Exemple #1
0
        public bool CheckCompleteInputData(StockTakingDTO argStockTaking)
        {
            bool bCompleteInput = false;

            Database db = m_db;

            DataRequest req = new DataRequest();

            req.CommandText = "S_STK040_CheckCompleteInputData";
            req.Parameters.Add("@pDtm_StockTakingDate", argStockTaking.STOCK_TAKING_DATE);
            req.Parameters.Add("@pVar_LocationCode", argStockTaking.LOCATION_CODE);

            req.CommandType = System.Data.CommandType.StoredProcedure;
            int iReturnCode = (int)db.ExecuteScalar(req);

            if (iReturnCode == 1)
            {
                bCompleteInput = true;
            }
            else
            {
                bCompleteInput = false;
            }

            return(bCompleteInput);
        }
Exemple #2
0
        public bool CheckExistsStockTaking(StockTakingDTO argStockTaking)
        {
            bool bExistsStockTaking = false;

            Database db = m_db;

            DataRequest req = new DataRequest();

            req.CommandText = "S_STK010_CheckExistsStockTaking";
            req.Parameters.Add("@pDtm_StockTakingDate", argStockTaking.STOCK_TAKING_DATE);
            req.CommandType = System.Data.CommandType.StoredProcedure;
            int iResult = (int)db.ExecuteScalar(req);

            if (iResult == 1)
            {
                bExistsStockTaking = true;
            }
            else
            {
                bExistsStockTaking = false;
            }


            return(bExistsStockTaking);
        }
Exemple #3
0
        private void ExportData()
        {
            string strFileName = GenerateFileName("StockTaking");

            string strTemplateFileName = @"Report\STR030_StockTaking.xls";
            string strTemplatePath     = Path.Combine(Application.StartupPath, strTemplateFileName);

            string strExportPath = SaveDialogUtil.GetBrowseFileDialogForExport(strFileName);

            if (!"".Equals(strExportPath))
            {
                StockTakingDTO dto = new StockTakingDTO();
                dto.STOCK_TAKING_DATE = Convert.ToDateTime(dtStockTakingDate.DateValue);
                dto.LOCATION_CODE     = cboProcess.SelectedValue == null ? string.Empty : cboProcess.SelectedValue.ToString();//txtLocation.Text;
                dto.PART_NO           = txtMasterNo.Text;
                dto.PART_TYPE         = Convert.ToString(cboItemType.SelectedValue);
                dto.PART_SUB_TYPE     = Convert.ToString(cboItemClassMinor04.SelectedValue);

                if (chkIncomplete.Checked)
                {
                    dto.SEARCH_INCOMPLETE = 1;
                }
                else
                {
                    dto.SEARCH_INCOMPLETE = 0;
                }

                if (chkDiff.Checked)
                {
                    dto.SEARCH_DIFF = 1;
                }
                else
                {
                    dto.SEARCH_DIFF = 0;
                }

                if (chkNoMaster.Checked)
                {
                    dto.NO_MASTER = 1;
                }
                else
                {
                    dto.NO_MASTER = 0;
                }

                DataSet ds = GetExportTable(dto);

                ExportUtil.Export(ds, strTemplatePath, strExportPath);


                MessageDialog.ShowInformation(this, null, new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription);

                if (File.Exists(strExportPath))
                {
                    System.Diagnostics.Process.Start(strExportPath);
                }
            }
        }
Exemple #4
0
        public bool CheckExistsStockTaking(StockTakingDTO argStockTaking)
        {
            bool bExistsStockTaking = false;

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

            return bExistsStockTaking;
        }
Exemple #5
0
        public DataTable LoadStockTakingEntryData(StockTakingDTO argStockTaking)
        {
            DataTable ret = null;

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

            return ret;
        }
Exemple #6
0
        public StockTakingDTO LoadLastStockTaking()
        {
            StockTakingDTO ret = null;

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

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

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

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

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

            return ret;
        }
