Пример #1
0
        private void InitialData()
        {
            SysConfigBIZ sysBiz        = new SysConfigBIZ();
            SysConfigDTO argScreenInfo = new SysConfigDTO();

            argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID;
            argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.DEFAULT_DATE.ToString();
            dtWorkResultDate.Value     = sysBiz.GetDefaultDateForScreen(argScreenInfo);

            if (m_screenMode == eScreenMode.ADD)
            {
                SysConfigDTO defaultSourceLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID,
                                                                (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.SOURCE_LOC.ToString());


                SysConfigDTO defaultDescLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID,
                                                              (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.DEST_LOC.ToString());



                UnPackingEntryUIDM model = new UnPackingEntryUIDM();
                shtView.DataSource    = model.DATA_VIEW;
                shtView.OperationMode = OperationMode.Normal;
            }
        }
Пример #2
0
        private void ClearAllControlExceptDefault()
        {
            CtrlUtil.ClearControlData(txtDeliveryNo, cboCustomerCode, txtInvoiceNo, dtInvoiceDate,
                                      cboTermOfPayment, dtPaymentDueDate, txtSubTotal, txtVat, txtVatTotal, txtTotal);

            CtrlUtil.ClearControlData(txtRemark, cboCustomerCode);
            // Set Default Date
            SysConfigBIZ sysBiz        = new SysConfigBIZ();
            SysConfigDTO argScreenInfo = new SysConfigDTO();

            argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN350.SYS_GROUP_ID;
            argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN350.SYS_KEY.DEFAULT_DATE.ToString();
            dtInvoiceDate.Value        = sysBiz.GetDefaultDateForScreen(argScreenInfo);

            argScreenInfo.SYS_KEY       = (NZString)DataDefine.eSYSTEM_CONFIG.TRN350.SYS_KEY.DEFAULT_VAT.ToString();
            txtVat.Decimal              = decimal.Parse(sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN350.SYS_GROUP_ID, "DEFAULT_VAT".ToNZString()).CHAR_DATA);
            shtCustomerOrder.Rows.Count = 0;
            if (shtCustomerOrder.DataSource != null)
            {
                DataTable dt = shtCustomerOrder.DataSource as DataTable;
                dt.Rows.Clear();
            }

            //m_SelectedDataRow = new SelectedDataRow();
        }
Пример #3
0
        /// <summary>
        /// Update record by using the table's primary key.
        /// </summary>
        /// <param name="database"></param>
        /// <param name="data">Data which to update.</param>
        /// <param name="oldSYS_GROUP_ID">Old Key #1</param>
        /// <param name="oldSYS_KEY">Old Key #2</param>
        /// <returns></returns>
        public int UpdateWithPK(Database database, SysConfigDTO data, NZString oldSYS_GROUP_ID, NZString oldSYS_KEY)
        {
            Database db = UseDatabase(database);

            StringBuilder sb = new StringBuilder();

            #region SQL Statement
            sb.AppendLine(" UPDATE " + data.TableName);
            sb.AppendLine(" SET ");
            sb.AppendLine("  " + SysConfigDTO.eColumns.SYS_GROUP_ID + "=:SYS_GROUP_ID");
            sb.AppendLine("  ," + SysConfigDTO.eColumns.SYS_KEY + "=:SYS_KEY");
            sb.AppendLine("  ," + SysConfigDTO.eColumns.CHAR_DATA + "=:CHAR_DATA");
            sb.AppendLine(" WHERE ");
            sb.AppendLine("  " + SysConfigDTO.eColumns.SYS_GROUP_ID + "=:oldSYS_GROUP_ID");
            sb.AppendLine("  AND " + SysConfigDTO.eColumns.SYS_KEY + "=:oldSysConfig");
            #endregion

            DataRequest req = new DataRequest(sb.ToString());
            #region Parameters
            req.Parameters.Add("SYS_GROUP_ID", DataType.VarChar, data.SYS_GROUP_ID.Value);
            req.Parameters.Add("SYS_KEY", DataType.VarChar, data.SYS_KEY.Value);
            req.Parameters.Add("CHAR_DATA", DataType.VarChar, data.CHAR_DATA.Value);
            req.Parameters.Add("oldSYS_GROUP_ID", DataType.VarChar, oldSYS_GROUP_ID.Value);
            req.Parameters.Add("oldSYS_KEY", DataType.VarChar, oldSYS_KEY.Value);
            #endregion

            return(db.ExecuteNonQuery(req));
        }
Пример #4
0
        private void InitialScreen()
        {
            InitialSpread();
            InitialComboBox();
            InitialFormat();
            dmcShip.AddControl(chkCancelInvoice);
            dmcShip.AddControl(lblTransactionNo);
            dmcShip.AddControl(txtDeliveryNo);
            dmcShip.AddControl(cboCustomerCode);
            dmcShip.AddControl(txtFullAddress);
            dmcShip.AddControl(txtInvoiceNo);
            dmcShip.AddControl(dtInvoiceDate);
            dmcShip.AddControl(cboTermOfPayment);
            dmcShip.AddControl(dtPaymentDueDate);
            dmcShip.AddControl(txtReferTemNo);
            dmcShip.AddControl(txtRemark);
            dmcShip.AddControl(txtSubTotal);
            dmcShip.AddControl(txtVat);
            dmcShip.AddControl(txtVatTotal);
            dmcShip.AddControl(txtTotal);

            CtrlUtil.EnabledControl(false, lblTransactionNo, txtTotal, txtSubTotal);

            txtDeliveryNo.KeyPress    += CtrlUtil.SetNextControl;
            cboCustomerCode.KeyPress  += CtrlUtil.SetNextControl;
            txtInvoiceNo.KeyPress     += CtrlUtil.SetNextControl;
            dtInvoiceDate.KeyPress    += CtrlUtil.SetNextControl;
            cboTermOfPayment.KeyPress += CtrlUtil.SetNextControl;
            dtPaymentDueDate.KeyPress += CtrlUtil.SetNextControl;
            txtReferTemNo.KeyPress    += CtrlUtil.SetNextControl;
            txtRemark.KeyPress        += CtrlUtil.SetNextControl;

            //ClearAllControl();

            if (m_Mode == Common.eScreenMode.ADD)
            {
                SysConfigBIZ sysBiz        = new SysConfigBIZ();
                SysConfigDTO argScreenInfo = new SysConfigDTO();
                argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN350.SYS_GROUP_ID;
                argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN350.SYS_KEY.DEFAULT_DATE.ToString();
                dtInvoiceDate.Value        = sysBiz.GetDefaultDateForScreen(argScreenInfo);
            }
            if (m_Mode != Common.eScreenMode.ADD)
            {
                dmcShip.LoadData(m_uidm);
                LoadShipList();
            }

            CheckCurrentInvPeriod();

            //m_keyboardSpread = new KeyboardSpread(fpCustomerOrder);
            //m_keyboardSpread.RowAdding += m_keyboardSpread_RowAdding;
            //m_keyboardSpread.RowAdded += m_keyboardSpread_RowAdded;
            //m_keyboardSpread.RowRemoved += m_keyboardSpread_RowRemoved;

            //if (m_Mode != Common.eScreenMode.VIEW)
            //{
            //    m_keyboardSpread.StartBind();
            //}
        }
Пример #5
0
        private void InitializeDefaultValue()
        {
            SysConfigBIZ sysBiz           = new SysConfigBIZ();
            SysConfigDTO default_StoreLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN020.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN020.SYS_KEY.STORE_LOC.ToString());

            m_strDefaultLocation = default_StoreLoc.CHAR_DATA.NVL("MAT'");
        }
