private void txt_STORE_Onblur() { TextBox txt_up_CHAN_NO = (TextBox)((ASP.stm_slp_slp_storechain_ascx)slp_up_CHAN_NO).FindControl("TextBoxCode");//通路 TextBox txt_up_STORE = (TextBox)((ASP.stm_slp_slp_store_ascx)slp_up_STORE).FindControl("TextBoxCode");//門市 TextBox txt_up_Z_O = (TextBox)((ASP.sys_slp_slp_codefile_ascx)slp_up_Z_O).FindControl("TextBoxCode");//營業所 TextBox txt_up_SALE_ID = (TextBox)((ASP.sys_slp_slp_user_ascx)slp_up_SALE_ID).FindControl("TextBoxCode");//營業人員 try { if (this.hid_PageStatus.Value == "INSERT" || this.hid_PageStatus.Value == "QUERY") { if (dtChainPOSetting != null) { dtChainPOSetting = null; } #region 從資料庫查詢資料 ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(txt_up_STORE.Text);//門市 ParameterList.Add(txt_up_CHAN_NO.Text);//通路 ParameterList.Add(Session["UID"].ToString()); //2009-06-01 cyhsu add 新增記錄 STORE and CHAN_NO s_CHAN_NO = txt_up_CHAN_NO.Text; s_STORE = txt_up_STORE.Text; DataTable dt_Return = new DataTable(); BCO.MaintainStore bco = new BCO.MaintainStore(ConntionDB); dt_Return = bco.QUERY_STORE_BY_STOREANDCHAN(ParameterList); #endregion if (dt_Return.Rows.Count == 0) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM041.aspx", "alert('查無門市資料');document.getElementById('" + txt_up_STORE.ClientID + "').focus();document.getElementById('" + txt_up_STORE.ClientID + "').select();", true); } else { if (this.hid_PageStatus.Value == "INSERT") { if (dt_Return.Rows[0]["MDC_END_DATE"].ToString() != string.Empty && ((DateTime)dt_Return.Rows[0]["MDC_END_DATE"]) < DateTime.Today) { throw new Exception("非有效門市,不可新增"); } } slp_up_CHAN_NO.Text = dt_Return.Rows[0]["CHAN_NO"].ToString(); slp_up_Z_O.Text = dt_Return.Rows[0]["Z_O"].ToString(); slp_up_SALE_ID.Text = dt_Return.Rows[0]["SAL_ID"].ToString(); #region 取得通路PO控制設定 GetChainPOSetting(dt_Return.Rows[0]["CHAN_NO"].ToString(), dt_Return.Rows[0]["STORE"].ToString()); #endregion } if (this.hid_PageStatus.Value == "QUERY") { //slp_up_BUSDATE.Focus(); TextBox txt_up_BUSDATE = (TextBox)((ASP.wui_slp_slp_slpdate_ascx)slp_up_BUSDATE).FindControl("TextBoxCode"); ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM041.aspx", "document.getElementById('" + txt_up_BUSDATE.ClientID + "').focus();document.getElementById('" + txt_up_BUSDATE.ClientID + "').select();", true); } else if (this.hid_PageStatus.Value == "INSERT") { //txt_up_PO_SOURCE_NO.Focus(); ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM041.aspx", "document.getElementById('" + txt_up_PO_SOURCE_NO.ClientID + "').focus();document.getElementById('" + txt_up_PO_SOURCE_NO.ClientID + "').select();", true); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM041.aspx", "alert('" + ex.Message + "');document.getElementById('" + txt_up_STORE.ClientID + "').focus();document.getElementById('" + txt_up_STORE.ClientID + "').select();", true); } }
/// <summary> /// 將變更後的內部變量this.CallBackValue返回給前台JavaScript方法ReceiveServerData(string Value)。 /// </summary> /// <returns></returns> string ICallbackEventHandler.GetCallbackResult() { if (CallBackValue != string.Empty) { try { #region 取得頁面元件 TextBox txt_up_CHAN_NO = (TextBox)((ASP.stm_slp_slp_storechain_ascx)slp_up_CHAN_NO).FindControl("TextBoxCode");//通路 TextBox txt_up_CHAN_NAME = (TextBox)((ASP.stm_slp_slp_storechain_ascx)slp_up_CHAN_NO).FindControl("TextBoxName");//通路名稱 TextBox txt_up_STORE = (TextBox)((ASP.stm_slp_slp_store_ascx)slp_up_STORE).FindControl("TextBoxCode");//門市 TextBox txt_up_Z_O = (TextBox)((ASP.sys_slp_slp_codefile_ascx)slp_up_Z_O).FindControl("TextBoxCode");//營業所 TextBox txt_up_Z_O_NAME = (TextBox)((ASP.sys_slp_slp_codefile_ascx)slp_up_Z_O).FindControl("TextBoxName");//營業所名稱 TextBox txt_up_BUSDATE = (TextBox)((ASP.wui_slp_slp_slpdate_ascx)slp_up_BUSDATE).FindControl("TextBoxCode");//訂單日期 TextBox txt_up_SALE_ID = (TextBox)((ASP.sys_slp_slp_user_ascx)slp_up_SALE_ID).FindControl("TextBoxCode");//營業人員 TextBox txt_up_SALE_NAME = (TextBox)((ASP.sys_slp_slp_user_ascx)slp_up_SALE_ID).FindControl("TextBoxName");//營業人員名稱 TextBox txt_up_BUSUID = (TextBox)((ASP.sys_slp_slp_user_ascx)slp_up_BUSUID).FindControl("TextBoxCode");//訂單維護者 Image img_up_CHAN_NO = (Image)((ASP.stm_slp_slp_storechain_ascx)slp_up_CHAN_NO).FindControl("Image1");//通路img Image img_up_STORE = (Image)((ASP.stm_slp_slp_store_ascx)slp_up_STORE).FindControl("Image1");//門市img Image img_up_BUSDATE = (Image)((ASP.wui_slp_slp_slpdate_ascx)slp_up_BUSDATE).FindControl("Image1");//訂單日期img Image img_up_SALE_ID = (Image)((ASP.sys_slp_slp_user_ascx)slp_up_SALE_ID).FindControl("Image1");//營業人員img Image img_up_BUSUID = (Image)((ASP.sys_slp_slp_user_ascx)slp_up_BUSUID).FindControl("Image1");//訂單維護者img Image img_down_ITEM = (Image)((ASP.itm_slp_slp_sku_ascx)slp_down_ITEM).FindControl("Image1");//品號img Image img_down_REQUEST_QTY = (Image)((ASP.wui_slp_slp_slpquantity_ascx)slp_down_REQUEST_QTY).FindControl("Image1");//訂貨量img Image img_down_RTN_DDL = (Image)((ASP.wui_slp_slp_slpdate_ascx)slp_down_RTN_DDL).FindControl("Image1");//退書截止日img TextBox txt_down_ITEM = (TextBox)((ASP.itm_slp_slp_sku_ascx)slp_down_ITEM).FindControl("TextBoxCode");//品號 TextBox txt_down_ITEM_NAME = (TextBox)((ASP.itm_slp_slp_sku_ascx)slp_down_ITEM).FindControl("TextBoxName");//品名 TextBox txt_down_REQUEST_QTY = (TextBox)((ASP.wui_slp_slp_slpquantity_ascx)slp_down_REQUEST_QTY).FindControl("TextBoxCode");//訂貨量 TextBox txt_down_REQUEST_QTY_NAME = (TextBox)((ASP.wui_slp_slp_slpquantity_ascx)slp_down_REQUEST_QTY).FindControl("TextBoxName");//訂貨量名稱 TextBox txt_down_RTN_DDL = (TextBox)((ASP.wui_slp_slp_slpdate_ascx)slp_down_RTN_DDL).FindControl("TextBoxCode");//退書截止日 CheckBox chk_down_IS_OVERDUE = (CheckBox)((ASP.wui_slp_slp_boolean_ascx)slp_down_IS_OVERDUE).FindControl("C1");//逾期客訂 #endregion System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Remove(0, sb.Length); CallBackValue = CallBackValue.Trim(); string[] s_Client_String = System.Text.RegularExpressions.Regex.Split(CallBackValue, "<partition>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); ArrayList ParameterList = new ArrayList();//20091117 #region 新增模式下異動欄位[門市] if (s_Client_String[0] == "新增模式下異動欄位[門市]") { if (dtChainPOSetting != null) { dtChainPOSetting = null; } s_STORE = s_Client_String[1].ToString().Trim();//門市 s_CHAN_NO = s_Client_String[2].ToString().Trim();//通路 #region 從資料庫查詢資料 ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//門市 ParameterList.Add(s_Client_String[2]);//通路 ParameterList.Add(Session["UID"].ToString()); DataTable dt_Return = new DataTable(); BCO.MaintainStore bco = new BCO.MaintainStore(ConntionDB); dt_Return = bco.QUERY_STORE_BY_STOREANDCHAN(ParameterList); #endregion #region 設定回傳Client端資訊 if (dt_Return.Rows.Count == 0) { sb.Append("新增模式下異動欄位[門市]<partition>"); sb.Append("FALSE<partition>"); sb.Append("查無門市資料<partition>"); sb.Append(txt_up_STORE.ClientID + "<partition>");//設定焦點的欄位 sb.Append(txt_up_CHAN_NO.ClientID + "<partition>"); sb.Append(txt_up_Z_O.ClientID + "<partition>"); sb.Append(txt_up_SALE_ID.ClientID); } else { sb.Append("新增模式下異動欄位[門市]<partition>"); sb.Append("TRUE<partition>"); sb.Append(dt_Return.Rows[0]["CHAN_NO"].ToString() + "<partition_Detail>" + txt_up_CHAN_NO.ClientID + "<partition>"); sb.Append(dt_Return.Rows[0]["Z_O"].ToString() + "<partition_Detail>" + txt_up_Z_O.ClientID + "<partition>"); //sb.Append(dt_Return.Rows[0]["SAL_ID"].ToString() + "<partition_Detail>" + txt_up_SALE_ID.ClientID); sb.Append(dt_Return.Rows[0]["SAL_ID"].ToString() + "<partition_Detail>" + txt_up_SALE_ID.ClientID + "<partition>"); sb.Append("<partition_Detail>" + txt_up_CHAN_NAME.ClientID + "<partition>"); sb.Append("<partition_Detail>" + txt_up_Z_O_NAME.ClientID + "<partition>"); sb.Append("<partition_Detail>" + txt_up_SALE_NAME.ClientID); #region 取得通路PO控制設定 GetChainPOSetting(dt_Return.Rows[0]["CHAN_NO"].ToString(), dt_Return.Rows[0]["STORE"].ToString()); #endregion } #endregion } #endregion #region 新增或編輯模式下異動欄位[二段碼] else if (s_Client_String[0] == "新增或編輯模式下異動欄位[二段碼]") { #region 從資料庫查詢資料:群分類、品號、期別 ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//通路 ParameterList.Add(s_Client_String[2]);//一段碼 ParameterList.Add(s_Client_String[3]);//二段碼 ParameterList.Add(Session["UID"].ToString()); DataTable dt_Return = new DataTable(); BCO.QueryCRMCommon bco = new BCO.QueryCRMCommon(ConntionDB); dt_Return = bco.QueryItemPeriodInfoByBarcode(ParameterList); #endregion if (dt_Return.Rows.Count == 0) { sb.Append("新增或編輯模式下異動欄位[二段碼]<partition>"); sb.Append("FALSE<partition>"); sb.Append("此一段碼/二段碼不存在對應商品期別資訊,請重新輸入<partition>"); sb.Append(this.txt_down_BARCODE.ClientID + "<partition>");//設定焦點的欄位 sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>"); sb.Append(txt_down_ITEM.ClientID + "<partition>"); sb.Append(this.txt_down_PERIOD.ClientID + "<partition>"); sb.Append(txt_down_RTN_DDL.ClientID); } else { sb.Append("新增或編輯模式下異動欄位[二段碼]<partition>"); sb.Append("TRUE<partition>"); sb.Append(dt_Return.Rows[0]["ITEM"].ToString() + "<partition_Detail>" + txt_down_ITEM.ClientID + "<partition>"); sb.Append(dt_Return.Rows[0]["PERIOD"].ToString() + "<partition_Detail>" + this.txt_down_PERIOD.ClientID + "<partition>"); sb.Append(DateTime.Parse(dt_Return.Rows[0]["RTN_DDL"].ToString()).ToString("yyyy/MM/dd") + "<partition_Detail>" + txt_down_RTN_DDL.ClientID); //期別或品號有異動時,重取庫存 if (s_ITEM != dt_Return.Rows[0]["ITEM"].ToString() || s_PERIOD != dt_Return.Rows[0]["PERIOD"].ToString() ) { dtStock = null; } s_ROOT_NO = dt_Return.Rows[0]["ROOT_NO"].ToString(); s_ITEM = dt_Return.Rows[0]["ITEM"].ToString(); s_PERIOD = dt_Return.Rows[0]["PERIOD"].ToString(); GetStock(s_ROOT_NO, s_ITEM, s_PERIOD); } } #endregion #region 新增或編輯模式下異動欄位[一段碼]onchange else if (s_Client_String[0] == "新增或編輯模式下異動欄位[一段碼]onchange") { #region 根據一段碼帶出品號,最大發行期別,二段碼 ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//通路 ParameterList.Add(s_STORE);//通路 ParameterList.Add(s_Client_String[3]);//一段碼 ParameterList.Add(string.Empty);//二段碼 ParameterList.Add(Session["UID"].ToString()); DataTable dt_Return = new DataTable(); BCO.QueryCRMCommon bco = new BCO.QueryCRMCommon(ConntionDB); dt_Return = bco.QueryItemPeriodInfoByBarcode2(ParameterList); #endregion if (dt_Return.Rows.Count == 0) { sb.Append("新增或編輯模式下異動欄位[一段碼]onchange<partition>"); sb.Append("FALSE<partition>"); sb.Append("此一段碼不存在已發行對應商品期別資訊,請重新輸入<partition>"); sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>"); sb.Append(txt_down_ITEM.ClientID + "<partition>"); sb.Append(this.txt_down_PERIOD.ClientID + "<partition>"); sb.Append(txt_down_RTN_DDL.ClientID + "<partition>"); sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>");//建議儲區 sb.Append(this.txt_down_BARCODE.ClientID);//設定焦點的欄位 } else { if (dt_Return.Rows[0]["CAN_DELIVER"].ToString() == "1") { //期別或品號有異動時,重取庫存 dtStock = null; s_ROOT_NO = dt_Return.Rows[0]["ROOT_NO"].ToString(); s_ITEM = dt_Return.Rows[0]["ITEM"].ToString(); s_PERIOD = dt_Return.Rows[0]["PERIOD"].ToString(); GetStock(s_ROOT_NO, s_ITEM, s_PERIOD); sb.Append("新增或編輯模式下異動欄位[一段碼]onchange<partition>");//找到對應商品期別資訊,設定商品期別 sb.Append("TRUE<partition>"); sb.Append(s_ITEM + "<partition_Detail>" + txt_down_ITEM.ClientID + "<partition>"); sb.Append(dt_Return.Rows[0]["PERIOD_BARCODE"].ToString() + "<partition_Detail>" + this.txt_down_PERIOD_BARCODE.ClientID + "<partition>"); sb.Append(DateTime.Parse(dt_Return.Rows[0]["RTN_DDL"].ToString()).ToString("yyyy/MM/dd") + "<partition_Detail>" + txt_down_RTN_DDL.ClientID + "<partition>"); sb.Append(s_PERIOD + "<partition_Detail>" + this.txt_down_PERIOD.ClientID); } else { sb.Append("新增或編輯模式下異動欄位[一段碼]onchange<partition>"); sb.Append("FALSE<partition>"); sb.Append("此一段碼對應品號" + s_ITEM + "客服區域限制不可出貨,請重新輸入<partition>"); sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>"); sb.Append(txt_down_ITEM.ClientID + "<partition>"); sb.Append(this.txt_down_PERIOD.ClientID + "<partition>"); sb.Append(txt_down_RTN_DDL.ClientID + "<partition>"); sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>");//建議儲區 sb.Append(this.txt_down_BARCODE.ClientID);//設定焦點的欄位 } } //sb.Append("新增或編輯模式下異動欄位[一段碼]onchange<partition>"); //sb.Append("TRUE<partition>"); //sb.Append(txt_down_ITEM.ClientID + "<partition>"); //異動一段碼時,清空 Item、 Period 、退貨日、儲區、逾期客訂,設定焦點到ITEM //sb.Append(this.txt_down_PERIOD.ClientID + "<partition>"); //期別 //sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>"); //二段碼 //sb.Append(txt_down_RTN_DDL.ClientID + "<partition>"); //預定退貨日 //sb.Append(this.txt_down_RECOMMAND_LOCATION);//建議儲區 } #endregion #region 新增或編輯模式下異動欄位[品號/品名] else if (s_Client_String[0] == "新增或編輯模式下異動欄位[品號/品名]") { //s_PMA = string.Empty;//大分類 //s_ROOT_NO = string.Empty;//群分類 s_ITEM = s_Client_String[1].ToString().Trim();//品號 #region 從資料庫查詢資料 ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//品號 ParameterList.Add(s_CHAN_NO);//通路 ParameterList.Add(s_STORE);//門市 ParameterList.Add(Session["UID"].ToString()); DataTable dt_Return_1 = new DataTable(); BCO.QueryCRMCommon bco = new BCO.QueryCRMCommon(ConntionDB); dt_Return_1 = bco.GetMaxDeiveryPeriod2(ParameterList); #endregion if (dt_Return_1 == null || dt_Return_1.Rows.Count == 0 || dt_Return_1.Rows[0]["PERIOD"].ToString() == string.Empty) { sb.Length = 0; sb.Append("新增或編輯模式下異動欄位[品號/品名]<partition>"); sb.Append("FALSE<partition>"); sb.Append("查無資料<partition>"); sb.Append(txt_down_ITEM.ClientID);//設定焦點的欄位 } else { //設定品號、期別 s_ITEM = s_Client_String[1]; s_PERIOD = dt_Return_1.Rows[0]["PERIOD"].ToString(); //設定群分類、大分類 s_PMA = dt_Return_1.Rows[0]["PMA"].ToString();//大分類 s_ROOT_NO = dt_Return_1.Rows[0]["ROOT_NO"].ToString();//群分類 if (dt_Return_1.Rows[0]["CAN_DELIVER"].ToString() == "1") { sb.Length = 0; sb.Append("新增或編輯模式下異動欄位[品號/品名]<partition>"); sb.Append("TRUE<partition>"); sb.Append(dt_Return_1.Rows[0]["PERIOD"].ToString() + "<partition_Detail>" + this.txt_down_PERIOD.ClientID); } else { sb.Length = 0; sb.Append("新增或編輯模式下異動欄位[品號/品名]<partition>"); sb.Append("FALSE<partition>"); sb.Append("客服區域限制不可出貨<partition>"); sb.Append(txt_down_ITEM.ClientID);//設定焦點的欄位 } #region OLD 取得商品主檔資訊 //DataTable dt_Return_2 = new DataTable(); //ParameterList.Clear(); //BCO_ITM.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.ITEM", s_Client_String[1], "=", "and"); //BCO_ITM.MaintainSKU bco_itm = new BCO_ITM.MaintainSKU(ConntionDB); //dt_Return_2 = bco_itm.QuerySKUByFind_1(ParameterList); //if (dt_Return_2 != null && dt_Return_2.Rows.Count != 0) //{ // s_PMA = dt_Return_2.Rows[0]["PMA"].ToString();//大分類 // s_ROOT_NO = dt_Return_2.Rows[0]["ROOT_NO"].ToString();//群分類 //} //else //{ // sb = sb.Remove(0, sb.Length); // sb.Append("新增或編輯模式下異動欄位[品號/品名]<partition>"); // sb.Append("FALSE<partition>"); // sb.Append("商品主檔中無對應品號<partition>"); // sb.Append(txt_down_ITEM.ClientID);//設定焦點的欄位 //} #endregion } } #endregion #region 新增或編輯模式下異動欄位[期別] else if (s_Client_String[0] == "新增或編輯模式下異動欄位[期別]") { //期別或品號有異動時,重取庫存 if (s_ITEM != s_Client_String[3].ToString().Trim() || s_PERIOD != s_Client_String[4].ToString().Trim() ) { dtStock = null; } s_CHAN_NO = s_Client_String[1].ToString().Trim();//通路 s_STORE = s_Client_String[2].ToString().Trim();//門市 if (s_ITEM != s_Client_String[3].ToString().Trim()) { } s_ITEM = s_Client_String[3].ToString().Trim();//品號 s_PERIOD = s_Client_String[4].ToString().Trim();//期別 #region 檢查書店是否有未結案同品項訂單 if (s_Client_String[8] == string.Empty) { #region 從資料庫查詢資料 ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//通路 ParameterList.Add(s_Client_String[2]);//門市 ParameterList.Add(s_Client_String[3]);//品號 ParameterList.Add(s_Client_String[4]);//期別 ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(this.txt_up_CODE.Text);//訂單單號 DataTable dt_Return_1 = new DataTable(); BCO.RecordCRMOrder bco_Record = new BCO.RecordCRMOrder(ConntionDB); dt_Return_1 = bco_Record.CheckOrderItemExist(ParameterList); #endregion if (dt_Return_1.Rows.Count > 0) { sb.Append("新增或編輯模式下異動欄位[期別]<partition>"); sb.Append("檢查書店是否有未結案同品項訂單<partition>"); sb.Append("該門市已存在未結案之同品項訂單於訂單標號:[" + dt_Return_1.Rows[0]["CRM_REQUEST_NO"].ToString() + "],不可新增<partition>"); sb.Append(this.txt_down_PO_SOURCE_NO.ClientID + "<partition>");//設定焦點的欄位 sb.Append(chk_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂 sb.Append(this.txt_down_PO_SOURCE_NO.ClientID + "<partition>");//PO單號 sb.Append(this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(txt_down_ITEM.ClientID + "<partition>");//品號 sb.Append(txt_down_ITEM_NAME.ClientID + "<partition>");//品名 sb.Append(this.txt_down_PERIOD.ClientID + "<partition>");//期別 sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//訂貨量 sb.Append(txt_down_REQUEST_QTY_NAME.ClientID + "<partition>");//訂貨量名稱 sb.Append(txt_down_RTN_DDL.ClientID + "<partition>");//退書截止日 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID);//建議儲區 return sb.ToString(); } } #endregion #region 檢查牌價是否已經正確建立 ParameterList.Clear(); ParameterList.Add(s_Client_String[2]);//門市 ParameterList.Add(s_Client_String[3]);//品號 ParameterList.Add(s_Client_String[4]);//期別 ParameterList.Add(DateTime.Today.ToString("yyyy/MM/dd")); // 系統日 ParameterList.Add(Session["UID"].ToString()); PIC.VDS2G.BSM.ALO.ProcessALOCommon co_process = new PIC.VDS2G.BSM.ALO.ProcessALOCommon(ConntionDB); string sRes = co_process.CheckStAcceptDisPrice(ParameterList); //bool bRes = co_process.CheckStAcceptDisPrice(ParameterList, null); if (sRes != string.Empty) { sb.Append("新增或編輯模式下異動欄位[期別]<partition>"); sb.Append("檢查牌價是否已經正確建立<partition>"); sb.Append("期別" + s_PERIOD + "牌價未生效[" + sRes + "],不可新增<partition>"); sb.Append(this.txt_down_PERIOD.ClientID + "<partition>");//設定焦點的欄位 sb.Append(chk_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂 sb.Append(this.txt_down_PO_SOURCE_NO.ClientID + "<partition>");//PO單號 sb.Append(this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(txt_down_ITEM.ClientID + "<partition>");//品號 sb.Append(txt_down_ITEM_NAME.ClientID + "<partition>");//品名 sb.Append(this.txt_down_PERIOD.ClientID + "<partition>");//期別 sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//訂貨量 sb.Append(txt_down_REQUEST_QTY_NAME.ClientID + "<partition>");//訂貨量名稱 sb.Append(txt_down_RTN_DDL.ClientID + "<partition>");//退書截止日 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID);//建議儲區 return sb.ToString(); } #endregion #region 設定二段碼、退書截止日與逾期客訂 string s_down_BARCODE = string.Empty;//一段碼 string s_down_PERIOD_BARCODE = string.Empty;//二段碼 string s_down_RTN_DDL = string.Empty;//退書截止日 s_down_BARCODE = s_Client_String[5]; s_down_PERIOD_BARCODE = s_Client_String[6]; s_down_RTN_DDL = s_Client_String[7]; BCO.QueryCRMCommon bco_Common = new BCO.QueryCRMCommon(ConntionDB); // 不管原來有沒有值,只要品號改變,都重新查詢 //if (s_Client_String[5] == string.Empty ||//一段碼 // s_Client_String[6] == string.Empty ||//二段碼 // s_Client_String[7] == string.Empty)//退書截止日 //{ ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//通路 ParameterList.Add(s_Client_String[3]);//品號 ParameterList.Add(s_Client_String[4]);//期別 ParameterList.Add(Session["UID"].ToString()); DataTable dt_Return_2 = new DataTable(); dt_Return_2 = bco_Common.QueryItemPeriodInfo(ParameterList); if (dt_Return_2.Rows.Count > 0)//有找到資料 { s_down_BARCODE = dt_Return_2.Rows[0]["BARCODE"].ToString(); s_down_PERIOD_BARCODE = dt_Return_2.Rows[0]["PERIOD_BARCODE"].ToString(); s_down_RTN_DDL = DateTime.Parse(dt_Return_2.Rows[0]["RTN_DDL"].ToString()).ToString("yyyy/MM/dd"); } else//查無資料 { sb.Append("新增或編輯模式下異動欄位[期別]<partition>"); sb.Append("設定二段碼、退書截止日與逾期客訂<partition>"); sb.Append("查無[一段碼][二段碼][退書截止日],無法新增<partition>"); sb.Append(this.txt_down_PO_SOURCE_NO.ClientID + "<partition>");//設定焦點的欄位 sb.Append(chk_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂 sb.Append(this.txt_down_PO_SOURCE_NO.ClientID + "<partition>");//PO單號 sb.Append(this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(txt_down_ITEM.ClientID + "<partition>");//品號 sb.Append(txt_down_ITEM_NAME.ClientID + "<partition>");//品名 sb.Append(this.txt_down_PERIOD.ClientID + "<partition>");//期別 sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//訂貨量 sb.Append(txt_down_REQUEST_QTY_NAME.ClientID + "<partition>");//訂貨量名稱 sb.Append(txt_down_RTN_DDL.ClientID + "<partition>");//退書截止日 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID);//建議儲區 return sb.ToString(); } //} #endregion #region 逾期客訂確認 TimeSpan time = new TimeSpan(11, 00, 00); bool b_down_IS_OVERDUE = false; DateTime d_Now; DateTime d_RTN_DDL; d_Now = DateTime.Now; d_RTN_DDL = DateTime.Parse(s_down_RTN_DDL); if (d_Now.DayOfWeek == DayOfWeek.Saturday || d_Now.DayOfWeek == DayOfWeek.Sunday || (d_Now.DayOfWeek == DayOfWeek.Friday && d_Now.TimeOfDay.CompareTo(time) >= 0)) { //if (d_RTN_DDL.AddDays(-5).ToShortDateString().CompareTo(d_Now.ToShortDateString()) <= 0) if (d_RTN_DDL.AddDays(-5).ToString("yyyy/MM/dd").CompareTo(d_Now.ToString("yyyy/MM/dd")) <= 0) { b_down_IS_OVERDUE = true; b_IS_OVERDUE = true; } } else { //if (d_RTN_DDL.AddDays(-2).ToShortDateString().CompareTo(d_Now.ToShortDateString()) <= 0) if (d_RTN_DDL.AddDays(-2).ToString("yyyy/MM/dd").CompareTo(d_Now.ToString("yyyy/MM/dd")) <= 0) { b_down_IS_OVERDUE = true; b_IS_OVERDUE = true; } } //[@逾期客訂].檢查結果為True時,顯示Confirm訊息『商品已逾期,不可退貨,確定要新增?』 //使用者確認要新增時,可繼續編輯。 //使用者選擇不新增時,取消本筆明細新增。 if (b_down_IS_OVERDUE == true) { sb.Append("新增或編輯模式下異動欄位[期別]<partition>"); sb.Append("[逾期客訂]檢查結果為TRUE<partition>"); sb.Append(chk_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂 sb.Append(s_ROOT_NO + "<partition>");//群分類 sb.Append(s_Client_String[3] + "<partition>");//品號 sb.Append(s_Client_String[4] + "<partition>");//期別 sb.Append(s_down_BARCODE + "<partition_Detail>" + this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(s_down_PERIOD_BARCODE + "<partition_Detail>" + this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(s_down_RTN_DDL + "<partition_Detail>" + txt_down_RTN_DDL.ClientID);//退書截止日 return sb.ToString(); } else { sb.Append("新增或編輯模式下異動欄位[期別]<partition>"); sb.Append("[逾期客訂]檢查結果為FALSE<partition>"); sb.Append(chk_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂 sb.Append(s_down_BARCODE + "<partition_Detail>" + this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(s_down_PERIOD_BARCODE + "<partition_Detail>" + this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(s_down_RTN_DDL + "<partition_Detail>" + txt_down_RTN_DDL.ClientID);//退書截止日 } #endregion #region 取得庫存資訊 GetStock(s_ROOT_NO, s_Client_String[3], s_Client_String[4]); #endregion } #endregion #region 新增或編輯模式下異動欄位[期別]Confirm後 else if (s_Client_String[0] == "新增或編輯模式下異動欄位[期別]Confirm後") { if (dtStock != null) { dtStock = null; } if (s_Client_String[1] == "TRUE")//繼續編輯。 { #region 取得商品主檔資訊 if (s_PMA == String.Empty || s_ROOT_NO == String.Empty) { DataTable dt_Return_2 = new DataTable(); ParameterList.Clear(); BCO_ITM.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.ITEM", slp_down_ITEM.Text, "=", "and"); BCO_ITM.MaintainSKU bco_itm = new BCO_ITM.MaintainSKU(ConntionDB); dt_Return_2 = bco_itm.QuerySKUByFind_1(ParameterList); if (dt_Return_2 != null && dt_Return_2.Rows.Count != 0) { s_PMA = dt_Return_2.Rows[0]["PMA"].ToString();//大分類 s_ROOT_NO = dt_Return_2.Rows[0]["ROOT_NO"].ToString();//群分類 } else { sb = sb.Remove(0, sb.Length); sb.Append("新增或編輯模式下異動欄位[期別]Confirm後<partition>"); sb.Append("FALSE<partition>"); sb.Append("商品主檔中無對應品號<partition>"); sb.Append(txt_down_ITEM.ClientID);//設定焦點的欄位 } } #endregion #region 取得庫存資訊 GetStock(s_ROOT_NO, s_Client_String[3], s_Client_String[4]); #endregion } else if (s_Client_String[1] == "FALSE")//取消本筆明細新增。 { #region 清空靜態變數 dtStock = null;//異動欄位[期別] s_PMA = string.Empty;//大分類(異動欄位[品號/品名]) s_ROOT_NO = string.Empty;//群分類(異動欄位[品號/品名]) s_SRC_LOCATE_TYPE = string.Empty;//建議儲區類別(異動欄位[訂貨量]) #endregion #region 計算 dt_Detail 的筆數 int i_dt_Detail_Count = 0; if (dt_Detail != null) { if (dt_Detail.GetChanges(DataRowState.Deleted) == null) { i_dt_Detail_Count = dt_Detail.Rows.Count; } else { i_dt_Detail_Count = dt_Detail.Rows.Count - dt_Detail.GetChanges(DataRowState.Deleted).Rows.Count; } } #endregion sb.Append("新增或編輯模式下異動欄位[期別]Confirm後<partition>"); sb.Append(i_dt_Detail_Count.ToString() + "<partition>");//dt_Detail的筆數 sb.Append(this.hid_PageStatus.ClientID + "<partition>");//hid_PageStatus sb.Append(this.panel_Down_AddDetail.ClientID + "<partition>");//panel_Down_AddDetail sb.Append(this.panel_Down_Button.ClientID + "<partition>");//panel_Down_Button sb.Append(chk_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂 sb.Append(this.txt_down_PO_SOURCE_NO.ClientID + "<partition>");//PO單號 sb.Append(this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(txt_down_ITEM.ClientID + "<partition>");//品號 sb.Append(txt_down_ITEM_NAME.ClientID + "<partition>");//品名 sb.Append(this.txt_down_PERIOD.ClientID + "<partition>");//期別 sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//訂貨量 sb.Append(txt_down_REQUEST_QTY_NAME.ClientID + "<partition>");//訂貨量名稱 sb.Append(txt_down_RTN_DDL.ClientID + "<partition>");//退書截止日 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>");//建議儲區 sb.Append(txt_up_CHAN_NO.ClientID + "<partition>");//通路 sb.Append(txt_up_STORE.ClientID + "<partition>");//門市 sb.Append(txt_up_Z_O.ClientID + "<partition>");//營業所 sb.Append(txt_up_BUSDATE.ClientID + "<partition>");//訂單日期 sb.Append(txt_up_SALE_ID.ClientID + "<partition>");//營業人員 sb.Append(txt_up_BUSUID.ClientID + "<partition>");//訂單維護者 sb.Append(((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).ClientID + "<partition>");//訂單來源 sb.Append(this.txt_up_PO_SOURCE_NO.ClientID + "<partition>");//PO單號預設 sb.Append(this.txt_up_CODE.ClientID + "<partition>");//訂單編號 sb.Append(this.txt_up_CRM_NO.ClientID + "<partition>");//流水編號 sb.Append(img_up_CHAN_NO.ClientID + "<partition>");//通路img sb.Append(img_up_STORE.ClientID + "<partition>");//門市img sb.Append(img_up_BUSDATE.ClientID + "<partition>");//訂單日期img sb.Append(img_up_SALE_ID.ClientID + "<partition>");//營業人員img sb.Append(img_up_BUSUID.ClientID);//訂單維護者img } } #endregion #region 新增或編輯模式下異動欄位[訂貨量] else if (s_Client_String[0] == "新增或編輯模式下異動欄位[訂貨量]") { #region 判斷庫存是否足夠 if ((dtStock == null) || (dtStock.Rows.Count < 1)) { GetStock(s_ROOT_NO, s_ITEM, s_PERIOD); } if (((dtStock == null) || (dtStock.Rows.Count < 1)) && (s_ROOT_NO != "2")) { sb.Append("新增或編輯模式下異動欄位[訂貨量]<partition>"); sb.Append("FALSE<partition>"); sb.Append("庫存量不足,請取消新增<partition>"); sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//設定焦點的欄位 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID); return sb.ToString(); } #endregion DataView dvStock = new DataView(dtStock.Copy()); s_SRC_LOCATE_TYPE = string.Empty; int i_REQUEST_QTY = 0;//畫面上使用者輸入的"訂貨量" int i_ONHD_QTY = 0;//現有庫存量 int i_RESERVE_QTY = 0;//配本保留數 int i_Final_QTY = 0;//庫存儲區可配量 int i_DIS_ENABLE = 0;//可配量 string s_SRC_LOCATE_NO = string.Empty;//VDS_CRM_ORDER_DETL.SRC_LOCATE_NO欄位 i_REQUEST_QTY = int.Parse(s_Client_String[1]); // 2009-07-30 cyshu 修改,逾期客訂可取退貨儲區庫存 #region [@群分類]=1(雜誌) 時 //if (s_ROOT_NO == "1" && s_Client_String[2] == "false") if (s_ROOT_NO == "1") { #region 先檢查庫存儲區可用庫存 dvStock.RowFilter = "LOCATETYPE = '2'"; dvStock.Sort = "ONHD_QTY DESC"; #region Old Source //if (dvStock.Count > 0) //{ // i_ONHD_QTY = 0; // i_RESERVE_QTY = 0; // for (int i = 0; i < dvStock.Count; i++) // { // i_ONHD_QTY += int.Parse(dvStock[i]["ONHD_QTY"].ToString()); // i_RESERVE_QTY += int.Parse(dvStock[i]["RESERVE_QTY"].ToString()); // } //} #endregion #region new code i_ONHD_QTY = 0; i_RESERVE_QTY = 0; bool b_Locate_Stock = false; //庫存儲區 for (int i = 0; i < dvStock.Count; i++) { i_ONHD_QTY = int.Parse(dvStock[i]["ONHD_QTY"].ToString()); i_RESERVE_QTY = int.Parse(dvStock[i]["RESERVE_QTY"].ToString()); i_Final_QTY = i_ONHD_QTY - i_RESERVE_QTY;//庫存儲區可配量 if (i_Final_QTY >= i_REQUEST_QTY) { s_SRC_LOCATE_TYPE = "2"; s_SRC_LOCATE_NO = dvStock[i]["LOCATE_NO"].ToString();//現有庫存儲區 try { i_DIS_ENABLE = int.Parse(dvStock[0]["ONHD_QTY"].ToString()) - int.Parse(dvStock[0]["RESERVE_QTY"].ToString()); } catch { i_DIS_ENABLE = 0; } b_Locate_Stock = true; break; } } if (!b_Locate_Stock) //庫存儲區庫存不足 { if (s_PMA == "13" || s_PMA == "14" || s_PMA == "15" || s_PMA == "16") { #region 外雜 sb.Append("新增或編輯模式下異動欄位[訂貨量]<partition>"); sb.Append("FALSE<partition>"); sb.Append("外雜D儲區庫存量不足,無法新增訂單<partition>"); sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//設定焦點的欄位 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID); return sb.ToString(); #endregion } else { #region 檢查退貨儲區可用庫存 i_ONHD_QTY = 0; i_RESERVE_QTY = 0; i_Final_QTY = 0; i_DIS_ENABLE = 0; s_SRC_LOCATE_NO = string.Empty; dvStock.RowFilter = "LOCATETYPE = '1'"; for (int i = 0; i < dvStock.Count; i++) { i_ONHD_QTY += int.Parse(dvStock[i]["ONHD_QTY"].ToString()); i_RESERVE_QTY += int.Parse(dvStock[i]["RESERVE_QTY"].ToString()); } i_Final_QTY = i_ONHD_QTY - i_RESERVE_QTY; if (i_Final_QTY >= i_REQUEST_QTY) { s_SRC_LOCATE_TYPE = "1";//退貨儲區 s_SRC_LOCATE_NO = dvStock[0]["LOCATE_NO"].ToString();//現有庫存量最大的儲區 i_DIS_ENABLE = int.Parse(dvStock[0]["ONHD_QTY"].ToString()) - int.Parse(dvStock[0]["RESERVE_QTY"].ToString()); } else { sb.Append("新增或編輯模式下異動欄位[訂貨量]<partition>"); sb.Append("FALSE<partition>"); sb.Append("庫存量不足,請取消新增<partition>"); sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//設定焦點的欄位 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID); return sb.ToString(); } #endregion } } #endregion new code #region old code2 //i_Final_QTY = i_ONHD_QTY - i_RESERVE_QTY;//庫存儲區可配量 //// 庫存儲區可配量 >= 訂量時,設定建議儲區 = 庫存儲區 //if (i_Final_QTY >= i_REQUEST_QTY) //{ // s_SRC_LOCATE_TYPE = "2";//庫存儲區 // s_SRC_LOCATE_NO = dvStock[0]["LOCATE_NO"].ToString();//現有庫存量最大的儲區 // try // { // i_DIS_ENABLE = int.Parse(dvStock[0]["ONHD_QTY"].ToString()) - int.Parse(dvStock[0]["RESERVE_QTY"].ToString()); // } // catch { i_DIS_ENABLE = 0; } //} //else //{ // if (s_PMA == "13" || // s_PMA == "14" || // s_PMA == "15" || // s_PMA == "16") // { // sb.Append("新增或編輯模式下異動欄位[訂貨量]<partition>"); // sb.Append("FALSE<partition>"); // sb.Append("外雜D儲區庫存量不足,無法新增訂單<partition>"); // sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//設定焦點的欄位 // sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID); // return sb.ToString(); // } // else // { // #region 檢查退貨儲區可用庫存 // i_ONHD_QTY = 0; // i_RESERVE_QTY = 0; // i_Final_QTY = 0; // i_DIS_ENABLE = 0; // s_SRC_LOCATE_NO = string.Empty; // dvStock.RowFilter = "LOCATETYPE = '1'"; // for (int i = 0; i < dvStock.Count; i++) // { // i_ONHD_QTY += int.Parse(dvStock[i]["ONHD_QTY"].ToString()); // i_RESERVE_QTY += int.Parse(dvStock[i]["RESERVE_QTY"].ToString()); // } // i_Final_QTY = i_ONHD_QTY - i_RESERVE_QTY; // if (i_Final_QTY >= i_REQUEST_QTY) // { // s_SRC_LOCATE_TYPE = "1";//退貨儲區 // s_SRC_LOCATE_NO = dvStock[0]["LOCATE_NO"].ToString();//現有庫存量最大的儲區 // i_DIS_ENABLE = int.Parse(dvStock[0]["ONHD_QTY"].ToString()) - int.Parse(dvStock[0]["RESERVE_QTY"].ToString()); // } // else // { // sb.Append("新增或編輯模式下異動欄位[訂貨量]<partition>"); // sb.Append("FALSE<partition>"); // sb.Append("庫存量不足,請取消新增<partition>"); // sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//設定焦點的欄位 // sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID); // return sb.ToString(); // } // #endregion // } //} #endregion old code2 #endregion } #endregion #region [@群分類]=2(圖書) else { dvStock.RowFilter = "LOCATETYPE = '2'"; dvStock.Sort = "ONHD_QTY DESC"; if (dvStock.Count > 0) { // 先作預設值 s_SRC_LOCATE_TYPE = "2"; // 庫存儲區 s_SRC_LOCATE_NO = dvStock[0]["LOCATE_NO"].ToString();//現有庫存量最大的儲區 for (int i = 0; i < dvStock.Count; i++) { i_ONHD_QTY += int.Parse(dvStock[i]["ONHD_QTY"].ToString()); i_RESERVE_QTY += int.Parse(dvStock[i]["RESERVE_QTY"].ToString()); } i_Final_QTY = i_ONHD_QTY - i_RESERVE_QTY; if (i_Final_QTY >= i_REQUEST_QTY) { s_SRC_LOCATE_TYPE = "2";//庫存儲區 s_SRC_LOCATE_NO = dvStock[0]["LOCATE_NO"].ToString();//現有庫存量最大的儲區 i_DIS_ENABLE = int.Parse(dvStock[0]["ONHD_QTY"].ToString()) - int.Parse(dvStock[0]["RESERVE_QTY"].ToString()); } else //圖書庫存不足仍可新增 { s_SRC_LOCATE_TYPE = "2";//庫存儲區 s_SRC_LOCATE_NO = "D"; i_DIS_ENABLE = 0; sb.Append("新增或編輯模式下異動欄位[訂貨量]<partition>"); sb.Append("TRUE_ALERT<partition>"); sb.Append("圖書庫存不足,確認要新增?<partition>"); sb.Append(s_SRC_LOCATE_NO + "<partition_Detail>" + this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>"); sb.Append(i_DIS_ENABLE.ToString() + "<partition_Detail>" + this.hid_DIS_ENABLE.ClientID); return sb.ToString(); } } else //圖書庫存不足仍可新增 { #region 圖書庫存不足仍可新增 s_SRC_LOCATE_TYPE = "2";//庫存儲區 s_SRC_LOCATE_NO = "D"; i_DIS_ENABLE = 0; sb.Append("新增或編輯模式下異動欄位[訂貨量]<partition>"); sb.Append("TRUE_ALERT<partition>"); sb.Append("圖書庫存不足,確認要新增?<partition>"); sb.Append(s_SRC_LOCATE_NO + "<partition_Detail>" + this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>"); sb.Append(i_DIS_ENABLE.ToString() + "<partition_Detail>" + this.hid_DIS_ENABLE.ClientID); return sb.ToString(); #endregion } } #endregion if (sb.ToString() == string.Empty) { if (i_REQUEST_QTY > 100) { sb.Append("新增或編輯模式下異動欄位[訂貨量]<partition>"); sb.Append("TRUE_ALERT<partition>"); sb.Append("訂貨量大於100<partition>"); sb.Append(s_SRC_LOCATE_NO + "<partition_Detail>" + this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>"); sb.Append(i_DIS_ENABLE.ToString() + "<partition_Detail>" + this.hid_DIS_ENABLE.ClientID); return sb.ToString(); } else { sb.Append("新增或編輯模式下異動欄位[訂貨量]<partition>"); sb.Append("TRUE_NO_ALERT<partition>"); sb.Append(s_SRC_LOCATE_NO + "<partition_Detail>" + this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>"); sb.Append(i_DIS_ENABLE.ToString() + "<partition_Detail>" + this.hid_DIS_ENABLE.ClientID); return sb.ToString(); } } } #endregion #region 新增或編輯模式按下明細區[取消]鈕 else if (s_Client_String[0] == "新增或編輯模式按下明細區[取消]鈕") { #region 清空靜態變數 dtStock = null;//異動欄位[期別] s_PMA = string.Empty;//大分類(異動欄位[品號/品名]) s_ROOT_NO = string.Empty;//群分類(異動欄位[品號/品名]) s_SRC_LOCATE_TYPE = string.Empty;//建議儲區類別(異動欄位[訂貨量]) sb.Remove(0, sb.Length); #endregion #region 計算 dt_Detail 的筆數 int i_dt_Detail_Count = 0; if (dt_Detail != null) { if (dt_Detail.GetChanges(DataRowState.Deleted) == null) { i_dt_Detail_Count = dt_Detail.Rows.Count; } else { i_dt_Detail_Count = dt_Detail.Rows.Count - dt_Detail.GetChanges(DataRowState.Deleted).Rows.Count; } } #endregion sb.Append("新增或編輯模式按下明細區[取消]鈕<partition>"); sb.Append(i_dt_Detail_Count.ToString() + "<partition>");//dt_Detail的筆數 sb.Append(this.hid_PageStatus.ClientID + "<partition>");//hid_PageStatus sb.Append(this.panel_Down_AddDetail.ClientID + "<partition>");//panel_Down_AddDetail sb.Append(this.panel_Down_Button.ClientID + "<partition>");//panel_Down_Button sb.Append(chk_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂 sb.Append(this.txt_down_PO_SOURCE_NO.ClientID + "<partition>");//PO單號 sb.Append(this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(txt_down_ITEM.ClientID + "<partition>");//品號 sb.Append(txt_down_ITEM_NAME.ClientID + "<partition>");//品名 sb.Append(this.txt_down_PERIOD.ClientID + "<partition>");//期別 sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//訂貨量 //sb.Append(txt_down_REQUEST_QTY_NAME.ClientID + "<partition>");//訂貨量名稱 sb.Append(txt_down_RTN_DDL.ClientID + "<partition>");//退書截止日 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>");//建議儲區 sb.Append(txt_up_CHAN_NO.ClientID + "<partition>");//通路 sb.Append(txt_up_STORE.ClientID + "<partition>");//門市 sb.Append(txt_up_Z_O.ClientID + "<partition>");//營業所 sb.Append(txt_up_BUSDATE.ClientID + "<partition>");//訂單日期 sb.Append(txt_up_SALE_ID.ClientID + "<partition>");//營業人員 sb.Append(txt_up_BUSUID.ClientID + "<partition>");//訂單維護者 sb.Append(((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).ClientID + "<partition>");//訂單來源 sb.Append(this.txt_up_PO_SOURCE_NO.ClientID + "<partition>");//PO單號預設 sb.Append(this.txt_up_CODE.ClientID + "<partition>");//訂單編號 sb.Append(this.txt_up_CRM_NO.ClientID + "<partition>");//流水編號 sb.Append(img_up_CHAN_NO.ClientID + "<partition>");//通路img sb.Append(img_up_STORE.ClientID + "<partition>");//門市img sb.Append(img_up_BUSDATE.ClientID + "<partition>");//訂單日期img sb.Append(img_up_SALE_ID.ClientID + "<partition>");//營業人員img sb.Append(img_up_BUSUID.ClientID);//訂單維護者img } #endregion #region 新增或編輯模式按下GridView[編輯]鈕 else if (s_Client_String[0] == "新增或編輯模式按下GridView[編輯]鈕") { DataRow dRow = dt_Detail.Select("ID = " + s_Client_String[1])[0]; string s_IS_OVERDUE; //改為已擷轉仍可修改 //if (dRow["TRANS_RESULT"].ToString() == "1")//已擷轉 //{ sb.Append("此筆訂單品項已擷轉,不可編輯或刪除\r\n"); } if (dRow["STATUS"].ToString() == "75")//已結案 { sb.Append("此筆訂單品項已結案,不可編輯或刪除\r\n"); } #region 編輯前檢查錯誤 if (sb.ToString() != string.Empty) { sb.Insert(0, "新增或編輯模式按下GridView[編輯]鈕_編輯前檢查FALSE<partition>"); return sb.ToString(); } #endregion #region 取得庫存 i_Curr_Order_Qty = 0; s_ROOT_NO = dRow["ROOT_NO"].ToString(); //群分類 s_ITEM = dRow["ITEM"].ToString(); //品號 s_PERIOD = dRow["PERIOD"].ToString(); //期別 i_Curr_Order_Qty = (dRow["REQUEST_QTY"].ToString().Trim() == string.Empty) ? 0 : int.Parse(dRow["REQUEST_QTY"].ToString().Trim()); s_SRC_LOCATE_NO = dRow["SRC_LOCATE_NO"].ToString();//原儲區 //取得目前庫存 dtStock = null; GetStock(s_ROOT_NO, s_ITEM, s_PERIOD); //編輯模式下,可用庫存應加上原訂單需求量 AddStockForEditMode(s_SRC_LOCATE_NO, i_Curr_Order_Qty); #endregion #region 編輯前檢查正確 s_IS_OVERDUE = (dRow["IS_OVERDUE"].ToString() == "0") ? "false" : "true"; sb.Append("新增或編輯模式按下GridView[編輯]鈕_編輯前檢查TRUE<partition>"); sb.Append(txt_up_CHAN_NO.ClientID + "<partition>");//通路 sb.Append(txt_up_STORE.ClientID + "<partition>");//門市 sb.Append(txt_down_ITEM.ClientID + "<partition>");//品號 sb.Append(this.txt_down_PERIOD.ClientID + "<partition>");//期別 sb.Append(this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(txt_down_RTN_DDL.ClientID + "<partition>");//退書截止日 sb.Append(this.panel_Down_AddDetail.ClientID + "<partition>");//panel_Down_AddDetail sb.Append(this.panel_Down_Button.ClientID + "<partition>");//panel_Down_Button sb.Append(s_IS_OVERDUE + "<partition_Detail>" + chk_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂 sb.Append(dRow["PO_SOURCE_NO"].ToString() + "<partition_Detail>" + this.txt_down_PO_SOURCE_NO.ClientID + "<partition>");//PO單號 sb.Append(dRow["BARCODE"].ToString() + "<partition_Detail>" + this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(dRow["PERIOD_BARCODE"].ToString() + "<partition_Detail>" + this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(dRow["ITEM"].ToString() + "<partition_Detail>" + txt_down_ITEM.ClientID + "<partition>");//品號 sb.Append(dRow["ITEM_NAME"].ToString() + "<partition_Detail>" + txt_down_ITEM_NAME.ClientID + "<partition>");//品名 sb.Append(dRow["PERIOD"].ToString() + "<partition_Detail>" + this.txt_down_PERIOD.ClientID + "<partition>");//期別 sb.Append(dRow["REQUEST_QTY"].ToString() + "<partition_Detail>" + txt_down_REQUEST_QTY.ClientID + "<partition>");//訂貨量 //sb.Append(dRow["REQUEST_QTY"].ToString() + ".0000<partition_Detail>" + txt_down_REQUEST_QTY_NAME.ClientID + "<partition>");//訂貨量名稱 sb.Append(DateTime.Parse(dRow["RTN_DDL"].ToString()).ToString("yyyy/MM/dd") + "<partition_Detail>" + txt_down_RTN_DDL.ClientID + "<partition>");//退書截止日 sb.Append(dRow["SRC_LOCATE_NO"].ToString() + "<partition_Detail>" + this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>");//建議儲區 sb.Append(dRow["ID"].ToString() + "<partition_Detail>" + this.hid_ID.ClientID);//hid_ID #endregion } #endregion #region 新增或編輯模式按下明細區[新增明細]鈕 else if (s_Client_String[0] == "新增或編輯模式按下明細區[新增明細]鈕") { #region 清空靜態變數 dtStock = null;//異動欄位[期別] s_PMA = string.Empty;//大分類(異動欄位[品號/品名]) s_ROOT_NO = string.Empty;//群分類(異動欄位[品號/品名]) s_SRC_LOCATE_TYPE = string.Empty;//建議儲區類別(異動欄位[訂貨量]) #endregion } #endregion #region 新增模式異動欄位[流水編號] else if (s_Client_String[0] == "新增模式異動欄位[流水編號]") { #region 檢查是否為有效流水編號 DataTable dt_Return = new DataTable(); ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//流水編號 ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); BCO.RecordCRMRecord bco = new BCO.RecordCRMRecord(ConntionDB); dt_Return = bco.QueryCRMRecordByCode_CheckExist(ParameterList); if (dt_Return.Rows.Count == 0) { sb.Append("新增模式異動欄位[流水編號]<partition>"); sb.Append("FALSE<partition>"); sb.Append(this.txt_up_CRM_NO.ClientID + "<partition>"); sb.Append("[流水編號]不為存在的有效編號"); } #endregion } #endregion CallBackValue = sb.ToString(); } catch (Exception ex) { CallBackValue = "發生例外錯誤<partition>" + ex.Message; } } return CallBackValue; }
protected void Page_Load(object sender, EventArgs e) { try { this.ErrorMsgLabel.Text = String.Empty; this.RightMsgLabel.Text = String.Empty; //AuthorityControls(this); #region 取得頁面狀態ServerSiteID TextBox txt_up_ChanNo = (TextBox)((ASP.stm_slp_slp_storechain_ascx)slp_up_CHAN_NO).FindControl("TextBoxCode");//通路 TextBox txt_up_Store = (TextBox)((ASP.stm_slp_slp_store_ascx)slp_up_STORE).FindControl("TextBoxCode");//門市 // TextBox txt_up_StoreName = (TextBox)((ASP.stm_slp_slp_store_ascx)slp_up_STORE).FindControl("TextBoxName");//門市名稱 add by cyhsu TextBox txt_up_Z_O = (TextBox)((ASP.sys_slp_slp_codefile_ascx)slp_up_Z_O).FindControl("TextBoxCode");//營業所 TextBox txt_up_BUSDATE = (TextBox)((ASP.wui_slp_slp_slpdate_ascx)slp_up_BUSDATE).FindControl("TextBoxCode");//訂單日期 TextBox txt_up_SALE_ID = (TextBox)((ASP.sys_slp_slp_user_ascx)slp_up_SALE_ID).FindControl("TextBoxCode");//營業人員 TextBox txt_up_BUSUID = (TextBox)((ASP.sys_slp_slp_user_ascx)slp_up_BUSUID).FindControl("TextBoxCode");//訂單維護者 Image img_up_CHAN_NO = (Image)((ASP.stm_slp_slp_storechain_ascx)slp_up_CHAN_NO).FindControl("Image1");//通路img Image img_up_STORE = (Image)((ASP.stm_slp_slp_store_ascx)slp_up_STORE).FindControl("Image1");//門市img Image img_up_BUSDATE = (Image)((ASP.wui_slp_slp_slpdate_ascx)slp_up_BUSDATE).FindControl("Image1");//訂單日期img Image img_up_SALE_ID = (Image)((ASP.sys_slp_slp_user_ascx)slp_up_SALE_ID).FindControl("Image1");//營業人員img Image img_up_BUSUID = (Image)((ASP.sys_slp_slp_user_ascx)slp_up_BUSUID).FindControl("Image1");//訂單維護者img Image img_down_ITEM = (Image)((ASP.itm_slp_slp_sku_ascx)slp_down_ITEM).FindControl("Image1");//品號img Image img_down_REQUEST_QTY = (Image)((ASP.wui_slp_slp_slpquantity_ascx)slp_down_REQUEST_QTY).FindControl("Image1");//訂貨量img Image img_down_RTN_DDL = (Image)((ASP.wui_slp_slp_slpdate_ascx)slp_down_RTN_DDL).FindControl("Image1");//退書截止日img TextBox txt_down_ITEM = (TextBox)((ASP.itm_slp_slp_sku_ascx)slp_down_ITEM).FindControl("TextBoxCode");//品號 TextBox txt_down_ITEM_NAME = (TextBox)((ASP.itm_slp_slp_sku_ascx)slp_down_ITEM).FindControl("TextBoxName");//品名 TextBox txt_down_RTN_DDL = (TextBox)((ASP.wui_slp_slp_slpdate_ascx)slp_down_RTN_DDL).FindControl("TextBoxCode");//退書截止日 TextBox txt_down_REQUEST_QTY = (TextBox)((ASP.wui_slp_slp_slpquantity_ascx)slp_down_REQUEST_QTY).FindControl("TextBoxCode");//訂貨量 TextBox txt_down_REQUEST_QTY_NAME = (TextBox)((ASP.wui_slp_slp_slpquantity_ascx)slp_down_REQUEST_QTY).FindControl("TextBoxName");//訂貨量名稱 CheckBox chk_down_IS_OVERDUE = (CheckBox)((ASP.wui_slp_slp_boolean_ascx)slp_down_IS_OVERDUE).FindControl("C1");//逾期客訂 #endregion #region 設定SLP元件 TextCode長度 this.slp_up_STORE.TextBox_Code.Width = 70; this.slp_up_STORE.TextBox_Name.Width = 100; this.slp_up_SALE_ID.TextBox_Code.Width = 80; this.slp_up_SALE_ID.TextBox_Name.Width = 100; this.slp_up_BUSUID.TextBox_Code.Width = 70; this.slp_up_BUSUID.TextBox_Name.Width = 100; #endregion if (!IsPostBack) { //寫入首次載入Page TimeStamp PageTimeStamp.Value = String.Format("{0}{1}{2}{3}{4}{5}", DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString().PadLeft(2, '0'), DateTime.Now.Day.ToString().PadLeft(2, '0'), DateTime.Now.Hour.ToString().PadLeft(2, '0'), DateTime.Now.Minute.ToString().PadLeft(2, '0'), DateTime.Now.Second.ToString().PadLeft(2, '0') ); ToolBarInit(); #region Attributes System.Text.StringBuilder sb = new System.Text.StringBuilder(); #region Up [編輯]鈕 Click //this.but_up_Edit.Attributes["onclick"] += "alert('" + this.but_up_Edit.ClientID + "')"; // this.but_up_Edit.Attributes.Add("onclick", @" //CallServer_Store('新增模式下異動欄位[門市]<partition>' + document.all['" + txt_up_Store.ClientID + "'].value + '<partition>' + document.all['" + txt_up_ChanNo.ClientID + @"'].value); //"); #endregion #region Down [新增明細]鈕 Click sb.Remove(0, sb.Length); sb.Append(txt_up_ChanNo.ClientID + "<partition>");//通路 sb.Append(txt_up_Store.ClientID + "<partition>");//門市 sb.Append(txt_up_Z_O.ClientID + "<partition>");//營業所 sb.Append(txt_up_BUSDATE.ClientID + "<partition>");//訂單日期 sb.Append(txt_up_SALE_ID.ClientID + "<partition>");//營業人員 sb.Append(txt_up_BUSUID.ClientID + "<partition>");//訂單維護者 sb.Append(((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).ClientID + "<partition>");//訂單來源 sb.Append(this.txt_up_CODE.ClientID + "<partition>");//訂單編號 sb.Append(this.txt_up_CRM_NO.ClientID + "<partition>");//流水編號 sb.Append(img_up_CHAN_NO.ClientID + "<partition>");//通路img sb.Append(img_up_STORE.ClientID + "<partition>");//門市img sb.Append(img_up_BUSDATE.ClientID + "<partition>");//訂單日期img sb.Append(img_up_SALE_ID.ClientID + "<partition>");//營業人員img sb.Append(img_up_BUSUID.ClientID + "<partition>");//訂單維護者img sb.Append(img_down_ITEM.ClientID + "<partition>");//品號img sb.Append(img_down_RTN_DDL.ClientID + "<partition>");//退書截止日img sb.Append(this.panel_Down_AddDetail.ClientID + "<partition>");//panel_Down_AddDetail sb.Append(this.panel_Down_Button.ClientID + "<partition>");//panel_Down_Button sb.Append(chk_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂 sb.Append(this.lab_down_IS_OVERDUE.ClientID + "<partition>");//逾期客訂Label sb.Append(txt_down_RTN_DDL.ClientID + "<partition>");//退書截止日 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID + "<partition>");//建議儲區 sb.Append(this.txt_down_PO_SOURCE_NO.ClientID + "<partition>");//PO單號 sb.Append(this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(txt_down_ITEM.ClientID + "<partition>");//品號 sb.Append(txt_down_ITEM_NAME.ClientID + "<partition>");//品名 sb.Append(this.txt_down_PERIOD.ClientID + "<partition>");//期別 sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//訂貨量 sb.Append(this.hid_ID.ClientID + "<partition>");//hid_ID sb.Append(this.hid_PageStatus.ClientID + "<partition>");//hid_PageStatus sb.Append(this.txt_up_PO_SOURCE_NO.ClientID);//PO單號預設 this.but_down_AddDetail.Attributes.Add("onclick", "return but_down_AddDetail_Click('" + sb.ToString() + "');"); #endregion #region Down [更新]鈕 Click sb.Remove(0, sb.Length); sb.Append(this.txt_down_BARCODE.ClientID + "<partition>");//一段碼 sb.Append(this.txt_down_PERIOD_BARCODE.ClientID + "<partition>");//二段碼 sb.Append(txt_down_ITEM.ClientID + "<partition>");//品號 sb.Append(this.txt_down_PERIOD.ClientID + "<partition>");//期別 sb.Append(txt_down_REQUEST_QTY.ClientID + "<partition>");//訂貨量 sb.Append(txt_down_RTN_DDL.ClientID + "<partition>");//退書截止日 sb.Append(this.txt_down_RECOMMAND_LOCATION.ClientID);//建議儲區 this.but_down_Update.Attributes.Add("onclick", "return but_down_Update_Click_Begin('" + sb.ToString() + "');"); #endregion #region AJAX CallBack 設定 #region 新增模式下異動欄位[門市] //string str = String.Format(@"document.all.['{0}'].value='';alert('111333');", txt_up_ChanNo.ClientID); //txt_up_Store.Attributes["onkeyup"] += str; //txt_up_Store.Attributes.Add("onkeyup", str + txt_up_Store.Attributes["onkeyup"]); //string str = String.Format(@"StoreOnBlur({0},{1},{2});", // txt_up_Store.ClientID, // this.hid_PageStatus.ClientID, // txt_up_ChanNo.ClientID); //txt_up_Store.Attributes["onblur"] += str; txt_up_Store.Attributes["onblur"] += "if(this.value.trim().length!=0)__doPostBack(document.all['" + up_Master.ClientID + "'].id,'txt_STORE_Onblur');"; // txt_up_Store.Attributes.Add("onblur", @" //if(this.value!='' && // document.all['" + this.hid_PageStatus.ClientID + @"'].value == 'INSERT') //{ // function() // { // try { // CallServer_Store('新增模式下異動欄位[門市]<partition>' + this.value + '<partition>' + document.all['" + txt_up_ChanNo.ClientID + @"'].value); // } catch(e) {} // } //}"); #endregion #region 新增或編輯模式下異動欄位[一段碼]onchange this.txt_down_BARCODE.Attributes["onchange"] += string.Format("txt_down_Barcode_onchange('{0}','{1}','{2}','{3}');", this.txt_down_BARCODE.ClientID, txt_up_ChanNo.ClientID, txt_up_Store.ClientID, this.hid_PageStatus.ClientID); #endregion #region 新增或編輯模式下異動欄位[二段碼] this.txt_down_PERIOD_BARCODE.Attributes.Add("onkeyup", "Check_BARCODE_Value('" + this.txt_down_BARCODE.ClientID + "','" + this.txt_down_PERIOD_BARCODE.ClientID + "');"); this.txt_down_PERIOD_BARCODE.Attributes.Add("onchange", @" if(this.value!='' && (document.all['" + this.hid_PageStatus.ClientID + "'].value == 'INSERT' || document.all['" + this.hid_PageStatus.ClientID + @"'].value == 'EDIT') && document.all['" + this.txt_down_BARCODE.ClientID + @"'].value !='') {CallServer_down_PERIOD_BARCODE('新增或編輯模式下異動欄位[二段碼]<partition>' + document.all['" + txt_up_ChanNo.ClientID + "'].value + '<partition>' + document.all['" + this.txt_down_BARCODE.ClientID + @"'].value+ '<partition>' + this.value);}"); #endregion #region 新增或編輯模式下異動欄位[品號/品名] //改成不管 期別欄位有沒有值,都重新執行 // txt_down_ITEM.Attributes.Add("onblur", @" //if(this.value!='' && // (document.all['" + this.hid_PageStatus.ClientID + "'].value == 'INSERT' || document.all['" + this.hid_PageStatus.ClientID + @"'].value == 'EDIT')&& // document.all['" + this.txt_down_PERIOD.ClientID + @"'].value =='') //{CallServer_down_ITEM('新增或編輯模式下異動欄位[品號/品名]<partition>' + this.value);}"); txt_down_ITEM.Attributes.Add("onchange", @" if(this.value !='' && this.value !='" + this.slp_down_ITEM.Text + "' && " + " (document.all['" + this.hid_PageStatus.ClientID + "'].value == 'INSERT' || document.all['" + this.hid_PageStatus.ClientID + @"'].value == 'EDIT') ) {CallServer_down_ITEM('新增或編輯模式下異動欄位[品號/品名]<partition>' + this.value);}"); #endregion #region 進入欄位[期別]後 this.txt_down_PERIOD.Attributes.Add("onkeypress", "Check_ITEM_Value('" + txt_down_ITEM.ClientID + "','" + this.txt_down_PERIOD.ClientID + "');"); #endregion #region 新增或編輯模式下異動欄位[期別] this.txt_down_PERIOD.Attributes.Add("onchange", @" if(this.value!='' && (document.all['" + this.hid_PageStatus.ClientID + "'].value == 'INSERT' || document.all['" + this.hid_PageStatus.ClientID + @"'].value == 'EDIT')) { CallServer_down_PERIOD('新增或編輯模式下異動欄位[期別]<partition>'+ document.all['" + txt_up_ChanNo.ClientID + @"'].value+'<partition>'+ document.all['" + txt_up_Store.ClientID + @"'].value+'<partition>'+ document.all['" + txt_down_ITEM.ClientID + @"'].value+'<partition>'+ this.value+'<partition>'+ document.all['" + this.txt_down_BARCODE.ClientID + @"'].value+'<partition>'+ document.all['" + this.txt_down_PERIOD_BARCODE.ClientID + @"'].value+'<partition>'+ document.all['" + txt_down_RTN_DDL.ClientID + @"'].value+'<partition>'+ document.all['" + this.hid_ID.ClientID + @"'].value); }"); #endregion #region 新增或編輯模式下異動欄位[期別]Confirm後 // this.txt_IS_OVERDUE_CONFIRM.Attributes.Add("onpropertychange", @" //if(this.value !='' && // (document.all['" + this.hid_PageStatus.ClientID + "'].value == 'INSERT' || document.all['" + this.hid_PageStatus.ClientID + @"'].value == 'EDIT')) //{ // CallServer_down_IS_OVERDUE_CONFIRM(this.value.replace(/</g,'<')); //}"); #endregion #region 新增或編輯模式下異動欄位[訂貨量] //txt_down_REQUEST_QTY.Attributes.Add("onchange", string.Format("txt_down_REQUEST_QTY_onblur('{0}','{1}','{2}');", txt_down_REQUEST_QTY.ClientID, chk_down_IS_OVERDUE.ClientID, this.hid_PageStatus.ClientID)); this.slp_down_REQUEST_QTY.TextBox_Code.Attributes["onchange"] += string.Format("txt_down_REQUEST_QTY_onblur('{0}','{1}','{2}');", txt_down_REQUEST_QTY.ClientID, chk_down_IS_OVERDUE.ClientID, this.hid_PageStatus.ClientID); #endregion #region 新增或編輯模式按下明細區[取消]鈕 this.but_down_Cancel.Attributes.Add("onclick", @" if(document.all['" + this.hid_PageStatus.ClientID + @"'].value == 'INSERT' || document.all['" + this.hid_PageStatus.ClientID + @"'].value == 'EDIT') { CallServer_down_Cancel('新增或編輯模式按下明細區[取消]鈕<partition>'); }"); #endregion #region 新增模式異動欄位[流水編號] this.txt_up_CRM_NO.Attributes.Add("onchange", @" if(this.value != '' && document.all['" + this.hid_PageStatus.ClientID + @"'].value == 'INSERT') { return Check_CRM_NO('" + this.txt_up_CRM_NO.ClientID + @"'); }"); #endregion #region 限制PO單號中英文長度限制 this.txt_up_PO_SOURCE_NO.Attributes["onkeypress"] += String.Format(@"return limit_length({0},{1});", this.txt_up_PO_SOURCE_NO.ClientID, this.txt_up_PO_SOURCE_NO.MaxLength); this.txt_down_PO_SOURCE_NO.Attributes["onkeypress"] += String.Format(@"return limit_length({0},{1});", this.txt_down_PO_SOURCE_NO.ClientID, this.txt_down_PO_SOURCE_NO.MaxLength); #endregion RegClientScript(); #endregion #endregion #region 清空靜態變數 dtChainPOSetting = null;//異動欄位[門市] --Page_Load dtStock = null;//異動欄位[期別] s_PMA = string.Empty;//大分類(異動欄位[品號/品名]) s_ROOT_NO = string.Empty;//群分類(異動欄位[品號/品名]) s_SRC_LOCATE_TYPE = string.Empty;//建議儲區類別(異動欄位[訂貨量]) dt_Detail = null; //Session["CRM041_dt_Detail" + PageTimeStamp.Value] = null; dt_Master = null; dt_Detail_Original = null; #endregion #region 設定頁面狀態 string s_PageStatus = "QUERY"; string s_CRM_NO = string.Empty; string s_STORE = string.Empty; try { s_CRM_NO = Request["CRM041_CRM_NO"].ToString(); s_STORE = Request["CRM041_STORE"].ToString(); s_PageStatus = "INSERT"; } catch { } try { s_CRM_NO = Request["CRM041_CRM_REQUEST_NO"].ToString(); s_PageStatus = "VIEW"; but_up_Query_Click("CRM051_TO_CRM041", null); } catch { } try { if (Request["mode"].ToString() != "") { s_PageStatus = Request["mode"].ToString(); } } catch { } this.hid_PageStatus.Value = s_PageStatus; this.txt_PageStatus.Text = s_PageStatus; SetPageStartValue(); SetPageStatus(); //代表是從CRM011檢視模式,按Button[開立補書訂單] if (s_CRM_NO != string.Empty && s_STORE != string.Empty) { if (dtChainPOSetting != null) { dtChainPOSetting = null; } #region 傳入參數 ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(s_STORE);//門市 ParameterList.Add(string.Empty);//通路 ParameterList.Add(Session["UID"].ToString()); #endregion #region 取得資料 DataTable dt_Return = new DataTable(); BCO.MaintainStore bco = new BCO.MaintainStore(ConntionDB); dt_Return = bco.QUERY_STORE_BY_STOREANDCHAN(ParameterList); #endregion #region 檢查回傳資料 if (dt_Return.Rows.Count == 0) { this.ErrorMsgLabel.Text = "查無門市資料"; } else { #region 將資料寫入畫面 this.slp_up_CHAN_NO.Text = dt_Return.Rows[0]["CHAN_NO"].ToString();//通路 this.slp_up_STORE.Text = s_STORE;//門市 this.slp_up_Z_O.Text = dt_Return.Rows[0]["Z_O"].ToString();//營業所 this.slp_up_SALE_ID.Text = dt_Return.Rows[0]["SAL_ID"].ToString();//營業人員 this.txt_up_CRM_NO.Text = s_CRM_NO;//流水編號 #endregion #region 取得通路PO控制設定 GetChainPOSetting(dt_Return.Rows[0]["CHAN_NO"].ToString(), dt_Return.Rows[0]["STORE"].ToString()); //ParameterList.Clear(); //ParameterList.Add(dt_Return.Rows[0]["CHAN_NO"].ToString()); //ParameterList.Add(dt_Return.Rows[0]["STORE"].ToString()); //BCO_ALO.MaintainChainPOSetting bco_alo = new BCO_ALO.MaintainChainPOSetting(ConntionDB); //dtChainPOSetting = bco_alo.QueryStorPOSettingByFind(ParameterList); #endregion } #endregion } #endregion #region 預設系統功能鍵:〔查詢〕 this.Form.Attributes.Add("onkeypress", "return WebForm_FireDefaultButton_Self();"); #endregion } else { if (Request.Form["__EVENTARGUMENT"] == "txt_STORE_Onblur") txt_STORE_Onblur(); } #region SLP有問題,必須在LOAD時取得值 b_IS_OVERDUE = chk_down_IS_OVERDUE.Checked; #endregion #region ToolBar設定 WUI_GMToolbarV uc = (WUI_GMToolbarV)this.GMToolbar1; uc.Btn_Find += new WUI_GMToolbarV.UCDelegate(this.UC_Find); uc.Btn_New += new WUI_GMToolbarV.UCDelegate(this.UC_New); uc.Btn_Edit += new WUI_GMToolbarV.UCDelegate(this.UC_Edit); uc.Btn_Save += new WUI_GMToolbarV.UCDelegate(this.UC_Save); uc.Btn_Delete += new WUI_GMToolbarV.UCDelegate(this.UC_Delete); uc.Btn_FindExport += new WUI_GMToolbarV.UCDelegate(UC_Export); uc.Btn_Copy += new WUI_GMToolbarV.UCDelegate(UC_Copy); uc.Btn_RecFirst += new WUI_GMToolbarV.UCDelegate(UC_RecFirst); uc.Btn_RecLast += new WUI_GMToolbarV.UCDelegate(UC_RecLast); uc.Btn_RecNext += new WUI_GMToolbarV.UCDelegate(UC_RecNext); uc.Btn_RecPre += new WUI_GMToolbarV.UCDelegate(UC_RecPre); #endregion AuthorityControls(this); } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } }
/// <summary> /// 設定頁面載入時,各個模式的畫面預設值 /// </summary> private void SetPageStartValue() { #region 新增狀態 if (this.hid_PageStatus.Value == "INSERT") { #region Tab_Up #region 設定初始值 if (this.slp_up_CHAN_NO.Text == string.Empty || this.slp_up_STORE.Text == string.Empty || this.slp_up_SALE_ID.Text == string.Empty || this.slp_up_Z_O.Text == string.Empty) { this.slp_up_CHAN_NO.Text = string.Empty;//通路 this.slp_up_STORE.Text = string.Empty;//門市 this.slp_up_Z_O.Text = string.Empty;//營業所 this.slp_up_SALE_ID.Text = string.Empty;//營業人員 } #region 設定訂單來源 DataTable dt_Return = new DataTable(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString());//V_USERCODE ParameterList.Add(Session["UID"].ToString());//V_LOG_UPDATEUID BCO.MaintainCRMPublic bco = new BCO.MaintainCRMPublic(ConntionDB); dt_Return = bco.QUERY_LOGIN_CODEANDNAME(ParameterList); if (dt_Return.Rows.Count == 0 || dt_Return.Rows[0]["NAME"].ToString() != "顧客服務Team")//訂單來源 { ((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).SelectedValue = "0"; } else { ((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).SelectedValue = "1"; } #endregion this.slp_up_BUSUID.Text = Session["UID"].ToString();//訂單維護者 this.slp_up_BUSDATE.Text = DateTime.Today.ToString("yyyy/MM/dd");//DateTime.Now.ToShortDateString();//訂單日期 this.txt_up_PO_SOURCE_NO.Text = string.Empty;//PO單號預設 this.txt_up_CODE.Text = "自動產生";//訂單編號 this.txt_up_CRM_NO.Text = string.Empty;//流水編號 slp_up_Z_O.ReadOnly = true; txt_up_CODE.Enabled = false; if (this.slp_up_CHAN_NO.Text != string.Empty && this.slp_up_STORE.Text != string.Empty) { #region 從資料庫查詢資料 // ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(this.slp_up_STORE.Text);//門市 ParameterList.Add(this.slp_up_CHAN_NO.Text);//通路 ParameterList.Add(Session["UID"].ToString()); //2009-06-01 cyhsu add 新增記錄 STORE and CHAN_NO s_CHAN_NO = this.slp_up_CHAN_NO.Text; s_STORE = this.slp_up_STORE.Text; //DataTable dt_Return = new DataTable(); BCO.MaintainStore bco1 = new BCO.MaintainStore(ConntionDB); dt_Return = bco1.QUERY_STORE_BY_STOREANDCHAN(ParameterList); if (dt_Return.Rows.Count == 0) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM041.aspx", "alert('查無門市資料');document.getElementById('" + this.slp_up_STORE.TextBox_Code.ClientID + "').focus();document.getElementById('" + this.slp_up_STORE.TextBox_Code.ClientID + "').select();", true); } else { if (this.hid_PageStatus.Value == "INSERT") { if (dt_Return.Rows[0]["MDC_END_DATE"].ToString() != string.Empty && ((DateTime)dt_Return.Rows[0]["MDC_END_DATE"]) < DateTime.Today) { throw new Exception("非有效門市,不可新增"); } } slp_up_CHAN_NO.Text = dt_Return.Rows[0]["CHAN_NO"].ToString(); slp_up_Z_O.Text = dt_Return.Rows[0]["Z_O"].ToString(); slp_up_SALE_ID.Text = dt_Return.Rows[0]["SAL_ID"].ToString(); #region 取得通路PO控制設定 GetChainPOSetting(dt_Return.Rows[0]["CHAN_NO"].ToString(), dt_Return.Rows[0]["STORE"].ToString()); #endregion dt_Return.Dispose(); } #endregion } #endregion #endregion } #endregion #region 查詢狀態 else if (this.hid_PageStatus.Value == "QUERY") { #region Tab_Up #region 設定初始值 this.slp_up_CHAN_NO.Text = string.Empty;//通路 this.slp_up_STORE.Text = string.Empty;//門市 this.slp_up_Z_O.Text = string.Empty;//營業所 this.slp_up_BUSDATE.Text = string.Empty;//訂單日期 this.slp_up_SALE_ID.Text = string.Empty;//營業人員 this.slp_up_BUSUID.Text = string.Empty;//訂單維護者 ((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).SelectedIndex = 0;//訂單來源 this.txt_up_PO_SOURCE_NO.Text = string.Empty;//PO單號預設 this.txt_up_CODE.Enabled = true; this.txt_up_CODE.Text = string.Empty;//訂單編號 this.txt_up_CRM_NO.Text = string.Empty;//流水編號 #endregion #endregion } #endregion #region 檢視狀態 else if (this.hid_PageStatus.Value == "VIEW") { } #endregion #region 編輯狀態 else if (this.hid_PageStatus.Value == "EDIT") { this.gv_Detail.DataSource = dt_Detail; this.gv_Detail.PageSize = 10; this.gv_Detail.PageIndex = 0; this.gv_Detail.DataBind(); Panel1.Height = gv_Detail.Rows.Count * 45 + 60; } #endregion if (this.hid_PageStatus.Value == "INSERT") { DropDownList DL = ((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")); if (DL.SelectedValue == "全部") { DL.Items.Remove(DL.SelectedItem); } //((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).Items.RemoveAt(0); } else if (this.hid_PageStatus.Value == "QUERY") { if (((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).Items.Count != 0) if (((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).Items[0].Value != "") ((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).Items.Insert(0, new ListItem("全部", "")); ((DropDownList)((ASP.sys_slp_slp_enumbase_ascx)drop_up_ORDER_TYPE).FindControl("D1")).SelectedIndex = 0; } try { AuthorityControls(this); } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } }
/// <summary> /// 門市 /// </summary> /// <param name="strChan"></param> /// <param name="strStore"></param> /// <param name="strUserID"></param> /// <param name="strPageTimeStamp"></param> /// <param name="strCurrentPageMode"></param> /// <returns></returns> private string GetValueByPageMethod_STORE(string strChan, string strStore, string strUserID, string strPageTimeStamp, string strCurrentPageMode) { #region string strRtn = "", strTemp = ""; bool bResult = false; try { if (Session[string.Format("CRM041_dtChainPOSetting_{0}", strPageTimeStamp)] != null) { Session[string.Format("CRM041_dtChainPOSetting_{0}", strPageTimeStamp)] = null; } #region 從資料庫查詢資料 ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strStore);//門市 ParameterList.Add(strChan);//通路 ParameterList.Add(strUserID); Session[string.Format("CRM041_s_CHAN_NO_{0}", strPageTimeStamp)] = strChan; Session[string.Format("CRM041_s_STORE_{0}", strPageTimeStamp)] = strStore; DataTable dt_Return = new DataTable(); BCO_CRM.MaintainStore BCO1 = new BCO_CRM.MaintainStore(ConntionDB); dt_Return = BCO1.QUERY_STORE_BY_STOREANDCHAN(ParameterList); BCO1.CloseConnection(); #endregion if (dt_Return.Rows.Count == 0) { bResult = false;//查無門市資料 } else { #region if (strCurrentPageMode == "INSERT") { if (dt_Return.Rows[0]["MDC_END_DATE"].ToString() != string.Empty && ((DateTime)dt_Return.Rows[0]["MDC_END_DATE"]) < DateTime.Today) { throw new Exception("非有效門市,不可新增"); } } bResult = true; strTemp = string.Format("{0};{1};{2}", dt_Return.Rows[0]["CHAN_NO"].ToString(), dt_Return.Rows[0]["Z_O"].ToString(), dt_Return.Rows[0]["SAL_ID"].ToString()); #region 取得通路PO控制設定 ArrayList ParameterList2 = new ArrayList(); ParameterList2.Clear(); ParameterList2.Add(dt_Return.Rows[0]["CHAN_NO"].ToString()); ParameterList2.Add(dt_Return.Rows[0]["STORE"].ToString()); BCO_ALO.MaintainChainPOSetting BCO2 = new BCO_ALO.MaintainChainPOSetting(ConntionDB); Session[string.Format("CRM041_dtChainPOSetting_{0}", strPageTimeStamp)] = BCO2.QueryStorPOSettingByFind(ParameterList2); BCO2.CloseConnection(); #endregion #endregion } } catch (Exception ex) { throw ex; } return strRtn = string.Format("{0};{1}", bResult.ToString().ToUpper(), strTemp); #endregion }
/// <summary> /// 將變更後的內部變量this.CallBackValue返回給前台JavaScript方法ReceiveServerData(string Value)。 /// </summary> /// <returns></returns> string ICallbackEventHandler.GetCallbackResult() { if (CallBackValue != string.Empty) { try { TextBox txt_CHAN_NO = (TextBox)((ASP.stm_slp_slp_storechain_ascx)slp_CHAN_NO).FindControl("TextBoxCode");//通路 TextBox txt_STORE = (TextBox)((ASP.stm_slp_slp_store_ascx)slp_STORE).FindControl("TextBoxCode");//門市 TextBox txt_ITEM = (TextBox)((ASP.itm_slp_slp_sku_ascx)slp_ITEM).FindControl("TextBoxCode");//品號 TextBox txt_PERIOD = (TextBox)((ASP.itm_slp_slp_itemperiod_ascx)slp_PERIOD).FindControl("TextBoxCode");//期別 System.Text.StringBuilder sb = new System.Text.StringBuilder(); CallBackValue = CallBackValue.Trim(); string[] s_Client_String = System.Text.RegularExpressions.Regex.Split(CallBackValue, "<partition>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); ArrayList ParameterList = new ArrayList();//20091117 #region 離開欄位[@門市] if (s_Client_String[0] == "離開欄位[@門市]") { #region 從資料庫查詢資料 ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//門市 ParameterList.Add(string.Empty);//通路 ParameterList.Add(Session["UID"].ToString()); DataTable dt_Return = new DataTable(); BCO.MaintainStore bco = new BCO.MaintainStore(ConntionDB); dt_Return = bco.QUERY_STORE_BY_STOREANDCHAN(ParameterList); #endregion if (dt_Return.Rows.Count == 0) { sb.Append("離開欄位[@門市]<partition>"); sb.Append("FALSE<partition>"); sb.Append("查無資料<partition>"); sb.Append(txt_STORE.ClientID + "<partition>");//設定焦點的欄位 sb.Append(txt_CHAN_NO.ClientID); } else { sb.Append("離開欄位[@門市]<partition>"); sb.Append("TRUE<partition>"); sb.Append(dt_Return.Rows[0]["CHAN_NO"].ToString() + "<partition_Detail>" + txt_CHAN_NO.ClientID); } } #endregion #region 異動欄位[@二段碼]設定值後 else if (s_Client_String[0] == "異動欄位[@二段碼]設定值後") { #region 從資料庫查詢資料 ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//通路 ParameterList.Add(s_Client_String[2]);//一段碼 ParameterList.Add(s_Client_String[3]);//二段碼 ParameterList.Add(Session["UID"].ToString()); DataTable dt_Return = new DataTable(); BCO.QueryCRMCommon bco = new BCO.QueryCRMCommon(ConntionDB); dt_Return = bco.QueryItemPeriodInfoByBarcode(ParameterList); #endregion if (dt_Return.Rows.Count == 0) { sb.Append("異動欄位[@二段碼]設定值後<partition>"); sb.Append("FALSE<partition>"); sb.Append("此一段碼/二段碼不存在對應商品期別資訊,請重新輸入<partition>"); sb.Append(this.txt_BARCODE.ClientID + "<partition>");//設定焦點的欄位 sb.Append(this.txt_PERIOD_BARCODE.ClientID + "<partition>"); sb.Append(txt_ITEM.ClientID + "<partition>"); sb.Append(txt_PERIOD.ClientID); } else { sb.Append("異動欄位[@二段碼]設定值後<partition>"); sb.Append("TRUE<partition>"); sb.Append(dt_Return.Rows[0]["ITEM"].ToString() + "<partition_Detail>" + txt_ITEM.ClientID + "<partition>"); sb.Append(dt_Return.Rows[0]["PERIOD"].ToString() + "<partition_Detail>" + txt_PERIOD.ClientID); } } #endregion #region 異動欄位[@品號/品名]設定值後 else if (s_Client_String[0] == "異動欄位[@品號/品名]設定值後") { #region 從資料庫查詢資料 ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//品號 ParameterList.Add(Session["UID"].ToString()); DataTable dt_Return_1 = new DataTable(); BCO.QueryCRMCommon bco = new BCO.QueryCRMCommon(ConntionDB); dt_Return_1 = bco.GetMaxDeiveryPeriod(ParameterList); #endregion if (dt_Return_1.Rows[0]["PERIOD"].ToString() == string.Empty) { sb.Append("異動欄位[@品號/品名]設定值後<partition>"); sb.Append("FALSE<partition>"); sb.Append("查無資料<partition>"); sb.Append(txt_ITEM.ClientID);//設定焦點的欄位 } else { sb.Append("異動欄位[@品號/品名]設定值後<partition>"); sb.Append("TRUE<partition>"); sb.Append(dt_Return_1.Rows[0]["PERIOD"].ToString() + "<partition_Detail>" + txt_PERIOD.ClientID); } } #endregion CallBackValue = sb.ToString(); } catch (Exception ex) { CallBackValue = "發生例外錯誤<partition>" + ex.Message; } } return CallBackValue; }
/// <summary> /// 將變更後的內部變量this.CallBackValue返回給前台JavaScript方法ReceiveServerData(string Value)。 /// </summary> /// <returns></returns> string ICallbackEventHandler.GetCallbackResult() { if (CallBackValue != string.Empty) { try { TextBox txt_CHAN_NO = (TextBox)this.slp_CHAN_NO.FindControl("TextBoxCode");//通路 TextBox txt_STORE = (TextBox)this.slp_STORE.FindControl("TextBoxCode");//店號 System.Text.StringBuilder sb = new System.Text.StringBuilder(); CallBackValue = CallBackValue.Trim(); string[] s_Client_String = System.Text.RegularExpressions.Regex.Split(CallBackValue, "<partition>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); #region 異動欄位[店號]設定值後 if (s_Client_String[0] == "異動欄位[店號]設定值後") { #region 從資料庫查詢資料 ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(s_Client_String[1]);//門市 ParameterList.Add(string.Empty);//通路 ParameterList.Add(Session["UID"].ToString()); DataTable dt_Return = new DataTable(); BCO.MaintainStore bco = new BCO.MaintainStore(ConntionDB); dt_Return = bco.QUERY_STORE_BY_STOREANDCHAN(ParameterList); #endregion if (dt_Return.Rows.Count == 0) { sb.Append("異動欄位[店號]設定值後<partition>"); sb.Append("FALSE<partition>"); sb.Append("查無資料<partition>"); sb.Append(txt_STORE.ClientID + "<partition>");//設定焦點的欄位 sb.Append(txt_CHAN_NO.ClientID); } else { sb.Append("異動欄位[店號]設定值後<partition>"); sb.Append("TRUE<partition>"); sb.Append(dt_Return.Rows[0]["CHAN_NO"].ToString() + "<partition_Detail>" + txt_CHAN_NO.ClientID); } } #endregion CallBackValue = sb.ToString(); } catch (Exception ex) { CallBackValue = "發生例外錯誤<partition>" + ex.Message; } } return CallBackValue; }
/// <summary> /// 離開欄位[@門市] /// </summary> /// <param name="strStore"></param> /// <param name="strUserID"></param> /// <returns></returns> private DataTable GetChanByStore(string strStore,string strUserID) { #region try { ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strStore);//門市 ParameterList.Add("");//通路 ParameterList.Add(strUserID); CRMModel.MaintainStore BCO = new CRMModel.MaintainStore(ConnectionDB); return BCO.QUERY_STORE_BY_STOREANDCHAN(ParameterList); } catch (Exception ex) { throw ex; } #endregion }