Пример #1
0
        /// <summary>
        /// Search and get installation data list for view with initial
        /// </summary>
        /// <returns></returns>
        public ActionResult CMS180_SearchResultWithInitial()
        {
            CMS180_ScreenParameter param = GetScreenObject <CMS180_ScreenParameter>();
            CommonUtil             cm    = new CommonUtil();
            ObjectResultData       res   = new ObjectResultData();
            List <dtInstallation>  lst   = new List <dtInstallation>();

            try
            {
                IInstallationHandler          handler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler;
                doSearchInstallationCondition cond    = new doSearchInstallationCondition();

                if (!CommonUtil.IsNullOrEmpty(param.ContractCode) || !CommonUtil.IsNullOrEmpty(param.InstallationSlipNo))
                {
                    cond.ContractCode   = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                    cond.slipNo         = param.InstallationSlipNo;
                    cond.ViewFlag       = true;
                    cond.InstallationBy = null;
                }
                else
                {
                    cond.InstallationBy = InstallationBy.C_INSTALLATION_BY_SECOM;
                }
                lst            = handler.GetInstallationDataListForView(cond);
                res.ResultData = CommonUtil.ConvertToXml <dtInstallation>(lst, "Common\\CMS180_ViewInstallationInfo", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }
Пример #2
0
        /// <summary>
        /// Search and get installation data list for view
        /// </summary>
        /// <param name="cond"></param>
        /// <returns></returns>
        public ActionResult CMS180_SearchResult(doSearchInstallationCondition cond)
        {
            CMS180_ScreenParameter param = GetScreenObject <CMS180_ScreenParameter>();
            CommonUtil             cm    = new CommonUtil();
            ObjectResultData       res   = new ObjectResultData();
            List <dtInstallation>  lst   = new List <dtInstallation>();

            try
            {
                IInstallationHandler handler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler;


                // Concate string CustomerTypeCode with commar separate. like ,xx,yy,zz,
                List <string> lstManagementStatus = new List <string>();
                lstManagementStatus.Add(cond.chkInstallationNotRegistered);
                lstManagementStatus.Add(cond.chkInstallationRequestedAndPoRegistered);
                lstManagementStatus.Add(cond.chkInstallationNotRequest);
                lstManagementStatus.Add(cond.chkInstallationUnderInstall); //Add by Jutarat A. on 27032014
                lstManagementStatus.Add(cond.chkInstallationCompleted);
                lstManagementStatus.Add(cond.chkInstallationRequestButPoNotRegistered);
                lstManagementStatus.Add(cond.chkInstallationCancelled);
                cond.installationStatus = CommonUtil.CreateCSVString(lstManagementStatus);

                List <string> lstSlipStatus = new List <string>();
                lstSlipStatus.Add(cond.chkNotStockOut);
                lstSlipStatus.Add(cond.chkNoNeedToStockOut);
                lstSlipStatus.Add(cond.chkReturned);
                lstSlipStatus.Add(cond.chkPartialStockOut);
                lstSlipStatus.Add(cond.chkInstallationSlipCanceled);
                lstSlipStatus.Add(cond.chkNoNeedToReturn);
                lstSlipStatus.Add(cond.chkStockOut);
                lstSlipStatus.Add(cond.chkWaitForReturn);
                lstSlipStatus.Add(cond.chkReplaced);
                cond.slipStatus = CommonUtil.CreateCSVString(lstSlipStatus);

                List <string> lstInstallationManagementStatus = new List <string>();
                lstInstallationManagementStatus.Add(cond.chkProcessing);
                lstInstallationManagementStatus.Add(cond.chkApproved);
                lstInstallationManagementStatus.Add(cond.chkCompleted);
                lstInstallationManagementStatus.Add(cond.chkRequestApprove);
                lstInstallationManagementStatus.Add(cond.chkRejected);
                lstInstallationManagementStatus.Add(cond.chkCanceled);
                cond.managementStatus = CommonUtil.CreateCSVString(lstInstallationManagementStatus);

                cond.siteCode     = cm.ConvertSiteCode(cond.siteCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                cond.ViewFlag     = false;
                cond.ContractCode = cm.ConvertContractCode(cond.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);

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

                ignoreList.Add("chkInstallationNotRegistered");
                ignoreList.Add("chkInstallationRequestedAndPoRegistered");
                ignoreList.Add("chkInstallationNotRequest");
                ignoreList.Add("chkInstallationUnderInstall"); //Add by Jutarat A. on 27032014
                ignoreList.Add("chkInstallationCompleted");
                ignoreList.Add("chkInstallationRequestButPoNotRegistered");
                ignoreList.Add("chkInstallationCancelled");

                ignoreList.Add("chkNotStockOut");
                ignoreList.Add("chkNoNeedToStockOut");
                ignoreList.Add("chkReturned");
                ignoreList.Add("chkPartialStockOut");
                ignoreList.Add("chkInstallationSlipCanceled");
                ignoreList.Add("chkNoNeedToReturn");
                ignoreList.Add("chkStockOut");
                ignoreList.Add("chkWaitForReturn");
                ignoreList.Add("chkReplaced");


                ignoreList.Add("chkProcessing");
                ignoreList.Add("chkApproved");
                ignoreList.Add("chkCompleted");
                ignoreList.Add("chkRequestApprove");
                ignoreList.Add("chkRejected");
                ignoreList.Add("chkCanceled");


                ignoreList.Add("ViewFlag");
                ignoreList.Add("slipNoNullFlag");
                //================ Teerapong S. 24/09/2011 ================
                ignoreList.Add("NotRegisteredYetSlipFlag");
                ignoreList.Add("NotRegisteredYetManagementFlag");
                //=========================================================


                res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                //=============== Teerapong S. 24/09/2011 ==================
                if (
                    (CommonUtil.IsNullOrEmpty(cond.chkInstallationNotRegistered) && CommonUtil.IsNullOrEmpty(cond.chkInstallationRequestedAndPoRegistered) && CommonUtil.IsNullOrEmpty(cond.chkInstallationNotRequest) && CommonUtil.IsNullOrEmpty(cond.chkInstallationCompleted) && CommonUtil.IsNullOrEmpty(cond.chkInstallationRequestButPoNotRegistered) && CommonUtil.IsNullOrEmpty(cond.chkInstallationCancelled)) && CommonUtil.IsNullOrEmpty(cond.chkInstallationUnderInstall) || //Add (chkInstallationUnderInstall) by Jutarat A. on 27032014)
                    (CommonUtil.IsNullOrEmpty(cond.chkNotStockOut) && CommonUtil.IsNullOrEmpty(cond.chkNoNeedToStockOut) && CommonUtil.IsNullOrEmpty(cond.chkReturned) && CommonUtil.IsNullOrEmpty(cond.chkPartialStockOut) && CommonUtil.IsNullOrEmpty(cond.chkInstallationSlipCanceled) && CommonUtil.IsNullOrEmpty(cond.chkNoNeedToReturn) && CommonUtil.IsNullOrEmpty(cond.chkStockOut) && CommonUtil.IsNullOrEmpty(cond.chkWaitForReturn) && CommonUtil.IsNullOrEmpty(cond.chkReplaced) && CommonUtil.IsNullOrEmpty(cond.NotRegisteredYetSlipFlag)) ||
                    (CommonUtil.IsNullOrEmpty(cond.chkProcessing) && CommonUtil.IsNullOrEmpty(cond.chkApproved) && CommonUtil.IsNullOrEmpty(cond.chkCompleted) && CommonUtil.IsNullOrEmpty(cond.chkRequestApprove) && CommonUtil.IsNullOrEmpty(cond.chkRejected) && CommonUtil.IsNullOrEmpty(cond.chkCanceled) && CommonUtil.IsNullOrEmpty(cond.NotRegisteredYetManagementFlag)))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0158);
                    return(Json(res));
                }
                //=========================================================
                if (CommonUtil.IsNullAllField(cond, ignoreList.ToArray()))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                    return(Json(res));
                }
                if (cond.slipIssueDateFrom > cond.slipIssueDateTo)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0090);
                    return(Json(res));
                }
                cond.InstallationBy = InstallationBy.C_INSTALLATION_BY_SECOM;
                lst = handler.GetInstallationDataListForView(cond);

                res.ResultData = CommonUtil.ConvertToXml <dtInstallation>(lst, "Common\\CMS180_ViewInstallationInfo", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }