/// <summary> /// 清單(報表)列印 /// </summary> protected void btnPrintReport_Click(object sender, EventArgs e) { if (VerifyFormData() == true) { try { ErrorMsgLabel.Text = ""; this.hid_PageStatus.Value = "PRINT"; CGDModel.MaintainSpecStore BCO = new CGDModel.MaintainSpecStore(ConntionDB); DataTable Dt; ParameterList.Clear(); //組sql where字串 string strWhere = ""; if (this.txtPickBatch.Text.Trim() != "") { strWhere += " and MA.PICK_BATCH = '" + this.txtPickBatch.Text.Trim() + "' "; } if (this.SLP_SLPDate1.Text.Trim() != "") { strWhere += " and MA.ST_ACCEPT_DATE = to_date('" + this.SLP_SLPDate1.Text.Trim() + "' , 'yyyy/mm/dd')"; } ParameterList.Add(strWhere); Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryStoreData, ParameterList); if (Dt.Rows.Count == 0) { this.hid_PageStatus.Value = "QUERY"; ErrorMsgLabel.Text = "查無資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 查無資料 ');", true); chkEarly.Checked = false; txtChanNo_Add.Text = ""; txtStore_Add.Text = ""; txtLabel.Value = ""; Panel1.Visible = false; CrystalReportViewer1.Visible = false; return; } else { #region 顯示報表 string s_FileName = ""; //設定輸出檔名 string s_rptFilePath = ""; //設定報表路徑 s_rptFilePath = Server.MapPath("./REPORT/CGD021.rpt"); s_FileName = HttpUtility.UrlEncode("理貨特殊門市.PDF", System.Text.Encoding.UTF8); LoadCrystalReport(s_FileName, s_rptFilePath, Dt, "PDF"); #endregion } //預覽報表 // ShowReport(Dt); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { } } }
/// <summary> /// 插入鈕 /// </summary> protected void btnInsert_Click(object sender, EventArgs e) { hidtxtPickBatch.Text = txtPickBatch.Text; if (SLP_SLPDate1.Text != "") { hidSLPDate1.Text = Convert.ToDateTime(SLP_SLPDate1.Text).ToShortDateString(); } #region 檢查輸入值 if (txtChanNo_Add.Text.Trim() == "") { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "A", "alert('[通路]不得為空白');", true); return; } if (txtStore_Add.Text.Trim() == "") { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "A", "alert('[門市]不得為空白');", true); return; } if (txtLabel.Value == "") { txtLabel.Value = "0"; } #endregion string SessionIDName = "CGD021_" + PageTimeStamp.Value; DataTable Dt = null; DataView DV1 = null; try { if (Session[SessionIDName] != null) { Dt = (DataTable)Session[SessionIDName]; } else { //從DB讀取一空table回來 CGDModel.MaintainSpecStore BCO = new CGDModel.MaintainSpecStore(ConntionDB); ParameterList.Clear(); Dt = BCO.QuerySwitch(CGDModel.MaintainSpecStore.QueryType.Empty, ParameterList); } //檢查是否有重複站所 string vCHAN_NO = txtChanNo_Add.Text; string vSTORE = txtStore_Add.Text; string vST_ACCEPT_DATE = hidSLPDate1.Text; string vPICK_BATCH = hidtxtPickBatch.Text; string repeat = ""; for (int i = 0; i <= Dt.Rows.Count - 1; i++) { if (Dt.Rows[i].RowState != DataRowState.Deleted) { if ((Dt.Rows[i]["CHAN_NO"].ToString() == vCHAN_NO) && (Dt.Rows[i]["STORE"].ToString() == vSTORE) && (Convert.ToDateTime(Dt.Rows[i]["ST_ACCEPT_DATE"].ToString()).ToShortDateString() == vST_ACCEPT_DATE) && (Dt.Rows[i]["PICK_BATCH"].ToString() == vPICK_BATCH)) { repeat = "Yes"; } } } if (repeat == "Yes") { if (userState == "ADD") { ErrorMsgLabel.Text = "此筆新增資料之[通路]與[門市]已重覆"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 此筆新增資料之[通路]與[門市]已重覆 ');", true); return; } } if (repeat == "Yes") { for (int i = Dt.Rows.Count - 1; i >= 0; i--) { if (Dt.Rows[i].RowState != DataRowState.Deleted) { if ((Dt.Rows[i]["CHAN_NO"].ToString() == vCHAN_NO) && (Dt.Rows[i]["STORE"].ToString() == vSTORE) && (Convert.ToDateTime(Dt.Rows[i]["ST_ACCEPT_DATE"].ToString()).ToShortDateString() == vST_ACCEPT_DATE) && (Dt.Rows[i]["PICK_BATCH"].ToString() == vPICK_BATCH)) { Dt.Rows[i]["CHAN_NO"] = txtChanNo_Add.Text; Dt.Rows[i]["STORE"] = txtStore_Add.Text; for (int j = 0; j <= txtLabel.Value.Length - 1; j++) { if (System.Char.IsNumber(txtLabel.Value, j) == false) throw new Exception("請輸入正數之數字"); } if (txtLabel.Value == "") { Dt.Rows[i]["LABEL_QTY"] = 0; } else { Dt.Rows[i]["LABEL_QTY"] = txtLabel.Value; } if (chkEarly.Checked == true) { Dt.Rows[i]["DELIV_EARLY"] = "Y"; } else { Dt.Rows[i]["DELIV_EARLY"] = "N"; } Dt.Rows[i]["UPDATEDATE"] = DateTime.Now; Dt.Rows[i]["UPDATEUID"] = Session["UID"].ToString(); } } } } else { #region 取通路名及店名 TextBox _tmpChanName = (TextBox)this.txtChanNo_Add.FindControl("TextBoxName"); tmpChanName = Request[_tmpChanName.UniqueID].ToString(); TextBox _tmpStoreName = (TextBox)this.txtStore_Add.FindControl("TextBoxName"); tmpStoreName = Request[_tmpStoreName.UniqueID].ToString(); #endregion #region 取temp ID tempID = 0; DataView tempDT = new DataView(); tempDT.Table = Dt.Copy(); tempDT.Sort = "ID ASC"; if (Dt.Rows.Count != 0) { tempID = Convert.ToInt32(tempDT[tempDT.Count - 1]["ID"].ToString()); } #endregion #region 取序號 DV1 = null; int rowNum = 1; if (Dt != null) { //DV1 = Dt.DefaultView; //DV1.RowFilter = "rownum <= " + TextBoxRowCountLimit.Text.Trim(); //DataTable tmpDT = DV1.ToTable(); //rowNum = tmpDT.Rows.Count; rowNum = Dt.Rows.Count; } #endregion DataRow dRow = Dt.NewRow(); //ID和CODE暫自訂, 真正寫入CO時會重取 int v_ID = tempID + 1; int v_CODE = tempID + 1; dRow["ID"] = v_ID; dRow["CODE"] = v_CODE; dRow["ROWNUM"] = rowNum + 1; dRow["CREATEDATE"] = DateTime.Now; dRow["UPDATEDATE"] = DateTime.Now; dRow["CREATEUID"] = Session["UID"].ToString(); dRow["UPDATEUID"] = Session["UID"].ToString(); dRow["STATUS"] = "1"; dRow["ENABLE"] = "1"; dRow["ST_ACCEPT_DATE"] = Convert.ToDateTime(hidSLPDate1.Text); dRow["PICK_BATCH"] = hidtxtPickBatch.Text; dRow["CHAN_NO"] = txtChanNo_Add.Text; dRow["NAME"] = tmpChanName; dRow["STORE"] = txtStore_Add.Text; dRow["STORE_NAME"] = tmpStoreName; if (chkEarly.Checked == true) { dRow["DELIV_EARLY"] = "Y"; } else { dRow["DELIV_EARLY"] = "N"; } for (int i = 0; i <= txtLabel.Value.Length - 1; i++) { if (System.Char.IsNumber(txtLabel.Value, i) == false) throw new Exception("請輸入正數之數字"); else dRow["LABEL_QTY"] = txtLabel.Value; } Dt.Rows.Add(dRow); } Session[SessionIDName] = Dt; DV1 = null; if (Dt != null) { DV1 = Dt.DefaultView; DV1.RowFilter = "rownum <= " + TextBoxRowCountLimit.Text.Trim(); } chkEarly.Checked = false; txtChanNo_Add.Text = ""; tmpChanName = ""; txtStore_Add.Text = ""; tmpStoreName = ""; txtLabel.Value = ""; Panel1.Visible = false; GridView1.DataSource = Dt; GridView1.DataBind(); userState = ""; } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { } }
/// <summary> /// databind 繫結查詢資料到GridView1 /// </summary> private void databind() { //抓取本頁初次登記的時間 string SessionIDName = "CGD021_" + PageTimeStamp.Value; CGDModel.MaintainSpecStore BCO = new CGDModel.MaintainSpecStore(ConntionDB); DataTable Dt; string strWhere = ""; if (Session[SessionIDName] != null) { Dt = (DataTable)Session[SessionIDName]; } else { ParameterList.Clear(); if (this.txtPickBatch.Text.Trim() != "") { strWhere += " and MA.PICK_BATCH = '" + this.txtPickBatch.Text.Trim() + "' "; } if (this.SLP_SLPDate1.Text.Trim() != "") { strWhere += " and MA.ST_ACCEPT_DATE = to_date('" + this.SLP_SLPDate1.Text.Trim() + "' , 'yyyy/mm/dd')"; } ParameterList.Add(strWhere); Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryStoreData, ParameterList); } if (Dt.Rows.Count == 0) { if (showNoDataMessage == "Y") ErrorMsgLabel.Text = "查無資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 查無資料 ');", true); chkEarly.Checked = false; txtChanNo_Add.Text = ""; txtStore_Add.Text = ""; txtLabel.Value = ""; Panel1.Visible = false; } Session[SessionIDName] = Dt; DataView DV1 = Dt.DefaultView; DV1.RowFilter = "rownum <= " + TextBoxRowCountLimit.Text.Trim(); GridView1.DataSource = DV1; //設定分頁大小 GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); }
/// <summary> /// 標籤列印確定鈕 /// </summary> protected void btnPrintLabelSubmit_Click(object sender, EventArgs e) { #region 檢查輸入值 if (txtExportPath.Text.Trim() == "") { ErrorMsgLabel.Text = "[匯出路徑]欄位不得空白"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' [匯出路徑]欄位不得空白 ');", true); return; } if (txtExportCount.Text.Trim() == "0") { ErrorMsgLabel.Text = "無資料可匯出"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 無資料可匯出 ');", true); return; } #endregion try { //---讀取資料 CGDModel.MaintainSpecStore BCO = new CGDModel.MaintainSpecStore(ConntionDB); DataTable Dt; ParameterList.Clear(); ParameterList.Add(SLP_SLPDate1.Text.Trim()); ParameterList.Add(txtPickBatch.Text.Trim()); Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.Label, ParameterList); if (Dt.Rows.Count == 0) { ErrorMsgLabel.Text = "無資料可匯出"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 無資料可匯出 ');", true); return; } //---輸出至文字檔 System.Text.StringBuilder sb_Out_String = new System.Text.StringBuilder(); Response.Clear(); Response.Buffer = true; Response.Charset = "BIG5"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(txtExportPath.Text.Trim())); Response.ContentEncoding = System.Text.Encoding.GetEncoding("BIG5"); Response.ContentType = "application/ms-txt"; this.EnableViewState = false; System.IO.StringWriter oStringWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter); foreach (DataRow dRow in Dt.Rows) { sb_Out_String.Remove(0, sb_Out_String.Length); //移除舊資料行 sb_Out_String.Append(dRow["STORE"].ToString() + "," + dRow["ROUTE"].ToString() + "," + dRow["STEP"].ToString() + "," + dRow["ST_ACCEPT_DATE"].ToString() + "," + dRow["STORE_NAME"].ToString() + "," + dRow["STORE"].ToString() + "," + dRow["LABEL_QTY"].ToString()); Response.Write(sb_Out_String.ToString()); Response.Write(oHtmlTextWriter.NewLine); } Response.End(); ErrorMsgLabel.Text = "匯出完畢"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 匯出完畢 ');", true); } catch (System.UnauthorizedAccessException a) { ErrorMsgLabel.Text = "匯出失敗,對該路徑無寫入權限"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 匯出失敗,對該路徑無寫入權限 ');", true); } catch (System.IO.DirectoryNotFoundException b) { ErrorMsgLabel.Text = "匯出失敗,請確認儲存路徑正確"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 匯出失敗,請確認儲存路徑正確 ');", true); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } }
/// <summary> /// 標籤列印 /// </summary> protected void btnPrintLabel_Click(object sender, EventArgs e) { if (VerifyFormData() == true) { DataTable Dt = null; try { CGDModel.MaintainSpecStore BCO = new CGDModel.MaintainSpecStore(ConntionDB); ParameterList.Clear(); ParameterList.Add(SLP_SLPDate1.Text.Trim()); ParameterList.Add(txtPickBatch.Text.Trim()); Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.Label, ParameterList); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { } txtExportPath.Text = @"P:\BARCODE\BFAMILY\VDSCGD021.NON"; txtExportCount.Text = Convert.ToString(Dt.Rows.Count); panExport.Visible = true; } //try //{ // if (Dt.Rows.Count == 0) // { // ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 無資料可列印 ');", true); // return; // } // string VDSCGD021TXTFILE = ""; // for ( int i = 0 ; i <= Dt.Rows.Count - 1 ; i ++ ) // { // VDSCGD021TXTFILE = Dt.Rows[i]["STORE"] + "," + Dt.Rows[i]["ROUTE"] + "," + Dt.Rows[i]["STEP"] + "," + Dt.Rows[i]["ST_ACCEPT_DATE"] + "," + Dt.Rows[i]["STORE_NAME"] + "," + Dt.Rows[i]["STORE"] + "," + Dt.Rows[i]["LABEL_QTY"]; // WriteTXT( VDSCGD021TXTFILE ); // } // Change(); // ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 列印完畢 ');", true); //} //catch (System.UnauthorizedAccessException a) //{ // ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 匯出失敗,對該路徑無寫入權限 ');", true); //} //catch (System.IO.DirectoryNotFoundException b) //{ // ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 匯出失敗,請確認儲存路徑正確 ');", true); //} //catch (Exception ex) //{ // ErrorMsgLabel.Text = ex.Message; //} }
/// <summary> /// 複製鈕(複製視窗內的) /// </summary> protected void btnSave_Click(object sender, EventArgs e) { #region 輸入檢查 if (SLP_CopyFromDate.Text == "") { ErrorMsgLabel.Text = "舊[門市進貨日]欄位不得空白"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 舊[門市進貨日]欄位不得空白 ');", true); return; } if (txtPickBatchCopyFrom.Text == "") { ErrorMsgLabel.Text = "舊[理貨批次]欄位不得空白"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 舊[理貨批次]欄位不得空白 ');", true); return; } if (SLP_CopyToDate.Text == "") { ErrorMsgLabel.Text = "新[門市進貨日]欄位不得空白"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 新[門市進貨日]欄位不得空白 ');", true); return; } if (Convert.ToDateTime(SLP_CopyToDate.Text) <= DateTime.Now) { ErrorMsgLabel.Text = "新[門市進貨日]欄位不得小於等於系統日"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 新[門市進貨日]欄位不得小於等於系統日 ');", true); return; } if (txtPickBatchCopyTo.Text == "") { ErrorMsgLabel.Text = "新[理貨批次]欄位不得空白"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 新[理貨批次]欄位不得空白 ');", true); return; } #endregion System.IO.TextReader tr; CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon(); System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction(); try { CGDModel.MaintainSpecStore BCO = new CGDModel.MaintainSpecStore(ConntionDB); string strWhere = ""; // 檢查新日期是否有資料----------------------------------------------------------------------------------------- #region checking DataTable DtCheckNew; ParameterList.Clear(); //組sql where字串 strWhere = ""; strWhere += " and MA.ST_ACCEPT_DATE = to_date('" + this.SLP_CopyToDate.Text.Trim() + "' , 'yyyy/mm/dd')"; strWhere += " and MA.PICK_BATCH = '" + this.txtPickBatchCopyTo.Text.Trim() + "'"; ParameterList.Add(strWhere); DtCheckNew = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryStoreData, ParameterList); if (DtCheckNew.Rows.Count > 0) { ErrorMsgLabel.Text = "輸入的新門市進貨日已有資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 輸入的新門市進貨日已有資料 ');", true); return; } #endregion // 檢查舊日期是否有資料 , 如有資料則進行複製-------------------------------------------------------------------- #region checking DataTable DtCheckOld; ParameterList.Clear(); //組sql where字串 strWhere = ""; strWhere += " and MA.ST_ACCEPT_DATE = to_date('" + this.SLP_CopyFromDate.Text.Trim() + "' , 'yyyy/mm/dd')"; strWhere += " and MA.PICK_BATCH = '" + this.txtPickBatchCopyFrom.Text.Trim() + "'"; ParameterList.Add(strWhere); DtCheckOld = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryStoreData, ParameterList); if (DtCheckOld.Rows.Count == 0) { ErrorMsgLabel.Text = "輸入的舊門市進貨日沒有資料可以複製"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 輸入的舊門市進貨日沒有資料可以複製 ');", true); return; } else { for (int i = 0; i <= DtCheckOld.Rows.Count - 1; i++) { ParameterList.Clear(); ParameterListDel.Clear(); ParameterList.Add(System.DateTime.Now); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(System.DateTime.Now); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DtCheckOld.Rows[i]["STATUS"]); ParameterList.Add(DtCheckOld.Rows[i]["ENABLE"]); ParameterList.Add(Convert.ToDateTime(this.SLP_CopyToDate.Text.Trim())); ParameterList.Add(this.txtPickBatchCopyTo.Text.Trim()); ParameterList.Add(DtCheckOld.Rows[i]["CHAN_NO"]); ParameterList.Add(DtCheckOld.Rows[i]["STORE"]); ParameterList.Add(DtCheckOld.Rows[i]["DELIV_EARLY"]); ParameterList.Add(DtCheckOld.Rows[i]["LABEL_QTY"]); BCO.CreatePICK_SPEC_STORE(ParameterList, DBT); } DBT.Commit();//交易成功 } #endregion ErrorMsgLabel.Text = "複製完畢"; ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 複製完畢 ');", true); } catch (Exception ex) { DBT.Rollback();//交易失敗 ErrorMsgLabel.Text = ex.Message; } btnCloseCopy_Click(null, null); }
/// <summary> /// 儲存鈕 /// </summary> protected void btnSaveAll_Click(object sender, EventArgs e) { string SessionIDName = "CGD021_" + PageTimeStamp.Value; DataTable Dt = null; DataTable DT_Add = null; DataTable DT_Mod = null; DataTable DT_Del = null; if (Session[SessionIDName] != null) { Dt = (DataTable)Session[SessionIDName]; DT_Add = Dt.GetChanges(DataRowState.Added); DT_Mod = Dt.GetChanges(DataRowState.Modified); DT_Del = Dt.GetChanges(DataRowState.Deleted); } else { ErrorMsgLabel.Text = "目前無資料異動"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 目前無資料異動 ');", true); return; } if (DT_Add == null && DT_Mod == null && DT_Del == null) { ErrorMsgLabel.Text = "目前無資料異動"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 目前無資料異動 ');", true); return; } CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon(); System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction(); CGDModel.MaintainSpecStore BCO = new CGDModel.MaintainSpecStore(ConntionDB); try { //刪除---------------------------------------------------------------------------------------------------------- if (DT_Del != null) { foreach (DataRow dRow in DT_Del.Rows) { ParameterList.Clear(); ParameterList.Add(dRow["PICK_BATCH", DataRowVersion.Original].ToString()); ParameterList.Add(Convert.ToDateTime(dRow["ST_ACCEPT_DATE", DataRowVersion.Original].ToString())); ParameterList.Add(dRow["CHAN_NO", DataRowVersion.Original].ToString()); ParameterList.Add(dRow["STORE", DataRowVersion.Original].ToString()); ParameterList.Add(Convert.ToDateTime(dRow["UPDATEDATE", DataRowVersion.Original])); string MSG = BCO.DeletePICK_SPEC_STORE(ParameterList, DBT); if (MSG == "NODATA") { throw new Exception("DB_NODATA"); } } } //新增---------------------------------------------------------------------------------------------------------- if (DT_Add != null) { foreach (DataRow dRow in DT_Add.Rows) { ParameterList.Clear(); ParameterList.Add(dRow["CREATEDATE"]); ParameterList.Add(dRow["CREATEUID"]); ParameterList.Add(dRow["UPDATEDATE"]); ParameterList.Add(dRow["UPDATEUID"]); ParameterList.Add(dRow["STATUS"]); ParameterList.Add(dRow["ENABLE"]); ParameterList.Add(dRow["ST_ACCEPT_DATE"]); ParameterList.Add(dRow["PICK_BATCH"]); ParameterList.Add(dRow["CHAN_NO"]); ParameterList.Add(dRow["STORE"]); ParameterList.Add(dRow["DELIV_EARLY"]); ParameterList.Add(dRow["LABEL_QTY"]); BCO.CreatePICK_SPEC_STORE(ParameterList, DBT); } } //修改---------------------------------------------------------------------------------------------------------- if (DT_Mod != null) { foreach (DataRow dRow in DT_Mod.Rows) { ParameterList.Clear(); ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Current].ToString()); ParameterList.Add(Convert.ToDateTime(dRow["ST_ACCEPT_DATE", DataRowVersion.Current].ToString())); ParameterList.Add(dRow["PICK_BATCH", DataRowVersion.Current].ToString()); ParameterList.Add(dRow["CHAN_NO", DataRowVersion.Current].ToString()); ParameterList.Add(dRow["STORE", DataRowVersion.Current].ToString()); ParameterList.Add(dRow["DELIV_EARLY", DataRowVersion.Current].ToString()); ParameterList.Add(Convert.ToInt32(dRow["LABEL_QTY", DataRowVersion.Current].ToString())); ParameterList.Add(Convert.ToDateTime(dRow["CREATEDATE", DataRowVersion.Original].ToString())); ParameterList.Add(dRow["CREATEUID", DataRowVersion.Original].ToString()); ParameterList.Add(Convert.ToDateTime(dRow["UPDATEDATE", DataRowVersion.Original].ToString())); ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Original].ToString()); ParameterList.Add(dRow["STATUS", DataRowVersion.Original].ToString()); ParameterList.Add(dRow["ENABLE", DataRowVersion.Original].ToString()); ParameterList.Add(Convert.ToDateTime(dRow["ST_ACCEPT_DATE", DataRowVersion.Original].ToString())); ParameterList.Add(dRow["PICK_BATCH", DataRowVersion.Original].ToString()); ParameterList.Add(dRow["CHAN_NO", DataRowVersion.Original].ToString()); ParameterList.Add(dRow["STORE", DataRowVersion.Original].ToString()); ParameterList.Add(dRow["DELIV_EARLY", DataRowVersion.Original].ToString()); ParameterList.Add(Convert.ToInt32(dRow["LABEL_QTY", DataRowVersion.Original].ToString())); string MSG = BCO.UpdatePICK_SPEC_STORE(ParameterList, DBT); if (MSG == "NODATA") { throw new Exception("DB_NODATA"); } } } DBT.Commit();//交易成功 btnQuery_Click(null, null); ErrorMsgLabel.Text = "儲存完畢"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 儲存完畢 ');", true); } catch (Exception ex) { DBT.Rollback();//交易失敗 if (ex.Message.IndexOf("違反必須為唯一的限制條件") > 0) { ErrorMsgLabel.Text = "新增之站所已重複"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 新增之站所已重複 ');", true); return; } if (ex.Message.IndexOf("NODATA") > 0) { ErrorMsgLabel.Text = "原資料已異動過,請重新查詢資料後再作處理"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 原資料已異動過,請重新查詢資料後再作處理 ');", true); return; } ErrorMsgLabel.Text = ex.Message; } finally { } }