Beispiel #1
0
        public void UpdateIVBinCache(DataRow pdrowReturnedGoodsDetail, bool blnNewReturnedGood, int pintCCNID)
        {
            if (blnNewReturnedGood && pdrowReturnedGoodsDetail.RowState == DataRowState.Deleted)
            {
                //in case of adding a new returned goods
                //we don't care the deleted record
                //we only care the other states : Modified and AddNew
                return;
            }

            /*
             *              MasterLocCache (CCN, MasLoc, CODE(PRODUCTID), AVG Cost, On Hand Qty)
             *                      AVG Cost = SO_CommitInventoryDetail.CostOfGoodsSold (SO -> SO Detail -> CommitInventoryDetail)
             */
            IV_BinCacheDS objIV_BinCacheDS = new IV_BinCacheDS();
            bool          blnHasProductID  = objIV_BinCacheDS.HasProductID(int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.PRODUCTID_FLD].ToString()),
                                                                           pintCCNID,
                                                                           int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.MASTERLOCATIONID_FLD].ToString()),
                                                                           int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.LOCATIONID_FLD].ToString()),
                                                                           int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.BINID_FLD].ToString()));

            //Initialize the VO for the MasLocCache object
            IV_BinCacheVO objIV_BinCacheVO = new IV_BinCacheVO();

            objIV_BinCacheVO.ProductID        = int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.PRODUCTID_FLD].ToString());
            objIV_BinCacheVO.MasterLocationID = int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.MASTERLOCATIONID_FLD].ToString());
            objIV_BinCacheVO.CCNID            = pintCCNID;
            objIV_BinCacheVO.LocationID       = int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.LOCATIONID_FLD].ToString());
            objIV_BinCacheVO.BinID            = int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.BINID_FLD].ToString());


            //first we implement the case of totally adding new returned goods record
            //incase of updating an existing returned goods record
            //according to Mr.Nguyen Manh Cuong ==> Implement later ==> because it is very very complicated
            if (blnNewReturnedGood)
            {
                objIV_BinCacheVO.OHQuantity = Decimal.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.RECEIVEQUANTITY_FLD].ToString());
            }
            else
            {
                //this one is implemented later
            }
            if (blnHasProductID)
            {
                //update an existing product
                objIV_BinCacheDS.UpdateReturnedGoods(objIV_BinCacheVO);
            }
            else
            {
                //Insert a new product into inventory
                objIV_BinCacheDS.AddReturnedGoods(objIV_BinCacheVO);
            }
        }
Beispiel #2
0
        /// <summary>
        /// GetAvalableQuantity
        /// </summary>
        /// <param name="pintLocationID"></param>
        /// <param name="pintBinID"></param>
        /// <param name="pintProductID"></param>
        /// <returns></returns>
        /// <author>Trada</author>
        /// <date>Monday, October 17 2005</date>

        public DataSet GetAvalableQuantity(int pintCCNID, int pintMasterLocationID, int pintLocationID, int pintBinID, int pintProductID)
        {
            if (pintBinID == 0)
            {
                IV_LocationCacheDS dsIV_LocationCache = new IV_LocationCacheDS();
                return(dsIV_LocationCache.GetAvailableQtyAndInsStatusByProduct(pintCCNID, pintMasterLocationID, pintLocationID, pintProductID));
            }
            else
            {
                IV_BinCacheDS dsIV_BinCache = new IV_BinCacheDS();
                return(dsIV_BinCache.GetAvailableQtyAndInsStatusByProduct(pintCCNID, pintMasterLocationID, pintLocationID, pintBinID, pintProductID));
            }
        }
Beispiel #3
0
 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);
     }
 }
Beispiel #4
0
        private void UpdateIVBinCache(DataRow pdrowReturnedGoodsDetail, bool blnNewReturnedGood, PO_ReturnToVendorMasterVO pobjPO_ReturnToVendorMasterVO)
        {
            if (blnNewReturnedGood && pdrowReturnedGoodsDetail.RowState == DataRowState.Deleted)
            {
                return;
            }

            IV_BinCacheDS objIV_BinCacheDS = new IV_BinCacheDS();
            bool          blnHasProductID  = objIV_BinCacheDS.HasProductID(int.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.PRODUCTID_FLD].ToString()),
                                                                           pobjPO_ReturnToVendorMasterVO.CCNID,
                                                                           pobjPO_ReturnToVendorMasterVO.MasterLocationID,
                                                                           int.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.LOCATIONID_FLD].ToString()),
                                                                           int.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.BINID_FLD].ToString()));

            //Initialize the VO for the MasLocCache object
            IV_BinCacheVO objIV_BinCacheVO = new IV_BinCacheVO();

            objIV_BinCacheVO.ProductID        = int.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.PRODUCTID_FLD].ToString());
            objIV_BinCacheVO.MasterLocationID = pobjPO_ReturnToVendorMasterVO.MasterLocationID;
            objIV_BinCacheVO.CCNID            = pobjPO_ReturnToVendorMasterVO.CCNID;
            objIV_BinCacheVO.LocationID       = int.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.LOCATIONID_FLD].ToString());
            objIV_BinCacheVO.BinID            = int.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.BINID_FLD].ToString());


            if (blnNewReturnedGood)
            {
                objIV_BinCacheVO.OHQuantity = Decimal.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.QUANTITY_FLD].ToString()) * (-1);
            }
            if (blnHasProductID)
            {
                objIV_BinCacheDS.UpdateReturnedGoods(objIV_BinCacheVO);
            }
            else
            {
                objIV_BinCacheDS.AddReturnedGoods(objIV_BinCacheVO);
            }
        }
