public DataTable QueryByDisNo(ArrayList ParameterList) { #region try { VDS_ALO_DIS_ITEM_DBO DBO = new VDS_ALO_DIS_ITEM_DBO(ref USEDB); return DBO.doQueryByDisNo(ParameterList); } catch (Exception ex) { throw GetNewException(ex); } #endregion }
public DataTable GetDisCRMItemSchema() { #region try { VDS_ALO_DIS_ITEM_DBO DBO = new VDS_ALO_DIS_ITEM_DBO(ref USEDB); return DBO.doGetDisCRMItemSchema(); } catch (Exception ex) { throw GetNewException(ex); } #endregion }
/// <summary> /// 查詢輔助項目備註 /// </summary> /// <param name="ParameterList"></param> /// <returns></returns> public string QueryDisAssistMemo(ArrayList ParameterList) { #region try { VDS_ALO_DIS_ITEM_DBO dbo = new VDS_ALO_DIS_ITEM_DBO(ref USEDB); return dbo.doQueryDisAssistMemo(ParameterList); } catch (Exception ex) { throw GetNewException(ex); } #endregion }
/// <summary> /// ALO11取得配本商品資訊 /// </summary> /// <param name="ParameterList">輸入變數</param> /// <returns>回傳查詢結果</returns> public DataTable QueryDisItemFor111(ArrayList ParameterList) { #region try { VDS_ALO_DIS_ITEM_DBO dbo = new VDS_ALO_DIS_ITEM_DBO(ref USEDB); return dbo.doQueryDisItemFor111(ParameterList); } catch (Exception ex) { throw GetNewException(ex); } #endregion }
public bool CreateDisCRMRecord(DataTable dtDisMain, DataTable dtDisItem, DataTable dtDisStore, out string vDisNo, DbTransaction RootDBT) { #region bool bResult = false; bool IsRootTranscation = false; try { VDS_ALO_DIS_MAIN_DBO DBO_MAIN = new VDS_ALO_DIS_MAIN_DBO(ref USEDB); VDS_ALO_DIS_ITEM_DBO DBO_ITEM = new VDS_ALO_DIS_ITEM_DBO(ref USEDB); VDS_ALO_DIS_CHAN_DBO DBO_CHAN = new VDS_ALO_DIS_CHAN_DBO(ref USEDB); VDS_ALO_DIS_STORE_DBO DBO_STORE = new VDS_ALO_DIS_STORE_DBO(ref USEDB); VDS_ALO_COMMON_DBO DBO_COMM = new VDS_ALO_COMMON_DBO(ref USEDB); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion vDisNo = ""; string strCode = "", strCodeLast = ""; ArrayList ParameterList = new ArrayList(); //配本主檔:VDS_ALO_DIS_MAIN if (dtDisMain != null && dtDisMain.Rows.Count > 0) { ParameterList.Clear(); ParameterList.Add(dtDisMain.Rows[0]["UPDATEDATE"]); ParameterList.Add(dtDisMain.Rows[0]["UPDATEUID"]); ParameterList.Add(dtDisMain.Rows[0]["DIS_DATE"]); ParameterList.Add(dtDisMain.Rows[0]["ST_ACCEPT_DATE"]); ParameterList.Add(dtDisMain.Rows[0]["RCHAN_NO"]); ParameterList.Add(dtDisMain.Rows[0]["PO_SOURCE_NO"]); vDisNo = DBO_MAIN.doCreateDisCRMMain(ParameterList, DBT); } if (vDisNo != "") { foreach (DataRow dr in dtDisItem.Rows) { #region 配本商品檔:VDS_ALO_DIS_ITEM ParameterList.Clear(); ParameterList.Add(dr["CREATEDATE"]); ParameterList.Add(dr["CREATEUID"]); ParameterList.Add(vDisNo); ParameterList.Add(dr["ITEM"]); ParameterList.Add(dr["PERIOD"]); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(dr["DIS_QTY"]); ParameterList.Add(dr["ACCEPT_QTY"]); ParameterList.Add(dr["DIS_STO_QTY"]); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(dr["TAX_TYPE"]); ParameterList.Add(dr["ROOT_NO"]); ParameterList.Add(dr["PMA"]); ParameterList.Add(dr["PATTERN_NO"]); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); ParameterList.Add(DBNull.Value); bResult = DBO_ITEM.doCreateDisItem(ParameterList, DBT); if (!bResult) throw new Exception(string.Format("寫入 {0} 發生失敗", "配本商品檔:VDS_ALO_DIS_ITEM")); #endregion #region 配本通路檔:VDS_ALO_DIS_CHAN ParameterList.Clear(); ParameterList.Add(vDisNo); ParameterList.Add(dr["ITEM"]); ParameterList.Add(dr["PERIOD"]); ParameterList.Add(dtDisMain.Rows[0]["RCHAN_NO"]); ParameterList.Add(DBNull.Value); ParameterList.Add(dr["CREATEDATE"]); ParameterList.Add(dr["CREATEUID"]); ParameterList.Add(DBNull.Value); //2009-05-04 cyhsu add for V_DIS_PRE_CQTY ParameterList.Add(dtDisMain.Rows[0]["ST_ACCEPT_DATE"]); bResult = DBO_CHAN.doCreateDisChan(ParameterList, DBT); if (!bResult) throw new Exception(string.Format("寫入 {0} 發生失敗", "配本通路檔:VDS_ALO_DIS_CHAN")); #endregion #region 配本門市檔:VDS_ALO_DIS_STORE if (dtDisStore != null && dtDisStore.Rows.Count > 0) { foreach (DataRow dr2 in dtDisStore.Rows) { strCode = string.Format("{0}_{1}_{2}_{3}_{4}", vDisNo, dr2["ITEM"].ToString().Trim(), dr2["PERIOD"].ToString().Trim(), dtDisMain.Rows[0]["RCHAN_NO"].ToString().Trim(), dr2["STORE"].ToString().Trim()); if (strCode != strCodeLast) { ParameterList.Clear(); ParameterList.Add(strCode); ParameterList.Add(dr2["UPDATEDATE"]); ParameterList.Add(dr2["UPDATEUID"]); ParameterList.Add(vDisNo); ParameterList.Add(dr2["ITEM"]); ParameterList.Add(dr2["PERIOD"]); ParameterList.Add(dtDisMain.Rows[0]["RCHAN_NO"]); ParameterList.Add(dr2["STORE"]); //ParameterList.Add(dr2["ROUTE"]);//是否需要? doCreateDisCRMStore 參數不相符 //ParameterList.Add(dr2["STEP"]); ParameterList.Add(dr2["DIS_QTY"]); ParameterList.Add(dr2["PO_SOURCE_NO"]); ParameterList.Add(dtDisMain.Rows[0]["ST_ACCEPT_DATE"]); bResult = DBO_STORE.doCreateDisCRMStore(ParameterList, DBT); } strCodeLast = string.Format("{0}_{1}_{2}_{3}_{4}", vDisNo, dr2["ITEM"].ToString().Trim(), dr2["PERIOD"].ToString().Trim(), dtDisMain.Rows[0]["RCHAN_NO"].ToString().Trim(), dr2["STORE"].ToString().Trim()); } } if (!bResult) throw new Exception(string.Format("寫入 {0} 發生失敗", "配本門市檔:VDS_ALO_DIS_STORE")); #endregion #region 呼叫 PKG_VDS_ALO_COMM.lf_area_qty ParameterList.Clear(); ParameterList.Add(vDisNo); ParameterList.Add(dr["ITEM"]); ParameterList.Add(dr["PERIOD"]); ParameterList.Add(dtDisMain.Rows[0]["RCHAN_NO"]); ParameterList.Add("X"); bResult = DBO_COMM.doLp_area_disqty(ParameterList, DBT); if (!bResult) throw new Exception(string.Format("{0} 發生失敗", "呼叫 PKG_VDS_ALO_COMM.lf_area_qty")); #endregion } } else { throw new Exception(string.Format("{0} 發生失敗", "呼叫 PKG_VDS_ALO_DIS_MAIN.CreateDisCRMMain")); } #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion bResult = true; } catch (Exception ex) { #region 交易失敗 bResult = false; if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw GetNewException(ex); } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } return bResult; #endregion }
public bool CreateDisItemFor131(DataTable dtDisItem, string vDisNo, DbTransaction RootDBT) { #region bool bResult = false; bool IsRootTranscation = false; try { VDS_ALO_DIS_ITEM_DBO ALOM = new VDS_ALO_DIS_ITEM_DBO(ref USEDB); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion ArrayList ParameterList = new ArrayList(); if (dtDisItem != null && dtDisItem.Rows.Count > 0) { for (Int32 i = 0; i <= dtDisItem.Rows.Count - 1; i++) { ParameterList.Clear(); ParameterList.Add(dtDisItem.Rows[i]["CREATEDATE"]); ParameterList.Add(dtDisItem.Rows[i]["CREATEUID"]); ParameterList.Add(vDisNo); ParameterList.Add(dtDisItem.Rows[i]["ITEM"]); ParameterList.Add(dtDisItem.Rows[i]["PERIOD"]); ParameterList.Add(dtDisItem.Rows[i]["ONWAY_QTY"]); ParameterList.Add(dtDisItem.Rows[i]["DIS_PRE_QTY"]); ParameterList.Add(dtDisItem.Rows[i]["DIS_QTY"]); ParameterList.Add(dtDisItem.Rows[i]["ACCEPT_QTY"]); ParameterList.Add(dtDisItem.Rows[i]["DIS_STO_QTY"]); ParameterList.Add(dtDisItem.Rows[i]["DIS_MDC_QTY"]); ParameterList.Add(dtDisItem.Rows[i]["DIS_ISU_QTY"]); ParameterList.Add(dtDisItem.Rows[i]["B1_PERIOD"]); ParameterList.Add(dtDisItem.Rows[i]["B2_PERIOD"]); ParameterList.Add(dtDisItem.Rows[i]["B3_PERIOD"]); ParameterList.Add(dtDisItem.Rows[i]["B4_PERIOD"]); ParameterList.Add(dtDisItem.Rows[i]["B5_PERIOD"]); ParameterList.Add(dtDisItem.Rows[i]["B6_PERIOD"]); ParameterList.Add(dtDisItem.Rows[i]["PACKAGE_UNIT"]); ParameterList.Add(dtDisItem.Rows[i]["BASE_QTY"]); ParameterList.Add(dtDisItem.Rows[i]["TAX_TYPE"]); ParameterList.Add(dtDisItem.Rows[i]["ROOT_NO"]); ParameterList.Add(dtDisItem.Rows[i]["PMA"]); ParameterList.Add(dtDisItem.Rows[i]["PATTERN_NO"]); ParameterList.Add(dtDisItem.Rows[i]["INCLUDE_NON_EFF"]); ParameterList.Add(dtDisItem.Rows[i]["CHAN_TYPE"]); ParameterList.Add(dtDisItem.Rows[i]["OP_STATUS"]); ParameterList.Add(dtDisItem.Rows[i]["DIS_TYPE"]); ParameterList.Add(dtDisItem.Rows[i]["MEMO"]); bResult = ALOM.doCreateDisItem(ParameterList, DBT); } } #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion } catch (Exception ex) { #region 交易失敗 bResult = false; if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw GetNewException(ex); } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } return bResult; #endregion }//end of CreateDisItemFor131
/// <summary> /// 刪除配本商品(111使用) /// </summary> /// <param name="ParameterList">輸入變數</param> /// <param name="RootDBT">交易</param> /// <returns>回傳結果</returns> public bool DeleteDisItemFor111(ArrayList ParameterList, DbTransaction RootDBT ) { bool bResult = false; bool IsRootTranscation = false; try { VDS_ALO_DIS_ITEM_DBO ALOITEMDBO = new VDS_ALO_DIS_ITEM_DBO(ref USEDB); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion ALOITEMDBO.doDeleteDisItemFor111(ParameterList, DBT ); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion bResult = true; } catch (Exception ex) { #region 交易失敗 bResult = false; if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw GetNewException(ex); } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } return bResult; }
}//end of CreateDisItem #endregion #region 更新相關BCO public bool UpdateDisItemFor111(DataTable dtDisItemDiff, DbTransaction RootDBT) { #region bool bResult = false; bool IsRootTranscation = false; try { VDS_ALO_DIS_ITEM_DBO ALOM = new VDS_ALO_DIS_ITEM_DBO(ref USEDB); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion ArrayList ParameterList = new ArrayList(); if (dtDisItemDiff != null && dtDisItemDiff.Rows.Count > 0) { ParameterList.Clear(); //new ParameterList.Add(dtDisItemDiff.Rows[0]["ID", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["UPDATEDATE", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["UPDATEUID", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["DIS_NO", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["ITEM", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["PERIOD", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["ONWAY_QTY", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["DIS_PRE_QTY", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["DIS_QTY", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["ACCEPT_QTY", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["DIS_STO_QTY", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["DIS_MDC_QTY", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["DIS_ISU_QTY", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["B1_PERIOD", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["B2_PERIOD", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["B3_PERIOD", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["B4_PERIOD", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["B5_PERIOD", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["B6_PERIOD", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["PACKAGE_UNIT", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["BASE_QTY", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["TAX_TYPE", DataRowVersion.Current]);//ParameterList.Add(dtDisItemDiff.Rows[0]["TAX_TPYE", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["ROOT_NO", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["PMA", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["PATTERN_NO", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["INCLUDE_NON_EFF", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["CHAN_TYPE", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["OP_STATUS", DataRowVersion.Current]); ParameterList.Add(dtDisItemDiff.Rows[0]["DIS_TYPE", DataRowVersion.Current]); //old ParameterList.Add(dtDisItemDiff.Rows[0]["ID", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["CODE", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["CREATEDATE", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["CREATEUID", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["UPDATEDATE", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["UPDATEUID", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["DIS_NO", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["ITEM", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["PERIOD", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["ROOT_NO", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["PMA", DataRowVersion.Original]); ParameterList.Add(dtDisItemDiff.Rows[0]["PATTERN_NO", DataRowVersion.Original]); bResult = ALOM.doUpdateDisItemFor111(ParameterList, DBT); } #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion } catch (Exception ex) { #region 交易失敗 bResult = false; if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw GetNewException(ex); } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } return bResult; #endregion }