Example #1
0
        public InventoryTransactionDTO LoadReserveResult(NZString workResultNo)
        {
            InventoryBIZ            bizInventory = new InventoryBIZ();
            InventoryTransactionDAO dao          = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase);
            InventoryTransactionDTO dto          = dao.LoadReserveResult(null, workResultNo);

            return(dto);
        }
Example #2
0
        public void DeleteIssueTransaction(NZString TransID, NZString RefNo)
        {
            InventoryBIZ biz = new InventoryBIZ();

            try
            {
                CommonLib.Common.CurrentDatabase.KeepConnection = true;
                CommonLib.Common.CurrentDatabase.BeginTransaction();
                biz.DeleteInventoryTransaction(CommonLib.Common.CurrentDatabase, TransID);
                biz.DeleteInventoryTransaction(CommonLib.Common.CurrentDatabase, RefNo);
                CommonLib.Common.CurrentDatabase.Commit();
            }
            catch (Exception)
            {
                CommonLib.Common.CurrentDatabase.Rollback();
                throw;
            }
        }
Example #3
0
        public void SaveShipmentEntry(Database db, List <InventoryTransactionDTO> addItems, List <InventoryTransactionDTO> updateItems, List <InventoryTransactionDTO> deleteItems)
        {
            InventoryBIZ bizInv = new InventoryBIZ();

            if (addItems != null && addItems.Count > 0)
            {
                bizInv.AddInventoryTransactions(db, addItems, true);
            }

            if (updateItems != null && updateItems.Count > 0)
            {
                bizInv.UpdateInventoryTransactions(db, updateItems);
            }

            if (deleteItems != null && deleteItems.Count > 0)
            {
                bizInv.DeleteInventoryTransactions(db, deleteItems);
            }
        }
Example #4
0
        public void RunStockTakingUpdateProcess(StockTakingDTO argStockTaking)
        {
            CommonLib.Common.CurrentDatabase.KeepConnection = true;
            CommonLib.Common.CurrentDatabase.BeginTransaction();

            try
            {
                argStockTaking.CRT_BY = CommonLib.Common.CurrentUserInfomation.UserCD;
                argStockTaking.CRT_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine;
                argStockTaking.UPD_BY = CommonLib.Common.CurrentUserInfomation.UserCD;
                argStockTaking.UPD_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine;

                StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);

                //load stock taking entry data and set flag as adjusted
                DataTable dtStockTakingEntry = dao.LoadStockTakingForUpdateProcess(argStockTaking);

                InventoryBIZ inventoryBIZ = new InventoryBIZ();

                InventoryPeriodBIZ bizPeriod = new InventoryPeriodBIZ();
                InventoryPeriodDTO dtoPeriod = bizPeriod.LoadCurrentPeriod();

                DateTime dtmCurrentDate = Common.GetDatabaseDateTime().Date;

                DateTime dtmAdjustDate = dtmCurrentDate;

                if (dtmCurrentDate < dtoPeriod.PERIOD_BEGIN_DATE.StrongValue)
                {
                    dtmAdjustDate = dtoPeriod.PERIOD_BEGIN_DATE.StrongValue;
                }
                else
                {
                    if (dtmCurrentDate > dtoPeriod.PERIOD_END_DATE.StrongValue)
                    {
                        dtmAdjustDate = dtoPeriod.PERIOD_END_DATE.StrongValue;
                    }
                    else
                    {
                        dtmAdjustDate = dtmCurrentDate;
                    }
                }

                //adjust inventory
                foreach (DataRow dr in dtStockTakingEntry.Rows)
                {
                    InventoryTransactionDTO invTrans = ConvertToInventoryTransactionDTO(argStockTaking.STOCK_TAKING_DATE, dtmAdjustDate, dr);

                    inventoryBIZ.AddInventoryTransaction(CommonLib.Common.CurrentDatabase, invTrans, true);
                }

                CommonLib.Common.CurrentDatabase.Commit();
            }
            catch (Exception ex)
            {
                CommonLib.Common.CurrentDatabase.Rollback();

                throw ex;
            }
            finally
            {
                CommonLib.Common.CurrentDatabase.KeepConnection = false;
            }
        }