//檢查此筆資料是否在編輯期間有異動過 private string CheckData(string strID) { string strMsg = string.Empty; CGDModel.VDS_CGD38_BCO BCO = new CGDModel.VDS_CGD38_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBNull.Value);//ID ParameterList.Add(DBPara(slpPickDate.Text, ParaType.Varchar2)); ParameterList.Add(DBPara(txtPICK_BATCH.Text, ParaType.Varchar2)); DataTable dt = BCO.QueryVDS_CGD_DAILY_RPT(ParameterList); if (strID == "") { if (dt.Rows.Count > 0) strMsg = "此筆資料在編輯期間有被異動過了,請重新查詢後編輯."; } else { if (dt.Rows.Count == 0) { strMsg = "此筆資料在編輯期間有被異動過了,請重新查詢後編輯."; } else { if ((dt.Rows[0]["UpdateDate"].ToString().Trim() != txtUpdateDate.Text.Trim()) || (dt.Rows[0]["UPDATEUID"].ToString().Trim() != SLP_UPDATEUID.Text.Trim())) { strMsg = "此筆資料在編輯期間有被異動過了,請重新查詢後編輯."; } } } return strMsg; }
private void BindMaster(string strPICK_DATE, string strPICK_BATCH) { CGDModel.VDS_CGD38_BCO BCO = new CGDModel.VDS_CGD38_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBNull.Value);//ID ParameterList.Add(DBPara(strPICK_DATE, ParaType.Varchar2)); ParameterList.Add(DBPara(strPICK_BATCH, ParaType.Varchar2)); DataTable dtRPT = BCO.QueryVDS_CGD_DAILY_RPT(ParameterList); Session["CGD38_RPT_" + PageTimeStamp.Value] = dtRPT; hdfID.Value = ""; if (dtRPT.Rows.Count > 0) hdfID.Value = dtRPT.Rows[0]["ID"].ToString(); ParameterList.Clear(); ParameterList.Add(DBPara(hdfID.Value, ParaType.Number));//ID ParameterList.Add(DBPara(strPICK_DATE, ParaType.Varchar2)); ParameterList.Add(DBPara(strPICK_BATCH, ParaType.Varchar2)); DataTable dtSUM = BCO.GetSummaryData(ParameterList); Session["CGD38_SUM_" + PageTimeStamp.Value] = dtSUM; //載入第一個區塊的資料(含建立&修改人資料) BindFirstBlock(); //中間區塊計算用的隱藏TEXTBOX txtTEMP_TIME07.Text = ShowTime(GetDef("PickTimeS")); txtTEMP_TIME08.Text = ShowTime(GetDef("PickTimeE")); //載入最後區塊(理貨各項數據區塊) BindLastBlock(); }
private void BindMaster(string strPICK_DATE, string strPICK_BATCH) { CGDModel.VDS_CGD38_BCO BCO = new CGDModel.VDS_CGD38_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBNull.Value);//ID ParameterList.Add(DBPara(strPICK_DATE, ParaType.Varchar2)); ParameterList.Add(DBPara(strPICK_BATCH, ParaType.Varchar2)); DataTable dtRPT = BCO.QueryVDS_CGD_DAILY_RPT(ParameterList); Session["CGD38_RPT_" + PageTimeStamp.Value] = dtRPT; hdfID.Value = ""; hdfRPT_UPDATEUID.Value = ""; hdfRPT_UPDATEDATE.Value = ""; if (dtRPT.Rows.Count > 0) { hdfID.Value = dtRPT.Rows[0]["ID"].ToString(); hdfRPT_UPDATEUID.Value = dtRPT.Rows[0]["UPDATEUID"].ToString(); hdfRPT_UPDATEDATE.Value = dtRPT.Rows[0]["UPDATEDATE"].ToString(); } ParameterList.Clear(); ParameterList.Add(DBPara(hdfID.Value, ParaType.Number));//ID ParameterList.Add(DBPara(strPICK_DATE, ParaType.Varchar2)); ParameterList.Add(DBPara(strPICK_BATCH, ParaType.Varchar2)); DataTable dtSUM = BCO.GetSummaryData(ParameterList); Session["CGD38_SUM_" + PageTimeStamp.Value] = dtSUM; //載入第一個區塊的資料 BindFirstBlock(); }
//檢查此筆資料是否在編輯期間有異動過 private void CheckData(out string strAlertMsg, out string strErrMsg) { strAlertMsg = ""; strErrMsg = ""; CGDModel.VDS_CGD38_BCO BCO38 = new CGDModel.VDS_CGD38_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBNull.Value);//ID ParameterList.Add(DBPara(slpPickDate.Text, ParaType.Varchar2)); ParameterList.Add(DBPara(txtPICK_BATCH.Text, ParaType.Varchar2)); DataTable dt = BCO38.QueryVDS_CGD_DAILY_RPT(ParameterList); if (dt.Rows.Count == 0) { strAlertMsg = "此筆資料在編輯期間有被異動過了,請重新查詢後編輯."; strErrMsg = strAlertMsg; return; } else { if ((dt.Rows[0]["UpdateDate"].ToString().Trim() != hdfRPT_UPDATEDATE.Value.Trim()) || (dt.Rows[0]["UPDATEUID"].ToString().Trim() != hdfRPT_UPDATEUID.Value.Trim())) { strAlertMsg = "此筆資料在編輯期間有被異動過了,請重新查詢後編輯."; strErrMsg = strAlertMsg; return; } } //檢查理貨品項短溢明細是否有輸入 DataTable dtITEM = (DataTable)Session["CGD39_ITEM_" + PageTimeStamp.Value]; if (dtITEM.Rows.Count == 0) { strAlertMsg = "理貨品項短溢明細未輸入"; strErrMsg = "理貨品項短溢明細未輸入"; return; } for (int i = 0; i < dtITEM.Rows.Count; i++) { string strSingleMsg = string.Empty; string strITEM = dtITEM.Rows[i]["ITEM"].ToString().Trim(); string strPERIOD = dtITEM.Rows[i]["PERIOD"].ToString().Trim(); string strSHORT_NUM = dtITEM.Rows[i]["SHORT_NUM"].ToString().Trim(); string strOVER_NUM = dtITEM.Rows[i]["OVER_NUM"].ToString().Trim(); if (strITEM == "") { strSingleMsg = "[品號]欄位未輸入"; } else if (strPERIOD == "") { strSingleMsg = "[期別]欄位未輸入"; } else if (CheckItemExists(strITEM) == false) { strSingleMsg = "查無此品號"; } else if (CheckPeriodExists(strITEM, strPERIOD) == false) { strSingleMsg = "查無此期別"; } else if (strSHORT_NUM == "") { strSingleMsg = "[短少數量]未輸入"; } else if (strOVER_NUM == "") { strSingleMsg = "[溢多數量]未輸入"; } else if ((strSHORT_NUM == "0") && (strOVER_NUM == "0")) { strSingleMsg = "短少和溢多數量不同時為零"; } else if ((strSHORT_NUM != "0") && (strOVER_NUM != "0")) { strSingleMsg = "短少和溢多數量只允許一方有數量"; } else { //檢查理貨品項短溢明細是否有重複品號期別 for (int j = 0; j < dtITEM.Rows.Count; j++) { if (j != i) { string strOtherITEM = dtITEM.Rows[j]["ITEM"].ToString().Trim(); string strOtherPERIOD = dtITEM.Rows[j]["PERIOD"].ToString().Trim(); if ((strOtherITEM == strITEM) && (strOtherPERIOD == strPERIOD)) { int iRow = i + 1; strSingleMsg = "與第 " + iRow.ToString() + " 行品號期別資料重複"; break; } } } } if (strSingleMsg != "") { int iRow = i + 1; strErrMsg += "第 " + iRow.ToString() + " 行 " + strSingleMsg + "<BR/>"; } } DataTable dtINFO = (DataTable)Session["CGD39_INFO_" + PageTimeStamp.Value]; for (int i = 0; i < dtINFO.Rows.Count; i++) { string strVENDOR_NAME = dtINFO.Rows[i]["VENDOR_NAME"].ToString().Trim(); string strSHORTNUM = dtINFO.Rows[i]["SHORTNUM"].ToString().Trim(); string strOVERNUM = dtINFO.Rows[i]["OVERNUM"].ToString().Trim(); if ((strSHORTNUM != "0") && (strOVERNUM != "0")) { strErrMsg += "廠商[" + strVENDOR_NAME + "]:短少和溢多欄位只允許一方有數量<BR/>"; } } if (strErrMsg != "") { strAlertMsg = "理貨品項短溢明細區資料有誤,請檢視網頁最下方的錯誤訊息!"; strErrMsg = "理貨品項短溢明細區資料錯誤<BR/>" + strErrMsg; return; } }
protected void btnEdit_Click(object sender, EventArgs e) { try { #region 檢查條件 ErrorMsgLabel.Text = ""; if (slpPickDate.Text.Trim() == "") { ErrorMsgLabel.Text = "[理貨日期]欄位必填"; return; } if (txtPICK_BATCH.Text.Trim() == "") { ErrorMsgLabel.Text = "[理貨批次]欄位必填"; return; } CGDModel.VDS_CGD38_BCO BCO = new CGDModel.VDS_CGD38_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBNull.Value);//ID ParameterList.Add(DBPara(slpPickDate.Text, ParaType.Varchar2)); ParameterList.Add(DBPara(txtPICK_BATCH.Text, ParaType.Varchar2)); DataTable dtRPT = BCO.QueryVDS_CGD_DAILY_RPT(ParameterList); if (dtRPT.Rows.Count != 0) Response.Redirect("CGD392.aspx?Code=CGD39&pickdate=" + slpPickDate.Text.Trim() + "&PICK_BATCH=" + txtPICK_BATCH.Text.Trim()); else ErrorMsgLabel.Text = "請先於CGD38進行日報表基本數據維護"; #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } }