private bool SaveData() { bool bResult = false; try { ErrorMsgLabel.Text = ""; //把GridView的資料寫入Session中 WriteToInfo(); WriteToITEM(); string strAlertMsg = string.Empty; string strErrMsg = string.Empty; CheckData(out strAlertMsg, out strErrMsg); //檢查編輯期間,已經有人編輯或新增的狀況. if (strAlertMsg != "") { ErrorMsgLabel.Text = strErrMsg; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "MSG", "window.setTimeout(function(){alert('" + strAlertMsg + "');}, 500);", true); return bResult; } DataTable dtINFO = (DataTable)Session["CGD39_INFO_" + PageTimeStamp.Value]; DataTable dtITEM = (DataTable)Session["CGD39_ITEM_" + PageTimeStamp.Value]; CGDModel.VDS_CGD39_BCO BCO = new CGDModel.VDS_CGD39_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBPara(hdfID.Value, ParaType.Number)); //0.PID ParameterList.Add(DBPara(slpPickDate.Text, ParaType.Date)); //1.PICK_DATE ParameterList.Add(DBPara(txtPICK_BATCH.Text, ParaType.Varchar2)); //2.PICK_BATCH ParameterList.Add(DBPara(Session["UID"].ToString(), ParaType.Varchar2)); //3.UID ParameterList.Add(DateTime.Now); //4.UPDATE_TIME ParameterList.Add(DBPara(SLP_CREATEUID.Text, ParaType.Varchar2)); //5.CREATEUID ParameterList.Add(DBPara(txtCreateDate.Text, ParaType.Date)); //6.CreateDate ParameterList.Add(DBPara(slpGET_TIME.Text, ParaType.Varchar2)); //7.V_GET_TIME (更新RPT用的) ParameterList.Add(DBPara(slpSPEC_ITEMNUM.Text, ParaType.Number)); //8.N_SPEC_ITEMNUM (更新RPT用的) ParameterList.Add(DBPara(slpCTRL_ITEMNUM.Text, ParaType.Number)); //9.N_CTRL_ITEMNUM (更新RPT用的) ParameterList.Add(DBPara(slpPICK_ITEMNUM.Text, ParaType.Number)); //10.N_PICK_ITEMNUM (更新RPT用的) ParameterList.Add(DBPara(slpAmt.Text, ParaType.Number)); //11.N_AMT (更新RPT用的) ParameterList.Add(DBPara(hdfRPT_UPDATEUID.Value, ParaType.Varchar2)); //12.OLD_RPT_UPDATEUID (更新RPT用的) ParameterList.Add(DBPara(hdfRPT_UPDATEDATE.Value, ParaType.Date)); //13.OLD_RPT_UPDATE_TIME (更新RPT用的) ArrayList ParameterSPEC = new ArrayList(); ParameterSPEC.Add(DBPara(txtSPEC_STORENUM_ALL.Text, ParaType.Number)); //0.N_SPEC_STORENUM_ALL in number, ParameterSPEC.Add(DBPara(txtSPEC_STORENUM.Text, ParaType.Number)); //1.N_SPEC_STORENUM in number, ParameterSPEC.Add(DBPara(txtSPEC_PERIODNUM_ALL.Text, ParaType.Number)); //2.N_SPEC_PERIODNUM_ALL in number, ParameterSPEC.Add(DBPara(txtSPEC_PERIODNUM.Text, ParaType.Number)); //3.N_SPEC_PERIODNUM in number, ParameterSPEC.Add(DBPara(txtSPEC_ITEMNUM.Text, ParaType.Number)); //4.N_SPEC_ITEMNUM in number, ParameterSPEC.Add(DBPara(txtSPEC_STAFFNUM.Text, ParaType.Number)); //5.N_SPEC_STAFFNUM in number, ParameterSPEC.Add(DBPara(txtSEPC_HR.Text, ParaType.Number)); //6.N_SEPC_HR in number, ParameterSPEC.Add(DBPara(txtVDS_TRANSNUM.Text, ParaType.Number)); //7.N_VDS_TRANSNUM in number, ParameterSPEC.Add(DBPara(txtDPS_TRANSNUM.Text, ParaType.Number)); //8.N_DPS_TRANSNUM in number, ParameterSPEC.Add(DBPara(txtNOTES.Text, ParaType.Varchar2)); //9.V_NOTES in varchar BCO.SaveData(ParameterList, dtINFO, ParameterSPEC, dtITEM); bResult = true; } catch (Exception ex) { throw new Exception(ex.Message); } finally { } return bResult; }
private void BindGridView1() { CGDModel.VDS_CGD39_BCO BCO = new CGDModel.VDS_CGD39_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBPara(slpPickDate.Text, ParaType.Varchar2)); ParameterList.Add(DBPara(txtPICK_BATCH.Text, ParaType.Varchar2)); DataTable dtITEM = BCO.QueryVDS_CGD_DAILY_ITEM(ParameterList); Session["CGD39_ITEM_" + PageTimeStamp.Value] = dtITEM; if (dtITEM.Rows.Count == 0) AddRow(dtITEM); GridView1.DataSource = dtITEM; GridView1.DataBind(); }
private bool CheckPeriodExists(string strITEM, string strPERIOD) { CGDModel.VDS_CGD39_BCO BCO = new CGDModel.VDS_CGD39_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBPara(strITEM, ParaType.Varchar2)); ParameterList.Add(DBPara(strPERIOD, ParaType.Varchar2)); DataTable dt = BCO.QueryPeriod(ParameterList); if (dt.Rows.Count > 0) return true; else return false; }
//載入最下方高見副代理區塊 private void BindSPEC(string strPICK_DATE, string strPICK_BATCH) { CGDModel.VDS_CGD39_BCO BCO = new CGDModel.VDS_CGD39_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBPara(slpPickDate.Text, ParaType.Varchar2)); ParameterList.Add(DBPara(txtPICK_BATCH.Text, ParaType.Varchar2)); DataTable dtSPEC = BCO.QueryVDS_CGD_DAILY_SPEC(ParameterList); Session["CGD39_SPEC_" + PageTimeStamp.Value] = dtSPEC; if (dtSPEC.Rows.Count > 0) { txtSPEC_STORENUM_ALL.Text = dtSPEC.Rows[0]["SPEC_STORENUM_ALL"].ToString(); txtSPEC_PERIODNUM_ALL.Text = dtSPEC.Rows[0]["SPEC_PERIODNUM_ALL"].ToString(); txtSPEC_STAFFNUM.Text = dtSPEC.Rows[0]["SPEC_STAFFNUM"].ToString(); txtSEPC_HR.Text = dtSPEC.Rows[0]["SEPC_HR"].ToString(); txtVDS_TRANSNUM.Text = dtSPEC.Rows[0]["VDS_TRANSNUM"].ToString(); txtDPS_TRANSNUM.Text = dtSPEC.Rows[0]["DPS_TRANSNUM"].ToString(); txtSPEC_STORENUM.Text = dtSPEC.Rows[0]["SPEC_STORENUM"].ToString(); txtSPEC_ITEMNUM.Text = dtSPEC.Rows[0]["SPEC_ITEMNUM"].ToString(); txtSPEC_PERIODNUM.Text = dtSPEC.Rows[0]["SPEC_PERIODNUM"].ToString(); txtNOTES.Text = dtSPEC.Rows[0]["NOTES"].ToString(); } else { ParameterList.Clear(); ParameterList.Add(DBPara(slpPickDate.Text, ParaType.Varchar2)); ParameterList.Add(DBPara(txtPICK_BATCH.Text, ParaType.Varchar2)); DataTable dtC67 = BCO.QueryDeilyDPSitem(ParameterList); //C6,C7 DataTable dtC5 = BCO.QueryDailyDPSitemData(ParameterList); //C5 DataTable dtC48 = BCO.GetPickOutItem(ParameterList); //C4,C8 string strSPEC_STORENUM_ALL = "0"; string strSPEC_PERIODNUM_ALL = "0"; string strVDS_TRANSNUM = "0"; string strDPS_TRANSNUM = "0"; string strSPEC_ITEMNUM = "0"; string strSPEC_PERIODNUM = "0"; if (dtC5.Rows.Count > 0) strSPEC_STORENUM_ALL = dtC5.Rows[0]["SPEC_STORE_CNT"].ToString();//C5 副代理門市店數-合計 if (dtC67.Rows.Count > 0) { strSPEC_PERIODNUM_ALL = dtC67.Rows[0]["SPEC_QTY_SUM"].ToString(); //C6 副代理明細資料-數量 strVDS_TRANSNUM = dtC67.Rows[0]["PICK_REC_CNT"].ToString(); //C7 理貨明細資料-比數 strDPS_TRANSNUM = dtC67.Rows[0]["PICK_REC_CNT"].ToString(); //C7 理貨明細資料-比數 } if (dtC48.Rows.Count > 0) { strSPEC_ITEMNUM = dtC48.Rows[0]["SPEC_ITEMNUM"].ToString();//C4-> count 資料列數 strSPEC_PERIODNUM = dtC48.Rows[0]["SPEC_PERIODNUM"].ToString();//C8-> 取《非理貨商品門市資料》區塊的《冊數》欄位合計值 } //載入預設值 txtSPEC_STORENUM_ALL.Text = strSPEC_STORENUM_ALL; txtSPEC_PERIODNUM_ALL.Text = strSPEC_PERIODNUM_ALL; txtSPEC_STAFFNUM.Text = "0"; txtSEPC_HR.Text = "0"; txtVDS_TRANSNUM.Text = strVDS_TRANSNUM; txtDPS_TRANSNUM.Text = strDPS_TRANSNUM; txtSPEC_STORENUM.Text = "0"; txtSPEC_ITEMNUM.Text = strSPEC_ITEMNUM; txtSPEC_PERIODNUM.Text = strSPEC_PERIODNUM; txtNOTES.Text = "0"; } int iSUM_PERIODNUM = int.Parse(txtSPEC_PERIODNUM_ALL.Text) + int.Parse(txtSPEC_PERIODNUM.Text); txtSUM_PERIODNUM.Text = iSUM_PERIODNUM.ToString(); }
private void LoadData() { if (Request["pickdate"] != null) slpPickDate.Text = Request["pickdate"].ToString(); if (Request["pick_batch"] != null) txtPICK_BATCH.Text = Request["pick_batch"].ToString(); BindMaster(slpPickDate.Text, txtPICK_BATCH.Text); //理貨品項短溢明細區塊 BindGridView1(); DataTable dtSUM = (DataTable)Session["CGD38_SUM_" + PageTimeStamp.Value]; if (dtSUM.Rows.Count > 0) hdfErrorNum.Value = dtSUM.Rows[0]["ErrorNum"].ToString();//CGD38.25 總錯誤本數 decimal dSumSHORT_NUM = 0; decimal dSumOVER_NUM = 0; for (int i = 0; i < GridView1.Rows.Count; i++) { string strSHORT_NUM = ((TextBox)GridView1.Rows[i].FindControl("txtSHORT_NUM")).Text; string strOVER_NUM = ((TextBox)GridView1.Rows[i].FindControl("txtOVER_NUM")).Text; if (strSHORT_NUM == "") strSHORT_NUM = "0"; if (strOVER_NUM == "") strOVER_NUM = "0"; dSumSHORT_NUM += decimal.Parse(strSHORT_NUM); dSumOVER_NUM += decimal.Parse(strOVER_NUM); } decimal dErrRate = 0; if ((txtTotalITEM2.Text.Trim() == "0") || (txtTotalITEM2.Text.Trim() == "")) dErrRate = 0; else dErrRate = Math.Round((dSumSHORT_NUM + dSumOVER_NUM + decimal.Parse(hdfErrorNum.Value)) / decimal.Parse(txtTotalITEM2.Text) * 100, 4); this.txtSUM_SHORTNUM.Text = dSumSHORT_NUM.ToString(); this.txtSUM_OVERNUM.Text = dSumOVER_NUM.ToString(); this.txtERR_RATE.Text = dErrRate.ToString(); this.txtSUM_SHORTNUM.Attributes.Add("ReadOnly", "ReadOnly"); this.txtSUM_OVERNUM.Attributes.Add("ReadOnly", "ReadOnly"); this.txtERR_RATE.Attributes.Add("ReadOnly", "ReadOnly"); this.txtSUM_SHORTNUM.CssClass = "readtxtbox"; this.txtSUM_OVERNUM.CssClass = "readtxtbox"; this.txtERR_RATE.CssClass = "readtxtbox"; CGDModel.VDS_CGD39_BCO BCO = new CGDModel.VDS_CGD39_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(DBPara(slpPickDate.Text, ParaType.Varchar2)); ParameterList.Add(DBPara(txtPICK_BATCH.Text, ParaType.Varchar2)); DataTable dtINFO = BCO.QueryVENDOR_DAILY_INFO(ParameterList); Session["CGD39_INFO_" + PageTimeStamp.Value] = dtINFO; GridView2.DataSource = dtINFO; GridView2.DataBind(); //前置作業工時 GridView3.DataSource = dtINFO; GridView3.DataBind(); GridView4.DataSource = dtINFO; GridView4.DataBind(); GridView5.DataSource = dtINFO; GridView5.DataBind(); GridView6.DataSource = dtINFO; GridView6.DataBind(); //載入最下方高見副代理區塊 BindSPEC(slpPickDate.Text, txtPICK_BATCH.Text); //建立&修改人員區塊 DataTable dtSPEC = (DataTable)Session["CGD39_SPEC_" + PageTimeStamp.Value]; if (dtSPEC.Rows.Count != 0) { txtCreateDate.Text = dtSPEC.Rows[0]["CreateDate"].ToString(); ; SLP_CREATEUID.Text = dtSPEC.Rows[0]["CREATEUID"].ToString(); txtUpdateDate.Text = dtSPEC.Rows[0]["UpdateDate"].ToString(); SLP_UPDATEUID.Text = dtSPEC.Rows[0]["UPDATEUID"].ToString(); } UpdatePanel2.Update(); }
private bool CheckPeriodExist(string strItem, string strPeriod) { bool bResult = false;//true:存在 false:不存在 CGDModel.VDS_CGD39_BCO BCO = new CGDModel.VDS_CGD39_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(strItem); ParameterList.Add(strPeriod); DataTable dt = BCO.QueryPeriod(ParameterList); if (dt.Rows.Count > 0) { bResult = true; } return bResult; }
private static string GetItemName(string strItem) { string strResult = string.Empty; CGDModel.VDS_CGD39_BCO BCO = new CGDModel.VDS_CGD39_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(strItem); DataTable dt = BCO.QueryItem(ParameterList); if (dt.Rows.Count > 0) { string strNowDate = DateTime.Now.ToString("yyyy/MM/dd"); if (string.Compare(dt.Rows[0]["mdc_end_date"].ToString(), strNowDate) < 0) { strResult = "此品號已過期"; } else { strResult = dt.Rows[0]["ITEM_NAME"].ToString().Trim(); } } else { strResult = "無此品號資料"; } return strResult; }