public static string CheckCheckDataResult(string ProcessingArgument) { //strAryArg[0] = UserId //strAryArg[1] = PageTimeStamp string[] strAryArg = ProcessingArgument.Split(",".ToCharArray()); string strResult = ""; 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, strAryArg[0], strAryArg[1], "【CheckTransAcceptResult.STEP 0】檢查轉單後結果", false); try { if (HttpContext.Current.Session[string.Format("ALO21_CheckResult_{0}", strAryArg[1])] != null && HttpContext.Current.Session[string.Format("ALO21_CheckResult_{0}", strAryArg[1])].ToString() != string.Empty) { strResult = HttpContext.Current.Session[string.Format("ALO21_CheckResult_{0}", strAryArg[1])].ToString(); if (strResult == string.Empty) { throw new Exception("檢查檢核結果有空值異常!"); } } } catch (Exception ex) { LEH.WriteErrorLog(strLogFilePath, strAryArg[0], strAryArg[1], "【CheckTransAcceptResult.執行發生異常】", ex, true); throw ex; } return strResult; }
public static string TransAcceptBridgeAtServer(string ProcessingArgument) { #region string[] strAryArg = ProcessingArgument.Split(",".ToCharArray()); string CallServerValue = strAryArg[0]; string ObjectFrom = strAryArg[1]; string CtrlPending = strAryArg[2]; string strResult = ""; string strErrMsg = ""; bool bResult = false; string[] strAry = CallServerValue.Split("_".ToCharArray()); string[] strAryCtrlPending = CtrlPending.Split(";".ToCharArray()); ALO_ALO211 ALO211 = new ALO_ALO211(); 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); //2010-05-01 cyhsu HttpContext.Current.Session[string.Format("ALO21_TransResult_{0}", strAry[4])] = null; try { #region LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 0】準備轉門市進貨單", ObjectFrom), false); LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 1-1】檢核輸入參數是否異常,輸入參數:{1}", ObjectFrom, CallServerValue), false); if (strAry.Length != 5) { throw new Exception(string.Format("TransAcceptBridgeAtServer:{0};輸入參數:{1}。", "輸入參數個數異常", CallServerValue)); } LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 1-2】檢核輸出參數是否異常,輸出參數:{1}", ObjectFrom, CtrlPending), false); if (strAryCtrlPending.Length != 3) { throw new Exception(string.Format("TransAcceptBridgeAtServer:{0};輸出參數:{1}。", "輸出參數個數異常", CtrlPending)); } LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 2-0】開始執行轉門市進貨單作業", ObjectFrom), false); bResult = ALO211.ProcessCreateMultiStoreAccepts2(strAry[0], strAry[1], strAry[2], strAry[3], strAry[4], out strErrMsg); LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 3】結束轉門市進貨單作業並組回傳字串", ObjectFrom), false); if (ObjectFrom.IndexOf("TRANSACCEPT") != -1) //轉門市進貨單 { strResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}", bResult.ToString().ToLower(), strErrMsg, "TRANSACCEPT", strAryCtrlPending[0], strAryCtrlPending[1], strAryCtrlPending[2], strAry[0], strAry[1], strAry[2]); LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 4】組成並回傳PageMethod字串:{1}", ObjectFrom, strResult), true); } #endregion } catch (Exception ex) { LEH.WriteErrorLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}執行發生異常】", ObjectFrom), ex, true); throw ex; } HttpContext.Current.Session[string.Format("ALO21_TransResult_{0}", strAry[4])] = strResult; return strResult; #endregion }
public static string CheckDataBridgeAtServer(string ProcessingArgument, string strDisNo) { #region 各項檢核 string[] strAryArg = ProcessingArgument.Split(",".ToCharArray()); string CallServerValue = strAryArg[0]; string ObjectFrom = strAryArg[1]; string CtrlPending = strAryArg[2]; string strResult = ""; string strErrMsg = ""; bool bResult = false; string[] strAry = CallServerValue.Split("_".ToCharArray()); string[] strAryCtrlPending = CtrlPending.Split(";".ToCharArray()); ALO_ALO211 ALO211 = new ALO_ALO211(); 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); HttpContext.Current.Session[string.Format("ALO21_CheckResult_{0}", strAry[4])] = null; try { #region LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 0】準備開始進行檢核", ObjectFrom), false); LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 1-1】檢核輸入參數是否異常,輸入參數:{1}", ObjectFrom, CallServerValue), false); if (strAry.Length != 5) { throw new Exception(string.Format("CheckDataBridgeAtServer:{0};輸入參數:{1}。", "輸入參數個數異常", CallServerValue)); } LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 1-2】檢核輸出參數是否異常,輸出參數:{1}", ObjectFrom, CtrlPending), false); if (strAryCtrlPending.Length != 6) { throw new Exception(string.Format("CheckDataBridgeAtServer:{0};輸出參數:{1}。", "輸出參數個數異常", CtrlPending)); } if (ObjectFrom.IndexOf("PICKDIFF") != -1) //出貨品項檢核 { #region LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 2-0】開始執行出貨品項檢核作業", ObjectFrom), false); bResult = ALO211.CheckData(strAry[0], strAry[1], strAry[2], strAry[3], strAry[4], strDisNo, ProcessingType.PICKDIFF, out strErrMsg); LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 3】結束出貨品項檢核作業並組回傳字串", ObjectFrom), false); strResult = string.Format("{0}||{1}||{2}||{3}||{4}||{5}||{6}||{7}||{8}", bResult.ToString().ToLower(), strErrMsg, strAryCtrlPending[0], strAryCtrlPending[1], "PICKDIFF", strAryCtrlPending[2], strAryCtrlPending[3], strAryCtrlPending[4], strAryCtrlPending[5]); #endregion } else if (ObjectFrom.IndexOf("DISDIFF") != -1) //配本品項檢核 { #region LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 2-0】開始執行配本品項檢核作業", ObjectFrom), false); bResult = ALO211.CheckData(strAry[0], strAry[1], strAry[2], strAry[3], strAry[4], strDisNo, ProcessingType.DISDIFF, out strErrMsg); LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 3】結束配本品項檢核作業並組回傳字串", ObjectFrom), false); strResult = string.Format("{0}||{1}||{2}||{3}||{4}||{5}||{6}||{7}||{8}", bResult.ToString().ToLower(), strErrMsg, strAryCtrlPending[0], strAryCtrlPending[1], "DISDIFF", strAryCtrlPending[2], strAryCtrlPending[3], strAryCtrlPending[4], strAryCtrlPending[5]); #endregion } else if (ObjectFrom.IndexOf("CHECKTRANS") != -1) //轉單前檢核 { #region LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 2-0】開始執行轉單前檢核作業", ObjectFrom), false); bResult = ALO211.CheckData(strAry[0], strAry[1], strAry[2], strAry[3], strAry[4], strDisNo, ProcessingType.CHECKTRANS, out strErrMsg); LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 3】結束轉單前檢核作業並組回傳字串", ObjectFrom), false); strResult = string.Format("{0}||{1}||{2}||{3}||{4}||{5}||{6}||{7}||{8}||{9}||{10}||{11}||{12}", bResult.ToString().ToLower(), strErrMsg, strAryCtrlPending[0], strAryCtrlPending[1], "CHECKTRANS", strAryCtrlPending[2], strAryCtrlPending[3], strAryCtrlPending[4], strAryCtrlPending[5], strAry[0], strAry[2], strAry[3], strAry[4] + "_" + strAry[3]); #endregion } LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 4】組成並回傳PageMethod字串:{1}", ObjectFrom, strResult.Trim() == "" ? "無值" : strResult), true); #endregion } catch (Exception ex) { LEH.WriteErrorLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}執行發生異常】", ObjectFrom), ex, true); throw ex; } HttpContext.Current.Session[string.Format("ALO21_CheckResult_{0}", strAry[4])] = strResult; return strResult; #endregion }
/// <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 }
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 }