public ActionResult IVS200_RetrieveInstrumentQuantityListDetail(doGetIVS200_Detail cond)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                #region //R2
                if (cond != null)
                {
                    IInventoryHandler invenhandler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    var listdata = invenhandler.GetIVS200_Detail(cond);
                    if (listdata.Count != 0)
                    {
                        res.ResultData = CommonUtil.ConvertToXml <doInventoryBookingDetail>(listdata, "Inventory\\IVS200_DetailInstrumentQuantity", CommonUtil.GRID_EMPTY_TYPE.VIEW);
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Ejemplo n.º 2
0
 public Dispatcher(ILogger <Dispatcher> log,
                   IControlHandler controlHandler,
                   IExamineHandler examineHandler,
                   IInventoryHandler inventoryHandler,
                   ILockHandler lockHandler,
                   ILookAroundHandler lookHandler,
                   IMagicHandler magicHandler,
                   IMoveDirectionHandler moveDirHandler,
                   IMoveFeatureHandler moveFeatureHandler,
                   IMoveLocationHandler moveLocHandler,
                   IOnOffHandler onOffHandler,
                   IResponseBuilder responseBuilder,
                   AdventureContext context)
 {
     _log                = log;
     _controlHandler     = controlHandler;
     _examineHandler     = examineHandler;
     _inventoryHandler   = inventoryHandler;
     _lockHandler        = lockHandler;
     _lookHandler        = lookHandler;
     _magicHandler       = magicHandler;
     _moveDirHandler     = moveDirHandler;
     _moveFeatureHandler = moveFeatureHandler;
     _moveLocHandler     = moveLocHandler;
     _onOffHandler       = onOffHandler;
     _responseBuilder    = responseBuilder;
     _advContext         = context;
 }
Ejemplo n.º 3
0
        ///<summary>
        ///Purpose   : not found contract code
        ///Parameters: Input02
        ///Expected  : - insert data in dobooking to Result1
        ///            - blnExistContractCode = 0 (false)
        ///</summary>
        ///
        public string Case1_2()
        {
            IInventoryHandler invenhandler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
            string            result       = "";

            bool?expectedObj = false;
            bool?actualObj   = null;

            string expected = expectedObj.ToString().ToUpper();
            string actual   = "";

            try
            {
                CommonUtil.dsTransData.dtTransHeader.ScreenID = ScreenID.C_SCREEN_ID_FN99;
                actualObj = invenhandler.NewBooking(Input02());

                expected = expectedObj.ToString().ToUpper();
                actual   = actualObj.ToString().ToUpper();
                result   = String.Format(RESULT_FORMAT, "1-2", expected, actual, CompareResult_bool(expectedObj, actualObj));
            }
            catch (ApplicationErrorException ex)
            {
                actual = ex.ErrorResult.Message.Code;
            }
            catch (Exception ex)
            {
                actual = ex.StackTrace;
            }

            //result = String.Format(RESULT_FORMAT, 1, expected, actual, CompareResult_bool(expected, actual));

            return(result);
        }
Ejemplo n.º 4
0
        public ActionResult IVS030_SearchSlip(doIVS030SearchCondition searchParam)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                if (searchParam == null || CommonUtil.IsNullAllField(searchParam))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }
                else
                {
                    IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    var lst = service.SearchReceiveSlip(searchParam);
                    CommonUtil.MappingObjectLanguage(lst);
                    res.ResultData = CommonUtil.ConvertToXml(lst, "inventory\\IVS030_SearchResult", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        public ActionResult IVS288_GenerateReportSummary(string[] slipNo)
        {
            IVS288_ScreenParameter param = GetScreenObject <IVS288_ScreenParameter>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                if (slipNo == null || slipNo.Length == 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }
                else if (param.LastSearchParam != null)
                {
                    IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    var lst = service.GetStockReport_ChangeArea_Detail(string.Join(",", slipNo));
                    IInventoryDocumentHandler docService = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler;
                    param.PendingDownloadFilePath = docService.GenerateIVS288ChangeAreaReportSummary(lst, param.LastSearchParam);
                    param.PendingDownloadFileName = "ChangeaAreaReport.xlsx";
                    res.ResultData = true;
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        /// <summary>
        /// Search installation slip for register picking list.
        /// </summary>
        /// <param name="param">DO of searching parameter.</param>
        /// <returns>Return ActionResult of JSON data for search result grid.</returns>
        public ActionResult IVS240_SearchInstallationSlip(doSearchInstallationSlipCond param)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                if (CommonUtil.IsNullAllField(param, "OperationOfficeCode", "OperationOfficeCodeList"))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }
                else
                {
                    IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;

                    if (!string.IsNullOrEmpty(param.ContractCode))
                    {
                        CommonUtil cmm = new CommonUtil();
                        param.ContractCode = cmm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                    }

                    var lst = service.SearchInstallationSlip(param);
                    res.ResultData = CommonUtil.ConvertToXml <dtSearchInstallationSlipResult>(lst, @"Inventory\IVS240_SearchResult", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Ejemplo n.º 7
0
        public ActionResult IVS160()
        {
            IVS160_ScreenParameter param              = GetScreenObject <IVS160_ScreenParameter>();
            IInventoryHandler      handlerInventory   = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
            List <tbt_InventoryCheckingSchedule> list = handlerInventory.GetLastCheckingSchedule();

            if (list.Count > 0)
            {
                ViewBag.CheckingYearMonth = list[0].CheckingYearMonth;
                param.CheckingYearMonth   = list[0].CheckingYearMonth;
                param.CheckingStartDate   = list[0].CheckingStartDate.HasValue ? list[0].CheckingStartDate.Value : DateTime.Now;
            }
            else
            {
                ViewBag.CheckingYearMonth = DateTime.Now.ToString("yyyyMM");
                param.CheckingYearMonth   = DateTime.Now.ToString("yyyyMM");
                param.CheckingStartDate   = DateTime.Now;
            }

            var lstHQOffice = handlerInventory.GetInventoryHeadOffice();

            if (lstHQOffice == null || lstHQOffice.Count <= 0)
            {
                throw new ApplicationException("Cannot get inventory head office.");
            }
            ViewBag.HeadOfficeCode = lstHQOffice[0].OfficeCode;

            return(View());
        }
Ejemplo n.º 8
0
        ///<summary>
        ///Purpose   : Process result
        ///Parameters: None
        ///Expected  : Result table in db.
        ///</summary>
        ///
        public string ExecuteProcess()
        {
            IInventoryHandler invenhandler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
            doCommonCSVInv    result       = null;
            string            strRes       = "";
            bool isValid = false;

            string strFormat_output2 = "AccountCode: {0} || AreaCode: {1} || TotalSum: {2}";

            try
            {
                //Spec changed. Can't test by this method.
                //result = invenhandler.GenerateInventoryAccountData(CommonUtil.dsTransData.dtUserData.EmpNo, CommonUtil.dsTransData.dtOperationData.ProcessDateTime);

                List <string> resultLst = new List <string>();

                foreach (var item in result.AssetAmountAcc)
                {
                    resultLst.Add(string.Format(strFormat_output2, item.AccountCode, item.AreaCode, item.TotalSum));
                }

                isValid = true;
                resultLst.Add(String.Format(RESULT_FORMAT_LIST, 1, (isValid) ? "Process completed." : strRes));

                strRes = CommonUtil.TextList(resultLst.ToArray(), "<br />");
            }
            catch (Exception ex)
            {
                strRes = ex.StackTrace;
            }

            return(strRes);
        }
        /// <summary>
        /// Get stock-out data of installatio slip.
        /// </summary>
        /// <param name="strInstallationSlipNo">Installation Slip No.</param>
        /// <returns>Return ActionResult of JSON data contains installation slip's stock-out data.</returns>
        public ActionResult IVS240_GetStockOutByInstallationSlip(string strInstallationSlipNo)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;

                var lst = service.GetStockOutByInstallationSlip(strInstallationSlipNo);
                if (lst.Count == 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4065);
                    res.ResultData = this.IVS240_GetStockOutByInstallationSlip_CreateResult(false, null);
                }
                else
                {
                    res.ResultData = this.IVS240_GetStockOutByInstallationSlip_CreateResult(true, lst);;
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Get inventory slip detail
        /// </summary>
        /// <param name="SlipNo">Slip no.</param>
        /// <returns></returns>
        public ActionResult IVS030_GetTbt_InventorySlipDetailForView(string SlipNo)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                IVS030_ScreenParameter param = GetScreenObject <IVS030_ScreenParameter>();

                IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                List <doTbt_InventorySlipDetailForView> lstSlipDetail = InvH.GetTbt_InventorySlipDetailForView(SlipNo);

                foreach (doTbt_InventorySlipDetailForView i in lstSlipDetail)
                {
                    i.NotInstalledQty = i.TransferQty;
                }

                List <IVS030INST> nlst = new List <IVS030INST>();

                foreach (doTbt_InventorySlipDetailForView l in lstSlipDetail)
                {
                    nlst.Add(CommonUtil.CloneObject <doTbt_InventorySlipDetailForView, IVS030INST>(l));
                }

                param.ElemInstrument = nlst;

                res.ResultData = CommonUtil.ConvertToXml <doTbt_InventorySlipDetailForView>(lstSlipDetail, "inventory\\IVS030_Instrument", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
Ejemplo n.º 11
0
        ///<summary>
        ///Purpose   : not found contract code
        ///Parameters: Input01
        ///Expected  : - blnExistContractCode = 1 (true)
        ///</summary>
        ///
        public string Case1_1()
        {
            IInventoryHandler invenhandler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
            string            result       = "";

            bool?expectedObj = true;
            bool?actualObj   = null;

            string expected = expectedObj.ToString().ToUpper();
            string actual   = "";

            try
            {
                actualObj = invenhandler.NewBooking(Input01());
                expected  = expectedObj.ToString().ToUpper();
                actual    = actualObj.ToString().ToUpper();
            }
            catch (ApplicationErrorException ex)
            {
                actual = ex.ErrorResult.Message.Code;
            }
            catch (Exception ex)
            {
                actual = ex.StackTrace;
            }

            result = String.Format(RESULT_FORMAT, "1-1", expected, actual, CompareResult_bool(expectedObj, actualObj));

            return(result);
        }
        /// <summary>
        /// Search stock-in/stock-out history.
        /// </summary>
        /// <param name="param">DO of searching parameter.</param>
        /// <returns>Return ActionResult of JSON data for search result grid.</returns>
        public ActionResult IVS220_GetIVS220(doGetIVS220 param)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                if (CommonUtil.IsNullAllField(param, "LocationCode"))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }
                else
                {
                    IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;

                    var lst = service.GetIVS220(param);
                    res.ResultData = CommonUtil.ConvertToXml <dtResultIVS220>(lst, @"Inventory\IVS220_SearchResult", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Retrieve installation slip no.
        /// </summary>
        /// <param name="SlipNo">Slip no.</param>
        /// <returns></returns>
        public ActionResult IVS030_GetReturnInstrumentByInstallationSlip(string SlipNo)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                IVS030_ScreenParameter param = GetScreenObject <IVS030_ScreenParameter>();

                IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                List <doResultReturnInstrument> lstSlipDetail = InvH.GetReturnInstrumentByInstallationSlip(SlipNo);

                List <IVS030INST> nlst = new List <IVS030INST>();

                foreach (doResultReturnInstrument l in lstSlipDetail)
                {
                    nlst.Add(CommonUtil.CloneObject <doResultReturnInstrument, IVS030INST>(l));
                }

                param.ElemInstrument = nlst;

                UpdateScreenObject(param);

                res.ResultData = CommonUtil.ConvertToXml <doResultReturnInstrument>(lstSlipDetail, "inventory\\IVS030_Instrument", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Stop checking.<br />
        /// - Check enable start button.<br />
        /// - Check system suspending.<br />
        /// - Check status of last checking schedule must be implementing.<br />
        /// - Update inventory checking schedule.
        /// </summary>
        /// <returns></returns>
        public ActionResult IVS150_StopChecking()
        {
            ObjectResultData res    = new ObjectResultData();
            string           result = "0";

            try
            {
                var enableButton = IVS150_GetPermission();

                if (enableButton.EnableBtnStopChecking)
                {
                    IInventoryHandler handlerInventory = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;

                    // Is suspend ?
                    ICommonHandler handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                    if (handler.IsSystemSuspending())
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                        return(Json(res));
                    }

                    var list = handlerInventory.GetLastCheckingSchedule();


                    if (list.Count > 0)
                    {
                        if (list[0].CheckingStatus != CheckingStatus.C_INV_CHECKING_STATUS_IMPLEMENTING)
                        {
                            res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4075);
                            return(Json(res));
                        }

                        // update field for update Tbt_InventoryCheckingSchedule
                        list[0].CheckingFinishDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                        list[0].CheckingStatus     = CheckingStatus.C_INV_CHECKING_STATUS_STOPPING;
                        list[0].FinishCheckingBy   = CommonUtil.dsTransData.dtUserData.EmpNo;
                        list[0].UpdateBy           = CommonUtil.dsTransData.dtUserData.EmpNo;
                        list[0].UpdateDate         = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;

                        using (TransactionScope scope = new TransactionScope())
                        {
                            string xml = CommonUtil.ConvertToXml_Store(list);
                            handlerInventory.UpdateTbt_InventoryCheckingSchedule(xml);

                            scope.Complete();

                            result = "1";
                        }
                    }
                }

                res.ResultData = result;
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        /// <summary>
        /// Search inventory instrument.
        /// </summary>
        /// <param name="Cond"></param>
        /// <param name="SourceOffice"></param>
        /// <param name="IntAreaComboData"></param>
        /// <returns></returns>
        public ActionResult IVS060_SearchInventoryInstrumentList(IVS060_SearchInstCond Cond, string SourceOffice, string IntAreaComboData)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                IVS060_ScreenParameter prm = GetScreenObject <IVS060_ScreenParameter>();

                if (prm.lstTransferInstrument == null)
                {
                    prm.lstTransferInstrument = new List <IVS060INST>();
                }

                ValidatorUtil.BuildErrorMessage(res, this, new object[] { Cond });
                if (res.IsError)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }
                if (Cond.SourceOffice == Cond.DestinationOffice)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4014, null, new string[] { "SourceOffice", "DestinationOffice" });
                    return(Json(res));
                }

                prm.SourceOffice      = SourceOffice;
                prm.DestinationOffice = Cond.DestinationOffice;

                IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                doSearchInstrumentListCondition SearchCond = new doSearchInstrumentListCondition();
                SearchCond.OfficeCode   = Cond.SourceOffice;
                SearchCond.LocationCode = InstrumentLocation.C_INV_LOC_INSTOCK;
                if (Cond.AreaCode == null)
                {
                    SearchCond.AreaCode = IntAreaComboData;
                }
                else
                {
                    SearchCond.AreaCode = Cond.AreaCode;
                }
                SearchCond.ShelfType      = ShelfType.C_INV_SHELF_TYPE_NORMAL;
                SearchCond.Instrumentcode = Cond.InstrumentCode;
                SearchCond.InstrumentName = Cond.InstrumentName;
                List <dtSearchInstrumentListResult> lstResult = InvH.SearchInventoryInstrumentList(SearchCond);

                if (lstResult.Count <= 0)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                }

                UpdateScreenObject(prm);
                res.ResultData = CommonUtil.ConvertToXml <dtSearchInstrumentListResult>(lstResult, "Inventory\\IVS060_Instrument", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
Ejemplo n.º 16
0
        public ActionResult IVS282_SearchSlip(doIVS282SearchCondition searchParam)
        {
            IVS282_ScreenParameter param = GetScreenObject <IVS282_ScreenParameter>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                if (searchParam == null || CommonUtil.IsNullAllField(searchParam))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }
                else
                {
                    IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    var lst = service.GetStockReport_ReturnReport_Header(searchParam);
                    param.LastSearchParam = searchParam;
                    res.ResultData        = CommonUtil.ConvertToXml(lst, @"Inventory\IVS282_SearchResult", CommonUtil.GRID_EMPTY_TYPE.VIEW);
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        /// <summary>
        /// Search instrument list.
        /// </summary>
        /// <param name="Cond"></param>
        /// <returns></returns>
        public ActionResult IVS050_SearchInventoryInstrumentList(IVS050SearchCondition Cond)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                ValidatorUtil.BuildErrorMessage(res, this, new object[] { Cond });
                if (res.IsError)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }

                IVS050_ScreenParameter prm  = GetScreenObject <IVS050_ScreenParameter>();
                IInventoryHandler      InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                List <dtSearchInstrumentListResult> lstResult =

                    InvH.SearchInventoryInstrumentList(prm.office.OfficeCode,
                                                       InstrumentLocation.C_INV_LOC_PRE_ELIMINATION,
                                                       Cond.AreaCode,
                                                       ShelfType.C_INV_SHELF_TYPE_NORMAL,
                                                       ShelfNo.C_INV_SHELF_NO_OTHER_LOCATION,
                                                       ShelfNo.C_INV_SHELF_NO_OTHER_LOCATION,
                                                       Cond.InstrumentName, Cond.InstrumentCode,
                                                       new string[] { InstrumentArea.C_INV_AREA_SE_LENDING_DEMO }
                                                       );

                res.ResultData = CommonUtil.ConvertToXml <dtSearchInstrumentListResult>(lstResult, "Inventory\\IVS050_Instrument", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
        public ActionResult IVS288_GetDetail(string[] slipNo)
        {
            IVS288_ScreenParameter param = GetScreenObject <IVS288_ScreenParameter>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                if (slipNo == null || slipNo.Length == 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }
                else if (param.LastSearchParam != null)
                {
                    IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    var lst = service.GetStockReport_ChangeArea_Detail(string.Join(",", slipNo));
                    res.ResultData = CommonUtil.ConvertToXml(lst, @"Inventory\IVS288_Detail", CommonUtil.GRID_EMPTY_TYPE.VIEW);
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Ejemplo n.º 19
0
        ///<summary>
        ///Purpose   : change  SCRAP value
        ///Parameters: Input No 3
        ///Expected  : Expect Result 3
        ///</summary>
        ///
        public string Case03()
        {
            IInventoryHandler invenhandler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
            string            res          = invenhandler.InsertDepreciationData(Input03());

            return(String.Format("Cast 3 Result: {0}", res));
        }
Ejemplo n.º 20
0
        ///<summary>
        ///Purpose   : not found contract code
        ///Parameters: Input03
        ///Expected  : blnExistContractCode = 0 (false)
        ///</summary>
        ///
        public string Case9()
        {
            IInventoryHandler invenhandler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
            string            result       = "";

            bool      expectedObj = false;
            doBooking actualObj   = null;

            string expected = expectedObj.ToString().ToUpper();
            string actual   = "";

            try
            {
                actualObj = invenhandler.UpdateStockOutInstrument(Input03());

                actual = actualObj.blnExistContractCode.ToString().ToUpper();
            }
            catch (ApplicationErrorException ex)
            {
                actual = ex.ErrorResult.Message.Code;
            }
            catch (Exception ex)
            {
                actual = ex.StackTrace;
            }

            result = String.Format(RESULT_FORMAT, 9, expected, actual, CompareResult_bool(expectedObj, actualObj.blnExistContractCode));

            return(result);
        }
        public ActionResult IVS170_GenerateReport(IVS170_doGetStockCheckingList cond)
        {
            List <dtStockCheckingList> list = new List <dtStockCheckingList>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                // Model validation
                if (ModelState.IsValid == false)
                {
                    ValidatorUtil.BuildErrorMessage(res, this);
                    if (res.IsError)
                    {
                        return(Json(res));
                    }
                }

                //Validate #1
                //if (CommonUtil.IsNullAllField(cond))
                //{
                //    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                //    return Json(res);
                //}

                //Validate #2
                if ((!CommonUtil.IsNullOrEmpty(cond.ShelfNoFrom)) &&
                    (!CommonUtil.IsNullOrEmpty(cond.ShelfNoTo)) &&
                    (String.Compare(cond.ShelfNoFrom, cond.ShelfNoTo) > 0))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4015, null, new string[] { "ShelfNoFrom", "ShelfNoTo" });
                    return(Json(res));
                }

                IInventoryHandler handler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                list = handler.GetStockCheckingList(cond);

                if (list == null || list.Count <= 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001, null, null);
                    return(Json(res));
                }

                IVS170_ScreenParameter    param      = GetScreenObject <IVS170_ScreenParameter>();
                IInventoryDocumentHandler docService = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler;
                param.PendingDownloadFilePath = docService.GenerateIVS170StockTakingResult(list, cond);
                param.PendingDownloadFileName = "StockDifferenceList.xlsx";

                res.ResultData = true;
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }
        /// <summary>
        /// Register receive between warehouse and branch.<br />
        /// - Register receive instrument.<br />
        /// - Update account transfer new/second hand/sample instrument.
        /// </summary>
        /// <returns></returns>
        public ActionResult IVS070_cmdConfirm_part2()
        {
            ObjectResultData res = new ObjectResultData();

            try
            {//4.5.1
                IVS070_ScreenParameter prm = GetScreenObject <IVS070_ScreenParameter>();
                string SlipNo = prm.SlipNo;

                using (TransactionScope scope = new TransactionScope())
                {
                    IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    InvH.RegisterReceiveInstrument(SlipNo, string.Empty);
                    //4.6.4
                    if (InvH.CheckNewInstrument(SlipNo) == 1)
                    {
                        List <doGroupNewInstrument> newInstGroup = InvH.GetGroupNewInstrument(SlipNo);
                        foreach (doGroupNewInstrument i in newInstGroup)
                        {
                            i.SourceLocationCode = InstrumentLocation.C_INV_LOC_TRANSFER;
                            i.SourceOfficeCode   = i.DestinationOfficeCode;
                            InvH.UpdateAccountTransferNewInstrument(i, null);
                        }
                    }
                    //4.7
                    if (InvH.CheckSecondhandInstrument(SlipNo) == 1)
                    {
                        List <doGroupSecondhandInstrument> secondHandInst = InvH.GetGroupSecondhandInstrument(SlipNo);
                        foreach (doGroupSecondhandInstrument i in secondHandInst)
                        {
                            i.SourceLocationCode = InstrumentLocation.C_INV_LOC_TRANSFER;
                            i.SourceOfficeCode   = i.DestinationOfficeCode;
                            InvH.UpdateAccountTransferSecondhandInstrument(i);
                        }
                    }
                    //4.8
                    if (InvH.CheckSampleInstrument(SlipNo) == 1)
                    {
                        List <doGroupSampleInstrument> sampleInst = InvH.GetGroupSampleInstrument(SlipNo);
                        foreach (doGroupSampleInstrument i in sampleInst)
                        {
                            i.SourceLocationCode = InstrumentLocation.C_INV_LOC_TRANSFER;
                            i.SourceOfficeCode   = i.DestinationOfficeCode;
                            InvH.UpdateAccountTransferSampleInstrument(i, null);
                        }
                    }

                    scope.Complete();
                } //end transaction scope
                res.ResultData = true;
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Search instrument information
        /// </summary>
        /// <param name="Cond">Search condition object</param>
        /// <returns></returns>
        public ActionResult IVS210_SearchInventoryInstrument(IVS210SearchCond Cond)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {    //Valid Cond
                ValidatorUtil.BuildErrorMessage(res, this, new object[] { Cond });
                if (res.IsError)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }

                if (!string.IsNullOrEmpty(Cond.ShelfNoFrom) && !string.IsNullOrEmpty(Cond.ShelfNoTo) &&
                    Cond.ShelfNoFrom.CompareTo(Cond.ShelfNoTo) > 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4015, null, new string[] { "ShelfNoFrom", "ShelfNoTo" });
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }

                IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;

                IVS210_ScreenParameter param = GetScreenObject <IVS210_ScreenParameter>();

                doSearchInstrumentListCondition searchCon = new doSearchInstrumentListCondition();
                searchCon.OfficeCode     = Cond.Office;
                searchCon.LocationCode   = Cond.Location;
                searchCon.AreaCode       = Cond.InstArea;
                searchCon.StartShelfNo   = Cond.ShelfNoFrom;
                searchCon.EndShelfNo     = Cond.ShelfNoTo;
                searchCon.Instrumentcode = Cond.InstCode;
                searchCon.InstrumentName = Cond.InstName;

                List <dtSearchInstrumentListResult> lstResult = InvH.SearchInventoryInstrumentListAllShelf(searchCon);

                if (lstResult.Count <= 0)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    return(Json(res));
                }
                else if (lstResult.Count > 1000)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4004);
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    return(Json(res));
                }

                res.ResultData = CommonUtil.ConvertToXml <dtSearchInstrumentListResult>(lstResult, "inventory\\IVS210_Instrument", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
        /// <summary>
        /// - Check system suspending.<br />
        /// - Check user permission for screen IVS060.<br />
        /// - Check freezed data.<br />
        /// - Check started stock checking.<br />
        /// - Get inventory head office.
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ActionResult IVS060_Authority(IVS060_ScreenParameter param)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                if (comh.IsSystemSuspending())
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }
                if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_TRANSFER_OFFICE, FunctionID.C_FUNC_ID_OPERATE))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    return(Json(res));
                }

                IInventoryHandler handInven = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;

                if (handInven.CheckFreezedData() == 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4002);
                    return(Json(res));
                }
                if (handInven.CheckStartedStockChecking() == 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4003);
                    return(Json(res));
                }

                List <doOffice> IvHeadOffice = handInven.GetInventoryHeadOffice();

                if (IvHeadOffice.Count <= 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4016);
                    return(Json(res));
                }

                param.office = IvHeadOffice[0];

                List <doOffice> SrinakarinOffice = handInven.GetInventorySrinakarinOffice();
                if (SrinakarinOffice.Count > 0)
                {
                    param.SrinakarinOfficeCode = SrinakarinOffice[0];
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(InitialScreenEnvironment <IVS060_ScreenParameter>("IVS060", param, res));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Search instrument information
        /// </summary>
        /// <param name="Cond">Search condition object</param>
        /// <returns></returns>
        public ActionResult IVS100_SearchInventoryInstrument(IVS100SearchCond Cond)
        {
            IInventoryDocumentHandler handler = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler;

            ObjectResultData res = new ObjectResultData();

            try
            {    //Valid Cond
                ValidatorUtil.BuildErrorMessage(res, this, new object[] { Cond });
                if (res.IsError)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }

                IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;

                IVS100_ScreenParameter param = GetScreenObject <IVS100_ScreenParameter>();

                List <dtSearchInstrumentListResult> lstResult =

                    InvH.SearchInventoryInstrumentList(param.office.OfficeCode,
                                                       Cond.SourceLoc,
                                                       Cond.InstArea,
                                                       ShelfType.C_INV_SHELF_TYPE_NORMAL,
                                                       null,
                                                       null,
                                                       Cond.InstName,
                                                       Cond.InstCode,
                                                       new string[] { InstrumentArea.C_INV_AREA_SE_LENDING_DEMO }
                                                       );

                if (lstResult.Count == 0)
                {
                    //res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001);
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    return(Json(res));
                }
                else if (lstResult.Count > 1000)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4004);
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    return(Json(res));
                }

                res.ResultData = CommonUtil.ConvertToXml <dtSearchInstrumentListResult>(lstResult, "inventory\\IVS100_Instrument", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
        /// <summary>
        /// Validate before show confirm screen.<br />
        /// </summary>
        /// <param name="cond"></param>
        /// <param name="SlipNo"></param>
        /// <returns></returns>
        public ActionResult RegisterIvs012(List <doIvs012Inventory> cond, string SlipNo, string VoucherNo, DateTime?VoucherDate)
        {
            ObjectResultData       res = new ObjectResultData();
            IVS012_ScreenParameter prm = GetScreenObject <IVS012_ScreenParameter>();

            try
            {
                ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                //3.1
                if (comh.IsSystemSuspending())
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }

                // Requested by user @ 2015/08/04, allowed 0 price.
                //var qErrorCtrls = cond.Where(i =>
                //    (
                //        i.InstrumentArea == InstrumentArea.C_INV_AREA_NEW_SALE
                //        || i.InstrumentArea == InstrumentArea.C_INV_AREA_NEW_RENTAL
                //        || i.InstrumentArea == InstrumentArea.C_INV_AREA_NEW_DEMO
                //    )
                //    && i.InstrumentTotalPrice <= 0
                //    && i.InstrumentTotalPriceEnable == true
                //).Select(i => i.txtInstrumentTotalPrice);

                //if (qErrorCtrls.Count() > 0)
                //{
                //    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                //    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4052, null, qErrorCtrls.ToArray());
                //    return Json(res);
                //}

                IInventoryHandler        InvH             = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                List <tbt_InventorySlip> lstInventorySlip = InvH.GetTbt_InventorySlip(SlipNo);

                // Monthly Price @ 2015 : Allow to register asset anytime until LockFlag = true
                if (lstInventorySlip.Count > 0 && lstInventorySlip[0].LockFlag == true)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4148);
                    return(Json(res));
                }

                prm.SlipNo             = SlipNo;
                prm.lstIVS012Inventory = cond;
                prm.VoucherNo          = VoucherNo;
                prm.VoucherDate        = VoucherDate;

                return(Json(true));
            }
            catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); }
        }
        //public ActionResult IVS040_GetSourceLocationCbo(string SourceLoc)
        //{
        //    ObjectResultData res = new ObjectResultData();
        //    try
        //    {
        //        ICommonHandler comh = ServiceContainer.GetService<ICommonHandler>() as ICommonHandler;
        //        List<string> lst = new List<string>();
        //        List<doMiscTypeCode> dtMisc = new List<doMiscTypeCode>();
        //        List<doMiscTypeCode> ResMisc = new List<doMiscTypeCode>();
        //        lst.Add(MiscType.C_INV_LOC);
        //        dtMisc = comh.GetMiscTypeCodeListByFieldName(lst);

        //        if (SourceLoc == InstrumentLocation.C_INV_LOC_INSTOCK || SourceLoc == InstrumentLocation.C_INV_LOC_RETURNED)
        //            ResMisc = (from c in dtMisc
        //                       where (c.ValueCode == InstrumentLocation.C_INV_LOC_INSTOCK ||
        //                           c.ValueCode == InstrumentLocation.C_INV_LOC_RETURNED)
        //                           && c.ValueCode != SourceLoc
        //                       select c).ToList<doMiscTypeCode>();
        //        else if (SourceLoc != null)
        //            ResMisc = (from c in dtMisc
        //                       where (c.ValueCode == InstrumentLocation.C_INV_LOC_INSTOCK ||
        //                           c.ValueCode == InstrumentLocation.C_INV_LOC_RETURNED || c.ValueCode == InstrumentLocation.C_INV_LOC_PRE_ELIMINATION) &&
        //                           (c.ValueCode != SourceLoc)
        //                       select c).ToList<doMiscTypeCode>();
        //        else
        //            ResMisc = dtMisc;

        //        //res.ResultData = CommonUtil.CommonComboBox<doMiscTypeCode>("BLANKID", ResMisc, "ValueCodeDisplay", "ValueCode", null, true).ToString();
        //        ComboBoxModel cboModel = new ComboBoxModel();
        //        cboModel.SetList<doMiscTypeCode>(ResMisc, "ValueCodeDisplay", "ValueCode");
        //        res.ResultData = cboModel;

        //        return Json(res);
        //    }
        //    catch (Exception ex)
        //    {
        //        res.AddErrorMessage(ex); return Json(res);
        //    }
        //}

        /// <summary>
        /// Validate before confirm screen.<br />
        /// - Check require field.<br />
        /// - Check instrument list not empty.<br />
        /// - Check memo.
        /// </summary>
        /// <param name="Cond"></param>
        /// <returns></returns>
        public ActionResult IVS040_cmdReg(IVS040RegisterCond Cond)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                IVS040_ScreenParameter prm = GetScreenObject <IVS040_ScreenParameter>();
                if (prm.ElemInstrument == null)
                {
                    prm.ElemInstrument = new List <IVS040INST>();
                }
                IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;

                if (CommonUtil.IsNullOrEmpty(Cond.ApproveNo))
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, "IVS040", MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4112, new string[] { "lblApproveNo" }, new string[] { "ApproveNo" });
                    return(Json(res));
                }
                prm.ApproveNo = Cond.ApproveNo;

                if (prm.ElemInstrument.Count <= 0)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4006);
                    return(Json(res));
                }
                //6.2.2
                foreach (IVS040INST i in prm.ElemInstrument)
                {
                    i.IsError = false;
                }

                if (Cond.Memo != null && Cond.Memo.Replace(" ", "").Contains("\n\n\n\n"))
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4022);
                    return(Json(res));
                }
                prm.Memo     = Cond.Memo;
                prm.Location = Cond.SourceLoc;

                UpdateScreenObject(prm);
                res.ResultData = true;
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Check for enable start/stop button.
        /// </summary>
        /// <returns></returns>
        public ActionResult IVS150_GetEnableStartStopButton()
        {
            bool             enableBtnStartingChecking = false;
            bool             enableBtnStopChecking     = false;
            ObjectResultData res = new ObjectResultData();

            try
            {
                List <UserBelongingData> lsUserBelonging = (from p in CommonUtil.dsTransData.dtUserBelongingData
                                                            where p.DepartmentCode == DepartmentMaster.C_DEPT_PURCHASE
                                                            select p).ToList <UserBelongingData>();
                if (lsUserBelonging.Count > 0)
                {
                    IInventoryHandler handlerInventory        = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    List <tbt_InventoryCheckingSchedule> list = handlerInventory.GetLastCheckingSchedule();
                    if (list.Count > 0)
                    {
                        if (list[0].CheckingStatus == CheckingStatus.C_INV_CHECKING_STATUS_PREPARING)
                        {
                            enableBtnStartingChecking = true;
                            enableBtnStopChecking     = false;
                        }
                        else if (list[0].CheckingStatus == CheckingStatus.C_INV_CHECKING_STATUS_IMPLEMENTING)
                        {
                            enableBtnStartingChecking = false;
                            enableBtnStopChecking     = true;
                        }
                        else if (list[0].CheckingStatus == CheckingStatus.C_INV_CHECKING_STATUS_STOPPING)
                        {
                            enableBtnStartingChecking = false;
                            enableBtnStopChecking     = false;
                        }
                    }
                }


                EnableButton result = new EnableButton()
                {
                    EnableBtnStartingChecking = enableBtnStartingChecking,
                    EnableBtnStopChecking     = enableBtnStopChecking
                };

                res.ResultData = result;
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Ejemplo n.º 29
0
        /// <summary>
        /// - Check system suspending.<br />
        /// - Check user permission for screen IVS160.<br />
        /// - Check freezed data.<br />
        /// - Check implement stock checking.
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ActionResult IVS160_Authority(IVS160_ScreenParameter param)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                // Is suspend ?
                ICommonHandler handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                if (handler.IsSystemSuspending())
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }

                // Check permission
                if (CheckUserPermission(ScreenID.C_INV_SCREEN_ID_CHECKING_INSTRUMENT, FunctionID.C_FUNC_ID_OPERATE) == false)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    return(Json(res));
                }

                // Check freezed data
                IInventoryHandler handlerInventory = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                if (handlerInventory.CheckFreezedData() == 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4002);
                    return(Json(res));
                }

                //// Check for the stock is started
                //if (handlerInventory.CheckStartedStockChecking() == 0)
                //{
                //    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4003);
                //    return Json(res);
                //}

                // Check for the implement stock checkint
                if (handlerInventory.CheckImplementStockChecking() == 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4003);
                    return(Json(res));
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(InitialScreenEnvironment <IVS160_ScreenParameter>("IVS160", param, res));
        }
        /// <summary>
        /// Search stock checking list.
        /// </summary>
        /// <param name="cond"></param>
        /// <returns></returns>
        public ActionResult IVS170_SearchResponse(IVS170_doGetStockCheckingList cond)
        {
            List <dtStockCheckingList> list = new List <dtStockCheckingList>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                // Model validation
                if (ModelState.IsValid == false)
                {
                    ValidatorUtil.BuildErrorMessage(res, this);
                    if (res.IsError)
                    {
                        return(Json(res));
                    }
                }

                //Validate #1
                //if (CommonUtil.IsNullAllField(cond))
                //{
                //    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                //    return Json(res);
                //}

                //Validate #2
                if ((!CommonUtil.IsNullOrEmpty(cond.ShelfNoFrom)) &&
                    (!CommonUtil.IsNullOrEmpty(cond.ShelfNoTo)) &&
                    (String.Compare(cond.ShelfNoFrom, cond.ShelfNoTo) > 0))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4015, null, new string[] { "ShelfNoFrom", "ShelfNoTo" });
                    return(Json(res));
                }

                IInventoryHandler handler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                list = handler.GetStockCheckingList(cond);
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            res.ResultData = CommonUtil.ConvertToXml <dtStockCheckingList>(list, "Inventory\\IVS170", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            return(Json(res));
        }