Пример #6
0
        public ErrorItem CheckOnhandQty_AfterTR(Database db, EVOFramework.Windows.Forms.IControlIdentify owner, NZString ItemCD, NZString LocationCD, NZString LotNo)
        {
            // FIRST CHECK FOR LOCATION IF IT ALLOW NEGATIVE STOCK
            DealingBIZ bizLoc = new DealingBIZ();
            DealingDTO dtoLoc = bizLoc.LoadLocation(LocationCD);

            if (!dtoLoc.ALLOW_NEGATIVE.IsNull && dtoLoc.ALLOW_NEGATIVE.StrongValue == DataDefine.Convert2ClassCode(DataDefine.eALLOW_NEGATIVE.Yes))
            {
                // IF THE LOCATION IS ALLOW FOR NEGATIVE THEN NOT CHECK ONHAND
                return(null);
            }

            InventoryBIZ        biz = new InventoryBIZ();
            ActualOnhandViewDTO dto = biz.LoadActualInventoryOnHand(db, ItemCD, LocationCD, LotNo);

            SysConfigBIZ bizConfig   = new SysConfigBIZ();
            SysConfigDTO dtoMinusQty = bizConfig.LoadByPK(DataDefine.eSYSTEM_CONFIG.LOCATION.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.LOCATION.SYS_KEY.MINUS_QTY.ToString());

            decimal decMinusQty = 0;

            decimal.TryParse(dtoMinusQty.CHAR_DATA.StrongValue, out decMinusQty);

            if (dto.ONHAND_QTY < decMinusQty)
            {
                return(new ErrorItem(owner, TKPMessages.eValidate.VLM0063.ToString(), new[] { ItemCD, LocationCD }));
            }
            return(null);
        }
Пример #7
0
        /// <summary>
        /// Insert new record into database.
        /// </summary>
        /// <param name="database"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public int AddNew(Database database, SysConfigDTO data)
        {
            Database db = UseDatabase(database);

            StringBuilder sb = new StringBuilder();

            #region SQL Statement
            sb.AppendLine(" INSERT INTO " + data.TableName + "(");
            sb.AppendLine("  " + SysConfigDTO.eColumns.SYS_GROUP_ID);
            sb.AppendLine("  ," + SysConfigDTO.eColumns.SYS_KEY);
            sb.AppendLine("  ," + SysConfigDTO.eColumns.CHAR_DATA);
            sb.AppendLine(") VALUES(");
            sb.AppendLine("   :SYS_GROUP_ID");
            sb.AppendLine("   ,:SYS_KEY");
            sb.AppendLine("   ,:CHAR_DATA");
            sb.AppendLine(" )");
            #endregion

            DataRequest req = new DataRequest(sb.ToString());
            #region Parameters
            req.Parameters.Add("SYS_GROUP_ID", DataType.VarChar, data.SYS_GROUP_ID.Value);
            req.Parameters.Add("SYS_KEY", DataType.VarChar, data.SYS_KEY.Value);
            req.Parameters.Add("CHAR_DATA", DataType.VarChar, data.CHAR_DATA.Value);
            #endregion

            return(db.ExecuteNonQuery(req));
        }
Пример #8
0
        internal int UpdateConfig(SystemConfigurationUIDM sysUIDM)
        {
            SysConfigDTO data = new SysConfigDTO();

            data.SYS_GROUP_ID = sysUIDM.SysGroupId;
            data.SYS_KEY      = sysUIDM.SysKey;
            data.CHAR_DATA    = sysUIDM.ChrData;
            int checkUpdate = UpdateConfig(data);

            return(checkUpdate);
        }
Пример #9
0
        /// <summary>
        /// Check exist before manipulate data. If found record will update data. Otherwise insert new data.
        /// </summary>
        /// <param name="database"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public int AddNewOrUpdate(Database database, SysConfigDTO data)
        {
            Database db = UseDatabase(database);

            if (Exist(database, data.SYS_GROUP_ID, data.SYS_KEY))
            {
                return(UpdateWithoutPK(db, data));
            }

            return(AddNew(db, data));
        }
Пример #10
0
        private void InitializeDefaultValue()
        {
            SysConfigBIZ sysBiz           = new SysConfigBIZ();
            SysConfigDTO default_StoreLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN100.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN100.SYS_KEY.FROM_LOC.ToString());

            InvoiceController ctrl = new InvoiceController();
            InvoiceEntryUIDM  uidm = ctrl.CreateUIDMForAddMode();
            DataTable         dt   = uidm.DATA_VIEW;

            shtCustomerOrder.DataSource = dt;
            shtCustomerOrder.RowCount   = 0;
        }
Пример #11
0
        public int GetDefaultRecoverDuration()
        {
            int value = 0;

            SysConfigBIZ biz = new SysConfigBIZ();
            SysConfigDTO dto = biz.LoadByPK((NZString)"RECOVER_DURATION", (NZString)"MRP010");

            if (dto != null)
            {
                value = Convert.ToInt32(dto.CHAR_DATA);
            }

            return(value);
        }
Пример #12
0
        private void InitialDefaultValue()
        {
            SysConfigBIZ sysBiz      = new SysConfigBIZ();
            SysConfigDTO argDateFrom = new SysConfigDTO();

            argDateFrom.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN102.SYS_GROUP_ID;
            argDateFrom.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN102.SYS_KEY.DEFAULT_DATE_FROM.ToString();
            dtPeriodBegin.Value      = sysBiz.GetDefaultDateForScreen_No_Fix(argDateFrom);

            SysConfigDTO argDateTo = new SysConfigDTO();

            argDateTo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN102.SYS_GROUP_ID;
            argDateTo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN102.SYS_KEY.DEFAULT_DATE_TO.ToString();
            dtPeriodEnd.Value      = sysBiz.GetDefaultDateForScreen_No_Fix(argDateTo);
        }
Пример #13
0
        /// <summary>
        /// Load new consumption list by input: item code, order location and qty.
        /// </summary>
        /// <param name="itemCode"></param>
        /// <param name="orderLoc"></param>
        /// <param name="qty"></param>
        private void LoadData()
        {
            SysConfigBIZ sysBiz           = new SysConfigBIZ();
            SysConfigDTO defaultSourceLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID,
                                                            (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.SOURCE_LOC.ToString());

            DataTable model = m_controller.LoadPackingList(txtItemCode.Text.ToNZString(), defaultSourceLoc.CHAR_DATA, txtLotNo.Text.ToNZString());

            shtView.DataSource = model;

            for (int i = 0; i < shtView.RowCount; i++)
            {
                shtView.Cells[i, (int)eColView.CHECKBOX].Value = false;
            }

            CalculateTotalQty();
        }
Пример #14
0
        public DateTime GetDefaultDateForScreen_No_Fix(Database database, SysConfigDTO data)
        {
            Database db = UseDatabase(database);


            DataRequest req = new DataRequest();

            req.CommandText = "S_GetDefaultDateForScreen_No_Fix";
            req.CommandType = System.Data.CommandType.StoredProcedure;

            #region Parameters
            req.Parameters.Add("@pSYS_GROUP_ID", DataType.VarChar, data.SYS_GROUP_ID.Value);
            req.Parameters.Add("@pSYS_KEY", DataType.VarChar, data.SYS_KEY.Value);
            #endregion

            return((DateTime)db.ExecuteScalar(req));
        }