Beispiel #5
0
        public void UpdateRelease(ArrayList parrMaster, DataSet pdstCommitDetail, DataSet pdstMasLocCache,
                                  DataSet pdstLocCache, DataSet pdstBinCache, DataSet pdstTransaction)
        {
            const string METHOD_NAME = THIS + ".UpdateRelease()";

            SO_CommitInventoryMasterDS dsMaster = new SO_CommitInventoryMasterDS();
            DataSet dstCopyOfDetail             = pdstCommitDetail.Clone();
            DataSet dstCopyOfTransaction        = pdstTransaction.Clone();
            UtilsBO boUtils = new UtilsBO();

            foreach (SO_CommitInventoryMasterVO voMaster in parrMaster)
            {
                int intOldID = voMaster.CommitInventoryMasterID;
                voMaster.CommitmentNo = boUtils.GetNoByMask(SO_CommitInventoryMasterTable.TABLE_NAME,
                                                            SO_CommitInventoryMasterTable.COMMITMENTNO_FLD, voMaster.CommitDate, Constants.YYYYMMDD0000);
                // add new master object and get new id
                voMaster.CommitInventoryMasterID = dsMaster.AddAndReturnID(voMaster);

                #region find all detail object to assign new master id

                DataRow[] drowDetails = pdstCommitDetail.Tables[0].Select(SO_CommitInventoryDetailTable.COMMITINVENTORYMASTERID_FLD + "=" + intOldID);
                foreach (DataRow drowDetail in drowDetails)
                {
                    if (drowDetail.RowState != DataRowState.Deleted)
                    {
                        DataRow drowCommitDetail = dstCopyOfDetail.Tables[0].NewRow();
                        foreach (DataColumn dcol in dstCopyOfDetail.Tables[0].Columns)
                        {
                            drowCommitDetail[dcol.ColumnName] = drowDetail[dcol.ColumnName];
                        }
                        drowCommitDetail[SO_CommitInventoryDetailTable.COMMITINVENTORYMASTERID_FLD] = voMaster.CommitInventoryMasterID;
                        dstCopyOfDetail.Tables[0].Rows.Add(drowCommitDetail);
                    }
                }

                #endregion

                #region find all transaction history object to assign new master id

                DataRow[] drowTransaction = pdstTransaction.Tables[0].Select(MST_TransactionHistoryTable.REFMASTERID_FLD + "=" + intOldID);
                foreach (DataRow drowDetail in drowTransaction)
                {
                    if (drowDetail.RowState != DataRowState.Deleted)
                    {
                        DataRow drowNewTransaction = dstCopyOfTransaction.Tables[0].NewRow();
                        foreach (DataColumn dcol in dstCopyOfTransaction.Tables[0].Columns)
                        {
                            drowNewTransaction[dcol.ColumnName] = drowDetail[dcol.ColumnName];
                        }
                        drowNewTransaction[MST_TransactionHistoryTable.REFMASTERID_FLD] = voMaster.CommitInventoryMasterID;
                        dstCopyOfTransaction.Tables[0].Rows.Add(drowNewTransaction);
                    }
                }

                #endregion
            }

            // update detail dataset
            SO_CommitInventoryDetailDS dsCommitDetail = new SO_CommitInventoryDetailDS();
            dsCommitDetail.UpdateDataSet(dstCopyOfDetail);
            // update transaction history
            MST_TransactionHistoryDS dsTransaction = new MST_TransactionHistoryDS();
            dsTransaction.UpdateDataSet(dstCopyOfTransaction);
            // update bin cache
            IV_BinCacheDS dsBinCache = new IV_BinCacheDS();
            dsBinCache.UpdateDataSet(pdstBinCache);
            // update location cache
            IV_LocationCacheDS dsLocCache = new IV_LocationCacheDS();
            dsLocCache.UpdateDataSet(pdstLocCache);
            // update master location cache
            IV_MasLocCacheDS dsMasLocCache = new IV_MasLocCacheDS();
            dsMasLocCache.UpdateDataSet(pdstMasLocCache);
        }
Beispiel #6
0
        public DataTable GetDSCacheQuantity(int pintCCNID)
        {
            IV_BinCacheDS dsBIN = new IV_BinCacheDS();

            return(dsBIN.GetDSCacheQuantity(pintCCNID));
        }
Beispiel #7
0
        public DataTable ListAllCache()
        {
            IV_BinCacheDS dsBinCache = new IV_BinCacheDS();

            return(dsBinCache.ListAllCache());
        }
Beispiel #8
0
        /// <summary>
        /// Get On-hand Qty in bin cache
        /// </summary>
        /// <param name="pintProductID"></param>
        /// <param name="pintLocationID"></param>
        /// <param name="pintBinID"></param>
        /// <returns></returns>
        /// <author>Trada</author>
        /// <date>Monday, August 14 2006</date>

        public decimal GetOnHandQtyInBinCache(int pintLocationID, int pintBinID, int pintProductID)
        {
            IV_BinCacheDS dsBinCache = new IV_BinCacheDS();

            return(dsBinCache.GetQuantityOnHand(pintLocationID, pintBinID, pintProductID));
        }