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 }
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 }