Пример #15
0
        private void SetScreenMode(eScreenMode mode)
        {
            switch (mode)
            {
            case eScreenMode.VIEW:
                CtrlUtil.EnabledControl(false, txtAdjustWeight, txtAdjustQty, txtItemDesc);
                CtrlUtil.EnabledControl(false, dtAdjustDate, rdoIncrease, rdoDecrease, txtMasterNo, txtItemDesc
                                        , btnItemCode, cboStoredLoc, txtLotNo, btnLotNo, txtPackNo, txtFGNo, txtCustomerLotNo
                                        , txtRemark, cboReasonCode);
                CtrlUtil.EnabledControl(false, txtCustomerName, txtOnhandQty);

                tsbSaveAndNew.Enabled   = false;
                tsbSaveAndClose.Enabled = false;
                break;

            case eScreenMode.ADD:
                CtrlUtil.EnabledControl(true, dtAdjustDate, rdoIncrease, rdoDecrease, txtMasterNo, txtItemDesc
                                        , btnItemCode, cboStoredLoc, txtAdjustWeight, txtAdjustQty
                                        , txtRemark, cboReasonCode);
                CtrlUtil.EnabledControl(false, txtLotNo, btnLotNo, txtPackNo, txtItemDesc, txtFGNo, txtCustomerLotNo);
                CtrlUtil.EnabledControl(false, txtCustomerName, txtOnhandQty);

                SysConfigBIZ sysBiz        = new SysConfigBIZ();
                SysConfigDTO argScreenInfo = new SysConfigDTO();
                argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN120.SYS_GROUP_ID;
                argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN120.SYS_KEY.DEFAULT_DATE.ToString();
                dtAdjustDate.Value         = sysBiz.GetDefaultDateForScreen(argScreenInfo);

                break;

            case eScreenMode.EDIT:
                CtrlUtil.EnabledControl(true, txtAdjustWeight, txtAdjustQty, txtRemark, cboReasonCode);
                CtrlUtil.EnabledControl(false, dtAdjustDate, rdoIncrease, rdoDecrease, txtMasterNo, txtItemDesc,
                                        btnItemCode, cboStoredLoc, txtItemDesc, txtOnhandQty);
                CtrlUtil.EnabledControl(false, txtPackNo, txtFGNo, txtLotNo, btnLotNo, txtCustomerLotNo);
                CtrlUtil.EnabledControl(false, txtCustomerName, txtOnhandQty);

                break;
            }

            m_screenMode = mode;
        }
Пример #16
0
        private void InitializeScreenMode()
        {
            if (m_editTransactionID == null)
            {
                SetScreenMode(eScreenMode.ADD);

                AdjustmentEntryUIDM model = new AdjustmentEntryUIDM();
                model.TransactionID.Value = "";
                dmcAdjust.LoadData(model);

                SysConfigBIZ sysBiz        = new SysConfigBIZ();
                SysConfigDTO argScreenInfo = new SysConfigDTO();
                argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN120.SYS_GROUP_ID;
                argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN120.SYS_KEY.DEFAULT_DATE.ToString();
                dtAdjustDate.Value         = sysBiz.GetDefaultDateForScreen(argScreenInfo);
            }
            else
            {
                bool bCanEdit = m_transactionValidator.TransactionCanEditOrDelete(m_editTransactionID);

                if (bCanEdit)
                {
                    SetScreenMode(eScreenMode.EDIT);
                }
                else
                {
                    SetScreenMode(eScreenMode.VIEW);
                }


                AdjustmentEntryUIDM model = m_controller.LoadData(m_editTransactionID);
                //if (model.AdjustType.StrongValue == DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.Out)) {
                //    model.OnHandQty.Value = model.OnHandQty.StrongValue + model.AdjustQty.StrongValue;
                //}

                dmcAdjust.LoadData(model);
                LoadInventoryUM(model.ItemCode);
                UpdateOnhandQtyText();
            }
        }
Пример #17
0
        private void INV010_InventoryOnHandInquiry_Load(object sender, EventArgs e)
        {
            InitialScreen();

            SysConfigBIZ sysBiz            = new SysConfigBIZ();
            SysConfigDTO dtoWarningRecords = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.INV060.SYS_GROUP_ID
                                                             , (NZString)DataDefine.eSYSTEM_CONFIG.INV060.SYS_KEY.WARNING_RECORDS.ToString());
            SysConfigDTO dtoErrorRecords = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.INV060.SYS_GROUP_ID
                                                           , (NZString)DataDefine.eSYSTEM_CONFIG.INV060.SYS_KEY.ERROR_RECORDS.ToString());

            if (dtoWarningRecords != null && dtoWarningRecords.CHAR_DATA.NVL("") != "")
            {
                decimal iRecords = 0;

                if (decimal.TryParse(dtoWarningRecords.CHAR_DATA.NVL("10000"), out iRecords))
                {
                    m_iWarningRecords = (int)iRecords;
                }
            }

            if (dtoErrorRecords != null && dtoErrorRecords.CHAR_DATA.NVL("") != "")
            {
                decimal iRecords = 0;

                if (decimal.TryParse(dtoErrorRecords.CHAR_DATA.NVL("60000"), out iRecords))
                {
                    m_iErrorRecords = (int)iRecords;
                }
            }



            this.dtPeriodBegin.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
            this.dtPeriodEnd.Value   = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(1).AddDays(-1);

            QueryData();
        }
Пример #18
0
        public async Task <ReturnVal <bool> > SysConf(SysConfigDTO dto)
        {
            if (dto.Key != Guid.Parse("3fa85f64-5717-4562-b3fc-2c963f66afa6"))
            {
                throw new CPValidateExceptions("无权限");
            }

            var reps = this._unitOfWork.GetRepositoryAsync <SysConfigEntity>();

            var entity = await reps.SingleAsync(_ => true);

            if (entity == null)
            {
                entity = new()
                {
                    TagAttr = JsonConvert.SerializeObject(dto.TagAttrs)
                };
            }
            else
            {
                entity.TagAttr = JsonConvert.SerializeObject(dto.TagAttrs);
            }

            if (entity.IndentityId > 0)
            {
                reps.UpdateAsync(entity);
            }
            else
            {
                await reps.AddAsync(entity);
            }

            this._unitOfWork.SaveChanges();


            return(this.RetOk(true));
        }