Exemple #9
0
        private DataSet GetExportTable(StockTakingDTO argSTK)
        {
            DataSet ds = null;

            ReportBIZ biz = new ReportBIZ();

            ds = biz.LoadStockCountingResultForExport(argSTK);

            return(ds);
        }
Exemple #10
0
        public DataSet LoadStockCountingResultForExport(StockTakingDTO argSTK)
        {
            DataSet ret = null;

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

            ret = dao.LoadStockCountingResultForExport(argSTK);

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

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


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


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


            return bRunUpdateProcess;
        }
Exemple #13
0
        private void LoadLastStockTaking()
        {
            StockTakingBIZ stkBiz = new StockTakingBIZ();
            StockTakingDTO stkDTO = stkBiz.LoadLastStockTaking();

            if (stkDTO != null)
            {
                this.txtLastRemark.Text       = stkDTO.REMARK;
                this.dtpLastSTKDate.DateValue = stkDTO.STOCK_TAKING_DATE;
                this.txtLastPreProcessBy.Text = stkDTO.PRE_PROCESS_BY + " - " + stkDTO.PRE_PROCESS_NAME;
            }
        }
Exemple #14
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;
        }
Exemple #15
0
        public DataSet LoadStockCountingResult(StockTakingDTO argSTK)
        {
            DataSet ret = null;

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

            ret = dao.LoadStockCountingResult(argSTK);

            if (ret != null && ret.Tables.Count > 0)
            {
                ret.Tables[0].TableName = "S_STR020_StockCountingResult";
            }

            return(ret);
        }
