Beispiel #1
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;
            }
        }
Beispiel #2
0
        public void ClearImportStockTaking()
        {
            StockTakingBIZ biz = new StockTakingBIZ();

            if (biz.DoAdjustInventory())
            {
                ErrorItem err = new ErrorItem(null, TKPMessages.eValidate.VLM0181.ToString());
                throw new BusinessException(err);
            }

            biz.ClearImportStockTaking(Common.CurrentUserInfomation.UserCD, Common.CurrentUserInfomation.Machine);
        }
Beispiel #3
0
        private void SaveData()
        {
            if (m_ParentSheet == null)
            {
                return;
            }

            int iBox = txtNumberOfBox.Int == 0 ? 1 : txtNumberOfBox.Int;

            for (int box = 0; box < iBox; box++)
            {
                NZString strPackNo = new NZString();
                if (string.Empty.Equals(txtPackNo.Text.Trim()))
                {
                    StockTakingBIZ biz = new StockTakingBIZ();
                    strPackNo = biz.GeneratePackNo();
                }
                else
                {
                    strPackNo = new NZString(txtPackNo, txtPackNo.Text);
                }

                for (int i = 0; i < shtView.RowCount; i++)
                {
                    m_ParentSheet.RowCount = m_ParentSheet.RowCount + 1;

                    //m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.STOCK_TAKING_ID].Value = string.Empty;
                    //m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.EFFECT_INVENTORY_FLAG].Value = false;
                    //m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.COUNTING_ID].Value = string.Empty;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.ITEM_CD].Value = txtMasterNo.Text.Trim();
                    //m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.BTN_ITEM_CD].Value = null;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.SHORT_NAME].Value      = txtPartNo.Text.Trim();
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.CUST_NAME].Value       = txtItemDesc.Text.Trim();
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.LOC_CD].Value          = m_Location;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.LOT_NO].Value          = shtView.Cells[i, (int)eColView.LOT_NO].Value;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.EXTERNAL_LOT_NO].Value = shtView.Cells[i, (int)eColView.EXTERNAL_LOT_NO].Value;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.PACK_NO].Value         = strPackNo.StrongValue; //txtPackNo.Text.Trim();
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.FG_NO].Value           = txtFGNo.Text.Trim();   //txtPackNo.Text.Trim();
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.SYSTEM_QTY].Value      = 0;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.COUNT_QTY].Value       = shtView.Cells[i, (int)eColView.QTY].Value;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.DIFF_QTY].Value        = shtView.Cells[i, (int)eColView.QTY].Value;
                    //m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.ADJUSTED_FLAG].Value = 0;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.MANUAL_ADD_FLAG].Value = 1;
                    //m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.TAG_NO].Value = string.Empty;
                    //m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.REMARK].Value = string.Empty;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.ROW_STATUS].Value = (int)STK030_StockTakingEntry.eRowStatus.ADD;
                    m_ParentSheet.Cells[m_ParentSheet.RowCount - 1, (int)STK030_StockTakingEntry.eColView.TAG_NO].Value     = this.txtTagNo.Text.Trim();
                }
            }
        }
Beispiel #4
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);
        }
Beispiel #5
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()));
            }
        }
Beispiel #6
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);
            }
        }
Beispiel #7
0
        //dtoImportList = data in import file
        public bool ImportStockTakingTemp(string FilePath, int TotalColumn, List <ImportStockTakingDTO> ImportDataList)
        {
            StockTakingBIZ biz = new StockTakingBIZ();

            biz.InsertStockTakingTemp(ImportDataList);

            List <ImportStockTakingDTO> errorList = biz.ValidateStockTakingTemp(Common.CurrentUserInfomation.UserCD,
                                                                                Common.CurrentUserInfomation.Machine);

            if (errorList == null || errorList.Count == 0)
            {
                biz.UpdateStockTaking(Common.CurrentUserInfomation.UserCD, Common.CurrentUserInfomation.Machine);
                return(true);
            }

            WriteErrorToExcelFile(FilePath, TotalColumn + 1, errorList);

            return(false);
        }
Beispiel #8
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()));
            }
        }
Beispiel #9
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);
        }
Beispiel #10
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);
        }
Beispiel #11
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);
        }
Beispiel #12
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            try
            {
                ErrorItem err = CheckCanRunProcess();
                if (err != null)
                {
                    MessageDialog.ShowBusiness(this, err.Message);
                    return;
                }

                //if (dtInventoryMonth.DateValue != null)
                //{
                //    // check exist in inventory period
                //    InventoryPeriodBIZ bizPeriod = new InventoryPeriodBIZ();
                //    NZString YearMonth = new NZString(null, Convert.ToDateTime(dtInventoryMonth.DateValue).ToString("yyyyMM"));
                //    if (!bizPeriod.Exist(YearMonth))
                //    {
                //        MessageDialog.ShowBusiness(this,
                //                                  Message.LoadMessage(
                //                                      TKPMessages.eValidate.VLM0045.ToString()));
                //        return;
                //    }


                //}

                ////MessageDialog.ShowBusiness(this,
                ////                                  Message.LoadMessage(
                ////                                      TKPMessages.eValidate.VLM0020.ToString()));


                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new Message(SystemMaintenance.Messages.eConfirm.CFM9008.ToString()).MessageDescription);
                if (dr == MessageDialogResult.Yes)
                {
                    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;

                    bool bAlreadyRunPreProcess = biz.CheckExistsStockTaking(stk);

                    if (bAlreadyRunPreProcess)
                    {
                        MessageDialogResult drExistStockTaking
                            = MessageDialog.ShowConfirmation(this,
                                                             new Message(SystemMaintenance.Messages.eConfirm.CFM9010.ToString()
                                                                         , new object[] { stk.STOCK_TAKING_DATE.ToString(Common.CurrentUserInfomation.DateFormatString) }
                                                                         ).MessageDescription
                                                             );
                        if (drExistStockTaking != MessageDialogResult.Yes)
                        {
                            return;
                        }
                    }

                    picWaiting.Visible = true;

                    try
                    {
                        if (RunProcess())
                        {
                            picWaiting.Visible = false;

                            MessageDialog.ShowBusiness(this, Message.LoadMessage(SystemMaintenance.Messages.eInformation.INF9003.ToString()));
                        }

                        //Modify on 20 oct 2010
                        //Disable run button after run process complete
                        //To prevent user execute process again, otherwise user close and open this screen again
                        this.btnRun.Enabled = false;
                    }
                    catch (Exception ex)
                    {
                        MessageDialog.ShowBusiness(this, ex.Message);
                    }
                    finally
                    {
                        picWaiting.Visible = false;
                    }

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