Пример #19
0
        private void InitialScreen()
        {
            CheckCurrentInvPeriod();
            InitialComboBox();

            CommonLib.CtrlUtil.EnabledControl(false, txtTransactionID, txtOnHandQty, txtItemDesc, cboInventoryUM);

            dtIssueDate.Format = CommonLib.Common.CurrentUserInfomation.DateFormatString;

            //dtIssueDate.KeyPress += CommonLib.CtrlUtil.SetNextControl;
            cboFromLoc.KeyPress  += CommonLib.CtrlUtil.SetNextControl;
            cboToLoc.KeyPress    += CommonLib.CtrlUtil.SetNextControl;
            txtLotNo.KeyPress    += CommonLib.CtrlUtil.SetNextControl;
            txtIssueQty.KeyPress += CommonLib.CtrlUtil.SetNextControl;
            //txtRemark.KeyPress += CommonLib.CtrlUtil.SetNextControl;
            cboSubType.KeyPress     += CommonLib.CtrlUtil.SetNextControl;
            txtRefDocNo.KeyPress    += CommonLib.CtrlUtil.SetNextControl;
            txtJobOrderNo.KeyPress  += CommonLib.CtrlUtil.SetNextControl;
            txtForMachine.KeyPress  += CommonLib.CtrlUtil.SetNextControl;
            cboForCustomer.KeyPress += CommonLib.CtrlUtil.SetNextControl;
            txtItemCode.KeyPress    += CommonLib.CtrlUtil.SetNextControl;

            //txtLotNo.KeyDown += CommonLib.CtrlUtil.SetHelpButton;

            dmcIssueByItem.AddControl(txtTransactionID);
            //dmcIssueByItem.AddControl(txtRefTransID);
            dmcIssueByItem.AddControl(txtItemDesc);
            dmcIssueByItem.AddControl(txtItemCode);
            dmcIssueByItem.AddControl(cboToLoc);
            dmcIssueByItem.AddControl(txtLotNo);
            dmcIssueByItem.AddControl(cboFromLoc);
            dmcIssueByItem.AddControl(txtOnHandQty);
            dmcIssueByItem.AddControl(txtIssueQty);
            dmcIssueByItem.AddControl(txtRemark);
            // dmcIssueByItem.AddControl(rdoIssueType_Issue);
            // dmcIssueByItem.AddControl(rdoIssueType_IssueReturn);
            dmcIssueByItem.AddControl(dtIssueDate);

            dmcIssueByItem.AddControl(cboSubType);
            dmcIssueByItem.AddControl(txtRefDocNo);
            dmcIssueByItem.AddControl(txtJobOrderNo);
            dmcIssueByItem.AddControl(txtForMachine);
            dmcIssueByItem.AddControl(cboForCustomer);

            ClearAll();
            // rdoIssueType_Issue.Checked = true;


            if (m_Mode == eSaveMode.ADD)
            {
                SysConfigBIZ sysBiz        = new SysConfigBIZ();
                SysConfigDTO argScreenInfo = new SysConfigDTO();
                argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN040.SYS_GROUP_ID;
                argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN040.SYS_KEY.DEFAULT_DATE.ToString();
                dtIssueDate.Value          = sysBiz.GetDefaultDateForScreen(argScreenInfo);
            }
            else if (m_Mode == eSaveMode.UPDATE)
            {
                LoadInventoryUM(m_uidm.ITEM_CD);
                dmcIssueByItem.LoadData(m_uidm);
                LoadLotNo(m_uidm.ITEM_CD, m_uidm.FROM_LOC_CD);
                //txtLotNo.SelectedValue = m_uidm.LOT_NO.StrongValue;

                txtOnHandQty.Text = CommonLib.CtrlUtil.GetCompleteNumberFormatValue(txtOnHandQty.MaxDecimalPlaces, (NZDecimal)(m_uidm.QTY.StrongValue + GetOnHandQty().NVL(0)));
                txtIssueQty.Tag   = txtIssueQty.Double;
                CommonLib.CtrlUtil.EnabledControl(false, txtItemCode, btnItemCode, cboFromLoc, cboToLoc, txtLotNo
                                                  //, rdoIssueType_IssueReturn, rdoIssueType_Issue
                                                  , dtIssueDate, txtRemark, btnLotNo);

                m_REF_NO = m_uidm.REF_NO.StrongValue;
                txtIssueQty.Focus();
                txtIssueQty.Select();
                txtIssueQty.SelectAll();
            }
            else if (m_Mode == eSaveMode.VIEW)
            {
                dmcIssueByItem.LoadData(m_uidm);
                LoadInventoryUM(m_uidm.ITEM_CD);
                LoadLotNo(m_uidm.ITEM_CD, m_uidm.FROM_LOC_CD);
                //txtLotNo.SelectedValue = m_uidm.LOT_NO.StrongValue;
                txtOnHandQty.Text = CommonLib.CtrlUtil.GetCompleteNumberFormatValue(txtOnHandQty.MaxDecimalPlaces, (NZDecimal)(m_uidm.QTY.StrongValue + GetOnHandQty().StrongValue));
                txtIssueQty.Tag   = txtIssueQty.Double;
                CommonLib.CtrlUtil.EnabledControl(false, txtItemCode, btnItemCode, cboFromLoc, cboToLoc, txtLotNo
                                                  //, rdoIssueType_IssueReturn, rdoIssueType_Issue
                                                  , dtIssueDate, txtRemark, txtIssueQty);
                CommonLib.CtrlUtil.EnabledControl(false, tsbSaveAndClose, tsbSaveAndNew);
                //m_REF_NO = m_uidm.REF_NO.StrongValue;
                //txtIssueQty.SelectAll();
            }
        }
Пример #20
0
        private void TRN020_Load(object sender, EventArgs e)
        {
            InitializeScreen();

            if (m_editReceiveNo == null)
            {
                SetScreenMode(Common.eScreenMode.ADD);
                ClearAll();

                m_model = new ReceivingEntryUIDM();
                dmcReceive.LoadData(m_model);

                SysConfigBIZ sysBiz        = new SysConfigBIZ();
                SysConfigDTO argScreenInfo = new SysConfigDTO();
                argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN020.SYS_GROUP_ID;
                argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN020.SYS_KEY.DEFAULT_DATE.ToString();
                dtReceiveDate.Value        = sysBiz.GetDefaultDateForScreen(argScreenInfo);


                shtView.RowCount   = 0;
                shtView.DataSource = m_model.DATA_VIEW;
                try
                {
                    if (rdoReceive.Checked)
                    {
                        cboStoredLoc.SelectedValue = m_strDefaultLocation;
                    }
                }
                catch
                {
                }
            }
            else
            {
                InventoryBIZ bizInventory = new InventoryBIZ();
                ClearAll();

                m_model = m_controller.LoadData(m_editReceiveNo);

                List <InventoryTransactionViewDTO> dtos = DTOUtility.ConvertDataTableToList <InventoryTransactionViewDTO>(m_model.DATA_VIEW);
                // bizInventory.LoadTransactionViewByReceiveNo(m_editReceiveNo);
                if (dtos.Count > 0)
                {
                    bool bCanEdit = m_transactionValidator.DateIsInCurrentPeriod(dtos[0].TRANS_DATE.StrongValue) == null;
                    if (bCanEdit)
                    {
                        SetScreenMode(Common.eScreenMode.EDIT);
                    }
                    else
                    {
                        SetScreenMode(Common.eScreenMode.VIEW);
                    }
                }
                else
                {
                    SetScreenMode(Common.eScreenMode.VIEW);
                }


                dmcReceive.LoadData(m_model);

                shtView.RowCount   = 0;
                shtView.DataSource = m_model.DATA_VIEW;

                //int row = shtView.Rows.Count;
                //// set amount value
                //if (row > 0)
                //{
                //    for (int i = 0; i < row; i++)
                //    {
                //        shtView.Cells[i, (int)eColView.AMOUNT].Value = Convert.ToDouble(shtView.Cells[i, (int)eColView.ORDER_QTY].Value)
                //                                                        * Convert.ToDouble(shtView.Cells[i, (int)eColView.PRICE].Value);
                //    }
                //}
            }

            CheckCurrentInvPeriod();
        }