Exemple #16
0
        private ErrorItem CheckCanRunProcess()
        {
            try
            {
                // modify on 30/oct
                // fix to support in case run closing period before end of month


                //// get year month
                //InventoryPeriodBIZ bizPeriod = new InventoryPeriodBIZ();
                //InventoryPeriodDTO dtoPeriod = bizPeriod.LoadCurrentPeriod();


                //if (!dtoPeriod.YEAR_MONTH.StrongValue.Equals(Convert.ToDateTime(dtpLastSTKDate.DateValue).ToString("yyyyMM")))
                //{
                //    return new ErrorItem(null, TKPMessages.eValidate.VLM0075.ToString());
                //}

                if (cboProcess.SelectedIndex == -1)
                {
                    return(new ErrorItem(null, TKPMessages.eValidate.VLM0087.ToString()));
                }


                StockTakingBIZ bizStockTaking = new StockTakingBIZ();
                StockTakingDTO dtoStockTaking = new StockTakingDTO();
                dtoStockTaking.STOCK_TAKING_DATE = Convert.ToDateTime(dtpLastSTKDate.DateValue);
                dtoStockTaking.LOCATION_CODE     = Convert.ToString(this.cboProcess.SelectedValue);

                bool bRunUpdateProcess = bizStockTaking.CheckLocationRunUpdateProcess(dtoStockTaking);
                if (bRunUpdateProcess)
                {
                    return(new ErrorItem(null, TKPMessages.eValidate.VLM0090.ToString(), new object[] { Convert.ToString(this.cboProcess.SelectedValue) }));
                }

                bool bCompleteInputData = bizStockTaking.CheckCompleteInputData(dtoStockTaking);
                if (bCompleteInputData == false)
                {
                    return(new ErrorItem(null, TKPMessages.eValidate.VLM0091.ToString(), new object[] { Convert.ToString(this.cboProcess.SelectedValue) }));
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }

            return(null);
        }
Exemple #17
0
        public string GetTextEffectInventory(StockTakingDTO argStockTaking)
        {
            string strEffectInventory = "";

            Database db = m_db;

            DataRequest req = new DataRequest();

            req.CommandText = "S_STK040_GetTextEffectInventory";
            req.Parameters.Add("@pDtm_StockTakingDate", argStockTaking.STOCK_TAKING_DATE);
            req.Parameters.Add("@pVar_LocationCode", argStockTaking.LOCATION_CODE);

            req.CommandType    = System.Data.CommandType.StoredProcedure;
            strEffectInventory = (string)db.ExecuteScalar(req);

            return(strEffectInventory);
        }
Exemple #18
0
        private void LoadCurrentStockTakingData()
        {
            StockTakingBIZ stkBiz = new StockTakingBIZ();
            StockTakingDTO stkDTO = stkBiz.LoadLastStockTaking();

            if (stkDTO != null)
            {
                this.txtRemark.Text = stkDTO.REMARK;
                this.dtStockTakingDate.DateValue = stkDTO.STOCK_TAKING_DATE;
                this.txtPreProcessBy.Text        = stkDTO.PRE_PROCESS_BY + " - " + stkDTO.PRE_PROCESS_NAME;
            }
            else
            {
                MessageDialog.ShowBusiness(this
                                           , new EVOFramework.Message(TKPMessages.eValidate.VLM0086.ToString()));
            }
        }
Exemple #19
0
        public int GetFlagRunUpdateProcess(StockTakingDTO argStockTaking)
        {
            int ret = 1;

            Database db = m_db;

            DataRequest req = new DataRequest();

            req.CommandText = "S_STK030_GetFlagRunUpdateProcess";
            req.Parameters.Add("@pDtm_StockTakingDate", argStockTaking.STOCK_TAKING_DATE);
            req.Parameters.Add("@pVar_LocationCode", argStockTaking.LOCATION_CODE);

            req.CommandType = System.Data.CommandType.StoredProcedure;
            ret             = (int)db.ExecuteScalar(req);

            return(ret);
        }
Exemple #20
0
        public StockTakingDTO RunStockTakingPreProcess(StockTakingDTO argStockTaking)
        {
            Database db = m_db;

            DataRequest req = new DataRequest();

            req.CommandText = "S_STK010_PreProcess";
            req.Parameters.Add("@pDtm_StockTakingDate", argStockTaking.STOCK_TAKING_DATE);
            req.Parameters.Add("@pVar_YearMonth", argStockTaking.YEAR_MONTH);
            req.Parameters.Add("@pVar_PreProcessBy", argStockTaking.CRT_BY);
            req.Parameters.Add("@pVar_Remark", argStockTaking.REMARK);
            req.Parameters.Add("@pVar_Machine", argStockTaking.CRT_MACHINE);
            req.CommandType = System.Data.CommandType.StoredProcedure;
            db.ExecuteNonQuery(req);

            return(argStockTaking);
        }
Exemple #21
0
        private DataSet GetReportTable(StockTakingDTO argSTK)
        {
            DataSet ds = null;

            ReportBIZ biz = new ReportBIZ();

            if (rdoReportCountingResult.Checked)
            {
                ds = biz.LoadStockCountingResult(argSTK);
            }
            else
            {
                ds = biz.LoadStockCheckingList(argSTK);
            }


            return(ds);
        }
Exemple #22
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            try
            {
                ErrorItem err = CheckCanRunProcess();
                if (err != null)
                {
                    MessageDialog.ShowBusiness(this, err.Message);
                    return;
                }

                StockTakingDTO dtoStockTaking = new StockTakingDTO();
                dtoStockTaking.STOCK_TAKING_DATE = Convert.ToDateTime(dtpLastSTKDate.DateValue);
                dtoStockTaking.YEAR_MONTH        = txtYearMonth.Text;
                dtoStockTaking.LOCATION_CODE     = Convert.ToString(cboProcess.SelectedValue);

                StockTakingBIZ bizStockTaking         = new StockTakingBIZ();
                string         strTextEffectInventory = bizStockTaking.GetTextEffectInventory(dtoStockTaking);

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new Message(SystemMaintenance.Messages.eConfirm.CFM9009.ToString(), new object[] { strTextEffectInventory }).MessageDescription, MessageDialogButtons.YesNo);
                if (dr == MessageDialogResult.Yes)
                {
                    if (RunProcess())
                    {
                        MessageDialog.ShowBusiness(this, Message.LoadMessage(SystemMaintenance.Messages.eInformation.INF9003.ToString()));
                    }

                    this.cboProcess.SelectedIndex = -1;
                    LoadCurrentStockTakingData();
                }
            }
            catch (ValidateException ex)
            {
                MessageDialog.ShowBusiness(this, ex.ErrorResults[0].Message);
            }
            catch (BusinessException ex)
            {
                MessageDialog.ShowBusiness(this, ex.Error.Message);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Exemple #23
0
        private void LoadCurrentStockTakingData()
        {
            StockTakingBIZ stkBiz = new StockTakingBIZ();
            StockTakingDTO stkDTO = stkBiz.LoadLastStockTaking();

            if (stkDTO != null)
            {
                this.dtpLastSTKDate.DateValue = stkDTO.STOCK_TAKING_DATE;
                this.txtLastPreProcessBy.Text = stkDTO.PRE_PROCESS_BY + " - " + stkDTO.PRE_PROCESS_NAME;
                this.txtYearMonth.Text        = stkDTO.YEAR_MONTH;

                CtrlUtil.EnabledControl(true, btnLocation, btnRun, cboProcess);
            }
            else
            {
                CtrlUtil.EnabledControl(false, btnLocation, btnRun, cboProcess);

                MessageDialog.ShowBusiness(this
                                           , new EVOFramework.Message(TKPMessages.eValidate.VLM0086.ToString()));
            }
        }
Exemple #24
0
        private bool RunProcess()
        {
            try
            {
                StockTakingBIZ biz = new StockTakingBIZ();

                StockTakingDTO stk = new StockTakingDTO();
                stk.STOCK_TAKING_DATE = Convert.ToDateTime(dtpLastSTKDate.DateValue);
                stk.YEAR_MONTH        = txtYearMonth.Text;
                stk.LOCATION_CODE     = Convert.ToString(cboProcess.SelectedValue);

                biz.RunStockTakingUpdateProcess(stk);

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }

            return(false);
        }
Exemple #25
0
        private bool RunProcess()
        {
            try
            {
                StockTakingBIZ biz = new StockTakingBIZ();

                StockTakingDTO stk = new StockTakingDTO();
                stk.STOCK_TAKING_DATE = Convert.ToDateTime(dtpStockTakingDate.Value);
                stk.REMARK            = txtRemark.Text;
                stk.YEAR_MONTH        = txtYearMonth.Text;

                biz.RunStockTakingPreProcess(stk);

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
                picWaiting.Visible = false;
            }

            return(false);
        }
Exemple #26
0
        public DataTable LoadStockTakingEntryData(StockTakingDTO argStockTaking)
        {
            DataTable ret = null;

            Database db = m_db;

            DataRequest req = new DataRequest();

            req.CommandText = "S_STK030_LoadStockTakingEntryData";
            req.Parameters.Add("@pDtm_StockTakingDate", argStockTaking.STOCK_TAKING_DATE);
            req.Parameters.Add("@pVar_LocationCode", argStockTaking.LOCATION_CODE);
            req.Parameters.Add("@pInt_IncompleteFlag", argStockTaking.SEARCH_INCOMPLETE);

            req.CommandType = System.Data.CommandType.StoredProcedure;
            DataSet ds = db.ExecuteDataSet(req);

            if (ds != null && ds.Tables.Count > 0)
            {
                ret = ds.Tables[0];
            }

            return(ret);
        }
Exemple #27
0
        public StockTakingDTO LoadLastStockTaking()
        {
            StockTakingDTO ret = null;

            Database db = m_db;

            DataRequest req = new DataRequest();

            req.CommandText = "S_STK010_LoadLatestStockTaking";
            req.CommandType = CommandType.StoredProcedure;


            db.KeepConnection = true;
            using (IDataReader reader = db.ExecuteDataReader(req))
            {
                if (reader.Read())
                {
                    ret = new StockTakingDTO();
                    ret.STOCK_TAKING_DATE = reader.GetDateTime(0);
                    ret.YEAR_MONTH        = reader.GetString(1);
                    ret.PRE_PROCESS_BY    = reader.GetString(2);
                    ret.PRE_PROCESS_DATE  = reader.GetDateTime(3);
                    ret.REMARK            = reader.GetString(4);
                    ret.CRT_BY            = reader.GetString(5);
                    ret.CRT_DATE          = reader.GetDateTime(6);
                    ret.CRT_MACHINE       = reader.GetString(7);
                    ret.UPD_BY            = reader.GetString(8);
                    ret.UPD_DATE          = reader.GetDateTime(9);
                    ret.UPD_MACHINE       = reader.GetString(10);

                    ret.PRE_PROCESS_NAME = reader.GetString(11);
                }
            }
            db.KeepConnection = false;

            return(ret);
        }
Exemple #28
0
        public DataSet LoadStockCountingResult(StockTakingDTO argSTK)
        {
            DataSet ret = null;

            Database db = m_db;

            DataRequest req = new DataRequest();

            req.CommandText = "S_STR020_StockCountingResult";
            req.CommandType = CommandType.StoredProcedure;

            req.Parameters.Add("@pDtm_StockTakingDate", argSTK.STOCK_TAKING_DATE);
            req.Parameters.Add("@pVar_LocationCode", CheckNull(argSTK.LOCATION_CODE));
            req.Parameters.Add("@pVar_PartNo", CheckNull(argSTK.PART_NO));
            req.Parameters.Add("@pVar_PartType", CheckNull(argSTK.PART_TYPE));
            req.Parameters.Add("@pVar_PartSubType", CheckNull(argSTK.PART_SUB_TYPE));
            req.Parameters.Add("@pInt_IncompleteFlag", CheckNull(argSTK.SEARCH_INCOMPLETE));
            req.Parameters.Add("@pInt_DiffFlag", CheckNull(argSTK.SEARCH_DIFF));
            req.Parameters.Add("@pInt_NoMaster", CheckNull(argSTK.NO_MASTER));

            ret = m_db.ExecuteDataSet(req);

            return(ret);
        }
Exemple #29
0
        public DataTable LoadStockTakingForUpdateProcess(StockTakingDTO argStockTaking)
        {
            DataTable ret = null;

            Database db = m_db;

            DataRequest req = new DataRequest();

            req.CommandText = "S_STK040_LoadStockTakingForUpdateProcess";
            req.Parameters.Add("@pDtm_StockTakingDate", argStockTaking.STOCK_TAKING_DATE);
            req.Parameters.Add("@pVar_LocationCode", argStockTaking.LOCATION_CODE);
            req.Parameters.Add("@pVar_UpdateBy", argStockTaking.UPD_BY);
            req.Parameters.Add("@pVar_UpdateMachine", argStockTaking.UPD_MACHINE);

            req.CommandType = System.Data.CommandType.StoredProcedure;
            DataSet ds = db.ExecuteDataSet(req);

            if (ds != null && ds.Tables.Count > 0)
            {
                ret = ds.Tables[0];
            }

            return(ret);
        }
Exemple #30
0
        private void LoadCurrentStockTakingData()
        {
            InventoryPeriodBIZ biz = new InventoryPeriodBIZ();
            InventoryPeriodDTO dto = biz.LoadCurrentPeriod();

            //DateTime currentYearMonth = new DateTime(
            //    Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)),
            //    Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)),
            //    1);
            txtYearMonth.Text        = dto.YEAR_MONTH;
            dtpStockTakingDate.Value = DateTime.Today;


            StockTakingBIZ stkBiz = new StockTakingBIZ();
            StockTakingDTO stkDTO = stkBiz.LoadLastStockTaking();

            if (stkDTO != null)
            {
                this.txtLastRemark.Text       = stkDTO.REMARK;
                this.dtpLastSTKDate.DateValue = stkDTO.STOCK_TAKING_DATE;
                this.txtLastPreProcessBy.Text = stkDTO.PRE_PROCESS_BY + " - " + stkDTO.PRE_PROCESS_NAME;
            }
            //CommonLib.CtrlUtil.EnabledControl(false, txtInfo, dtInventoryMonth);
        }