private string ProcessConfirmFromBridge(string strStAcceptDate, string strDisNoForAry, string strCtrlPending, Int32 iProcessingAryIndex) { #region bool bResult = false, bResultCheck = false; string strCallbackResult = ""; string strResult = "", strErrMsg = "", strErrMsgCheck = ""; string strPrefixed = "POP_DisApproveError"; string strDisNo = "", strNextDisNo = ""; string strDIS_QTY = ""; string[] strAryDisAry = strDisNoForAry.Split(";".ToCharArray()); string[] strAryCtrlPending = strCtrlPending.Split(";".ToCharArray()); try { fmStatus = FormStatus.fmProcess; ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB); if (iProcessingAryIndex < strAryDisAry.Length) { strDisNo = strAryDisAry[iProcessingAryIndex]; ArrayList ParameterList = new ArrayList();//20091113 //--------------------------------------------------------------------- //2010/02/09 added:確認前檢核 ALOModel.MaintainDisCRMRecord BCO3 = new ALOModel.MaintainDisCRMRecord(ConnectionDB); ParameterList.Clear(); ParameterList.Add(strStAcceptDate); ParameterList.Add(strDisNo); try { bResultCheck = BCO3.Pick_Control_Check(ParameterList, out strErrMsgCheck); } catch (Exception ex) { throw ex; } //--------------------------------------------------------------------- ParameterList.Clear(); ParameterList.Add(strStAcceptDate); ParameterList.Add(strDisNo); ParameterList.Add("VDS_ALO_DIS_STORE"); ParameterList.Add(strAryCtrlPending[5]); try { bResult = BCO.ProcessConfirm(ParameterList, out strResult, out strErrMsg, null); } catch (Exception ex) { throw ex; } if (!bResult) { Session[string.Format("{0}_DISNO_{1}", strPrefixed, strAryCtrlPending[0])] += string.Format("{0},", strDisNo); Session[string.Format("{0}_OPTYPE_{1}", strPrefixed, strAryCtrlPending[0])] = "1"; Session[string.Format("{0}_ERRMSG_{1}", strPrefixed, strAryCtrlPending[0])] += string.Format("配本序號:{0},{1}{2}{3};\r\n", strDisNo, strErrMsgCheck, bResultCheck ? "" : ",", strErrMsg); } else { if (!bResultCheck) { Session[string.Format("{0}_ERRMSG_{1}", strPrefixed, strAryCtrlPending[0])] += string.Format("配本序號:{0},{1};\r\n", strDisNo, strErrMsgCheck); } } ALOModel.ProcessMultiDisRecords BCO2 = new ALOModel.ProcessMultiDisRecords(ConnectionDB); DataTable dtTemp = BCO2.QueryDisItemForALO20(GetQueryParams(strStAcceptDate, strDisNo, bResult)); if (dtTemp != null && dtTemp.Rows.Count > 0) strDIS_QTY = dtTemp.Rows[0]["DIS_QTY"].ToString().Trim(); iProcessingAryIndex = iProcessingAryIndex + 1; if (iProcessingAryIndex < strAryDisAry.Length) { strNextDisNo = strAryDisAry[iProcessingAryIndex]; } else { strNextDisNo = "X";//表示已執行到最後一筆 } //0:DIS_NO字串For陣列用- //1:下一筆陣列Index- //2:執行結果- //3:錯誤訊息- //4:要關閉執行狀態的DIS_NO- //5:要開啟執行狀態的DIS_NO- //6:是否有累積執行錯誤之DIS_NO- //7:ST_ACCEPT_DATE ClientID- //8:ResultMsgLabel ClientID- //9:ErrMsgLabel ClientID- //10:將再開啟之控制項字串陣列 //11:DIS_QTY string strCtrlIDToUnLock = string.Format("{0}", strAryCtrlPending[1]); strCallbackResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}-{9}-{10}-{11}", strDisNoForAry, iProcessingAryIndex, bResult ? "OK" : "NG", Session[string.Format("{0}_ERRMSG_{1}", strPrefixed, strAryCtrlPending[0])].ToString(),//strErrMsg, strDisNo, strNextDisNo, Session[string.Format("{0}_DISNO_{1}", strPrefixed, strAryCtrlPending[0])] == null ? "0" : "1", strAryCtrlPending[2], strAryCtrlPending[3], strAryCtrlPending[4], strCtrlIDToUnLock, strDIS_QTY ); } } catch (Exception ex) { throw ex; } return strCallbackResult; #endregion }
/// <summary> /// 配本確認 2009-07-02 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SetupConfirmBtn_Click(object sender, EventArgs e) { #region string strResult = "", strErrMsg = "", strErrMsgCheck = ""; bool bResultCheck = false; string strPrefixed = "POP_DisApproveError"; try { #region #region 門市進貨日判斷 if (DateTime.Parse(SLP_STAcceptDate.Text) < DateTime.Today.AddDays(1))//2010/04/06 added : 門市進貨日必須大於等於系統日+1日 { throw new Exception("門市進貨日必須大於等於系統日+1日!!"); } #endregion #region ALOModel.MaintainDisCRMRecord BCO = new ALOModel.MaintainDisCRMRecord(ConnectionDB); ArrayList ParameterList = new ArrayList(); //--------------------------------------------------------------------- //2010/02/08 added:確認前檢核 ParameterList.Clear(); ParameterList.Add(DateTime.Parse(SLP_STAcceptDate.Text).ToShortDateString()); ParameterList.Add(DISNOTxt.Text); bResultCheck = BCO.Pick_Control_Check(ParameterList, out strErrMsgCheck); //--------------------------------------------------------------------- ParameterList.Clear(); ParameterList.Add(DateTime.Parse(SLP_STAcceptDate.Text).ToShortDateString()); ParameterList.Add(DISNOTxt.Text); ParameterList.Add("VDS_ALO_DIS_STORE"); ParameterList.Add(Session["UID"].ToString()); BCO.ProcessConfirm(ParameterList, out strResult, out strErrMsg, null); if ((strResult == "1") && (strErrMsg.Trim() == ""))//確認成功 { #region 確認成功 SLP_ApproveDate.Text = DateTime.Now.ToString("yyyy/MM/dd"); Int32 iReserveQty = 0; //保留數 Int32 iMdcQty = 0; //預留數(理論) = 到貨數-保留數-實配數 Int32 iAcceptQTY = 0; //到貨數 Int32 iDisQty = 0; //實配數 //取舊值 iReserveQty = Int32.Parse(this.ReserveQTYtxt.Text); iMdcQty = Int32.Parse(this.DIS_MDCQTYtxt.Text); iAcceptQTY = Int32.Parse(this.AcceptQTYtxt.Text); iDisQty = Int32.Parse(this.DISQTYtxt.Text); //算新值 iReserveQty = iReserveQty + iDisQty; iMdcQty = iAcceptQTY - iReserveQty;//預留數(實際) = 到貨數-新保留數 this.ReserveQTYtxt.Text = iReserveQty.ToString(); this.OLD_ReserveQTYtxtHidden.Value = iReserveQty.ToString(); this.DIS_MDCQTYtxt.Text = iMdcQty.ToString(); this.OLD_DISMDCQTYHidden.Value = iMdcQty.ToString(); //Gridview SessionIDName = "ALO111ItemGridViewDv_" + PageTimeStamp.Value; DataView dv = (DataView)Session[SessionIDName]; for (Int32 i = 0; i <= dv.Table.Rows.Count - 1; i++) { if (dv.Table.Rows[i]["ITEM"].ToString().Trim() == SLP_SKU1.TextBox_Code.Text.Trim() && dv.Table.Rows[i]["PERIOD"].ToString().Trim() == SLP_ItemPeriod1.TextBox_Code.Text.Trim()) { dv.Table.Rows[i]["RESERVE_QTY"] = iReserveQty; dv.Table.Rows[i]["DIS_MDC_QTY"] = iMdcQty; break; } } Session[SessionIDName] = dv; GridView_ItemList.DataSource = dv; GridView_ItemList.DataBind(); //2010/04/20 modified if (!bResultCheck && strErrMsgCheck != "") { ScriptManager.RegisterStartupScript(this, this.GetType(), "", string.Format("alert('{0}');alert('確認成功!');", strErrMsgCheck), true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('確認成功!');", true); } #endregion } // 只要成功完成檢核,無論筆數 strResult 都=1, 所以要另外檢查strErrMsg 不為空值代表有檢核錯誤資料需要開POP else if ((strResult == "1") && (strErrMsg.Trim() != ""))//確認失敗 { #region 確認失敗 Session[string.Format("{0}_DISNO_{1}", strPrefixed, PageTimeStamp.Value)] = DISNOTxt.Text; Session[string.Format("{0}_OPTYPE_{1}", strPrefixed, PageTimeStamp.Value)] = "1"; strResult = "0"; #endregion } if (bResultCheck) { #region check ok && confirm fail if (strResult != "1") { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "POP_DisApproveError();", true); } #endregion } else { #region check fail && confirm fail if (strResult != "1") { ScriptManager.RegisterStartupScript(this, this.GetType(), "", string.Format("alert('{0}');POP_DisApproveError();", strErrMsgCheck), true); } #endregion } FormStatusControl(FormStatus.View); UpdatePanel_ALODisMain.Update(); UpdatePanel_Item.Update(); #endregion #endregion } catch (Exception ex) { this.ErrorMsgLabel.Text = ex.Message; if (!bResultCheck && strErrMsgCheck != "") { ScriptManager.RegisterStartupScript(this, this.GetType(), "", string.Format("alert('{0}');", strErrMsgCheck), true); } } finally { UpdatePanel_ErrorMessage.Update(); } #endregion }