Пример #21
0
        public bool SaveData(MultiWorkResultEntryUIDM model)
        {
            ItemBIZ             bizItem      = new ItemBIZ();
            ClassListBIZ        bizClassList = new ClassListBIZ();
            InventoryBIZ        biz          = new InventoryBIZ();
            IssueEntryValidator valLot       = new IssueEntryValidator();

            #region Validate data

            MultiWorkResultEntryValidator workResultEntryValidator = new MultiWorkResultEntryValidator();
            ItemValidator      itemValidator     = new ItemValidator();
            DealingValidator   locationValidator = new DealingValidator();
            CommonBizValidator commonVal         = new CommonBizValidator();
            ValidateException.ThrowErrorItem(workResultEntryValidator.CheckWorkResultDate(model.WorkResultDate));
            ValidateException.ThrowErrorItem(itemValidator.CheckEmptyItemCode(model.ItemCode));
            ValidateException.ThrowErrorItem(itemValidator.CheckEmptyItemCode(model.ChildItemCode));
            ValidateException.ThrowErrorItem(workResultEntryValidator.CheckEmptyShiftType(model.ShiftClass));

            BusinessException itemFound = itemValidator.CheckItemNotExist(model.ItemCode);
            if (itemFound != null)
            {
                ValidateException.ThrowErrorItem(itemFound.Error);
            }

            ValidateException.ThrowErrorItem(locationValidator.CheckEmptyLocationCode(model.OrderLoc));
            ValidateException.ThrowErrorItem(locationValidator.CheckNotExistsLocationCode(model.OrderLoc));

            ValidateException.ThrowErrorItem(locationValidator.CheckEmptyLocationCode(model.StoredLoc));
            ValidateException.ThrowErrorItem(locationValidator.CheckNotExistsLocationCode(model.StoredLoc));

            #endregion

            DataTable dtData = null;
            if (model.DataView == null)
            {
                MultiWorkResultEntryViewDTO dto = new MultiWorkResultEntryViewDTO();
                dto.CreateDataTableSchema(out dtData);
            }
            else
            {
                dtData = model.DataView;
            }


            DataTable dtAdd    = dtData.GetChanges(DataRowState.Added);
            DataTable dtUpdate = dtData.GetChanges(DataRowState.Modified);
            DataTable dtDelete = dtData.GetChanges(DataRowState.Deleted);

            DataTable dtUnChanged = dtData.GetChanges(DataRowState.Unchanged);

            List <InventoryTransactionDTO> listAdd    = new List <InventoryTransactionDTO>();
            List <InventoryTransactionDTO> listUpdate = new List <InventoryTransactionDTO>();
            List <InventoryTransactionDTO> listDelete = new List <InventoryTransactionDTO>();

            List <MultiWorkResultEntryViewDTO> listViewAdd    = DTOUtility.ConvertDataTableToList <MultiWorkResultEntryViewDTO>(dtAdd);
            List <MultiWorkResultEntryViewDTO> listViewUpdate = DTOUtility.ConvertDataTableToList <MultiWorkResultEntryViewDTO>(dtUpdate);
            List <MultiWorkResultEntryViewDTO> listViewDelete = DTOUtility.ConvertDataTableToList <MultiWorkResultEntryViewDTO>(dtDelete);
            List <MultiWorkResultEntryViewDTO> listUnchanged  = DTOUtility.ConvertDataTableToList <MultiWorkResultEntryViewDTO>(dtUnChanged);



            Database db = null;
            try
            {
                db = Common.CurrentDatabase;
                db.KeepConnection = true;
                db.BeginTransaction();

                NZString runningNo            = new NZString();
                NZString strWorkResultGroupNo = new NZString();

                InventoryTransactionDTO dtoWorkResult    = null;
                InventoryTransactionDTO dtoNGResult      = null;
                InventoryTransactionDTO dtoReserveResult = null;
                InventoryTransactionDTO dtoConsumption   = null;


                InventoryTransBIZ bizTran = new InventoryTransBIZ();
                SysConfigBIZ      bizSYS  = new SysConfigBIZ();

                SysConfigDTO dtoSYS = bizSYS.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN080.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN080.SYS_KEY.NG_LOC_CD.ToString());

                //SysConfigDTO dtoSupplyLot = bizSYS.LoadByPK((NZString)"SUPPLY", (NZString)"SUPP_LOT");

                NZString strNGLocation = null;
                if (dtoSYS == null || dtoSYS.CHAR_DATA.IsNull || dtoSYS.CHAR_DATA.StrongValue == "ORDER_LOC")
                {
                    strNGLocation = model.OrderLoc;
                }
                else
                {
                    strNGLocation = dtoSYS.CHAR_DATA;
                }

                RunningNumberBIZ runningNumberBIZ = new RunningNumberBIZ();

                //set Work Result Group No ให้กับทุกตัว
                //ถ้าheader ยังไม่มีก็ genใหม่
                //ถ้าheader มีแล้ว ก็ใช้ตัวนั้น
                if (model.WorkResultGroupNo.IsNull)
                {
                    strWorkResultGroupNo    = runningNumberBIZ.GetCompleteRunningNo((NZString)"WORK_RESULT_GROUP_NO", (NZString)"TB_INV_TRANS_TR");
                    model.WorkResultGroupNo = strWorkResultGroupNo;
                }

                foreach (MultiWorkResultEntryViewDTO dtoAdd in listViewAdd)
                {
                    runningNo = runningNumberBIZ.GetCompleteRunningNo((NZString)"WORK_RESULT_SLIP_NO", (NZString)"TB_INV_TRANS_TR");

                    //ถ้าใส่จำนวนใดจำนวนหนึ่งมา ก็จะ save ได้
                    if (dtoAdd.GOOD_QTY.NVL(0) + dtoAdd.NG_QTY.NVL(0) + dtoAdd.RESERVE_QTY.NVL(0) > 0)
                    {
                        dtoWorkResult         = CreateDTOForWorkResult(model, dtoAdd);
                        dtoWorkResult.SLIP_NO = runningNo;
                        listAdd.Add(dtoWorkResult);

                        if (dtoAdd.NG_QTY.NVL(0) > 0)
                        {
                            dtoNGResult         = CreateDTOForNGResult(model, dtoAdd, strNGLocation);
                            dtoNGResult.SLIP_NO = runningNo;
                            listAdd.Add(dtoNGResult);
                        }

                        //เฉพาะ work result ที่จะมี reserve ได้
                        if (DataDefine.eTRAN_SUB_CLS.WR.ToString().Equals(model.TRAN_SUB_CLS))
                        {
                            if (dtoAdd.RESERVE_QTY.NVL(0) > 0)
                            {
                                dtoReserveResult         = CreateDTOForReserveResult(model, dtoAdd);
                                dtoReserveResult.SLIP_NO = runningNo;
                                listAdd.Add(dtoReserveResult);
                            }
                        }

                        dtoConsumption        = CreateDTOForConsumption(model, dtoAdd);
                        dtoConsumption.REF_NO = dtoWorkResult.SLIP_NO;
                        listAdd.Add(dtoConsumption);
                    }
                }

                foreach (MultiWorkResultEntryViewDTO dtoUnchanged in listUnchanged)
                {
                    dtoWorkResult = CreateDTOForWorkResult(model, dtoUnchanged);
                    listUpdate.Add(dtoWorkResult);
                }


                foreach (MultiWorkResultEntryViewDTO dtoUpdate in listViewUpdate)
                {
                    dtoWorkResult = CreateDTOForWorkResult(model, dtoUpdate);
                    listUpdate.Add(dtoWorkResult);

                    if (dtoUpdate.NG_QTY.NVL(0) > 0)
                    {
                        dtoNGResult = CreateDTOForNGResult(model, dtoUpdate, strNGLocation);

                        if (dtoNGResult.TRANS_ID.IsNull)
                        {
                            listAdd.Add(dtoNGResult);
                        }
                        else
                        {
                            listUpdate.Add(dtoNGResult);
                        }
                    }

                    //เฉพาะ work result ที่จะมี reserve ได้
                    if (DataDefine.eTRAN_SUB_CLS.WR.ToString().Equals(model.TRAN_SUB_CLS))
                    {
                        if (dtoUpdate.RESERVE_QTY.NVL(0) > 0)
                        {
                            dtoReserveResult = CreateDTOForReserveResult(model, dtoUpdate);

                            if (dtoReserveResult.TRANS_ID.IsNull)
                            {
                                listAdd.Add(dtoReserveResult);
                            }
                            else
                            {
                                listUpdate.Add(dtoReserveResult);
                            }
                        }
                    }

                    dtoConsumption        = CreateDTOForConsumption(model, dtoUpdate);
                    dtoConsumption.REF_NO = dtoWorkResult.SLIP_NO;
                    //consumption ใช้การ add เพราะ ใช้การ clear แล้ว insert ใหม่ เลยต้อง add consumption ใหม่ตลอด
                    listAdd.Add(dtoConsumption);

                    biz.ClearConsumption(Common.CurrentDatabase, dtoWorkResult);
                }



                foreach (MultiWorkResultEntryViewDTO dtoDelete in listViewDelete)
                {
                    dtoWorkResult = CreateDTOForWorkResult(model, dtoDelete);
                    listDelete.Add(dtoWorkResult);

                    if (dtoDelete.NG_QTY.NVL(0) > 0)
                    {
                        dtoNGResult = CreateDTOForNGResult(model, dtoDelete, strNGLocation);
                        listDelete.Add(dtoNGResult);
                    }

                    //เฉพาะ work result ที่จะมี reserve ได้
                    if (DataDefine.eTRAN_SUB_CLS.WR.ToString().Equals(model.TRAN_SUB_CLS))
                    {
                        if (dtoDelete.RESERVE_QTY.NVL(0) > 0)
                        {
                            dtoReserveResult = CreateDTOForReserveResult(model, dtoDelete);
                            listDelete.Add(dtoReserveResult);
                        }
                    }

                    dtoConsumption = CreateDTOForConsumption(model, dtoDelete);
                    listDelete.Add(dtoConsumption);
                }


                biz.WorkResultItems(Common.CurrentDatabase, listAdd, listUpdate, listDelete);

                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                throw ex;
            }
            finally
            {
                if (db.DBConnectionState == ConnectionState.Open)
                {
                    db.Close();
                }
            }

            return(true);
        }
