Example #1
0
        public void UpdateStockTaking(NZString UserCD, NZString MachineCD)
        {
            CommonLib.Common.CurrentDatabase.KeepConnection = true;
            CommonLib.Common.CurrentDatabase.BeginTransaction();

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

                dao.UpdateStockTaking(UserCD, MachineCD);

                dao.DeleteStockTakingTemp(UserCD, MachineCD);

                CommonLib.Common.CurrentDatabase.Commit();
            }
            catch (Exception ex)
            {
                CommonLib.Common.CurrentDatabase.Rollback();
                throw ex;
            }
            finally
            {
                CommonLib.Common.CurrentDatabase.KeepConnection = false;
            }

        }
Example #2
0
        public void InsertStockTakingTemp(List<ImportStockTakingDTO> listData)
        {
            CommonLib.Common.CurrentDatabase.KeepConnection = true;
            CommonLib.Common.CurrentDatabase.BeginTransaction();

            try
            {
                StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);
                dao.DeleteStockTakingTemp(Common.CurrentUserInfomation.UserCD, Common.CurrentUserInfomation.Machine);

                foreach (ImportStockTakingDTO dto in listData)
                {
                    dao.InsertStockTakingTemp(dto);
                }

                CommonLib.Common.CurrentDatabase.Commit();
            }
            catch (Exception ex)
            {
                CommonLib.Common.CurrentDatabase.Rollback();
                throw ex;
            }
            finally
            {
                CommonLib.Common.CurrentDatabase.KeepConnection = false;
            }

        }
Example #3
0
        public List<ImportStockTakingDTO> ValidateStockTakingTemp(NZString UserCD, NZString MachineCD)
        {
            CommonLib.Common.CurrentDatabase.KeepConnection = true;
            CommonLib.Common.CurrentDatabase.BeginTransaction();

            try
            {
                List<ImportStockTakingDTO> listError = null;

                StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);
                listError = dao.ValidateStockTakingTemp(UserCD, MachineCD);

                CommonLib.Common.CurrentDatabase.Commit();

                return listError;
            }
            catch (Exception ex)
            {
                CommonLib.Common.CurrentDatabase.Rollback();
                throw ex;
            }
            finally
            {
                CommonLib.Common.CurrentDatabase.KeepConnection = false;
            }

        }
Example #4
0
        public DataTable LoadStockTakingEntryData(StockTakingDTO argStockTaking)
        {
            DataTable ret = null;

            StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);
            ret = dao.LoadStockTakingEntryData(argStockTaking);

            return ret;
        }
Example #5
0
        public StockTakingDTO LoadLastStockTaking()
        {
            StockTakingDTO ret = null;

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

            return ret;
        }
Example #6
0
        public string GetTextEffectInventory(StockTakingDTO argStockTaking)
        {
            string strEffectInventory = "";

            StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);
            strEffectInventory = dao.GetTextEffectInventory(argStockTaking);

            return strEffectInventory;
        }
Example #7
0
        public bool CheckExistsStockTaking(StockTakingDTO argStockTaking)
        {
            bool bExistsStockTaking = false;

            StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);
            bExistsStockTaking = dao.CheckExistsStockTaking(argStockTaking);

            return bExistsStockTaking;
        }
Example #8
0
        public int GetFlagRunUpdateProcess(StockTakingDTO argStockTaking)
        {
            int ret = 1;

            StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);
            ret = dao.GetFlagRunUpdateProcess(argStockTaking);

            return ret;
        }
Example #9
0
        public bool CheckCompleteInputData(StockTakingDTO argStockTaking)
        {
            bool bCompleteInput = false;

            StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);
            bCompleteInput = dao.CheckCompleteInputData(argStockTaking);


            return bCompleteInput;
        }
Example #10
0
        public bool CheckLocationRunUpdateProcess(StockTakingDTO argStockTaking)
        {
            bool bRunUpdateProcess = false;


            StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);
            bRunUpdateProcess = dao.CheckLocationRunUpdateProcess(argStockTaking);


            return bRunUpdateProcess;
        }
Example #11
0
        public StockTakingDTO RunStockTakingPreProcess(StockTakingDTO argStockTaking)
        {
            StockTakingDTO ret = null;

            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);
            dao.RunStockTakingPreProcess(argStockTaking);

            return ret;
        }
Example #12
0
        public void UpdateStockTakingData(List<StockTakingDetailDTO> listDataInsert, List<StockTakingDetailDTO> listDataUpdate, List<StockTakingDetailDTO> listDataDelete)
        {
            CommonLib.Common.CurrentDatabase.KeepConnection = true;
            CommonLib.Common.CurrentDatabase.BeginTransaction();

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

                foreach (StockTakingDetailDTO dtoInsert in listDataInsert)
                {
                    dao.InsertStockTakingEntry(dtoInsert);
                }

                foreach (StockTakingDetailDTO dtoUpdate in listDataUpdate)
                {
                    dao.UpdateStockTakingEntry(dtoUpdate);
                }

                foreach (StockTakingDetailDTO dtoDelete in listDataDelete)
                {
                    dao.DeleteStockTakingEntry(dtoDelete);
                }

                CommonLib.Common.CurrentDatabase.Commit();
            }
            catch (Exception ex)
            {
                CommonLib.Common.CurrentDatabase.Rollback();
                throw ex;
            }
            finally
            {
                CommonLib.Common.CurrentDatabase.KeepConnection = false;
            }


        }
Example #13
0
 public bool DoAdjustInventory()
 {
     StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase);
     return dao.DoAdjustInventory();
 }
Example #14
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;
            }
        }