コード例 #1
0
ファイル: ALO211.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    private bool ProcessCreateMultiStoreAccepts()
    {
        #region
        bool bResult = false;

        try
        {
            Trace.Warn("使用者:" + Session["UID"].ToString() + "於" + DateTime.Now.ToString() + "呼叫BCO.Create");

            //ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);
            ALOWebService.ALOService BCO = new ALOWebService.ALOService();
            //WebService Timeout 時間60分鐘
            BCO.Timeout = 3600000;//1hr
            string strErrMsg = "";
            string strStAcceptNoArr = "";
            ArrayList ParameterList = new ArrayList();
            string strStAcceptDate = SLP_SLPDate1.Text;
            string strPickBatch = SLP_SLPNumber1.Text;
            string strDisType = GetDisTypeSelectedValue();

            ParameterList.Clear();
            ParameterList.Add(strStAcceptDate);//門市進貨日
            ParameterList.Add(strPickBatch);//理貨批次
            ParameterList.Add(strDisType);//配本方式
            ParameterList.Add(Session["UID"].ToString());//執行者
            ParameterList.Add(string.Format("{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString()));//PageTimeStamp_LoginID
            //Trace.Warn("使用者:" + Session["UID"].ToString() + "於" + DateTime.Now.ToString() + "呼叫BCO.開始轉單!");

            //bResult = BCO.ProcessCreateMultiStoreAccepts(ParameterList, out strStAcceptNoArr, out strErrMsg, null);
            DataSet Ds = BCO.ProcessCreateMultiStoreAccepts(VDS2GXmlSerializer(ParameterList));

            #region 拆解回傳後的物件(第一個為結果,第二個為StAccept錯誤訊息,第三個為錯誤訊息)

            if (Ds.Tables.Count > 0)
            {
                #region
                for (int i = 0; i < Ds.Tables.Count; i++)
                {
                    switch (i)
                    {
                        case 0:
                            if (Ds.Tables[i].Rows.Count > 0)
                            {
                                bResult = Boolean.Parse(Ds.Tables[i].Rows[0]["Result"].ToString());
                            }
                            else
                            {
                                throw new Exception("查無ProcessCreateMultiStoreAccepts的回傳bool訊息!!");
                            }
                            break;
                        case 1:
                            if (Ds.Tables[i].Rows.Count > 0)
                            {
                                strStAcceptNoArr = Ds.Tables[i].Rows[0]["ErrMsg"].ToString();
                            }
                            else
                            {
                                throw new Exception("查無ProcessCreateMultiStoreAccepts的StAccept錯誤回傳訊息!!");
                            }
                            break;
                        case 2:
                            if (Ds.Tables[i].Rows.Count > 0)
                            {
                                strErrMsg = Ds.Tables[i].Rows[0]["ErrMsg"].ToString();
                            }
                            else
                            {
                                throw new Exception("查無ProcessCreateMultiStoreAccepts的錯誤回傳訊息!!");
                            }
                            break;
                        default:
                            break;
                    }
                }
                #endregion
            }
            else
            {
                throw new Exception("查無ProcessCreateMultiStoreAccepts任何資料!!");
            }

            #endregion

            Trace.Warn("使用者:" + Session["UID"].ToString() + "於" + DateTime.Now.ToString() + "呼叫BCO.結束轉單!");


            if (bResult)
            {
                //轉單成功後
                ResultMsgLabel.Text = "轉門市進貨單順利完成";

                hiddenTransferFinished.Value = "true";
                string strCtrlIDToLock = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", btn0_CheckOutItem.ClientID, btn1_CheckDisItem.ClientID, btn3_Save.ClientID, btn4_CountItem.ClientID, btn5_CountDisNo.ClientID, btn6_BatchDelete.ClientID, btn8_CheckBeforeTrans.ClientID, btn9_TransAccept.ClientID);//2010/04/07 modified: btn7_Print.ClientID 不關閉
                string strOpenCAM20 = "AddIFrameTab('(DDD,PAY載入)', '" + Application["AppSite_RootDir"] + "CAM/CAM201.aspx?Code=CAM20');";
                string strJSAfterAcceptTrans = "";//2010/04/08 added 已由server side執行,不再使用Javascript: string.Format("RebindingUIAfterAcceptTrans('{0}','{1}','{2}');", strStAcceptDate, strPickBatch, strDisType);

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "transaccept",
                    string.Format("alert('轉門市進貨單順利完成');LockOrUnlockControls('{0}',true);LockOrUnLockButtonInGridviewControl(true,'btn','btn_Delete');{1}{2}", strCtrlIDToLock, strJSAfterAcceptTrans, strOpenCAM20),
                    true);


                //2010/04/08 added:將轉單狀態改為【已轉單】並保留原資料
                rbtn_TransStatus0.Checked = false;
                rbtn_TransStatus1.Checked = true;
                SLP_SLPDate1.Text = strStAcceptDate;
                SLP_SLPNumber1.Text = strPickBatch;
                ((DropDownList)SLP_EnumBase1.FindControl("D1")).SelectedValue = strDisType;


            }
            else
            {
                btn11_ClearAbnormal.Enabled = true;
                ErrorMsgLabel.Text = strErrMsg;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "transaccept", "alert('轉門市進貨單發生錯誤');", true);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return bResult;

        #endregion
    }
コード例 #2
0
ファイル: ALO211.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    /// <summary>
    /// 執行各項檢查
    /// </summary>
    /// <param name="strStAcceptDate"></param>
    /// <param name="strDisType"></param>
    /// <param name="strPickBatch"></param>
    /// <param name="strUserID"></param>
    /// <param name="strSessionID"></param>
    /// <param name="strProcessingType"></param>
    /// <param name="strErrMsg"></param>
    /// <returns></returns>
    private bool CheckData(string strStAcceptDate, string strDisType, string strPickBatch, string strUserID, string strSessionID, string strDisNo, ProcessingType strProcessingType, out string strErrMsg)
    {
        #region
        bool bResult = false;
        try
        {
            ALOWebService.ALOService BCO = new ALOWebService.ALOService();
            //WebService Timeout 時間60分鐘
            BCO.Timeout = 3600000;//1hr
            //BCO.ConnStr(ConnectionDB);
            //ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);
            string strPrefixed = "";
            strErrMsg = "";
            DataSet Ds = null;
            DataTable dt = null;


            LogEventErrorHandler LEH = new LogEventErrorHandler();
            string strLogFileFolder = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["LogFolder"]).Replace("ALO\\", "");
            string strLogFileName = string.Format("{0}_{1}.log", "ALO21", DateTime.Now.ToString("yyyyMMdd"));
            string strLogFilePath = string.Format("{0}\\{1}", strLogFileFolder, strLogFileName);


            LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-1】CheckData 輸入之參數門市進貨日:{1}、理貨批次:{2}、配本方式:{3}", strProcessingType.ToString(), strStAcceptDate, strPickBatch, strDisType), false);


            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(strStAcceptDate);//門市進貨日
            ParameterList.Add(strDisType);//配本方式
            ParameterList.Add(strPickBatch);//理貨批次
            ParameterList.Add(strUserID);//執行者
            ParameterList.Add(string.Format("{0}_{1}", strSessionID, strUserID));//PageTimeStamp_LoginID

            if (strProcessingType == ProcessingType.PICKDIFF)
            {
                #region PICKDIFF
                strPrefixed = "POP_CheckDiff";

                LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-2】開始呼叫 ALOWebService.ALOService.CheckPickContronlDiff", strProcessingType.ToString()), false);

                Ds = BCO.CheckPickContronlDiff(VDS2GXmlSerializer(ParameterList));

                LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-3】完成呼叫 ALOWebService.ALOService.CheckPickContronlDiff", strProcessingType.ToString()), false);

                #region 拆解回傳後的物件(第一個DataTable為結果,第二個為錯誤訊息)

                if (Ds.Tables.Count > 0)
                {
                    for (int i = 0; i < Ds.Tables.Count; i++)
                    {
                        switch (i)
                        {
                            case 0:
                                dt = Ds.Tables[i];
                                break;
                            case 1:
                                if (Ds.Tables[i].Rows.Count > 0)
                                {
                                    strErrMsg = Ds.Tables[i].Rows[0]["ErrMsg"].ToString();
                                }
                                else
                                {
                                    throw new Exception("查無CheckPickContronlDiff的錯誤回傳訊息!!");
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
                else
                {
                    throw new Exception("查無CheckPickContronlDiff任何資料表!!");
                }

                #endregion
                #endregion
            }
            else if (strProcessingType == ProcessingType.DISDIFF)
            {
                #region DISDIFF
                strPrefixed = "POP_CheckDiff";

                LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-2】開始呼叫 ALOWebService.ALOService.CheckDisRecordDiff", strProcessingType.ToString()), false);

                Ds = BCO.CheckDisRecordDiff(VDS2GXmlSerializer(ParameterList));

                LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-3】完成呼叫 ALOWebService.ALOService.CheckDisRecordDiff", strProcessingType.ToString()), false);

                #region 拆解回傳後的物件(第一個DataTable為結果,第二個為錯誤訊息)

                if (Ds.Tables.Count > 0)
                {
                    for (int i = 0; i < Ds.Tables.Count; i++)
                    {
                        switch (i)
                        {
                            case 0:
                                dt = Ds.Tables[i];
                                break;
                            case 1:
                                if (Ds.Tables[i].Rows.Count > 0)
                                {
                                    strErrMsg = Ds.Tables[i].Rows[0]["ErrMsg"].ToString();
                                }
                                else
                                {
                                    throw new Exception("查無CheckDisRecordDiff的錯誤回傳訊息!!");
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
                else
                {
                    throw new Exception("查無CheckDisRecordDiff任何資料表!!");
                }

                #endregion
                #endregion
            }
            else if (strProcessingType == ProcessingType.CHECKTRANS)
            {
                #region CHECKTRANS
                strPrefixed = "POP_CheckError";

                //LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-2A】開始呼叫 ConfirmDisAgain", strProcessingType.ToString()), false);

                //bool bConfirmResult = ConfirmDisAgain(strDisNo, strStAcceptDate, strUserID);

                //LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-2B】完成呼叫 ConfirmDisAgain", strProcessingType.ToString()), false);

                //if (!bConfirmResult)
                //{
                //    throw new Exception("確認失敗,呼叫POP_DisApproveError();");
                //}

                LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-3A】開始呼叫 ALOWebService.ALOService.CheckCanTransToStAccept", strProcessingType.ToString()), false);

                Ds = BCO.CheckCanTransToStAccept(VDS2GXmlSerializer(ParameterList));

                LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-3B】完成呼叫 ALOWebService.ALOService.CheckCanTransToStAccept", strProcessingType.ToString()), false);

                #region 拆解回傳後的物件(第一個DataTable為結果,第二個為錯誤訊息)

                if (Ds.Tables.Count > 0)
                {
                    for (int i = 0; i < Ds.Tables.Count; i++)
                    {
                        switch (i)
                        {
                            case 0:
                                dt = Ds.Tables[i];
                                break;
                            case 1:
                                if (Ds.Tables[i].Rows.Count > 0)
                                {
                                    strErrMsg = Ds.Tables[i].Rows[0]["ErrMsg"].ToString();
                                }
                                else
                                {
                                    throw new Exception("查無CheckCanTransToStAccept的錯誤回傳訊息!!");
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
                else
                {
                    throw new Exception("查無CheckCanTransToStAccept任何資料表!!");
                }

                #endregion
                #endregion
            }


            if (strErrMsg == "" && (dt == null || dt.Rows.Count <= 0))
            {
                bResult = true;
            }
            else
            {
                bResult = false;

                if (dt != null && dt.Rows.Count > 0)
                {
                    Session[string.Format("{0}_{1}_{2}", strPrefixed, strSessionID, strUserID)] = dt;
                }

                //2010/08/25 added
                if (strErrMsg.IndexOf("不可配送門市") != -1 ||
                    strErrMsg.IndexOf("期別通路未生效或未建") != -1)
                {
                    Session[string.Format("{0}_DISNO_{1}", "POP_DisApproveError", strSessionID)] = (strErrMsg.Split(";".ToCharArray()))[1];
                    Session[string.Format("{0}_OPTYPE_{1}", "POP_DisApproveError", strSessionID)] = "1";
                }
            }

            LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-4】拆解回傳後的物件,結果:{1}", strProcessingType.ToString(), bResult), false);

        }
        catch (Exception ex)
        {
            throw ex;
        }
        return bResult;
        #endregion
    }
コード例 #3
0
ファイル: ALO211.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    private bool ProcessCreateMultiStoreAccepts2(string strStAcceptDate, string strDisType, string strPickBatch, string strUserID, string strSessionID, out string strErrMsg)
    {
        #region
        bool bResult = false;
        strErrMsg = "";

        try
        {
            ALOWebService.ALOService BCO = new ALOWebService.ALOService();
            BCO.Timeout = 3600000;//1hr

            string strStAcceptNoArr = "";
            LogEventErrorHandler LEH = new LogEventErrorHandler();
            string strLogFileFolder = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["LogFolder"]).Replace("ALO\\", "");
            string strLogFileName = string.Format("{0}_{1}.log", "ALO21", DateTime.Now.ToString("yyyyMMdd"));
            string strLogFilePath = string.Format("{0}\\{1}", strLogFileFolder, strLogFileName);

            LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-1】ProcessCreateMultiStoreAccepts2 輸入參數之門市進貨日:{1}、理貨批次:{2}、配本方式:{3}", "TRANSACCEPT", strStAcceptDate, strPickBatch, strDisType), false);

            Session[string.Format("ALO21_StAcceptDate_{0}_{1}", strSessionID, strUserID)] = strStAcceptDate;
            Session[string.Format("ALO21_PickBatch_{0}_{1}", strSessionID, strUserID)] = strPickBatch;
            Session[string.Format("ALO21_DisType_{0}_{1}", strSessionID, strUserID)] = strDisType;

            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(strStAcceptDate);//門市進貨日
            ParameterList.Add(strPickBatch);//理貨批次
            ParameterList.Add(strDisType);//配本方式
            ParameterList.Add(strUserID);//執行者
            ParameterList.Add(string.Format("{0}_{1}", strSessionID, strUserID));//PageTimeStamp_LoginID

            LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-2】開始呼叫 ALOWebService.ALOService.ProcessCreateMultiStoreAccepts", "TRANSACCEPT"), false);

            DataSet Ds = BCO.ProcessCreateMultiStoreAccepts(VDS2GXmlSerializer(ParameterList));

            LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-3】完成呼叫 ALOWebService.ALOService.ProcessCreateMultiStoreAccepts", "TRANSACCEPT"), false);


            #region 拆解回傳後的物件(第一個為結果,第二個為StAccept錯誤訊息,第三個為錯誤訊息)

            if (Ds.Tables.Count > 0)
            {
                #region
                for (int i = 0; i < Ds.Tables.Count; i++)
                {
                    switch (i)
                    {
                        case 0:
                            if (Ds.Tables[i].Rows.Count > 0)
                            {
                                bResult = Boolean.Parse(Ds.Tables[i].Rows[0]["Result"].ToString());

                                LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-4-1】拆解回傳後的物件,結果:{1}", "TRANSACCEPT", bResult), false);
                            }
                            else
                            {
                                throw new Exception("查無ProcessCreateMultiStoreAccepts的回傳bool訊息!!");
                            }
                            break;
                        case 1:
                            if (Ds.Tables[i].Rows.Count > 0)
                            {
                                strStAcceptNoArr = Ds.Tables[i].Rows[0]["ErrMsg"].ToString();

                                LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-4-2】拆解回傳後的物件,StAccept 錯誤訊息:{1}", "TRANSACCEPT", strStAcceptNoArr.Trim() == "" ? "無值" : strStAcceptNoArr), false);
                            }
                            else
                            {
                                throw new Exception("查無ProcessCreateMultiStoreAccepts的StAccept錯誤回傳訊息!!");
                            }
                            break;
                        case 2:
                            if (Ds.Tables[i].Rows.Count > 0)
                            {
                                strErrMsg = Ds.Tables[i].Rows[0]["ErrMsg"].ToString();

                                LEH.WriteEventLog(strLogFilePath, strUserID, strSessionID, string.Format("【{0}.STEP 2-4-3】拆解回傳後的物件,錯誤訊息:{1}", "TRANSACCEPT", strErrMsg.Trim() == "" ? "無值" : strErrMsg), false);
                            }
                            else
                            {
                                throw new Exception("查無ProcessCreateMultiStoreAccepts的錯誤回傳訊息!!");
                            }
                            break;
                        default:
                            break;
                    }
                }
                #endregion
            }
            else
            {
                throw new Exception("查無ProcessCreateMultiStoreAccepts任何資料!!");
            }

            #endregion
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return bResult;

        #endregion
    }