Пример #22
0
        public override void OnSaveAndNew()
        {
            try
            {
                label7.Focus();

                this.fpCustomerOrder.StopCellEditing();
                //if (m_bRowHasModified)
                //{ // ถ้า Row กำลังแก้ไขอยู่
                //    if (!ValidateRowSpread(shtCustomerOrder.ActiveRowIndex, false))
                //    {
                //        return;
                //    }
                //}


                // ต้องเรียกก่อน Save เสมอ  เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid
                // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource
                CtrlUtil.SpreadSheetRowEndEdit(shtCustomerOrder, shtCustomerOrder.ActiveRowIndex);

                RemoveRowUnused(shtCustomerOrder);

                if (!ValidateMandatory())
                {
                    return;
                }

                MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new Message(SystemMaintenance.Messages.eConfirm.CFM9001.ToString()).MessageDescription);
                switch (dr)
                {
                case MessageDialogResult.Cancel:
                    return;

                case MessageDialogResult.No:
                    //Close();
                    return;

                case MessageDialogResult.Yes:
                    break;
                }
                if (SaveData())
                {
                    MessageDialog.ShowInformation(this, "Information", new Message(SystemMaintenance.Messages.eInformation.INF9003.ToString()).MessageDescription);
                    ClearAllControlExceptDefault();
                    m_Mode = Common.eScreenMode.ADD;
                    lblTransactionNo.Text = "";

                    SysConfigBIZ sysBiz        = new SysConfigBIZ();
                    SysConfigDTO argScreenInfo = new SysConfigDTO();
                    argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN100.SYS_GROUP_ID;
                    argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN100.SYS_KEY.DEFAULT_DATE.ToString();
                    dtInvoiceDate.Value        = sysBiz.GetDefaultDateForScreen(argScreenInfo);

                    CtrlUtil.EnabledControl(true, txtRemark, dtInvoiceDate, cboCustomerCode);
                    dtInvoiceDate.Focus();
                    dtInvoiceDate.Select();
                }
            }
            catch (ValidateException err)
            {
                for (int i = 0; i < err.ErrorResults.Count; i++)
                {
                    MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message);
                    err.ErrorResults[i].FocusOnControl();
                }
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Пример #23
0
        public DateTime GetDefaultDateForScreen_No_Fix(SysConfigDTO argParam)
        {
            SysConfigDAO dao = new SysConfigDAO(CommonLib.Common.CurrentDatabase);

            return(dao.GetDefaultDateForScreen_No_Fix(null, argParam));
        }
Пример #24
0
        public int UpdateData(SysConfigDTO data)
        {
            SysConfigDAO dao = new SysConfigDAO(CommonLib.Common.CurrentDatabase);

            return(dao.UpdateWithoutPK(null, data));
        }
Пример #25
0
        private void InitialScreen()
        {
            CheckCurrentInvPeriod();
            InitialSpread();
            InitialComboBox();

            CtrlUtil.EnabledControl(false, txtIssueNo);

            dmcIssue.AddControl(txtIssueNo);
            dmcIssue.AddControl(dtIssueDate);
            dmcIssue.AddControl(cboToLoc);
            dmcIssue.AddControl(cboFromLoc);
            dmcIssue.AddControl(txtRemark);
            dmcIssue.AddControl(cboSubType);
            dmcIssue.AddControl(txtRefDocNo);
            dmcIssue.AddControl(txtJobOrderNo);
            dmcIssue.AddControl(cboForCustomer);


            dtIssueDate.Format = Common.CurrentUserInfomation.DateFormatString;


            cboFromLoc.KeyPress += CtrlUtil.SetNextControl;
            cboToLoc.KeyPress   += CtrlUtil.SetNextControl;

            cboSubType.KeyPress    += CommonLib.CtrlUtil.SetNextControl;
            txtRefDocNo.KeyPress   += CommonLib.CtrlUtil.SetNextControl;
            txtJobOrderNo.KeyPress += CommonLib.CtrlUtil.SetNextControl;
            //txtForMachine.KeyPress += CommonLib.CtrlUtil.SetNextControl;
            cboForCustomer.KeyPress += CommonLib.CtrlUtil.SetNextControl;
            dtIssueDate.KeyPress    += CommonLib.CtrlUtil.SetNextControl;

            ClearAllControl();


            SysConfigBIZ sysBiz        = new SysConfigBIZ();
            SysConfigDTO argScreenInfo = new SysConfigDTO();

            argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN080.SYS_GROUP_ID;
            argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.TRN080.SYS_KEY.DEFAULT_DATE.ToString();
            dtIssueDate.Value          = sysBiz.GetDefaultDateForScreen(argScreenInfo);

            if (m_Mode == eSaveMode.UPDATE)
            {
                if (m_uidm != null)
                {
                    dmcIssue.LoadData(m_uidm);
                    NZString TranId = (NZString)Convert.ToString(m_uidm.TRANS_ID.Value);
                    GetShipNo(TranId);
                }
                CtrlUtil.EnabledControl(false
                                        , cboFromLoc, cboToLoc
                                        , dtIssueDate);
            }
            else if (m_Mode == eSaveMode.VIEW)
            {
                if (m_uidm != null)
                {
                    dmcIssue.LoadData(m_uidm);

                    LoadIssueListForEdit(m_uidm.SLIP_NO);
                }
                CtrlUtil.EnabledControl(true
                                        , cboFromLoc, cboToLoc, txtRemark
                                        , dtIssueDate);
                CtrlUtil.EnabledControl(false, tsbSaveAndClose, tsbSaveAndNew);
            }
        }
