public void UpdateInventory(DataTable pdtbAdjustmentTable, DataTable pdtbCache, string pstrComment) { // update adjustment if (pdtbAdjustmentTable.Rows.Count > 0) { DataSet dstData = new DataSet(); dstData.Tables.Add(pdtbAdjustmentTable); IV_AdjustmentDS dsAdjustment = new IV_AdjustmentDS(); dsAdjustment.UpdateDataSet(dstData); IV_BinCacheDS dsBinCache = new IV_BinCacheDS(); DataSet dstCache = new DataSet(); dstCache.Tables.Add(pdtbCache); dsBinCache.UpdateDataSetForTaking(dstCache); // update location and master location cache IV_LocationCacheDS dsLocation = new IV_LocationCacheDS(); dsLocation.UpdateAllQuantityFromBin(); // update transaction history InventoryUtilsBO boIVUtils = new InventoryUtilsBO(); DataSet dstTransaction = boIVUtils.ListTransactionHistory(0); // get the list of new adjustment DataSet dstAdjust = dsAdjustment.List(pstrComment); foreach (DataRow drowData in dstAdjust.Tables[0].Rows) { // each row will be on transaction history #region Transaction history //SaveTransactionHistory DataRow drowTransaction = dstTransaction.Tables[0].NewRow(); drowTransaction[MST_TransactionHistoryTable.CCNID_FLD] = drowData[IV_AdjustmentTable.CCNID_FLD]; drowTransaction[MST_TransactionHistoryTable.TRANSDATE_FLD] = drowData[IV_AdjustmentTable.POSTDATE_FLD]; drowTransaction[MST_TransactionHistoryTable.POSTDATE_FLD] = drowData[IV_AdjustmentTable.POSTDATE_FLD]; drowTransaction[MST_TransactionHistoryTable.REFMASTERID_FLD] = drowData[IV_AdjustmentTable.ADJUSTMENTID_FLD]; drowTransaction[MST_TransactionHistoryTable.PRODUCTID_FLD] = drowData[IV_AdjustmentTable.PRODUCTID_FLD]; drowTransaction[MST_TransactionHistoryTable.TRANTYPEID_FLD] = 17; drowTransaction[MST_TransactionHistoryTable.USERNAME_FLD] = drowData[IV_AdjustmentTable.USERNAME_FLD]; drowTransaction[MST_TransactionHistoryTable.QUANTITY_FLD] = drowData[IV_AdjustmentTable.ADJUSTQUANTITY_FLD]; drowTransaction[MST_TransactionHistoryTable.MASTERLOCATIONID_FLD] = drowData[IV_AdjustmentTable.MASTERLOCATIONID_FLD]; drowTransaction[MST_TransactionHistoryTable.LOCATIONID_FLD] = drowData[IV_AdjustmentTable.LOCATIONID_FLD]; drowTransaction[MST_TransactionHistoryTable.BINID_FLD] = drowData[IV_AdjustmentTable.BINID_FLD]; drowTransaction[MST_TransactionHistoryTable.STOCKUMID_FLD] = drowData[IV_AdjustmentTable.STOCKUMID_FLD]; dstTransaction.Tables[0].Rows.Add(drowTransaction); #endregion } MST_TransactionHistoryDS dsTransactionHistory = new MST_TransactionHistoryDS(); dsTransactionHistory.UpdateDataSet(dstTransaction); } }
/// <summary> /// List all adjustment transaction in period of time /// </summary> /// <param name="pintCCNID">CCN</param> /// <param name="pdtmFromDate">From Date</param> /// <param name="pdtmToDate">To Date</param> /// <returns></returns> public DataTable GetAdjusment(int pintCCNID, DateTime pdtmFromDate, DateTime pdtmToDate) { IV_AdjustmentDS dsAdjustment = new IV_AdjustmentDS(); return(dsAdjustment.List(pintCCNID, pdtmFromDate, pdtmToDate)); }