private bool GetItemPeriodDisStateByItemPeriod(string strItem, string strPeriod, string strStAcceptDate, out string strErrMsg) { #region bool bResult = true; strErrMsg = ""; try { ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strItem); ParameterList.Add(strPeriod); ParameterList.Add(strStAcceptDate); ALOModel.QueryALOCommon BCO_comm = new ALOModel.QueryALOCommon(ConnectionDB); DataTable dtTaxType = BCO_comm.QueryItemPeriodInfo(ParameterList); #region 取得稅別 #endregion s_TAX_TYPE = ""; if(dtTaxType!=null && dtTaxType.Rows.Count>0) { s_TAX_TYPE = dtTaxType.Rows[0]["TAX_TYPE"].ToString().Trim(); } ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB); Hashtable htTemp = BCO.CheckItemPeriodDisState(ParameterList); #region 取得前六期期別 s_B1_PERIOD = ""; s_B2_PERIOD = ""; s_B3_PERIOD = ""; s_B4_PERIOD = ""; s_B5_PERIOD = ""; s_B6_PERIOD = ""; if (htTemp != null && htTemp.Count != 0) { if (htTemp["PERIODEXIST"].ToString().Trim() == "0") { strErrMsg = string.Format("期別{0},不存在於期別主檔", strPeriod); bResult = false; } else if (htTemp["DIS_DATE"] == null || htTemp["DIS_DATE"].ToString().Trim() != "") { strErrMsg = string.Format("該品號期別於該配本日期已配本"); bResult = true; } if (bResult) { s_B1_PERIOD = htTemp["P_B1"].ToString();//前一期別 s_B2_PERIOD = htTemp["P_B2"].ToString();//前二期別 s_B3_PERIOD = htTemp["P_B3"].ToString();//前三期別 s_B4_PERIOD = htTemp["P_B4"].ToString();//前四期別 s_B5_PERIOD = htTemp["P_B5"].ToString();//前五期別 s_B6_PERIOD = htTemp["P_B6"].ToString();//前六期別 DateTime dtIssDate; DateTime.TryParse(htTemp["ISS_DATE"].ToString(), out dtIssDate); s_ISS_DATE = dtIssDate.ToString("yyyy/MM/dd");//發行日 GetItemPeriodStock(strItem, strPeriod); } } else { strErrMsg = string.Format("期別{0},不存在於期別主檔", strPeriod); bResult = false; } #endregion } catch (Exception ex) { bResult = false; throw ex; } return bResult; #endregion }
/// <summary> ///1.目的:將上傳檔案內容,存入暫存檔 ///2.傳入參數:@處理檔名、@使用者 /// 回傳參數:@處理筆數、@正確筆數、@錯誤筆數、@錯誤訊息 ///3.處理表格:VDS_ALO_STORESPEC_TMP(T) ///4.處理邏輯: /// 4.1) 先清除前一次,同一使用者執行的匯入暫存資訊與錯誤資訊。 /// 相關Table:VDS_ALO_STORESPEC_TM /// 4.2) 讀取匯入檔案到暫存資料集。 /// 4.3) 檢查匯入檔案格式內容是否正確,如有任何錯誤,則停止上傳流程,並回傳錯誤訊息。 /// 『XX檔案,檔案內容錯誤:@錯誤說明』 (格式請參考資料庫Table Shcema) /// * 日期:檢查日期格式。 /// * 數字:檢查內容是否為數字。 /// * 文字:檢查長度是否溢位。 /// * 檔案欄位數是否不足。 /// * 檢查必填欄位是否有值:通路、店號、品號、數量、原因代碼、設定類別 /// * 工作表匯入內容有任一筆錯,皆視為錯誤,整批放棄。 /// * 匯入表格細節說明請參考:Excel文件 /// 4.4) 格式檢查正確無誤後 /// a) 暫存檔中的[狀態]欄位調整為1:FILE TO TMP /// b) 呼叫 [CheckData] ,檢查資料內容邏輯正確性 /// 4.5) 無論CheckData()檢查結果是否為True, /// 皆將上傳檔案內容新增到資料庫Tmp Table:, /// 並記錄錯誤原因、匯入者、匯入日期、處理檔案名稱=上傳檔名。 ///5. 回傳處理結果(@處理筆數、@正確筆數、@錯誤筆數、@錯誤訊息(無錯誤時=null) ) /// </summary> public ArrayList FileToTmp(DataSet ds_Excel, DateTime d_CreateDate, string s_LoginUser, string s_AP_FileName, string V_SESSION_ID) { #region int i_newTable_Count = 0; ArrayList arl_Return = new ArrayList(); ArrayList arr_CheckData_Table = new ArrayList(); ArrayList arr_CheckData = new ArrayList(); int i_FileToTemp_Total_count = 0; int i_FileToTemp_Right_count = 0; int i_FileToTemp_Wrong_count = 0; bool b_Check_Logic = true; ArrayList paramTemp = new ArrayList(); Hashtable htTemp = new Hashtable(); DataTable dtTemp = new DataTable(); string strErrMsg = ""; string strErrMsgDataFormat = ""; Int32 iErrCount = 0; string strTemp = ""; bool bResultTemp = false; try { ParameterList.Clear(); DataTable dt_ALO_IMPORT_TMP = QuerySwitch(QueryType.GetStoreSpec_TmpSchema, ParameterList); VDS_ALO_DIS_PATTERN_DBO ALO_DIS_PATTERN = new VDS_ALO_DIS_PATTERN_DBO(ref USEDB); VDS_ALO_STORESPEC_TMP_DBO ALO_STORESPEC_TMP = new VDS_ALO_STORESPEC_TMP_DBO(ref USEDB); VDS_ALO_STORESPEC_DETL_DBO ALO_STORESPEC_DETL = new VDS_ALO_STORESPEC_DETL_DBO(ref USEDB); MaintainStoreSpec ALO_STORESPEC_MAIN = new MaintainStoreSpec(ConnectionDB); QueryALOCommon BCOCommon = new QueryALOCommon(ConnectionDB); //20090626 added VDS_ALO_STORESPEC_TMP_DBO DBO = new VDS_ALO_STORESPEC_TMP_DBO(ref USEDB); ParameterList.Clear(); ParameterList.Add(s_LoginUser); ParameterList.Add(V_SESSION_ID); DBO.doDelete_STORESPEC_TMP(ParameterList, null); foreach (System.Data.DataRow dRow in ds_Excel.Tables[0].Rows) { #region iErrCount = 0; strErrMsg = ""; if (!CheckRequiredField(dRow, iAryRequiredColumnsCheck, out strErrMsgDataFormat))//檢查必填欄位 { #region 檢查資料格式正確性 arl_Return.Add("FALSE"); arl_Return.Add(strErrMsgDataFormat); return arl_Return; } else if (!CheckOverFlow(dRow, iAryOverflowColumnsCheck, out strErrMsgDataFormat))//檢查是否為溢位 { arl_Return.Add("FALSE"); arl_Return.Add(strErrMsgDataFormat); return arl_Return; } else if (!CheckInputValueIsInt32_2(dRow, iAryRequiredColumnsCheck, out strErrMsgDataFormat))//檢查是否為數值 { //2009-06-26 cyhsu 改用 CheckInputValueIsInt32_2 //因為數值欄位部分條件下可輸入負值,所以在格式檢查時不檢查正負號 arl_Return.Add("FALSE"); arl_Return.Add(strErrMsgDataFormat); return arl_Return; #endregion } else { #region 檢查資料邏輯正確性 #region 將資料寫入 TEMP TABLE DataRow dRow_Temp = dt_ALO_IMPORT_TMP.NewRow(); dRow_Temp["CREATEDATE"] = d_CreateDate; dRow_Temp["CREATEUID"] = s_LoginUser; dRow_Temp["ID"] = i_newTable_Count; dRow_Temp["UPDATEDATE"] = d_CreateDate; dRow_Temp["UPDATEUID"] = s_LoginUser; dRow_Temp["CHAN_NO"] = dRow[1].ToString().Trim(); dRow_Temp["STORE"] = dRow[2].ToString().Trim(); dRow_Temp["ITEM"] = dRow[3].ToString().Trim(); dRow_Temp["SPEC_QTY"] = Int32.Parse(dRow[5].ToString().Trim()); dRow_Temp["REASON"] = dRow[6].ToString().Trim(); dRow_Temp["SPEC_TYPE"] = dRow[7].ToString().Trim(); dRow_Temp["SESSION_ID"] = V_SESSION_ID; #endregion #region 4.1 判斷是否可新增 htTemp.Clear(); strTemp = ""; htTemp.Add("ChanNo", dRow[1].ToString().Trim()); htTemp.Add("Store", dRow[2].ToString().Trim()); htTemp.Add("Item", dRow[3].ToString().Trim()); htTemp.Add("StartDate", DateTime.Now.ToString("yyyy/MM/dd")); htTemp.Add("EndDate", DateTime.Now.AddDays(90).ToString("yyyy/MM/dd")); bResultTemp = ALO_STORESPEC_MAIN.CheckStoreSpecCanAdd(htTemp, ref strTemp); if (!bResultTemp) { strErrMsg += string.Format("{0},", strTemp); } ParameterList.Clear(); ParameterList.Add(dRow[1].ToString().Trim()); ParameterList.Add(dRow[2].ToString().Trim()); strTemp = BCOCommon.CheckCurrentStoreState(ParameterList); if (strTemp != "") { strErrMsg += string.Format("{0},", strTemp); } #endregion #region switch (dRow[7].ToString().Trim()) { case "1"://加減本數 strErrMsg += "不可匯入控制類別[加減本數],"; dRow_Temp["S_START_DATE"] = DateTime.Now; dRow_Temp["S_END_DATE"] = DateTime.Now.AddDays(90); break; case "3"://停配 dRow_Temp["S_START_DATE"] = DateTime.Now; dRow_Temp["S_END_DATE"] = DateTime.Parse("9999/12/31"); dRow_Temp["SPEC_QTY"] = "0"; break; case "2": case "4": case "5": case "6": dRow_Temp["S_START_DATE"] = DateTime.Now; dRow_Temp["S_END_DATE"] = DateTime.Now.AddDays(90); break; default: strErrMsg += "無此控制類別,"; dRow_Temp["S_START_DATE"] = DateTime.Now; dRow_Temp["S_END_DATE"] = DateTime.Now.AddDays(90); break; } #endregion #region 控制類別 = 2 時,可輸入負值,其他不可 2009-060-26 cyhsu add if ((dRow_Temp["SPEC_TYPE"].ToString().Trim() != "2") && (int.Parse(dRow_Temp["SPEC_QTY"].ToString()) < 0) ) { strErrMsg += "此控制類別非加減比例,對應之設定值不可小於0,"; } #endregion #region 4.4 針對MEMO是否為空字串做檢查 if (strErrMsg.Trim() == string.Empty) { dRow_Temp["MEMO"] = System.DBNull.Value; dRow_Temp["DATASOURCE"] = s_AP_FileName; } else { if (strErrMsg.Trim().Length > 0) { if (strErrMsg.Trim().Substring(strErrMsg.Trim().Length - 1) == ",") { strErrMsg = strErrMsg.Trim().Substring(0, strErrMsg.Trim().Length - 1); } } dRow_Temp["MEMO"] = strErrMsg; dRow_Temp["DATASOURCE"] = s_AP_FileName; iErrCount++; } if (iErrCount != 0) { i_FileToTemp_Wrong_count += 1; dRow_Temp["DATATYPE"] = 2; b_Check_Logic = false; } else { i_FileToTemp_Right_count += 1; dRow_Temp["DATATYPE"] = 1; } #endregion dt_ALO_IMPORT_TMP.Rows.Add(dRow_Temp); i_newTable_Count += 1; #endregion } i_FileToTemp_Total_count += 1; #endregion } #region 先清除前一次,同一使用者執行的匯入暫存資訊與錯誤資訊,並將 Excel 資料匯入 TEMP TABLE ParameterList.Clear(); ParameterList.Add(s_LoginUser); ParameterList.Add(V_SESSION_ID); DELETE_AND_INSERT_TEMP_TABLE(ParameterList, null, dt_ALO_IMPORT_TMP); #endregion arl_Return.Add("TRUE"); arl_Return.Add(b_Check_Logic); arl_Return.Add(i_FileToTemp_Total_count); arl_Return.Add(i_FileToTemp_Right_count); arl_Return.Add(i_FileToTemp_Wrong_count); } catch (Exception ex) { arl_Return.Add("FALSE"); arl_Return.Add(GetNewException(ex).Message); } return arl_Return; #endregion }
protected void btn_Save_Click(object sender, EventArgs e) { #region try { #region 取得畫面元件的值 string v_DIS_USER = SLP_User1.Text.Trim(); string v_ROOT_no = SLP_ROOT1.Text.Trim(); string v_PMA = SLP_PMA1.Text.Trim(); string v_Pattern = SLP_Pattern1.Text.Trim() == "" ? null : SLP_Pattern1.Text.Trim(); string v_Item = SLP_SKU1.Text.Trim() == "" ? null : SLP_SKU1.Text.Trim(); #endregion ArrayList ParameterList = new ArrayList();//20091111 #region 存檔前檢查分類正確性 ParameterList.Clear(); ParameterList.Add(v_ROOT_no); ParameterList.Add(v_PMA); ParameterList.Add(null); //category ParameterList.Add(null); //sort_out ParameterList.Add(v_Pattern); ParameterList.Add(v_Item); string vLevel = "1"; if (v_Pattern != null) { vLevel = "P"; } if (v_Item != null) { vLevel = "I"; } ParameterList.Add(vLevel); ALOModel.QueryALOCommon alo_comm = new ALOModel.QueryALOCommon(ConnectionDB); bool bCheck = alo_comm.CheckItemClassValid(ParameterList); if (!bCheck) { throw new Exception("所輸入的品號/Pattern/大分類/群分類有誤,請確認後重新輸入"); } #endregion #region 加入輸入條件 #region Master ParameterList.Clear(); ParameterList.Add(v_DIS_USER); ParameterList.Add(v_ROOT_no); ParameterList.Add(v_PMA); ParameterList.Add(v_Pattern); ParameterList.Add(v_Item); #endregion #endregion ALOModel.MaintinDisPattern BCO = new ALOModel.MaintinDisPattern(ConnectionDB); bool bResult = false; bResult = BCO.CreateDisPattern(ParameterList, null); if (!bResult) { throw new Exception("新增0筆資料!"); } else { ResultMsgLabel.Text = "新增完成"; ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("location.replace('ALO011.aspx?dis_user={0}&Code=ALO01');", Session["UID"].ToString().Trim()), true);//alert('新增完成'); } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } #endregion }
private bool GetTaxType(string strItem, string strPeriod) { #region bool bResult = false; try { //ITMModel.MaintainSKUPeriod BCO = new ITMModel.MaintainSKUPeriod(ConnectionDB); //ParameterList.Clear(); //ITMModel.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "ITEM", strItem, "=", "and"); //ITMModel.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.PERIOD", strPeriod, "=", "and"); // DataTable dt = BCO.QuerySKUPeriodByFind_1(ParameterList); DataTable dt = null; if (strItem != "" && strPeriod != "") { ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strItem); ParameterList.Add(strPeriod); ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); dt = BCO.QueryItemPeriodInfo(ParameterList); } if (dt != null && dt.Rows.Count > 0 && dt.Rows[0]["TAX_TYPE"] != null && dt.Rows[0]["TAX_TYPE"].ToString().Trim() != "") { i_TaxType = Int32.Parse(dt.Rows[0]["TAX_TYPE"].ToString().Trim()); bResult = true; } else { i_TaxType = 0; bResult = false; } } catch (Exception ex) { throw ex; } return bResult; #endregion }
private bool CheckPOSourceNO(string s_ChanNo, string s_Store, string s_StAcceptDate, string s_PoSourceNo, TextBox txt_POSourceNo, out string strErrMsg) { #region bool bResult = true; strErrMsg = ""; try { DataTable dtTemp = dtStorePOSetting; ALOModel.MaintainChainPO BCO = new ALOModel.MaintainChainPO(ConnectionDB); ALOModel.QueryALOCommon BCO2 = new ALOModel.QueryALOCommon(ConnectionDB); ArrayList ParameterList1 = new ArrayList(); if (dtTemp != null && dtTemp.Rows.Count > 0) { #region for (Int32 i = 0; i <= dtTemp.Rows.Count - 1; i++) { //1.根據[DI.群分類+大分類],由[dtStorePOSetting]過濾取得對應通路PO單號控制資訊。 if (s_ROOT_NO == dtTemp.Rows[i]["root_no"].ToString().Trim() && s_PMA == dtTemp.Rows[i]["pma"].ToString().Trim()) { if (dtTemp.Rows[i]["is_dis_bypo"].ToString().Trim() == "0") { if (s_PoSourceNo != "")//2.若查詢之IS_DIS_BYPO=否,則PO單號必須為空白,清空PO單號,並顯示訊息提示使用者。 { #region 不可輸入PO單號 strErrMsg = string.Format("『(通路,門市,群分類,大分類)=({0},{1},{2},{3})時不可輸入通路單號。』", s_ChanNo, s_Store, s_ROOT_NO, s_PMA); txt_POSourceNo.Text = ""; bResult = false; break; #endregion } } else if (dtTemp.Rows[i]["is_dis_bypo"].ToString().Trim() == "1") { if (s_PoSourceNo == "")//3.若IS_DIS_BYPO=是 =>PO單號為必填欄位,檢查是否正確輸入。異常則顯示錯誤訊息,提示使用者。 { #region PO單號為必填 strErrMsg = string.Format("『請輸入通路單號。』"); bResult = false; break; #endregion } #region old //if (dtTemp.Rows[i]["is_multipo"].ToString().Trim() == "0")//4.若IS_DIS_BYPO=是,且IS_MULTIPO=否,=>檢查同品號/期別/門市進貨日/門市是否存在不同PO,若存在則顯示錯誤訊息,不允許更新。 //{ // #region // if (bResult) // { // DataTable dtTempMD = dtDisStore; // for (Int32 k = 0; k <= dtTempMD.Rows.Count - 1; k++) // { // if (dtTempMD.Rows[k]["chan_no"].ToString().Trim() == s_ChanNo && // dtTempMD.Rows[k]["store"].ToString().Trim() == s_Store && // dtTempMD.Rows[k]["item"].ToString().Trim() == s_ITEM && // dtTempMD.Rows[k]["period"].ToString().Trim() == s_PERIOD && // //dtTempMD.Rows[k]["st_accept_date"].ToString().Trim() == s_StAcceptDate &&//todo need to check // dtTempMD.Rows[k]["po_source_no"].ToString().Trim() != s_PoSourceNo && // k != i_CurrentIndexInDisStore) // { // strErrMsg = string.Format("『(通路,門市,群分類,大分類)=({0},{1},{2},{3})時不允許多重PO。』", s_ChanNo, s_Store, s_ROOT_NO, s_PMA); // bResult = false; // break; // } // } // } // #endregion // #region // if (bResult) // { // ParameterList1.Clear(); // ParameterList1.Add(s_ChanNo); // ParameterList1.Add(s_Store); // ParameterList1.Add(s_ITEM); // ParameterList1.Add(s_PERIOD); // ParameterList1.Add(s_StAcceptDate); // ParameterList1.Add(null); // DataTable dtTempPoDetl = BCO.QueryChainPODetlByFind(ParameterList1); // if (dtTempPoDetl != null && dtTempPoDetl.Rows.Count > 0) // { // for (Int32 j = 0; j <= dtTempPoDetl.Rows.Count - 1; j++) // { // if (dtTempPoDetl.Rows[j]["po_source_no"].ToString().Trim() != s_PoSourceNo) // { // strErrMsg = string.Format("『(通路,門市,群分類,大分類)=({0},{1},{2},{3})時不允許多重PO。』", s_ChanNo, s_Store, s_ROOT_NO, s_PMA); // bResult = false; // break; // } // } // } // } // #endregion //} #endregion if (bResult) { #region DataTable dtTempMD = dtDisStore; for (Int32 k = 0; k <= dtTempMD.Rows.Count - 1; k++) { if (dtTempMD.Rows[k]["chan_no"].ToString().Trim() == s_ChanNo && dtTempMD.Rows[k]["store"].ToString().Trim() == s_Store && dtTempMD.Rows[k]["item"].ToString().Trim() == s_ITEM && dtTempMD.Rows[k]["period"].ToString().Trim() == s_PERIOD && dtTempMD.Rows[k]["po_source_no"].ToString().Trim() != s_PoSourceNo && k != i_CurrentIndexInDisStore) { ParameterList1.Clear(); ParameterList1.Add(s_StAcceptDate); ParameterList1.Add(dtTemp.Rows[i]["is_dis_bypo"].ToString().Trim()); ParameterList1.Add(dtTemp.Rows[i]["is_multipo"].ToString().Trim()); ParameterList1.Add(s_ROOT_NO); ParameterList1.Add(s_PMA); ParameterList1.Add(s_ITEM); ParameterList1.Add(s_PERIOD); ParameterList1.Add(s_ChanNo); ParameterList1.Add(s_Store); ParameterList1.Add(s_PoSourceNo); ParameterList1.Add(Session["UID"].ToString()); bResult = BCO2.CheckPODuplicate(ParameterList1, out strErrMsg); if (!bResult) break; } } #endregion } } } } #endregion } #region #region if (bResult) { DataTable dtTempMD = dtDisStore; for (Int32 k = 0; k <= dtTempMD.Rows.Count - 1; k++) { if (dtTempMD.Rows[k]["chan_no", DataRowVersion.Current].ToString().Trim() == s_ChanNo && dtTempMD.Rows[k]["store", DataRowVersion.Current].ToString().Trim() == s_Store && dtTempMD.Rows[k]["item", DataRowVersion.Current].ToString().Trim() == s_ITEM && dtTempMD.Rows[k]["period", DataRowVersion.Current].ToString().Trim() == s_PERIOD && //dtTempMD.Rows[k]["st_accept_date"].ToString().Trim() == s_StAcceptDate &&//todo need to check dtTempMD.Rows[k]["po_source_no", DataRowVersion.Current].ToString().Trim() == s_PoSourceNo && k != i_CurrentIndexInDisStore) { strErrMsg = string.Format("『PK重複(通路,門市,群分類,大分類,進貨日,PO單號)=({0},{1},{2},{3},{4},{5})。』", s_ChanNo, s_Store, s_ROOT_NO, s_PMA, s_StAcceptDate, s_PoSourceNo); bResult = false; break; } } } #endregion #region if (bResult) { ParameterList1.Clear(); ParameterList1.Add(s_ChanNo); ParameterList1.Add(s_Store); ParameterList1.Add(s_ITEM); ParameterList1.Add(s_PERIOD); ParameterList1.Add(s_StAcceptDate); ParameterList1.Add(s_PoSourceNo); bool bTemp = BCO.CheckChainPODetlIsExistedByFind(ParameterList1); if (bTemp) { strErrMsg = string.Format("『PK重複(通路,門市,群分類,大分類,進貨日,PO單號)=({0},{1},{2},{3},{4},{5})。』", s_ChanNo, s_Store, s_ROOT_NO, s_PMA, s_StAcceptDate, s_PoSourceNo); bResult = false; } } #endregion #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } return bResult; #endregion }
public static string GetRootNoByPMAAtServer(string str_PMA) { #region string strResult = ""; try { string strRoot_No = "", strRoot_Name = "", strPMA_Name = ""; ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); DataTable dt = null; ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(str_PMA); ParameterList.Add(null); ParameterList.Add(null); dt = BCO.QueryItemClassInfo(ParameterList); //回傳完整商品ID、NAME資訊(群分類、大分類、Pattern、Item) //0,1:ROOT //2,3:PMA //4,5:PATTERN //6,7:ITEM if (dt != null) { if (dt.Rows.Count > 0) { strRoot_No = dt.Rows[0][0].ToString(); strRoot_Name = dt.Rows[0][1].ToString(); strPMA_Name = dt.Rows[0][3].ToString(); } } strResult = string.Format("{0}||{1}||{2}", strRoot_No, strRoot_Name, strPMA_Name); } catch (Exception ex) { throw ex; } return strResult; #endregion }
/// <summary> /// 取得商品期別資訊 /// </summary> /// <param name="strItem"></param> /// <param name="strPeriod"></param> /// <returns></returns> private bool GetTaxType(string strItem, string strPeriod) { #region bool bResult = false; try { DataTable dt = null; if (strItem != "" && strPeriod != "") { ArrayList ParameterList = new ArrayList();//20091113 ParameterList.Clear(); ParameterList.Add(strItem); ParameterList.Add(strPeriod); ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); dt = BCO.QueryItemPeriodInfo(ParameterList); } if (dt != null && dt.Rows.Count > 0 && dt.Rows[0]["TAX_TYPE"] != null && dt.Rows[0]["TAX_TYPE"].ToString().Trim() != "") { bResult = true; } else { bResult = false; } } catch (Exception ex) { throw ex; } return bResult; #endregion }
private string CheckByItemAndPeriod(string strItem, string strPeriod) { #region string strReuslt = ""; try { ALOModel.QueryALOCommon BCO_comm = new ALOModel.QueryALOCommon(ConnectionDB); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strItem); ParameterList.Add(strPeriod); DataTable dtTemp = BCO_comm.QueryItemPeriodInfo(ParameterList); if (dtTemp.Rows.Count > 0) { strReuslt = dtTemp.Rows[0]["PRICE"].ToString(); } return strReuslt; } catch (Exception ex) { throw ex; } #endregion }
private bool GetPrice(string strItem, string strPeriod) { #region bool bResult = false; try { ALOModel.QueryALOCommon BCO_comm = new ALOModel.QueryALOCommon(ConnectionDB); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strItem); ParameterList.Add(strPeriod); DataTable dtTemp = BCO_comm.QueryItemPeriodInfo(ParameterList); if (dtTemp == null || dtTemp.Rows.Count <= 0) { bResult = false; } else { bResult = true; } return bResult; } catch (Exception ex) { throw ex; } #endregion }
/// <summary> /// 取得群分類、大分類、Pattern分類 /// </summary> /// <param name="strItem"></param> /// <param name="iIncludeNonEffChecked"></param> /// <returns></returns> private bool GetRootPmaPatternByItem(string strItem, out Int32 iIncludeNonEffChecked) { #region bool bResult = false; iIncludeNonEffChecked = 0; try { //20090514 modified:this method is out of order //ParameterList.Clear(); //ITMModel.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.ITEM", strItem, "=", "and"); //ITMModel.MaintainSKU BCO = new ITMModel.MaintainSKU(ConnectionDB); //DataTable dtTemp = BCO.QuerySKUByFind_1(ParameterList); ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); ArrayList ParameterList = new ArrayList();//20091106 ParameterList.Clear(); ParameterList.Add(strItem); DataTable dtTemp = BCO.QueryItemInfo(ParameterList); s_PMA = ""; s_ROOT_NO = ""; s_PATTERN = ""; if (dtTemp != null && dtTemp.Rows.Count != 0) { s_ROOT_NO = dtTemp.Rows[0]["ROOT_NO"].ToString().Trim();//群分類 s_PMA = dtTemp.Rows[0]["PMA"].ToString().Trim();//大分類 s_PATTERN = dtTemp.Rows[0]["PATTERN_NO"].ToString().Trim();//Pattern分類 if (s_ROOT_NO == "1" && !(s_PMA == "13" || s_PMA == "14" || s_PMA == "15" || s_PMA == "16")) iIncludeNonEffChecked = 1; else iIncludeNonEffChecked = 0; bResult = true;//有資料 } else { iIncludeNonEffChecked = 0; bResult = false;//無資料 } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } return bResult; #endregion }
/// <summary> /// 取得該商品各項數據資料 /// </summary> /// <param name="strItem"></param> /// <param name="strPeriod"></param> /// <param name="iStAcceptQty"></param> /// <param name="iBackwardQty"></param> /// <param name="iRealMerit"></param> /// <param name="iRealSalesRate"></param> /// <returns></returns> private bool GetItemPeriodSalesInfo(string strItem, string strPeriod, out Int32 iStAcceptQty, out Int32 iBackwardQty, out Int32 iRealMerit, out double iRealSalesRate) { #region bool bResult = false; iStAcceptQty = 0; iBackwardQty = 0; iRealMerit = 0; iRealSalesRate = 0; try { ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); ArrayList ParameterList1 = new ArrayList();//20091106 ParameterList1.Clear(); ParameterList1.Add(strItem); ParameterList1.Add(strPeriod); DataTable dtTemp = BCO.QueryItemPeriodSalesInfo(ParameterList1); if (dtTemp != null && dtTemp.Rows.Count > 0) { Int32.TryParse(dtTemp.Rows[0]["ACCEPT_QTY"].ToString().Trim(), out iStAcceptQty); Int32.TryParse(dtTemp.Rows[0]["BACKWARD_QTY"].ToString().Trim(), out iBackwardQty); iRealMerit = iStAcceptQty - iBackwardQty; iRealSalesRate = (iStAcceptQty == 0) ? 0 : Math.Round(((double)iRealMerit / (double)iStAcceptQty) * 100, MidpointRounding.AwayFromZero); bResult = true; } } catch (Exception ex) { throw ex; } return bResult; #endregion }
/// <summary> /// 取得配本參數資料 /// </summary> /// <param name="strParam"></param> /// <param name="iRowCounts"></param> /// <returns></returns> private bool GetDisParameter(string strParam, out Int32 iRowCounts) { #region bool bResult = false; iRowCounts = 0; try { ArrayList ParameterList = new ArrayList();//20091106 ParameterList.Clear(); ParameterList.Add(strParam); ALOModel.MaintainDisParameter BCO = new ALOModel.MaintainDisParameter(ConnectionDB); ALOModel.QueryALOCommon BCO2 = new ALOModel.QueryALOCommon(ConnectionDB); dtParam = BCO.QuerySwitch(ALOModel.ALOCommon.QueryType.CODE, ParameterList); if (dtParam != null && dtParam.Rows.Count != 0) { bResult = true; iRowCounts = dtParam.Rows.Count; } else { bResult = false; } if (bResult) { iRowCounts = BCO2.GetDisItemReferCount(dtParam); } vItemReferCount = iRowCounts; } catch (Exception ex) { bResult = false; ErrorMsgLabel.Text = ex.Message; } return bResult; #endregion }
/// <summary> /// 把值傳到Client端 /// </summary> /// <returns></returns> public string GetCallbackResult() { #region string rtn = "", strResult = ""; string strErrMsg = ""; Int32 iIncludeNonEffChecked = 0; Int32 iResult=0; Int32 iStAcceptQty = 0; Int32 iBackwardQty = 0; Int32 iRealMerit = 0; double iRealSalesRate = 0; string[] strAryArg; try { ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); ALOModel.MaintainDisCopy BCO2 = new ALOModel.MaintainDisCopy(ConnectionDB); if (ObjectFrom.IndexOf("ITEM") != -1) { #region if (ObjectFrom.IndexOf("NAME") != -1) { strAryArg = CallServerValue.Split(";".ToCharArray()); rtn = string.Format("{0}", GetItemNameByItem(strAryArg[0])); } else { if (GetRootPmaPatternByItem(CallServerValue, out iIncludeNonEffChecked)) rtn = string.Format("{0}-{1}-{2}", "1", iIncludeNonEffChecked, s_PATTERN); else rtn = string.Format("{0}-{1}-{2}", "0", iIncludeNonEffChecked, s_PATTERN); } #endregion } else if (ObjectFrom.IndexOf("PERIOD") != -1) { #region strAryArg = CallServerValue.Split(";".ToCharArray()); if (strAryArg[0].Trim() != "" && strAryArg[1].Trim() != "" && strAryArg[2].Trim() != "") { s_ISS_DATE = ""; i_DIS_ISU_QTY = 0; i_ONHD_QTY = 0; if (GetItemPeriodDisStateByItemPeriod(strAryArg[0], strAryArg[1], strAryArg[2], out strErrMsg)) rtn = string.Format("{0}-{1}-{2}-{3}-{4}", "1", strErrMsg, s_ISS_DATE, i_DIS_ISU_QTY, i_ONHD_QTY); else rtn = string.Format("{0}-{1}-{2}-{3}-{4}", "0", strErrMsg, s_ISS_DATE, i_DIS_ISU_QTY, i_ONHD_QTY); } else { rtn = string.Format("{0}-{1}-{2}-{3}-{4}", "0", string.Format("(品號/品名,期別,門市進貨日)=({0},{1},{2})輸入不完整", strAryArg[0], strAryArg[1], strAryArg[2]), "", "", ""); } #endregion } else if (ObjectFrom.IndexOf("PARAM") != -1) { #region strAryArg = CallServerValue.Split(";".ToCharArray()); if (strAryArg[0] == "1")//要清除 dtDisItemRefer { //dtDisItemRefer.Clear(); for (Int32 i = dtDisItemRefer.Rows.Count - 1; i >= 0; i--) { dtDisItemRefer.Rows.RemoveAt(i); } hiddenDtDisItemReferCounts.Value = dtDisItemRefer.Rows.Count.ToString(); gv_ItemRefer.DataBind(); UpdatePanel1.Update(); } if (GetDisParameter(strAryArg[1], out iResult)) { rtn = string.Format("{0}-{1}-{2}", "1", iResult, strAryArg[0]); } else { rtn = string.Format("{0}-{1}-{2}", "0", iResult, strAryArg[0]); } #endregion } else if (ObjectFrom.IndexOf("DELETENEWGVROW") != -1) { #region dtDisItemRefer.Rows.RemoveAt(iEditingRowIndex); gv_ItemRefer.EditIndex = -1; gv_ItemRefer.DataSource = dtDisItemRefer; gv_ItemRefer.DataBind(); if (dtDisItemRefer.Rows.Count <= 0) { dtDisItemRefer.Clear(); } #endregion } else if (ObjectFrom.IndexOf("SALESINFO") != -1) { #region strAryArg = CallServerValue.Split(";".ToCharArray()); if (strAryArg[0].Trim() != "" && strAryArg[1].Trim() != "") { if (CheckDisItemAndDisItemReferIsAlreadyExisted(strAryArg[0], strAryArg[1])) { if (GetItemPeriodSalesInfo(strAryArg[0], strAryArg[1], out iStAcceptQty, out iBackwardQty, out iRealMerit, out iRealSalesRate)) { rtn = string.Format("{0}||{1}||{2}||{3}||{4}||X", iStAcceptQty, iBackwardQty, iRealMerit, iRealSalesRate, GetItemReferRate()); } else { rtn = string.Format("{0}||{1}||{2}||{3}||{4}||查無銷售實績,不可做為參考品項", iStAcceptQty, iBackwardQty, iRealMerit, iRealSalesRate, GetItemReferRate()); } } else { rtn = string.Format("{0}||{1}||{2}||{3}||{4}||參照品項不可與配本品項同期別或重複參照", iStAcceptQty, iBackwardQty, iRealMerit, iRealSalesRate, GetItemReferRate()); } } else { rtn = string.Format("{0}||{1}||{2}||{3}||{4}||(品號,期別)=({5},{6})輸入不完整", iStAcceptQty, iBackwardQty, iRealMerit, iRealSalesRate, GetItemReferRate(), strAryArg[0], strAryArg[1]); } #endregion } //附加相關控制項 if (ObjectFrom.IndexOf("ITEM") != -1) { #region if (ObjectFrom.IndexOf("NAME") != -1) { strAryArg = CallServerValue.Split(";".ToCharArray()); strResult = string.Format("{0}-{1};{2}",strAryArg[1],strAryArg[2], rtn); } else { strResult = string.Format("{0}-{1}-{2};{3}", hiddenItemIsAvailable.ClientID, ((CheckBox)SLP_Boolean1.FindControl("C1")).ClientID, hiddenPatternNo.ClientID, rtn); } #endregion } else if (ObjectFrom.IndexOf("PERIOD") != -1) { #region strResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6};{7}", hiddenDisplayMode.ClientID, Panel_AddNewItem.ClientID, ((TextBox)SLP_SLPDate3.FindControl("TextBoxCode")).ClientID, ((TextBox)SLP_SLPNumber1.FindControl("TextBoxCode")).ClientID, ((TextBox)SLP_SLPNumber2.FindControl("TextBoxCode")).ClientID, ((TextBox)SLP_PARAM1.FindControl("TextBoxCode")).ClientID, ((TextBox)SLP_ItemPeriod1.FindControl("TextBoxCode")).ClientID, rtn); #endregion } else if (ObjectFrom.IndexOf("PARAM") != -1) { #region strResult = string.Format("{0}-{1};{2}", ((TextBox)SLP_PARAM1.FindControl("TextBoxCode")).ClientID, hiddenItemReferCountAllowed.ClientID, rtn); #endregion } else if (ObjectFrom.IndexOf("DELETENEWGVROW") != -1) { #region //無需回傳結果 #endregion } else if (ObjectFrom.IndexOf("SALESINFO") != -1) { #region strAryArg = CallServerValue.Split(";".ToCharArray()); strResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6};{7}", strAryArg[2], strAryArg[3], strAryArg[4], strAryArg[5], strAryArg[6], strAryArg[7], strAryArg[8], rtn); #endregion } } catch (Exception ex) { throw ex;//直接拋出給前端處理 } return strResult; #endregion }
private void GetItemPeriodStock(string strItem, string strPeriod) { #region try { CRMModel.QueryCRMCommon BCO = new CRMModel.QueryCRMCommon(ConnectionDB); DataTable dtTemp = new DataTable(); dtTemp.Clear(); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strItem); ParameterList.Add(strPeriod); ParameterList.Add("0");//2009-10-08 cyhsu :0進貨1退貨2庫存 ParameterList.Add(Session["UID"].ToString()); dtTemp = BCO.QUERY_ITEM_PERIODSTOCK(ParameterList); i_ONHD_QTY = 0; i_ACCEPT_QTY = 0; i_RESERVE_QTY = 0; i_DIS_QTY = 0; i_DIS_MDC_QTY = 0; i_DIS_ISU_QTY = 0; if (dtTemp != null && dtTemp.Rows.Count != 0) { i_ONHD_QTY = Int32.Parse(dtTemp.Rows[0]["ONHD_QTY"].ToString());//庫存數 i_ACCEPT_QTY = Int32.Parse(dtTemp.Rows[0]["ONHD_QTY"].ToString());//到貨數 i_RESERVE_QTY = Int32.Parse(dtTemp.Rows[0]["RESERVE_QTY"].ToString());//保留數 i_DIS_QTY = 0;// Int32.Parse(dtTemp.Rows[0]["DIS_QTY"].ToString());//實配數 i_DIS_MDC_QTY = i_ONHD_QTY - i_DIS_QTY - i_RESERVE_QTY;//預留數 } ALOModel.QueryALOCommon BCO2 = new ALOModel.QueryALOCommon(ConnectionDB); ArrayList ParameterList1 = new ArrayList(); ParameterList1.Clear(); ParameterList1.Add(strItem); ParameterList1.Add(strPeriod); ParameterList1.Add(s_ROOT_NO); i_DIS_ISU_QTY = BCO2.QueryPurchaseQty(ParameterList1);//採購數 } catch (Exception ex) { throw ex; } #endregion }
protected void btn_Save_Click(object sender, EventArgs e) { #region try { #region if (SLP_RootNo1.Text != "" && SLP_PMA1.Text != "") { #region 存檔前檢查分類正確性 ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(SLP_RootNo1.Text.Trim()); ParameterList.Add(SLP_PMA1.Text.Trim()); ParameterList.Add(null);//category ParameterList.Add(null);//sort_out ParameterList.Add(null);//pattern ParameterList.Add(null);//item string vLevel = "1"; ParameterList.Add(vLevel); ALOModel.QueryALOCommon alo_comm = new ALOModel.QueryALOCommon(ConnectionDB); bool bCheck = alo_comm.CheckItemClassValid(ParameterList); if (!bCheck) { throw new Exception("所輸入的群分類、大分類有誤,請確認後重新輸入"); } #endregion #region MKTModel.VDS_MKT22_BCO BCO = new MKTModel.VDS_MKT22_BCO(ConnectionDB); string strID = "", strErrMsg = ""; bool bResult = false; bResult = BCO.ADD_UN_TAG_PMA(GetQueryParams(), null, out strID, out strErrMsg); if (bResult && strErrMsg == "") { ArrayList aryTmp = new ArrayList(); aryTmp.Clear(); aryTmp.Add(strID); aryParamsPKey = aryTmp; CurrentPageMode = PageCurrentMode.Readonly; SetControlsByCurrentPageMode(); ErrorMsgLabel.Text = "新增成功"; } else { ErrorMsgLabel.Text = strErrMsg; } #endregion } else { ErrorMsgLabel.Text = "請輸入通路、門市"; } #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; UpdatePanel1.Update(); } #endregion }//btn_Save_Click
/// <summary> /// 把值傳到Client端 /// </summary> /// <returns></returns> public string GetCallbackResult() { string rtn = "", strResult = ""; ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); ALOModel.MaintainDisStoreMemo BCO2 = new ALOModel.MaintainDisStoreMemo(ConnectionDB); DataTable dt = null; string strChan_No = "", strChan_Name = "", strStore_Name = "", strItemStateDesc = ""; Int32 iResult = 0; ArrayList ParameterList = new ArrayList();//20091113 if (ObjectFrom.IndexOf("ITEM") != -1) { #region if (CallServerValue != "") { ParameterList.Clear(); ParameterList.Add(CallServerValue); strItemStateDesc = BCO.CheckCurrentItemState(ParameterList); } else { strItemStateDesc = "品號必填"; } rtn = string.Format("{0}", strItemStateDesc); #endregion } else if (ObjectFrom.IndexOf("STORE") != -1) { #region string[] strAry = CallServerValue.Split("_".ToCharArray()); ParameterList.Clear(); ParameterList.Add(strAry[0]);//Store dt = BCO2.QueryChanNoByStore(ParameterList); if (dt != null && dt.Rows.Count > 0) { strChan_No = dt.Rows[0][0].ToString().Trim(); strChan_Name = dt.Rows[0][1].ToString().Trim(); strStore_Name = dt.Rows[0][3].ToString().Trim(); if (strChan_No != strAry[1] && strAry[1] != "") strStore_Name = "查無資料"; } else { strStore_Name = "查無資料"; } rtn = string.Format("{0}-{1}-{2}", strChan_No, strChan_Name, strStore_Name); #endregion } //附加相關控制項 if (ObjectFrom.IndexOf("ITEM") != -1) { strResult = string.Format("{0};{1}", hiddenItemStateDesc.ClientID, rtn); } else if (ObjectFrom.IndexOf("STORE") != -1) { TextBox txtStoreChain2 = (TextBox)SLP_StoreChain2.FindControl("TextBoxCode"); strResult = string.Format("{0};{1}", txtStoreChain2.ClientID, rtn); } return strResult; }
}//btn_Save_Click protected void btn_Delete_Click(object sender, EventArgs e) { #region try { #region if (SLP_RootNo1.Text != "" && SLP_PMA1.Text != "") { #region 存檔前檢查分類正確性 ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(SLP_RootNo1.Text.Trim()); ParameterList.Add(SLP_PMA1.Text.Trim()); ParameterList.Add(null);//category ParameterList.Add(null);//sort_out ParameterList.Add(null);//pattern ParameterList.Add(null);//item string vLevel = "1"; ParameterList.Add(vLevel); ALOModel.QueryALOCommon alo_comm = new ALOModel.QueryALOCommon(ConnectionDB); bool bCheck = alo_comm.CheckItemClassValid(ParameterList); if (!bCheck) { throw new Exception("所輸入的群分類、大分類有誤,請確認後重新輸入"); } #endregion #region MKTModel.VDS_MKT22_BCO BCO = new MKTModel.VDS_MKT22_BCO(ConnectionDB); BCO.DEL_UN_TAG_PMA(GetQueryParams(), null); ErrorMsgLabel.Text = "刪除成功"; SLP_RootNo1.Text = ""; SLP_PMA1.Text = ""; string strJS = string.Format("alert('刪除成功');location.replace('MKT221.aspx?Code=MKT22&PageTimeStamp={0}');", PageTimeStamp.Value); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DELETE_OK", strJS, true); #endregion } else { ErrorMsgLabel.Text = "請輸入通路、門市"; } #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } #endregion }//btn_Delete_Click
private void CheckByItem() { #region try { if (SLP_SKU1.Text.Trim() != "") { ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); ArrayList ParameterList = new ArrayList();//20091113 ParameterList.Clear(); ParameterList.Add(SLP_SKU1.Text.Trim()); string strResult = BCO.CheckCurrentItemState(ParameterList); vItemStateDesc = strResult; if (vItemStateDesc != "") { rBtn_Active.Checked = false; rBtn_Inactive.Checked = true; boolStoreStateActive = false; lbl_StoreStatus.ForeColor = System.Drawing.Color.Red; btn_Check.Enabled = true; } else { rBtn_Active.Checked = true; rBtn_Inactive.Checked = false; boolStoreStateActive = true; lbl_StoreStatus.ForeColor = System.Drawing.Color.Empty; btn_Check.Enabled = false; } } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } #endregion }
protected void btn_UpdateRecord_Click(object sender, EventArgs e) { #region try { string v_ROOT_no = SLP_ROOT.Text.Trim() == "" ? null : SLP_ROOT.Text.Trim(); string v_PMA = SLP_PMA.Text.Trim() == "" ? null : SLP_PMA.Text.Trim(); string v_Pattern = SLP_Pattern.Text.Trim() == "" ? null : SLP_Pattern.Text.Trim(); string v_Item = SLP_Item.Text.Trim() == "" ? null : SLP_Item.Text.Trim(); #region 存檔前檢查分類正確性 ArrayList ParameterList = new ArrayList();//20091112 ParameterList.Clear(); ParameterList.Add(v_ROOT_no); ParameterList.Add(v_PMA); ParameterList.Add(null); //category ParameterList.Add(null); //sort_out ParameterList.Add(v_Pattern); ParameterList.Add(v_Item); string vLevel = "1"; if (v_Pattern != null) { vLevel = "P"; } if (v_Item != null) { vLevel = "I"; } ParameterList.Add(vLevel); ALOModel.QueryALOCommon alo_comm = new ALOModel.QueryALOCommon(ConnectionDB); bool bCheck = alo_comm.CheckItemClassValid(ParameterList); if (!bCheck) { throw new Exception("所輸入的品號/Pattern/大分類/群分類有誤,請確認後重新輸入"); } #endregion DataTable dtTemp = null; string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); ALOModel.MaintainStoreAssignItem BCO = new ALOModel.MaintainStoreAssignItem(ConnectionDB); STM_SLP_StoreChain SLP_StoreChain1 = (STM_SLP_StoreChain)FormView1.FindControl("SLP_StoreChain1"); PIC.VDS2G.WebUI.SLP.SLP_Store SLP_Store1 = (PIC.VDS2G.WebUI.SLP.SLP_Store)FormView1.FindControl("SLP_Store1"); dtTemp = GetTempDataTableByCurrentMode(); if (dtTemp != null) { for (Int32 i = 0; i <= dtTemp.Rows.Count - 1; i++) { if (dtTemp.Rows[i].RowState != DataRowState.Deleted) { if (dtTemp.Rows[i]["ROOT_NO"].ToString().Trim() == SLP_ROOT.Text.Trim() && //20120813 rika insert dtTemp.Rows[i]["PMA"].ToString().Trim() == SLP_PMA.Text.Trim() && dtTemp.Rows[i]["PATTERN"].ToString().Trim() == SLP_Pattern.Text.Trim() && dtTemp.Rows[i]["ITEM"].ToString().Trim() == SLP_Item.Text.Trim()) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "ClientScript", "alert('此資料存在於該門市');", true); return; } } } DataRow dr = dtTemp.NewRow(); dr["rownum"] = dtTemp.Rows.Count + 1; dr["ROOT_NO"] = SLP_ROOT.Text.Trim(); dr["pma"] = SLP_PMA.Text.Trim(); dr["pattern"] = SLP_Pattern.Text.Trim(); dr["item"] = SLP_Item.Text.Trim(); dr["CHAIN_CODE"] = SLP_StoreChain1.Text.Trim(); dr["STORE_CODE"] = SLP_Store1.Text.Trim(); #region DataTable dtTempForNewRecord = GetInfoForNewRecord(SLP_StoreChain1.Text.Trim(), SLP_Store1.Text.Trim(), SLP_ROOT.Text.Trim(), SLP_PMA.Text.Trim(), SLP_Pattern.Text.Trim(), SLP_Item.Text.Trim()); if (dtTempForNewRecord != null && dtTempForNewRecord.Rows.Count > 0) { dr["ROOT_NAME"] = dtTempForNewRecord.Rows[0]["ROOT_NAME"]; dr["PMA_NAME"] = dtTempForNewRecord.Rows[0]["PMA_NAME"]; dr["Pattern_Name"] = dtTempForNewRecord.Rows[0]["Pattern_Name"]; dr["item_name"] = dtTempForNewRecord.Rows[0]["item_name"]; dr["period"] = dtTempForNewRecord.Rows[0]["period"]; dr["st_accept_qty"] = dtTempForNewRecord.Rows[0]["st_accept_qty"]; dr["backward_qty"] = dtTempForNewRecord.Rows[0]["backward_qty"]; dr["realsale_qty"] = dtTempForNewRecord.Rows[0]["realsale_qty"]; } #endregion SetCommonDataForDataRow(dtTemp, dr); SetMasterInfoData(dtTemp); GridView2.DataSource = dtTemp; GridView2.DataBind(); Session[SessionIDName] = dtTemp; } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { Panel_AddSingle.Visible = false; } #endregion }
private string GetItemValueByPageMethod(string CallServerValue) { #region ALOModel.QueryALOCommon BCOCommon = new ALOModel.QueryALOCommon(ConnectionDB); string rtn = ""; try { ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add((CallServerValue.Split(";".ToCharArray()))[0]); ParameterList.Add((CallServerValue.Split(";".ToCharArray()))[1]); ParameterList.Add(""); rtn = BCOCommon.GetMaxUnIssuancePeriod(ParameterList); } catch (Exception ex) { throw ex; } finally { BCOCommon.CloseConnection(); } return rtn; #endregion }
}//Page_Load private void QueryData() { #region string SessionIDName = string.Format("{0}_{1}", strPrefixed, PageTimeStamp.Value); DataTable dt = new DataTable(); ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); string strQueryType = GetQueryTypeOfCalssAndItem(); string strWhere = ""; strWhere = GetQuerySQLStatement(); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strWhere); Int32 iTopRowNum; Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRowNum); ParameterList.Add(iTopRowNum); switch (strQueryType) { #region case "1": if (SLP_Item1.Text.Trim() == "" && SLP_Item2.Text.Trim() == "") { //選擇大分類查詢結果,且商品起迄輸入為空值時 dt = BCO.QuerySwitch(PIC.VDS2G.BSM.ALO.QueryALOCommon.QueryTypeOfCalssAndItem.PMA, ParameterList); } else { //選擇大分類查詢結果,且商品起迄輸入不為空值時 dt = BCO.QuerySwitch(PIC.VDS2G.BSM.ALO.QueryALOCommon.QueryTypeOfCalssAndItem.PMA2, ParameterList); } break; case "2": if (SLP_Item1.Text.Trim() == "" && SLP_Item2.Text.Trim() == "") { //選擇Pattern查詢結果,且商品起迄輸入為空值時 dt = BCO.QuerySwitch(PIC.VDS2G.BSM.ALO.QueryALOCommon.QueryTypeOfCalssAndItem.PATTERN, ParameterList); } else { //選擇Pattern查詢結果,且商品起迄輸入不為空值時 dt = BCO.QuerySwitch(PIC.VDS2G.BSM.ALO.QueryALOCommon.QueryTypeOfCalssAndItem.PATTERN2, ParameterList); } break; case "3": //選擇商品查詢結果時 dt = BCO.QuerySwitch(PIC.VDS2G.BSM.ALO.QueryALOCommon.QueryTypeOfCalssAndItem.ITEM, ParameterList); break; default: dt = BCO.QuerySwitch(PIC.VDS2G.BSM.ALO.QueryALOCommon.QueryTypeOfCalssAndItem.EMPTY, ParameterList); break; #endregion } bAfterQueryDataBinding = true; if (!dt.Columns.Contains("CHECKED"))//增加欄位以方便判別是否可 dt.Columns.Add("CHECKED"); if (!dt.Columns.Contains("ROWID"))//2010/03/09 added:增加欄位以判別勾選與否 dt.Columns.Add("ROWID"); hidden_RowID_MaxID.Value = dt == null ? "-1" : (dt.Rows.Count - 1).ToString();//2010/03/09 added:記錄最大ROWID hidden_RowID_Selected.Value = "";//2010/03/09 added:清空已選ROWID Session[SessionIDName] = dt; SetRowIDToDataTable(true);//2010/03/09 added:設定ROWID GridView1.DataSource = dt; GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); GridView1.SelectedIndex = -1; GridView2.DataSource = null; GridView2.DataBind(); bAfterQueryDataBinding = false; LabelQueryRecordCount.Text = string.Format(" {0} Rows ", dt.Rows.Count.ToString()); if (dt == null || (dt != null && dt.Rows.Count <= 0)) { ResultMsgLabel.Text = "查無資料"; } #endregion }
/// <summary> /// 把值傳到Client端 /// </summary> /// <returns></returns> public string GetCallbackResult() { string rtn = "", strResult = ""; ALOModel.MaintinDisPattern BCO = new ALOModel.MaintinDisPattern(ConnectionDB); ALOModel.MaintainDisStoreMemo BCO2 = new ALOModel.MaintainDisStoreMemo(ConnectionDB); ALOModel.MaintainStoreOrderItem BCO3 = new ALOModel.MaintainStoreOrderItem(ConnectionDB); ALOModel.MaintainStoreAssignItem BCO4 = new ALOModel.MaintainStoreAssignItem(ConnectionDB); ALOModel.QueryALOCommon BCOCommon = new ALOModel.QueryALOCommon(ConnectionDB); DataTable dt = null; DataTable dt2 = null; DataTable dt3 = null; string strChan_No = "", strChan_Name = "", strStore_Name = "", strCommemt = "", strConfirm = "", strStoreStateDesc = ""; Int32 iResult = 0; if (ObjectFrom.IndexOf("STORE") != -1) { #region string[] strAry = CallServerValue.Split("_".ToCharArray()); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strAry[0]);//Store dt = BCO2.QueryChanNoByStore(ParameterList); dt3 = BCO3.CheckSettingStateByStore(ParameterList); if (dt != null && dt.Rows.Count > 0) { strChan_No = dt.Rows[0][0].ToString().Trim(); strChan_Name = dt.Rows[0][1].ToString().Trim(); strStore_Name = dt.Rows[0][3].ToString().Trim(); #region ParameterList.Clear(); ParameterList.Add(strAry[1] != "" ? strAry[1] : strChan_No);//Chan_No ParameterList.Add(strAry[0]);//Store dt2 = BCO2.QueryMemoByChanAndStore(ParameterList);//get memo #endregion if (strChan_No != strAry[1] && strAry[1] != "") strStore_Name = "查無資料"; ParameterList.Clear(); ParameterList.Add(dt.Rows[0][0].ToString()); ParameterList.Add(strAry[0]); strStoreStateDesc = BCO4.CheckByChanAndStore(ParameterList); if (strChan_No != strAry[1] && strAry[1] != "") strStoreStateDesc = "輸入門市不屬於輸入通路"; } else { strStore_Name = "查無資料"; strStoreStateDesc = "輸入門市不屬於輸入通路"; if (strAry[0] == "" || strAry[1] == "") strStoreStateDesc = "通路、門市必填"; } if (dt2 != null && dt2.Rows.Count > 0) { strCommemt = dt2.Rows[0][0].ToString().Trim(); if (strChan_No != strAry[1] && strAry[1] != "") strCommemt = ""; if (strCommemt == "") strCommemt = "無設定備註"; } else { strCommemt = "無設定備註"; } if (dt3 != null && dt3.Rows.Count > 0) { Int32.TryParse(dt3.Rows[0][0].ToString().Trim(), out iResult); strConfirm = iResult.ToString(); } else { strConfirm = "0"; } rtn = string.Format("{0}||{1}||{2}||{3}||{4}||{5}", strChan_No, strChan_Name, strStore_Name, strCommemt, strConfirm, strStoreStateDesc); #endregion } else if (ObjectFrom.IndexOf("ITEM") != -1) { #region ArrayList ParameterList2 = new ArrayList(); ParameterList2.Clear(); ParameterList2.Add((CallServerValue.Split(";".ToCharArray()))[0]); ParameterList2.Add((CallServerValue.Split(";".ToCharArray()))[1]); ParameterList2.Add(""); rtn = BCOCommon.GetMaxUnIssuancePeriod(ParameterList2); #endregion } //附加相關控制項 if (ObjectFrom.IndexOf("STORE") != -1) { TextBox txtStoreChain1 = (TextBox)SLP_StoreChain1.FindControl("TextBoxCode"); TextBox txtStoreChain2 = (TextBox)SLP_StoreChain2.FindControl("TextBoxCode"); if (ObjectFrom.IndexOf("1") != -1) { strResult = string.Format("{0}||{1}||{2}||{3}||{4};{5}", txtStoreChain1.UniqueID, txt_Comment.UniqueID, hiddenCounts.UniqueID, hiddenStoreStateDesc.UniqueID, btn_EditComment.ClientID, rtn); } else if (ObjectFrom.IndexOf("2") != -1) { strResult = string.Format("{0}||{1}||{2}||{3}||{4};{5}", txtStoreChain2.UniqueID, txt_Comment.UniqueID, hiddenCounts.UniqueID, hiddenStoreStateDesc.UniqueID, btn_EditComment.ClientID, rtn); } } else if (ObjectFrom.IndexOf("ITEM") != -1) { TextBox txtPeriodSt = (TextBox)SLP_ItemPeriod5.FindControl("TextBoxCode"); strResult = string.Format("{0},{1}", txtPeriodSt.UniqueID, rtn); } return strResult; }
private bool GetRouteStepByStore(string strChan, string strStore, string strStAcceptDate) { #region bool bResult = false; try { ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); ArrayList ParameterList1 = new ArrayList(); ParameterList1.Clear(); ParameterList1.Add(strChan); ParameterList1.Add(strStore); ParameterList1.Add(strStAcceptDate); string strRoute, strTransNo, strStep; //Int32 iStep; BCO.QueryEffectRouteAndStep(ParameterList1, out strRoute, out strStep, out strTransNo); if (strRoute != "") { s_ROUTE = strRoute; s_STEP = strStep; s_TRANS_NO = strTransNo; bResult = true; } else { s_ROUTE = ""; s_STEP = ""; s_TRANS_NO = ""; bResult = false; } } catch (Exception ex) { throw ex; } return bResult; #endregion }
public static ALOModel.ALOCommon.PERIODWithChanSale GetPeriodWithSalesItem(ALOModel.ALOCommon.PERIODWithChanSale PERIODWithChanSaleObject) { try { ALOModel.QueryALOCommon PeriodProc = new ALOModel.QueryALOCommon(ConnectionDB); #region 輸入變數 ArrayList ParameterList = new ArrayList();//20091113 ParameterList.Clear(); //品號 ParameterList.Add(PERIODWithChanSaleObject.Item); //期別 ParameterList.Add(PERIODWithChanSaleObject.Period); //通路 ParameterList.Add(PERIODWithChanSaleObject.ChanNO); #endregion DataTable Dt = PeriodProc.QueryItemPeriodChanSalesInfo(ParameterList); if (Dt.Rows.Count == 0) { PERIODWithChanSaleObject.NoDataErrorMsg = "查無銷售實績,不可做為參考品項!"; } else { //進貨 PERIODWithChanSaleObject.AcceptQty = Dt.Rows[0]["ACCEPT_QTY"].ToString(); //退貨 PERIODWithChanSaleObject.BackWardQty = Dt.Rows[0]["BACKWARD_QTY"].ToString(); //實績 int iRealSale = int.Parse(PERIODWithChanSaleObject.AcceptQty) - int.Parse(PERIODWithChanSaleObject.BackWardQty); PERIODWithChanSaleObject.RealSale = iRealSale.ToString(); //實銷率 double iRealSalePercent = double.Parse(PERIODWithChanSaleObject.RealSale) / double.Parse(PERIODWithChanSaleObject.AcceptQty) * 100; PERIODWithChanSaleObject.RealSalePercent = Math.Round(iRealSalePercent, 0).ToString(); //錯誤訊息 PERIODWithChanSaleObject.NoDataErrorMsg = ""; } return PERIODWithChanSaleObject; } catch (Exception ex) { throw ex; } }
/// <summary> /// 把值傳到Client端 /// </summary> /// <returns></returns> public string GetCallbackResult() { #region string rtn = "", strResult = ""; string strErrMsg = ""; string[] strAryArg; try { ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); ALOModel.MaintainDisCopy BCO2 = new ALOModel.MaintainDisCopy(ConnectionDB); s_CallServerData_STORE = ""; if (ObjectFrom.IndexOf("ITEM") != -1) { #region strAryArg = CallServerValue.Split(";".ToCharArray()); GetItemNameByItem(strAryArg[0]); rtn = string.Format("{0}-{1}", s_ITEM_NAME, s_PMA_NAME); #endregion } else if (ObjectFrom.IndexOf("STORE") != -1) { #region strAryArg = CallServerValue.Split(";".ToCharArray()); s_STORE_NAME = ""; s_STORE_OPEN_DATE = ""; s_ROUTE = ""; s_STEP = ""; strErrMsg = ""; if (strAryArg[1] != "") { GetStorePOSetting(strAryArg[0], strAryArg[1]); if (GetOpenDateByStore(strAryArg[0], strAryArg[1])) { if (!GetRouteStepByStore(strAryArg[0], strAryArg[1], strAryArg[2])) { strErrMsg = "此門市無有效路線路順"; } } else { strErrMsg = "無此門市資訊"; } } rtn = string.Format("{0}-{1}-{2}-{3}-{4}", s_STORE_NAME, s_STORE_OPEN_DATE, s_ROUTE, s_STEP, strErrMsg); #endregion } else if (ObjectFrom.IndexOf("CHAN") != -1) { #region GetChanPOSetting(CallServerValue); #endregion } else if (ObjectFrom.IndexOf("PERIOD") != -1) { #region strAryArg = CallServerValue.Split(";".ToCharArray()); if (GetTaxType(strAryArg[0], strAryArg[1])) { if (CheckItemPeriodIsDuplicated(strAryArg[0], strAryArg[1])) { if (GetItemPeriodStock(strAryArg[0], strAryArg[1])) { rtn = string.Format("{0}||{1}||{2}||X", i_ONHD_QTY, i_RESERVE_QTY, i_DIS_ENABLE); } else { rtn = string.Format("{0}||{1}||{2}||無可出庫商品,請輸入其他品項", i_ONHD_QTY, i_RESERVE_QTY, i_DIS_ENABLE); } } else { rtn = string.Format("{0}||{1}||{2}||品號、期別重複輸入", i_ONHD_QTY, i_RESERVE_QTY, i_DIS_ENABLE); } } else { rtn = string.Format("{0}||{1}||{2}||無此期別,請輸入其他期別", i_ONHD_QTY, i_RESERVE_QTY, i_DIS_ENABLE); } #endregion } else if (ObjectFrom.IndexOf("PROCESSCONFIRM") != -1) { #region strAryArg = CallServerValue.Split(";".ToCharArray()); rtn = ProcessConfirm(strAryArg[0], strAryArg[1]); #endregion } #region 附加相關控制項 if (ObjectFrom.IndexOf("ITEM") != -1) { strAryArg = CallServerValue.Split(";".ToCharArray()); strResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6};{7}", strAryArg[1], strAryArg[2], strAryArg[3], strAryArg[4], strAryArg[5], strAryArg[6], strAryArg[7], rtn); } else if (ObjectFrom.IndexOf("STORE") != -1) { strAryArg = CallServerValue.Split(";".ToCharArray()); strResult = string.Format("{0}-{1}-{2}-{3};{4}", strAryArg[3], strAryArg[4], strAryArg[5], strAryArg[6], rtn); s_CallServerData_STORE = strResult; } else if (ObjectFrom.IndexOf("CHAN") != -1) { //不回傳值 } else if (ObjectFrom.IndexOf("PERIOD") != -1) { #region strAryArg = CallServerValue.Split(";".ToCharArray()); strResult = string.Format("{0}-{1}-{2}-{3};{4}", strAryArg[2], strAryArg[3], strAryArg[4], strAryArg[5], rtn); #endregion } else if (ObjectFrom.IndexOf("PROCESSCONFIRM") != -1) { //回傳結果格式為: //確認日期ClientID,確認按鈕ClientID,解除按鈕ClientID,結果訊息區ClientID,執行狀態隱藏欄位ClientID,確認日期,執行結果,執行狀態訊息 strResult = rtn; } #endregion } catch (Exception ex) { throw ex;//直接拋出給前端處理 } return strResult; #endregion }
public DataTable QueryPatternSpecByFindForPattern(ArrayList Paramslist) { #region try { VDS_ALO_PATTERNSPEC_MAIN_DBO ALOM = new VDS_ALO_PATTERNSPEC_MAIN_DBO(ref USEDB); QueryALOCommon ALOCommon = new QueryALOCommon(strConn); DataTable dt = ALOM.doQueryByFindForPattern(Paramslist); #region ArrayList ParameterList = new ArrayList(); string strStstusCode = "", strStstus = "", strStstusDesc = ""; if (dt != null) { for (Int32 i = 0; i <= dt.Rows.Count - 1; i++) { strStstusCode = ""; strStstus = ""; strStstusDesc = ""; ParameterList.Clear(); ParameterList.Add(dt.Rows[i]["chan_no"]); ParameterList.Add(dt.Rows[i]["store"]); strStstusDesc = ALOCommon.CheckCurrentStoreState(ParameterList); if (strStstusDesc.Trim() != "") { strStstus = "未生效"; strStstusCode = "0"; } else { strStstus = "生效"; strStstusCode = "1"; } if (strStstusDesc.Trim().Length > 0) { if (strStstusDesc.Substring(strStstusDesc.Length - 1, 1) == ",") { strStstusDesc = strStstusDesc.Substring(0, strStstusDesc.Length - 1); } } dt.Rows[i]["storestatusCode"] = strStstusCode; dt.Rows[i]["storestatus"] = strStstus; dt.Rows[i]["storestatusdesc"] = strStstusDesc; } } #endregion return dt; } catch (Exception ex) { throw GetNewException(ex); } #endregion }
private string ProcessQueryItemClassInfo(string strParamValue, string strCtrlCallingFrom, string strRootNoClientID, string strPMAClientID, string strPatternClientID,string strItemClientID) { #region string strCallbackResult = ""; try { ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); DataTable dt = null; ArrayList ParameterList = new ArrayList();//20091111 ParameterList.Clear(); if (strCtrlCallingFrom == "PMA") { ParameterList.Add(strParamValue); ParameterList.Add(null); ParameterList.Add(null); dt = BCO.QueryItemClassInfo(ParameterList); } else if (strCtrlCallingFrom == "PATTERN") { ParameterList.Add(null); ParameterList.Add(strParamValue); ParameterList.Add(null); dt = BCO.QueryItemClassInfo(ParameterList); } else if (strCtrlCallingFrom == "ITEM") { ParameterList.Add(null); ParameterList.Add(null); ParameterList.Add(strParamValue); dt = BCO.QueryItemClassInfo(ParameterList); } if (dt != null) { if (dt.Rows.Count > 0) { string strCtrlPending = "";//附加相關控制項 string strItemClassInfo = ""; strItemClassInfo = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", dt.Rows[0][0].ToString(), dt.Rows[0][1].ToString(), dt.Rows[0][2].ToString(), dt.Rows[0][3].ToString(), dt.Rows[0][4].ToString(), dt.Rows[0][5].ToString(), dt.Rows[0][6].ToString(), dt.Rows[0][7].ToString()); if (strCtrlCallingFrom == "PMA") { //ROOT strCtrlPending = string.Format("{0},{1},{2},{3}", strRootNoClientID, strPMAClientID, "null", "null"); } else if (strCtrlCallingFrom == "PATTERN") { //ROOT-PMA strCtrlPending = string.Format("{0},{1},{2},{3}", strRootNoClientID, strPMAClientID, strPatternClientID, "null"); } else if (strCtrlCallingFrom == "ITEM") { //ROOT-PMA-PATTERN strCtrlPending = string.Format("{0},{1},{2},{3}", strRootNoClientID, strPMAClientID, strPatternClientID, strItemClientID); } strCallbackResult = string.Format("{0};{1}", strCtrlPending, strItemClassInfo); } } } catch (Exception ex) { throw ex; } return strCallbackResult; #endregion }
/// <summary> /// 依配本方式('101','103','104')取得預設參照資訊 /// dtParam(配本參數方式)、dtDisItem(配本商品)、V_DIS_TYPE、V_ITEM、V_PERIOD、I_ITEM_REFER_COUNT /// </summary> /// <param name="dtParam">配本參數方式</param> /// <param name="B1_PERIOD">前一期銷售實績</param> /// <param name="B2_PERIOD">前二期銷售實績</param> /// <param name="B3_PERIOD">前三期銷售實績</param> /// <param name="B4_PERIOD">前四期銷售實績</param> /// <param name="B5_PERIOD">前五期銷售實績</param> /// <param name="B6_PERIOD">前六期銷售實績</param> /// <param name="V_DIS_TYPE">配本方式</param> /// <param name="V_ITEM">品號</param> /// <param name="V_PERIOD">期別</param> /// <param name="I_ITEM_REFER_COUNT">設定品項參照數</param> /// <returns>dtDisItemRefer</returns> public DataTable QueryDisItemReferByDisType(DataTable dtParam, string B1_PERIOD, string B2_PERIOD, string B3_PERIOD, string B4_PERIOD, string B5_PERIOD, string B6_PERIOD, string V_DIS_TYPE, string V_ITEM, string V_PERIOD, Int32 I_ITEM_REFER_COUNT ) { #region #region Variables Int32 iSelect_Period; //往前取前幾期 Int32 iSelect_P_From; //往前取前幾期From Int32 iSelect_P_To; //往前取前幾期To string vOrderBy = ""; //排序方式 string vPeriod_S = ""; //期別起 string vPeriod_E = ""; //期別迄 string vITEM_NAME = ""; DataTable dtItemSales = null; MaintainDisItemRefer BCODIR = new MaintainDisItemRefer(ConnectionDB); DataTable dtDisItemRefer = BCODIR.GetDisItemReferSchema(); ArrayList Paramslist = new ArrayList(); DataRow nRow = null; Int32 iStAcceptQty = 0; Int32 iBackwardQty = 0; Int32 iFoundCount = 0; Int32 iPeriod_S = 0; //期別起 Int32 iPeriod_E = 0; //期別迄 Int32 iPERIOD = 0; Int32 iRowCnt = 0; Int32[] i32AryPeriod = null; string sB1_Period = ""; //前1期期別 string sB2_Period = ""; //前2期期別 string sB3_Period = ""; //前3期期別 string sB4_Period = ""; //前4期期別 string sB5_Period = ""; //前5期期別 string sB6_Period = ""; //前6期期別 Int32 iB1_Period = 0; //前1期期別 Int32 iB2_Period = 0; //前2期期別 Int32 iB3_Period = 0; //前3期期別 Int32 iB4_Period = 0; //前4期期別 Int32 iB5_Period = 0; //前5期期別 Int32 iB6_Period = 0; //前6期期別 int SubQty = 0; Decimal REAL_SALESRATE = 0; Decimal REAL_SALESRATE_Sum = 0; #endregion try { #region //4.1) 判斷配本方式 if (!(V_DIS_TYPE == "101" || V_DIS_TYPE == "103" || V_DIS_TYPE == "104")) { //停止處理流程,離開此涵式 //不視為Exception; return dtDisItemRefer; } //4.2) 取得基本資料與配本參數 MaintainDisParameter BCO1 = new MaintainDisParameter(ConnectionDB); QueryALOCommon BCO2 = new QueryALOCommon(ConnectionDB); ITMModel.MaintainSKU BCO3 = new ITMModel.MaintainSKU(ConnectionDB); Paramslist.Clear(); Paramslist.Add(V_ITEM); DataTable dt = BCO3.QuerySKUByCode(Paramslist); if (dt != null && dt.Rows.Count > 0) { vITEM_NAME = dt.Rows[0]["ITEM_NAME"].ToString(); } //a) 取得配本參數資料 if (dtParam == null || dtParam.Rows.Count == 0) { //重取配本方式參數 Paramslist.Clear(); Paramslist.Add(V_DIS_TYPE); Paramslist.Add(1); dtParam = BCO1.QuerySwitch(QueryType.CODE, Paramslist); } if (dtParam == null || dtParam.Rows.Count == 0) { //顯示錯誤訊息『無此配本方式:V_DIS_TYPE』於訊息區; throw new Exception(string.Format("無此配本方式:{0}", V_DIS_TYPE)); } //b) 取得配本參數資料 Int32.TryParse(dtParam.Rows[0]["SELECT_PERIOD"].ToString().Trim(), out iSelect_Period); //往前取前幾期 Int32.TryParse(dtParam.Rows[0]["SELECT_P_FROM"].ToString().Trim(), out iSelect_P_From); //往前取前幾期From Int32.TryParse(dtParam.Rows[0]["SELECT_P_TO"].ToString().Trim(), out iSelect_P_To); //往前取前幾期To //b) 取得配本商品資料 //DataRow[] ItemRow = dtDisItem.Select("ITEM='" + V_ITEM + "' and PERIOD='" + V_PERIOD + "' "); //取得品項數 if (I_ITEM_REFER_COUNT == 0) { I_ITEM_REFER_COUNT = BCO2.GetDisItemReferCount(dtParam); } if (I_ITEM_REFER_COUNT == 0) { //顯示錯誤訊息『參照品項數=0』於訊息區; throw new Exception("參照品項數=0"); } //c) 取得排序方式 vOrderBy = ""; if (dtParam.Rows[0]["SORT_KEY1"].ToString() != "") { vOrderBy += dtParam.Rows[0]["SORT_KEY1"].ToString() + ","; } if (dtParam.Rows[0]["SORT_KEY2"].ToString() != "") { vOrderBy += dtParam.Rows[0]["SORT_KEY2"].ToString() + ","; } if (dtParam.Rows[0]["SORT_KEY3"].ToString() != "") { vOrderBy += dtParam.Rows[0]["SORT_KEY3"].ToString() + ","; } //# 去掉最後一個逗號 "," if (vOrderBy.Trim().Length > 0) { if (vOrderBy.Substring(vOrderBy.Length - 1, 1) == ",") { vOrderBy = vOrderBy.Substring(0, vOrderBy.Length - 1); } } //4.3) 依照配本方式設定設定不同計算期別 switch (V_DIS_TYPE) { case "101"://a) V_DIS_TYPE = 101 (前期比例)時 #region 前期比例 switch (iSelect_Period) { case 1: vPeriod_S = B1_PERIOD; break; case 2: vPeriod_S = B2_PERIOD; break; case 3: vPeriod_S = B3_PERIOD; break; case 4: vPeriod_S = B4_PERIOD; break; case 5: vPeriod_S = B5_PERIOD; break; case 6: vPeriod_S = B6_PERIOD; break; default: throw new Exception("期別起無資料!"); break; } vPeriod_E = vPeriod_S; #endregion break; case "103"://b) V_DIS_TYPE = 103 (實績加重) 或 104 (移行指數)時 case "104": #region 移行指數 switch (iSelect_P_From) { case 1: vPeriod_E = B1_PERIOD; break; case 2: vPeriod_E = B2_PERIOD; break; case 3: vPeriod_E = B3_PERIOD; break; case 4: vPeriod_E = B4_PERIOD; break; case 5: vPeriod_E = B5_PERIOD; break; case 6: vPeriod_E = B6_PERIOD; break; default: throw new Exception("往前取前幾期From無資料!"); break; } switch (iSelect_P_To) { case 1: vPeriod_S = B1_PERIOD; break; case 2: vPeriod_S = B2_PERIOD; break; case 3: vPeriod_S = B3_PERIOD; break; case 4: vPeriod_S = B4_PERIOD; break; case 5: vPeriod_S = B5_PERIOD; break; case 6: vPeriod_S = B6_PERIOD; break; default: throw new Exception("往前取前幾期To無資料!"); } #endregion break; } //c) 取得前幾期銷售實績 Paramslist.Clear(); Paramslist.Add(V_ITEM == "" ? null : V_ITEM); Paramslist.Add(vPeriod_S == "" ? null : vPeriod_S); Paramslist.Add(vPeriod_E == "" ? null : vPeriod_E); Paramslist.Add(vOrderBy == "" ? null : vOrderBy); dtItemSales = BCO2.QueryP6_PeriodSalesInfo(Paramslist); //4.4) 依照不同配本方式,取得新增參照商品資料 Int32.TryParse(vPeriod_S, out iPeriod_S); Int32.TryParse(vPeriod_E, out iPeriod_E); sB1_Period = B1_PERIOD; sB2_Period = B2_PERIOD; sB3_Period = B3_PERIOD; sB4_Period = B4_PERIOD; sB5_Period = B5_PERIOD; sB6_Period = B6_PERIOD; Int32.TryParse(sB1_Period, out iB1_Period); Int32.TryParse(sB2_Period, out iB2_Period); Int32.TryParse(sB3_Period, out iB3_Period); Int32.TryParse(sB4_Period, out iB4_Period); Int32.TryParse(sB5_Period, out iB5_Period); Int32.TryParse(sB6_Period, out iB6_Period); #endregion switch (V_DIS_TYPE) { case "101"://a) V_DIS_TYPE = 101 (前期比例)時 (vPeriod_S=vPeriod_E=前一期:P_B1) #region if (sB1_Period == "" || sB1_Period == null) { //* 前一期資料不存在時,設定訊息『新品無前期發行資訊』於訊息區。 throw new Exception("新品無前期發行資訊"); } if (dtItemSales.Rows.Count == 0) { //* 前一期資料不存在銷售實績時,設定訊息『無前期實銷資訊』於訊息區。 throw new Exception("無前期實銷資訊,請使用其他配本方式"); } Int32.TryParse(dtItemSales.Rows[0]["ST_ACCEPT_QTY"].ToString().Trim(), out iStAcceptQty); Int32.TryParse(dtItemSales.Rows[0]["BACKWARD_QTY"].ToString().Trim(), out iBackwardQty); nRow = dtDisItemRefer.NewRow(); nRow["ITEM"] = V_ITEM; //--品號 nRow["ITEM_NAME"] = vITEM_NAME; //--品名 nRow["PERIOD"] = sB1_Period; //--期別 nRow["RITEM"] = V_ITEM; //--參照品號 nRow["RITEM_NAME"] = vITEM_NAME; //--參照品名 nRow["RPERIOD"] = vPeriod_S; //--參照期別 nRow["ST_ACCEPT_QTY"] = iStAcceptQty; //--進貨 nRow["BACKWARD_QTY"] = iBackwardQty; //--退貨 nRow["REAL_MERIT"] = iStAcceptQty - iBackwardQty; //--實績 SubQty = iStAcceptQty - iBackwardQty; if (iStAcceptQty == 0) { //REAL_SALESRATE = 0; throw new Exception("前一期別無銷售實績,不可作為參照品項!!"); } else { REAL_SALESRATE = Decimal.Parse(SubQty.ToString()) / Decimal.Parse(iStAcceptQty.ToString()) * 100; } nRow["REAL_SALESRATE"] = (iStAcceptQty == 0) ? 0 : Decimal.Round(REAL_SALESRATE, MidpointRounding.AwayFromZero); //--實銷率 nRow["REFER_RATE"] = 100; //--參照比率% dtDisItemRefer.Rows.Add(nRow); break; #endregion case "103"://b) V_DIS_TYPE = 103 (實績加重) 時 #region //# 由配本商品資料 ItemRow 中取前1期~前6期 (B1_PERIOD~B6_PERIOD)作計算基準 if (sB1_Period == "" && sB2_Period == "" && sB3_Period == "" && sB4_Period == "" && sB5_Period == "" && sB6_Period == "") { //顯示訊息『新品請使用其他配本方式』於訊息區,離開涵式處理流程。 throw new Exception("新品請使用其他配本方式"); } //# 比較前1期~前6期 與 計算期別起迄(vPeriod_S~vPeriod_E), // 將符合起迄的期別,記錄相符筆數 i32AryPeriod = new Int32[] { iB1_Period, iB2_Period, iB3_Period, iB4_Period, iB5_Period, iB6_Period }; for (Int32 i = 0; i <= i32AryPeriod.GetUpperBound(0); i++) { //if (iPeriod_S <= i32AryPeriod[i] && i32AryPeriod[i] <= iPeriod_E) if ((i32AryPeriod[i]) >= iPeriod_S && (i32AryPeriod[i] > 0 && i32AryPeriod[i] <= iPeriod_E)) { iFoundCount++; } } if (iFoundCount == 0)//--查無任何一筆相符資料 { //顯示錯誤訊息『存在前六期別銷售資料,但查無可參照期別,請確認配本方式設定是否異常。』 throw new Exception("存在前六期別銷售資料,但查無可參照期別,請確認配本方式設定是否異常。"); } else if (iFoundCount != iSelect_Period)// (往前選幾期)) --可用之參照期別品項數與參數檔設定不相符 { //# 選出前一期別銷售實績 sB1_Period = B1_PERIOD; //# 新增前一期資料作為參照商品,以例外比例作為參照比率% QueryALOCommon BCOCommon = new QueryALOCommon(ConnectionDB); Paramslist.Clear(); Paramslist.Add(V_ITEM); Paramslist.Add(V_PERIOD); DataTable dtTemp = BCOCommon.QueryItemPeriodSalesInfo(Paramslist); if (dtTemp != null && dtTemp.Rows.Count > 0) { Int32.TryParse(dtTemp.Rows[0]["ACCEPT_QTY"].ToString().Trim(), out iStAcceptQty); Int32.TryParse(dtTemp.Rows[0]["BACKWARD_QTY"].ToString().Trim(), out iBackwardQty); } nRow = dtDisItemRefer.NewRow(); nRow["ITEM"] = V_ITEM; //--品號 nRow["ITEM_NAME"] = vITEM_NAME; //--品名 nRow["PERIOD"] = sB1_Period; //--期別 nRow["RITEM"] = V_ITEM; //--參照品號 nRow["RITEM_NAME"] = vITEM_NAME; //--參照品名 nRow["RPERIOD"] = B1_PERIOD; //--參照期別=B1 nRow["ST_ACCEPT_QTY"] = iStAcceptQty; //--進貨 nRow["BACKWARD_QTY"] = iBackwardQty; //--退貨 nRow["REAL_MERIT"] = iStAcceptQty - iBackwardQty; //--實績 SubQty = iStAcceptQty - iBackwardQty; if (iStAcceptQty > 0) { REAL_SALESRATE = Decimal.Parse(SubQty.ToString()) / Decimal.Parse(iStAcceptQty.ToString()) * 100; } else { REAL_SALESRATE = 0; } nRow["REAL_SALESRATE"] = (iStAcceptQty == 0) ? 0 : Decimal.Round(REAL_SALESRATE, MidpointRounding.AwayFromZero); //--實銷率 nRow["REFER_RATE"] = dtParam.Rows[0]["REFER_OTHER"]; //--參照比率%,使用例外比率; //--參照比率% dtDisItemRefer.Rows.Add(nRow); } else if (iFoundCount == iSelect_Period)//--可用之參照期別品項數與參數檔設定相符時 { // --因為要考慮排序,所以使用dtItemSales的排序方式,進行資料新增與判斷。 //依照 dtItemSales 的排序 iRowCnt = 0; REAL_SALESRATE_Sum = 0; foreach (DataRow dRow in dtItemSales.Rows) { Int32.TryParse(dRow["PERIOD"].ToString().Trim(), out iPERIOD); if (iPeriod_S <= iPERIOD && iPERIOD <= iPeriod_E) { iRowCnt++; if (iRowCnt > iSelect_Period) { break; } //# 新增一筆資料作為參照商品, 依新增iRowCont 取得參照比率 Int32.TryParse(dRow["ST_ACCEPT_QTY"].ToString().Trim(), out iStAcceptQty); Int32.TryParse(dRow["BACKWARD_QTY"].ToString().Trim(), out iBackwardQty); nRow = dtDisItemRefer.NewRow(); nRow["ITEM"] = V_ITEM; //--品號 nRow["ITEM_NAME"] = vITEM_NAME; //--品名 nRow["PERIOD"] = sB1_Period; //--期別 nRow["RITEM"] = V_ITEM; //--參照品號 nRow["RITEM_NAME"] = vITEM_NAME; //--參照品名 nRow["RPERIOD"] = dRow["PERIOD"]; //--參照期別 nRow["ST_ACCEPT_QTY"] = iStAcceptQty; //--進貨 nRow["BACKWARD_QTY"] = iBackwardQty; //--退貨 nRow["REAL_MERIT"] = iStAcceptQty - iBackwardQty; //--實績 SubQty = iStAcceptQty - iBackwardQty; REAL_SALESRATE = (iStAcceptQty == 0) ? 0 : Decimal.Parse(SubQty.ToString()) / Decimal.Parse(iStAcceptQty.ToString()) * 100; REAL_SALESRATE_Sum += REAL_SALESRATE;// 實銷率合計 nRow["REAL_SALESRATE"] = (iStAcceptQty == 0) ? 0 : Decimal.Round(REAL_SALESRATE, MidpointRounding.AwayFromZero); //--實銷率 nRow["REFER_RATE"] = dtParam.Rows[0]["REFER_RATE" + iRowCnt.ToString()]; //--參照比率%,依照排序順序取得參照比率 dtDisItemRefer.Rows.Add(nRow); } }//end for // 新增判斷 所有參照品項的銷售實績均為0時,需alert訊息 if (REAL_SALESRATE_Sum < 1) { throw new Exception("參照品項均無銷售實績,請調整參照品項"); } } break; #endregion case "104"://c) V_DIS_TYPE = 104 (移行指數) 時 #region //# 由配本商品資料 ItemRow 中取前1期~前6期 (B1_PERIOD~B6_PERIOD)作計算基準 if (sB1_Period == "" && sB2_Period == "" && sB3_Period == "" && sB4_Period == "" && sB5_Period == "" && sB6_Period == "") { //顯示訊息『新品請使用其他配本方式』於訊息區,離開涵式處理流程。 throw new Exception("新品請使用其他配本方式"); } //# 比較前1期~前6期 與 計算期別起迄(vPeriod_S~vPeriod_E), // 將符合起迄的期別,記錄相符筆數 i32AryPeriod = new Int32[] { iB1_Period, iB2_Period, iB3_Period, iB4_Period, iB5_Period, iB6_Period }; for (Int32 i = 0; i <= i32AryPeriod.GetUpperBound(0); i++) { if (iPeriod_S <= i32AryPeriod[i] && i32AryPeriod[i] <= iPeriod_E) { iFoundCount++; } } if (iFoundCount == 0 || iFoundCount != iSelect_Period) { //顯示錯誤訊息『銷售期別不足,請使用其他配本方式。』 throw new Exception("銷售期別不足,請使用其他配本方式。"); } else if (iFoundCount == iSelect_Period) { //--因為要考慮排序,所以使用dtItemSales的排序方式,進行資料新增與判斷。 // 依照 dtItemSales 的排序 iRowCnt = 0; REAL_SALESRATE_Sum = 0; foreach (DataRow dRow in dtItemSales.Rows) { Int32.TryParse(dRow["PERIOD"].ToString().Trim(), out iPERIOD); if (iPeriod_S <= iPERIOD && iPERIOD <= iPeriod_E) { iRowCnt++; if (iRowCnt > iSelect_Period) { break; } //# 新增一筆資料作為參照商品, 依新增iRowCont 取得參照比率 Int32.TryParse(dRow["ST_ACCEPT_QTY"].ToString().Trim(), out iStAcceptQty); Int32.TryParse(dRow["BACKWARD_QTY"].ToString().Trim(), out iBackwardQty); nRow = dtDisItemRefer.NewRow(); nRow["ITEM"] = V_ITEM; //--品號 nRow["ITEM_NAME"] = vITEM_NAME; //--品名 nRow["PERIOD"] = dRow["PERIOD"]; //--期別 nRow["RITEM"] = V_ITEM; //--參照品號 nRow["RITEM_NAME"] = vITEM_NAME; //--參照品名 nRow["RPERIOD"] = dRow["PERIOD"]; //--參照期別 nRow["ST_ACCEPT_QTY"] = iStAcceptQty; //--進貨 nRow["BACKWARD_QTY"] = iBackwardQty; //--退貨 nRow["REAL_MERIT"] = iStAcceptQty - iBackwardQty; //--實績 SubQty = iStAcceptQty - iBackwardQty; REAL_SALESRATE = (iStAcceptQty == 0) ? 0 : Decimal.Parse(SubQty.ToString()) / Decimal.Parse(iStAcceptQty.ToString()) * 100; REAL_SALESRATE_Sum += REAL_SALESRATE;// 實銷率合計 nRow["REAL_SALESRATE"] = (iStAcceptQty == 0) ? 0 : Decimal.Round(REAL_SALESRATE, MidpointRounding.AwayFromZero); //--實銷率 nRow["REFER_RATE"] = dtParam.Rows[0]["REFER_RATE" + iRowCnt.ToString()]; //--參照比率%,依照排序順序取得參照比率 dtDisItemRefer.Rows.Add(nRow); } } } // 新增判斷 所有參照品項的銷售實績均為0時,需alert訊息 if (REAL_SALESRATE_Sum < 1) { throw new Exception("參照品項均無銷售實績,請調整參照品項"); } #region 取得去年同期資訊 2009-07-16 cyhsu add string sErrMsg = ""; Paramslist.Clear(); Paramslist.Add(V_ITEM); Paramslist.Add(V_PERIOD); DataTable dtLY_Sales = QueryLastYear_PeriodSalesInfo(Paramslist); if (dtLY_Sales != null && dtLY_Sales.Rows.Count > 0) { #region 逐筆新增配本參照資料 foreach (DataRow dRow in dtLY_Sales.Rows) { //# 新增一筆資料作為參照商品, 依新增iRowCont 取得參照比率 Int32.TryParse(dRow["ST_ACCEPT_QTY"].ToString().Trim(), out iStAcceptQty); Int32.TryParse(dRow["BACKWARD_QTY"].ToString().Trim(), out iBackwardQty); nRow = dtDisItemRefer.NewRow(); nRow["ITEM"] = V_ITEM; //--品號 nRow["ITEM_NAME"] = vITEM_NAME; //--品名 nRow["PERIOD"] = dRow["PERIOD"]; //--期別 nRow["RITEM"] = V_ITEM; //--參照品號 nRow["RITEM_NAME"] = vITEM_NAME; //--參照品名 nRow["RPERIOD"] = dRow["PERIOD"]; //--參照期別 nRow["ST_ACCEPT_QTY"] = iStAcceptQty; //--進貨 nRow["BACKWARD_QTY"] = iBackwardQty; //--退貨 nRow["REAL_MERIT"] = iStAcceptQty - iBackwardQty; //--實績 SubQty = iStAcceptQty - iBackwardQty; REAL_SALESRATE = (iStAcceptQty == 0) ? 0 : Decimal.Parse(SubQty.ToString()) / Decimal.Parse(iStAcceptQty.ToString()) * 100; nRow["REAL_SALESRATE"] = (iStAcceptQty == 0) ? 0 : Decimal.Round(REAL_SALESRATE, MidpointRounding.AwayFromZero); //--實銷率 nRow["REFER_RATE"] = dtParam.Rows[0]["REFER_RATE" + iRowCnt.ToString()]; //--參照比率%,依照排序順序取得參照比率 dtDisItemRefer.Rows.Add(nRow); } #endregion } dtLY_Sales.Dispose(); #endregion break; #endregion } } catch (Exception ex) { throw GetNewException(ex); } return dtDisItemRefer; #endregion }
/// <summary> /// 把值傳到Client端 /// </summary> /// <returns></returns> public string GetCallbackResult() { #region string rtn = "", strResult = ""; try { #region OLD //ALOModel.MaintinDisPattern BCO = new ALOModel.MaintinDisPattern(ConnectionDB); //DataTable dt = null; //if (ObjectFrom == "PMA") //{ // dt = BCO.QueryRootByPMA(CallServerValue); //} //else if (ObjectFrom == "PATTERN") //{ // dt = BCO.QueryPMAByPattern(CallServerValue); //} //else if (ObjectFrom == "ITEM") //{ // dt = BCO.QueryPMA_PatternByItem(CallServerValue); //} //if (dt != null) //{ // if (dt.Rows.Count > 0) // { // if (ObjectFrom == "PMA") // { // //ROOT // rtn = string.Format("{0}", dt.Rows[0][0].ToString()); // } // else if (ObjectFrom == "PATTERN") // { // //ROOT-PMA // rtn = string.Format("{0}-{1}", dt.Rows[0][1].ToString(), dt.Rows[0][0].ToString()); // } // else if (ObjectFrom == "ITEM") // { // //ROOT-PMA-PATTERN // rtn = string.Format("{0}-{1}-{2}", dt.Rows[0][2].ToString(), dt.Rows[0][0].ToString(), dt.Rows[0][1].ToString()); // } // } //} ////附加相關控制項 //if (ObjectFrom == "PMA") //{ // strResult = string.Format("{0},{1}", ((TextBox)SLP_ROOT1.FindControl("TextBoxCode")).ClientID, rtn); //} //else if (ObjectFrom == "PATTERN") //{ // strResult = string.Format("{0}-{1},{2}", ((TextBox)SLP_ROOT1.FindControl("TextBoxCode")).ClientID, ((TextBox)SLP_PMA1.FindControl("TextBoxCode")).ClientID, rtn); //} //else if (ObjectFrom == "ITEM") //{ // strResult = string.Format("{0}-{1}-{2},{3}", ((TextBox)SLP_ROOT1.FindControl("TextBoxCode")).ClientID, ((TextBox)SLP_PMA1.FindControl("TextBoxCode")).ClientID, ((TextBox)SLP_Pattern1.FindControl("TextBoxCode")).ClientID, rtn); //} #endregion #region NEW if (CallServerValue.Trim() == "") return strResult; ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); DataTable dt = null; ArrayList ParameterList = new ArrayList();//20091111 ParameterList.Clear(); if (ObjectFrom == "PMA")//改由PageMethod執行 { ParameterList.Add(CallServerValue); ParameterList.Add(null); ParameterList.Add(null); dt = BCO.QueryItemClassInfo(ParameterList); } else if (ObjectFrom == "PATTERN")//改由PageMethod執行 { ParameterList.Add(null); ParameterList.Add(CallServerValue); ParameterList.Add(null); dt = BCO.QueryItemClassInfo(ParameterList); } else if (ObjectFrom == "ITEM")//改由PageMethod執行 { ParameterList.Add(null); ParameterList.Add(null); ParameterList.Add(CallServerValue); dt = BCO.QueryItemClassInfo(ParameterList); } if (dt != null) { if (dt.Rows.Count > 0) { string strCtrlPending = "";//附加相關控制項 string strItemClassInfo = ""; strItemClassInfo = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", dt.Rows[0][0].ToString(), dt.Rows[0][1].ToString(), dt.Rows[0][2].ToString(), dt.Rows[0][3].ToString(), dt.Rows[0][4].ToString(), dt.Rows[0][5].ToString(), dt.Rows[0][6].ToString(), dt.Rows[0][7].ToString()); if (ObjectFrom == "PMA") { //ROOT strCtrlPending = string.Format("{0},{1},{2},{3}", SLP_ROOT1.TextBox_Code.ClientID, SLP_PMA1.TextBox_Code.ClientID, "null", "null"); } else if (ObjectFrom == "PATTERN") { //ROOT-PMA strCtrlPending = string.Format("{0},{1},{2},{3}", SLP_ROOT1.TextBox_Code.ClientID, SLP_PMA1.TextBox_Code.ClientID, SLP_Pattern1.TextBox_Code.ClientID, "null"); } else if (ObjectFrom == "ITEM") { //ROOT-PMA-PATTERN strCtrlPending = string.Format("{0},{1},{2},{3}", SLP_ROOT1.TextBox_Code.ClientID, SLP_PMA1.TextBox_Code.ClientID, SLP_Pattern1.TextBox_Code.ClientID, SLP_SKU1.TextBox_Code.ClientID); } strResult = string.Format("{0};{1}", strCtrlPending, strItemClassInfo); } } #endregion } catch (Exception ex) { throw ex; } return strResult; #endregion }
private void QueryData() { #region try { string SessionIDName = string.Format("{0}_{1}", strPrefixed, PageTimeStamp.Value); ALOModel.QueryALOCommon BCO = new ALOModel.QueryALOCommon(ConnectionDB); if (s_DIS_NO.Substring(s_DIS_NO.Length - 1, 1) == ",") { s_DIS_NO = s_DIS_NO.Substring(0, s_DIS_NO.Length - 1); } ArrayList ParameterList = new ArrayList();//20091113 ParameterList.Clear(); ParameterList.Add(s_DIS_NO); ParameterList.Add(s_OP_TYPE == "" ? "1" : s_OP_TYPE); ParameterList.Add(Session["UID"].ToString()); DataTable dt = BCO.QueryApproveErrorData(ParameterList); if (dt != null && dt.Rows.Count > 0) { this.btn_Save.Enabled = true; this.gv_Result.DataSource = dt; this.gv_Result.PageSize = 10; this.gv_Result.PageIndex = 0; this.gv_Result.DataBind(); Session[SessionIDName] = dt; } else { ResultMsgLabel.Text = "查無資料"; } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } #endregion }