Пример #26
0
        public void SaveNewPacking(PackingEntryUIDM data, int NumberOfBox)
        {
            try
            {
                #region Validate

                ItemValidator itemValidator = new ItemValidator();
                ValidateException.ThrowErrorItem(itemValidator.CheckEmptyItemCode(data.MASTER_NO));

                BusinessException businessException = itemValidator.CheckItemNotExist(data.MASTER_NO);
                if (businessException != null)
                {
                    ValidateException.ThrowErrorItem(businessException.Error);
                }

                #endregion

                InventoryBIZ biz = new InventoryBIZ();

                SysConfigBIZ sysBiz                = new SysConfigBIZ();
                SysConfigDTO defaultSourceLoc      = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN320.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN320.SYS_KEY.SOURCE_LOC.ToString());
                SysConfigDTO defaultDestinationLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN320.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN320.SYS_KEY.DEST_LOC.ToString());

                InventoryTransactionDTO        Source          = new InventoryTransactionDTO();
                List <InventoryTransactionDTO> DestinationList = new List <InventoryTransactionDTO>();

                #region Destination

                foreach (DataRow dr in data.DATA_VIEW.Rows)
                {
                    InventoryTransactionDTO dto = new InventoryTransactionDTO();
                    dto.CRT_BY = Common.CurrentUserInfomation.UserCD;
                    //dto.CRT_DATE
                    dto.CRT_MACHINE = Common.CurrentUserInfomation.Machine;
                    dto.UPD_BY      = Common.CurrentUserInfomation.UserCD;
                    //dto.UPD_DATE
                    dto.UPD_MACHINE = Common.CurrentUserInfomation.Machine;
                    //dto.TRANS_ID
                    dto.ITEM_CD         = data.MASTER_NO;
                    dto.LOC_CD          = defaultDestinationLoc.CHAR_DATA;
                    dto.LOT_NO          = new NZString(null, dr[(int)PackingEntryUIDM.eColView.LOT_NO]);
                    dto.FG_NO           = data.FG_NO;
                    dto.PACK_NO         = data.PACK_NO;
                    dto.EXTERNAL_LOT_NO = new NZString(null, dr[(int)PackingEntryUIDM.eColView.EXTERNAL_LOT_NO]);
                    dto.TRANS_DATE      = data.PACKING_DATE;
                    dto.TRANS_CLS       = DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Packing).ToNZString();
                    dto.IN_OUT_CLS      = DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.In).ToNZString();
                    dto.FG_NO           = data.FG_NO;

                    if (dr[(int)PackingEntryUIDM.eColView.QTY] == null ||
                        dr[(int)PackingEntryUIDM.eColView.QTY] == (object)DBNull.Value)
                    {
                        dto.QTY = new NZDecimal(null, 0);
                    }
                    else
                    {
                        dto.QTY = new NZDecimal(null, dr[(int)PackingEntryUIDM.eColView.QTY]);
                    }

                    //dto.WEIGHT
                    //dto.OBJ_ITEM_CD
                    //dto.OBJ_ORDER_QTY
                    //dto.REF_NO
                    //dto.REF_SLIP_NO
                    //dto.REF_SLIP_CLS
                    //dto.OTHER_DL_NO
                    //dto.SLIP_NO
                    dto.REMARK = data.REMARK;
                    //dto.DEALING_NO
                    //dto.PRICE
                    //dto.AMOUNT
                    //dto.FOR_CUSTOMER
                    //dto.FOR_MACHINE
                    dto.SHIFT_CLS = data.SHIFT_CLS;
                    //dto.REF_SLIP_NO2
                    //dto.NG_QTY
                    //dto.NG_WEIGHT
                    //dto.TRAN_SUB_CLS =
                    dto.SCREEN_TYPE = DataDefine.ScreenType.PackingEntry.ToNZString();
                    //dto.GROUP_TRANS_ID
                    //dto.RESERVE_QTY
                    //dto.RETURN_QTY
                    //dto.NG_REASON
                    dto.EFFECT_STOCK = new NZInt(null, (int)DataDefine.eEFFECT_STOCK.In);
                    //dto.LOT_REMARK
                    dto.PERSON_IN_CHARGE = data.PERSON_IN_CHARGE;
                    //dto.CURRENCY
                    //dto.REWORK_FLAG
                    dto.OLD_DATA = new NZInt(null, 0);
                    //dto.TIME_STAMP

                    DestinationList.Add(dto);
                }

                #endregion

                #region Pack

                Source.CRT_BY = Common.CurrentUserInfomation.UserCD;
                //Source.CRT_DATE
                Source.CRT_MACHINE = Common.CurrentUserInfomation.Machine;
                Source.UPD_BY      = Common.CurrentUserInfomation.UserCD;
                //Source.UPD_DATE
                Source.UPD_MACHINE = Common.CurrentUserInfomation.Machine;
                //Source.TRANS_ID
                Source.ITEM_CD = data.MASTER_NO;
                Source.LOC_CD  = defaultSourceLoc.CHAR_DATA;
                //Source.LOT_NO
                Source.FG_NO   = data.FG_NO;
                Source.PACK_NO = data.PACK_NO;
                //Source.EXTERNAL_LOT_NO
                Source.TRANS_DATE = data.PACKING_DATE;
                Source.TRANS_CLS  = DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Packing_Consumption).ToNZString();
                Source.IN_OUT_CLS = DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.Out).ToNZString();
                Source.QTY        = data.TOTAL_QTY;
                //Source.WEIGHT
                //Source.OBJ_ITEM_CD
                //Source.OBJ_ORDER_QTY
                //Source.REF_NO
                //Source.REF_SLIP_NO
                //Source.REF_SLIP_CLS
                //Source.OTHER_DL_NO
                //Source.SLIP_NO
                Source.REMARK = data.REMARK;
                //Source.DEALING_NO
                //Source.PRICE
                //Source.AMOUNT
                //Source.FOR_CUSTOMER
                //Source.FOR_MACHINE
                Source.SHIFT_CLS = data.SHIFT_CLS;
                //Source.REF_SLIP_NO2
                //Source.NG_QTY
                //Source.NG_WEIGHT
                //Source.TRAN_SUB_CLS =
                Source.SCREEN_TYPE = DataDefine.ScreenType.PackingEntry.ToNZString();
                //Source.GROUP_TRANS_ID
                //Source.RESERVE_QTY
                //Source.RETURN_QTY
                //Source.NG_REASON
                Source.EFFECT_STOCK = new NZInt(null, (int)DataDefine.eEFFECT_STOCK.Out);
                //Source.LOT_REMARK
                Source.PERSON_IN_CHARGE = data.PERSON_IN_CHARGE;
                //Source.CURRENCY
                //Source.REWORK_FLAG
                Source.OLD_DATA = new NZInt(null, 0);
                //Source.TIME_STAMP

                #endregion

                biz.AddPacking(DestinationList, Source, NumberOfBox);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #27
0
        public void SaveNewUnPacking(UnPackingEntryUIDM data)
        {
            try
            {
                #region Validate

                ItemValidator itemValidator = new ItemValidator();
                ValidateException.ThrowErrorItem(itemValidator.CheckEmptyItemCode(data.ITEM_CD));

                BusinessException businessException = itemValidator.CheckItemNotExist(data.ITEM_CD);
                if (businessException != null)
                {
                    ValidateException.ThrowErrorItem(businessException.Error);
                }

                #endregion

                InventoryBIZ biz = new InventoryBIZ();

                SysConfigBIZ sysBiz                = new SysConfigBIZ();
                SysConfigDTO defaultSourceLoc      = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.SOURCE_LOC.ToString());
                SysConfigDTO defaultDestinationLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.DEST_LOC.ToString());

                List <InventoryTransactionDTO> SourceList  = new List <InventoryTransactionDTO>();
                InventoryTransactionDTO        Destination = new InventoryTransactionDTO();

                #region source
                data.TOTAL_QTY = new NZDecimal(null, 0);
                foreach (DataRow dr in data.DATA_VIEW.Rows)
                {
                    InventoryTransactionDTO dto = new InventoryTransactionDTO();
                    dto.CRT_BY          = Common.CurrentUserInfomation.UserCD;
                    dto.CRT_MACHINE     = Common.CurrentUserInfomation.Machine;
                    dto.UPD_BY          = Common.CurrentUserInfomation.UserCD;
                    dto.UPD_MACHINE     = Common.CurrentUserInfomation.Machine;
                    dto.ITEM_CD         = data.ITEM_CD;
                    dto.LOC_CD          = defaultSourceLoc.CHAR_DATA;
                    dto.PACK_NO         = new NZString(null, dr[(int)UnPackingEntryUIDM.eColView.PACK_NO]);
                    dto.FG_NO           = new NZString(null, dr[(int)UnPackingEntryUIDM.eColView.FG_NO]);
                    dto.LOT_NO          = new NZString(null, dr[(int)UnPackingEntryUIDM.eColView.LOT_NO]);
                    dto.EXTERNAL_LOT_NO = new NZString(null, dr[(int)UnPackingEntryUIDM.eColView.EXTERNAL_LOT_NO]);
                    dto.TRANS_DATE      = data.UNPACKING_DATE;
                    dto.TRANS_CLS       = DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Unpack_Consumption).ToNZString();
                    dto.IN_OUT_CLS      = DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.Out).ToNZString();

                    if (dr[(int)UnPackingEntryUIDM.eColView.ONHAND_QTY] == null ||
                        dr[(int)UnPackingEntryUIDM.eColView.ONHAND_QTY] == (object)DBNull.Value)
                    {
                        dto.QTY = new NZDecimal(null, 0);
                    }
                    else
                    {
                        dto.QTY         = new NZDecimal(null, dr[(int)UnPackingEntryUIDM.eColView.ONHAND_QTY]);
                        data.TOTAL_QTY += dto.QTY;
                    }

                    dto.REMARK           = data.REMARK;
                    dto.SHIFT_CLS        = data.SHIFT_CLS;
                    dto.PERSON_IN_CHARGE = data.PERSON_IN_CHARGE;
                    dto.SCREEN_TYPE      = DataDefine.ScreenType.UnPackingEntry.ToNZString();
                    dto.EFFECT_STOCK     = new NZInt(null, (int)DataDefine.eEFFECT_STOCK.Out);
                    dto.OLD_DATA         = new NZInt(null, 0);
                    //dto.TIME_STAMP

                    SourceList.Add(dto);
                }

                #endregion

                #region Destination (Unpack)

                Destination.CRT_BY           = Common.CurrentUserInfomation.UserCD;
                Destination.CRT_MACHINE      = Common.CurrentUserInfomation.Machine;
                Destination.UPD_BY           = Common.CurrentUserInfomation.UserCD;
                Destination.UPD_MACHINE      = Common.CurrentUserInfomation.Machine;
                Destination.ITEM_CD          = data.ITEM_CD;
                Destination.LOC_CD           = defaultDestinationLoc.CHAR_DATA;
                Destination.TRANS_DATE       = data.UNPACKING_DATE;
                Destination.TRANS_CLS        = DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Unpack).ToNZString();
                Destination.IN_OUT_CLS       = DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.In).ToNZString();
                Destination.QTY              = data.TOTAL_QTY;
                Destination.REMARK           = data.REMARK;
                Destination.SHIFT_CLS        = data.SHIFT_CLS;
                Destination.SCREEN_TYPE      = DataDefine.ScreenType.UnPackingEntry.ToNZString();
                Destination.EFFECT_STOCK     = new NZInt(null, (int)DataDefine.eEFFECT_STOCK.In);
                Destination.PERSON_IN_CHARGE = data.PERSON_IN_CHARGE;
                Destination.OLD_DATA         = new NZInt(null, 0);

                #endregion

                biz.AddUnPacking(SourceList, Destination);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #28
0
        internal int UpdateConfig(SysConfigDTO data)
        {
            SysConfigBIZ biz = new SysConfigBIZ();

            return(biz.UpdateData(data));
        }
Пример #29
0
        private void InitialScreen()
        {
            cboProcess.Format += Common.ComboBox_Format;

            rdoReportCheckingList.KeyPress   += CtrlUtil.SetNextControl;
            rdoReportCountingResult.KeyPress += CtrlUtil.SetNextControl;
            //txtLocation.KeyPress += CtrlUtil.SetNextControl;
            cboProcess.KeyPress          += CtrlUtil.SetNextControl;
            txtMasterNo.KeyPress         += CtrlUtil.SetNextControl;
            cboItemType.KeyPress         += CtrlUtil.SetNextControl;
            cboItemClassMinor04.KeyPress += CtrlUtil.SetNextControl;
            chkIncomplete.KeyPress       += CtrlUtil.SetNextControl;
            chkDiff.KeyPress             += CtrlUtil.SetNextControl;
            chkNoMaster.KeyPress         += CtrlUtil.SetNextControl;


            LookupDataBIZ bizLookup = new LookupDataBIZ();

            LookupData lookupItemType = bizLookup.LoadLookupClassType(new NZString(null, "ITEM_CLS"));

            cboItemType.LoadLookupData(lookupItemType);
            cboItemType.SelectedIndex = -1;

            //------------ Location --------------------//
            NZString[] locationtype = new NZString[1];
            locationtype[0] = DataDefine.Convert2ClassCode(DataDefine.eLOCATION_CLS.Production).ToNZString();
            LookupData dataProductionProcess = bizLookup.LoadLookupLocation(locationtype);

            cboProcess.LoadLookupData(dataProductionProcess);
            cboProcess.SelectedIndex = -1;
            //------------ Location --------------------//

            if (m_strPartSubType != null)
            {
                this.cboItemType.SelectedValue = m_strPartType;
            }

            if (m_strPartSubType != null)
            {
                this.cboItemClassMinor04.SelectedValue = m_strPartSubType;
            }



            dtStockTakingDate.Format = Common.CurrentUserInfomation.DateFormatString;

            CtrlUtil.EnabledControl(false, dtStockTakingDate, txtPreProcessBy, txtRemark);

            LoadCurrentStockTakingData();


            if (btnPrintTag.Visible == false)
            {
                SysConfigBIZ sysBiz        = new SysConfigBIZ();
                SysConfigDTO argScreenInfo = new SysConfigDTO();
                argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.STK020.SYS_GROUP_ID;
                argScreenInfo.SYS_KEY      = (NZString)DataDefine.eSYSTEM_CONFIG.STK020.SYS_KEY.DEV_VERSION.ToString();

                SysConfigDTO data = sysBiz.LoadByPK(argScreenInfo.SYS_GROUP_ID, argScreenInfo.SYS_KEY);

                if (data != null && "1".Equals(data.CHAR_DATA.NVL("").Trim()))
                {
                    btnPrintTag.Visible = true;
                }
            }
        }