Example #1
0
        public void DeleteGroupTransaction(NZString receiveNo)
        {
            try
            {
                InventoryBIZ biz = new InventoryBIZ();
                // for Consumtion item it must delete too
                InventoryTransBIZ bizTran = new InventoryTransBIZ();

                // Delete
                List <InventoryTransactionDTO> listReceive = bizTran.LoadBySlipNo(receiveNo);

                Common.CurrentDatabase.KeepConnection = true;
                Common.CurrentDatabase.BeginTransaction();

                foreach (InventoryTransactionDTO dtoReceive in listReceive)
                {
                    List <InventoryTransactionDTO> listForDelete = bizTran.LoadByRefNo(dtoReceive.REF_NO);


                    biz.DeleteInventoryTransactions(Common.CurrentDatabase, listForDelete);
                }
                Common.CurrentDatabase.Commit();
            }
            catch (Exception ex)
            {
                Common.CurrentDatabase.Rollback();
                throw ex;
            }
        }
Example #2
0
        private bool RunProcess(string strLocation)
        {
            try
            {
                this.Cursor        = Cursors.WaitCursor;
                picWaiting.Visible = true;
                picWaiting.BringToFront();

                InventoryBIZ biz = new InventoryBIZ();
                biz.NegativeLotClearingProcess(strLocation);

                MessageDialog.ShowBusiness(this, EVOFramework.Message.LoadMessage(SystemMaintenance.Messages.eInformation.INF9003.ToString()));
                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
                return(false);
            }
            finally
            {
                this.Cursor        = Cursors.Default;
                picWaiting.Visible = false;
            }
        }
Example #3
0
        public void DeleteGroupTransaction(NZString transferNo)
        {
            try
            {
                InventoryBIZ biz = new InventoryBIZ();
                // for Consumtion item it must delete too
                InventoryTransBIZ bizTran = new InventoryTransBIZ();

                // Delete
                List <InventoryTransactionDTO> listTransfer = bizTran.LoadBySlipNo(transferNo);

                Common.CurrentDatabase.KeepConnection = true;
                Common.CurrentDatabase.BeginTransaction();

                foreach (InventoryTransactionDTO dtoTransfer in listTransfer)
                {
                    //List<InventoryTransactionDTO> listForDelete = bizTran.LoadByRefNo(dtoTransfer.REF_NO);
                    //NZString TransID = new NZString(null, shtView.Cells[shtView.ActiveRowIndex, (int)eColView.ISSUE_NO].Value);
                    //NZString RefNo = new NZString(null, shtView.Cells[shtView.ActiveRowIndex, (int)eColView.REF_NO].Value);
                    //biz.DeleteInventoryTransactions(Common.CurrentDatabase, listForDelete);

                    NZString TransID = dtoTransfer.TRANS_ID;
                    NZString RefNo   = dtoTransfer.REF_NO;

                    biz.DeleteInventoryTransaction(CommonLib.Common.CurrentDatabase, TransID);
                    biz.DeleteInventoryTransaction(CommonLib.Common.CurrentDatabase, RefNo);
                }
                Common.CurrentDatabase.Commit();
            }
            catch (Exception ex)
            {
                Common.CurrentDatabase.Rollback();
                throw ex;
            }
        }
Example #4
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);
        }
Example #5
0
        public void DeleteItem(NZString transactionID)
        {
            try
            {
                InventoryBIZ biz = new InventoryBIZ();

                // for Consumtion item it must delete too
                InventoryTransBIZ bizTran = new InventoryTransBIZ();

                // Delete
                InventoryTransactionDTO        dto        = bizTran.LoadByTransactionID(transactionID);
                List <InventoryTransactionDTO> listConDTO = bizTran.LoadByRefNo(dto.REF_NO);

                Common.CurrentDatabase.KeepConnection = true;
                Common.CurrentDatabase.BeginTransaction();

                biz.DeleteInventoryTransactions(Common.CurrentDatabase, listConDTO);

                Common.CurrentDatabase.Commit();
            }
            catch (Exception ex)
            {
                Common.CurrentDatabase.Rollback();
                throw ex;
            }
            //biz.DeleteInventoryTransaction(Common.CurrentDatabase, transactionID);
        }
Example #6
0
        private void miDeleteGroup_Click(object sender, EventArgs e)
        {
            if (shtCustomerOrderList.RowCount > 0)
            {
                int                     rowIndex = shtCustomerOrderList.ActiveRowIndex;
                InventoryBIZ            biz      = new InventoryBIZ();
                InventoryTransactionDTO dto      = new InventoryTransactionDTO();
                dto.REF_NO    = shtCustomerOrderList.GetValue(rowIndex, (int)eColView.ORDER_NO).ToString().ToNZString();
                dto.TRANS_CLS = DataDefine.eTRANS_TYPE_string.Shipment.ToNZString();
                //CustomerOrderDDTO LoadCustomerOrderDetail(String Order_No, NZString Order_Detail_No)
                List <InventoryTransactionDTO> listDTO = biz.LoadInventoryTrans(dto);
                decimal ShipQTY = 0;
                foreach (InventoryTransactionDTO dtos in listDTO)
                {
                    if (!dtos.QTY.IsNull && dtos.QTY.StrongValue > 0)
                    {
                        ShipQTY += dtos.QTY.StrongValue;
                    }
                }
                if (ShipQTY > 0)
                {
                    MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0205.ToString()));
                    return;
                }
            }

            OnDeleteGroup();
        }
Example #7
0
        public void DeleteGroupTransaction(NZString transID)
        {
            InventoryTransBIZ inventoryTransBiz = new InventoryTransBIZ();
            InventoryBIZ      biz = new InventoryBIZ();

            biz.DeleteInventoryGroupTrans(Common.CurrentDatabase, transID);
        }
Example #8
0
        /// <summary>
        /// Check On hand Inventory function follow business rule
        /// </summary>
        /// <param name="eOperation"></param>
        /// <param name="eInoutCls"></param>
        /// <param name="QTY"></param>
        /// <param name="ItemCD"></param>
        /// <param name="LocationCD"></param>
        /// <param name="LotNo"></param>
        /// <param name="strTranID">in case of Update, this value must be sent, the others send null.</param>
        /// <returns></returns>
        public ErrorItem CheckOnhandQty(DataDefine.eOperationClass eOperation, DataDefine.eIN_OUT_CLASS eInoutCls, NZDecimal QTY, NZString ItemCD, NZString LocationCD, NZString LotNo, NZString strTranID)
        {
            // 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);
            }

            //Operation Class
            switch (eOperation)
            {
            case DataDefine.eOperationClass.Add:
                //Do notting
                break;

            case DataDefine.eOperationClass.Update:
                //Find Diff Qty
                InventoryTransBIZ       biz = new InventoryTransBIZ();
                InventoryTransactionDTO dto = biz.LoadByTransactionID(strTranID);
                if (dto != null)
                {
                    QTY = (QTY - dto.QTY).ToNZDecimal();
                }
                break;

            case DataDefine.eOperationClass.Delete:
                //Delete Inverse Qty
                QTY = (-1 * QTY.StrongValue).ToNZDecimal();
                break;
            }

            //inout Class
            if (eInoutCls == DataDefine.eIN_OUT_CLASS.Out)
            {
                QTY = (-1 * QTY.StrongValue).ToNZDecimal();
            }

            // CHECK FOR ONHAND WITH ACTUAL INVENTORY ONHAND
            InventoryBIZ        bizInv             = new InventoryBIZ();
            ActualOnhandViewDTO dtoActOnhand       = bizInv.LoadActualInventoryOnHand(ItemCD, LocationCD, LotNo);
            decimal             decActualOnhandQty = 0;

            if (dtoActOnhand != null && !dtoActOnhand.ONHAND_QTY.IsNull)
            {
                decActualOnhandQty = dtoActOnhand.ONHAND_QTY.StrongValue;
            }

            decActualOnhandQty = decActualOnhandQty + QTY;

            if (decActualOnhandQty < 0)
            {
                return(new ErrorItem(QTY.Owner, TKPMessages.eValidate.VLM0063.ToString(), new[] { ItemCD, LocationCD }));
            }
            return(null);
        }
Example #9
0
        //public void DeleteGroup_Return(NZString SlipNo)
        //{
        //    // if TransactionType = Shipment return, Check stock before delete.
        //    InventoryTransBIZ inventoryTransBiz = new InventoryTransBIZ();
        //    InventoryBIZ biz = new InventoryBIZ();

        //    biz.DeleteInventorySlipNo_Return(Common.CurrentDatabase, SlipNo);
        //}

        public void DeleteOrder(NZString transID)
        {
            // if TransactionType = Shipment return, Check stock before delete.
            InventoryTransBIZ inventoryTransBiz = new InventoryTransBIZ();
            InventoryBIZ      biz = new InventoryBIZ();

            biz.DeleteInventoryOrder(Common.CurrentDatabase, transID);
        }
Example #10
0
        private void LoadItemData(string keyFilter)
        {
            //set ให้ show column ทั้งหมด
            shtView.Columns[0, shtView.Columns.Count - 1].Visible = true;


            InventoryPeriodBIZ inventoryPeriodBIZ = new InventoryPeriodBIZ();
            InventoryPeriodDTO inventoryPeriodDTO = inventoryPeriodBIZ.LoadCurrentPeriod();

            DataTable    dt           = null;
            InventoryBIZ inventoryBIZ = new InventoryBIZ();

            if (m_searchType == eSearchType.All)
            {
                dt = inventoryBIZ.LoadAllLotNo(inventoryPeriodDTO.YEAR_MONTH);
                shtView.Columns[(int)eColView.ON_HAND_QTY].Visible = false;
            }
            else if (m_searchType == eSearchType.DependOnItemAndLocation)
            {
                dt = inventoryBIZ.LoadAllLotNoByItemAndLocation(inventoryPeriodDTO.YEAR_MONTH, m_itemCode, m_locationCode);
            }
            else
            {
                dt = inventoryBIZ.LoadAllLotNo(inventoryPeriodDTO.YEAR_MONTH);
                shtView.Columns[(int)eColView.ON_HAND_QTY].Visible = false;
            }

            DataTable dtView = dt.Clone();

            if (keyFilter != string.Empty)
            {
                //                string filterString = string.Format(@"
                //                                                {1} LIKE '%{0}%'
                //                                                OR {2} LIKE '%{0}%'
                //                                                ", keyFilter, eColView.LOT_NO, eColView.PACK_NO);

                string filterString = FilterStringUtil.GetFilterstring(dtView, keyFilter);

                //get only the rows you want
                DataRow[] results = dt.Select(filterString);

                //populate new destination table
                foreach (DataRow dr in results)
                {
                    dtView.ImportRow(dr);
                }
            }
            else
            {
                foreach (DataRow dr in dt.Rows)
                {
                    dtView.ImportRow(dr);
                }
            }
            fpView.DataSource = dtView;
        }
Example #11
0
        internal ErrorItem CheckIfItemLotHasNegativeQty(NZString YearMonth)
        {
            InventoryBIZ bizInv = new InventoryBIZ();
            List <InventoryOnhandDTO> dtoList = bizInv.LoadInvOnhandWithNegativeQty(YearMonth);

            if (dtoList != null && dtoList.Count > 0)
            {
                return(new ErrorItem(null, TKPMessages.eValidate.VLM0076.ToString()));
            }
            return(null);
        }
Example #12
0
 public void DeleteGroupTransaction(NZString TransID)
 {
     try
     {
         InventoryBIZ biz = new InventoryBIZ();
         biz.DeleteGroupTransaction(TransID);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #13
0
        private List <InventoryTransactionDTO> CreateConsumptionDTO(InventoryTransactionDTO dto)
        {
            List <InventoryTransactionDTO> dtoConList = new List <InventoryTransactionDTO>();
            InventoryTransactionDTO        dtoCon;

            InventoryBIZ biz = new InventoryBIZ();

            // GET LOCATION INFORMATION
            DealingBIZ bizLoc        = new DealingBIZ();
            DealingDTO dtoLoc        = bizLoc.LoadLocation(dto.DEALING_NO);
            bool       AllowNegative = dtoLoc.ALLOW_NEGATIVE.StrongValue == "01";

            //WorkResultController ctrlWR=new WorkResultController ();
            List <WorkResultEntryViewDTO> dtoChildItem = biz.LoadConsumptionListFromItemCode(dto.ITEM_CD, dto.DEALING_NO, dto.QTY);

            for (int j = 0; j < dtoChildItem.Count; j++)
            {
                // GET CONSUMPTION ITEM FROM FIFO PROCESS WRITE BY KIMMIK.
                List <ActualOnhandViewDTO> dtoListActOnhand = biz.FifoListingProcess(Common.CurrentDatabase
                                                                                     , dtoChildItem[j].ITEM_CD.StrongValue, dtoChildItem[j].LOC_CD.StrongValue, dtoChildItem[j].CONSUMPTION_QTY.StrongValue
                                                                                     , !AllowNegative, AllowNegative);
                if (dtoListActOnhand != null && dtoListActOnhand.Count > 0)
                {
                    for (int i = 0; i < dtoListActOnhand.Count; i++)
                    {
                        dtoCon                  = new InventoryTransactionDTO();
                        dtoCon.ITEM_CD          = dtoListActOnhand[i].ITEM_CD;
                        dtoCon.LOC_CD           = dtoListActOnhand[i].LOC_CD;
                        dtoCon.LOT_NO           = dtoListActOnhand[i].LOT_NO;
                        dtoCon.DEALING_NO       = dto.DEALING_NO;
                        dtoCon.TRANS_DATE       = dto.TRANS_DATE;
                        dtoCon.TRANS_CLS.Value  = DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Consumption);
                        dtoCon.IN_OUT_CLS.Value = DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.Out);
                        dtoCon.QTY              = dtoListActOnhand[i].ONHAND_QTY;
                        dtoCon.OBJ_ORDER_QTY    = dto.QTY;
                        dtoCon.OBJ_ITEM_CD      = dto.ITEM_CD;
                        dtoCon.REMARK           = dto.REMARK;
                        dtoCon.CRT_BY           = Common.CurrentUserInfomation.UserCD;
                        dtoCon.CRT_MACHINE      = Common.CurrentUserInfomation.Machine;
                        dtoCon.UPD_BY           = Common.CurrentUserInfomation.UserCD;
                        dtoCon.UPD_MACHINE      = Common.CurrentUserInfomation.Machine;
                        dtoCon.SCREEN_TYPE      = DataDefine.ScreenType.ReceivingEntry.ToNZString();
                        dtoCon.REF_NO           = dto.REF_NO;

                        dtoConList.Add(dtoCon);
                    }
                }
            }



            return(dtoConList);
        }
Example #14
0
        internal void DeleteTransaction(NZString TransID, NZString RefNo, NZString ConsumptionID)
        {
            List <NZString> TransIDList = new List <NZString>();

            TransIDList.Add(TransID);
            TransIDList.Add(RefNo);
            TransIDList.Add(ConsumptionID);

            InventoryBIZ biz = new InventoryBIZ();

            biz.DeleteInventoryTransactions(CommonLib.Common.CurrentDatabase, TransIDList);
        }
Example #15
0
        internal ErrorItem CheckIfExistWithYearMonth(NZString PreMonth)
        {
            InventoryBIZ bizInv = new InventoryBIZ();
            List <InventoryOnhandDTO> dtoList = bizInv.LoadInventoryWithYearMonth(PreMonth);

            if (dtoList == null || dtoList.Count == 0)
            {
                ErrorItem err = new ErrorItem(null, TKPMessages.eValidate.VLM0077.ToString());
                return(err);
            }
            return(null);
        }
Example #16
0
        internal NZDecimal GetOnHandQty(IssueByItemUIDM uidmIssue)
        {
            InventoryBIZ        bizInv = new InventoryBIZ();
            ActualOnhandViewDTO dtoInvOnHand;

            dtoInvOnHand = bizInv.LoadActualInventoryOnHand(uidmIssue.ITEM_CD, uidmIssue.FROM_LOC_CD, uidmIssue.LOT_NO);
            if (dtoInvOnHand != null)
            {
                return(dtoInvOnHand.ONHAND_QTY);
            }

            return(new NZDecimal());
        }
Example #17
0
        public List <InventoryMovementInqUIDM> LoadDataInventorymovementInquiryByLotNo(NZString YEAR_MONTH, NZDateTime PERIOD_BEGIN_DATE, NZDateTime PERIOD_END_DATE
                                                                                       , NZString ITEM_CD
                                                                                       , NZString LOC_CD
                                                                                       , NZString LOT_NO
                                                                                       , NZString PACK_NO
                                                                                       )
        {
            InventoryBIZ biz = new InventoryBIZ();
            List <InventoryTransactionDTO> listData     = biz.LoadInventoryMovementByLotNo(PERIOD_BEGIN_DATE, PERIOD_END_DATE, ITEM_CD, LOC_CD, LOT_NO);
            InventoryOnhandDTO             dtoInvOnHand = biz.LoadInventoryOnHandByYearMonth(YEAR_MONTH, ITEM_CD, LOC_CD, LOT_NO, PACK_NO);

            return(GenerateLines(dtoInvOnHand, listData));
        }
Example #18
0
        private decimal GetOnhandQty(NZString ItemCD, NZString LocCD, NZString LotNo)
        {
            // get Onhand Qty

            InventoryBIZ        bizInv = new InventoryBIZ();
            ActualOnhandViewDTO dto    =
                bizInv.LoadActualInventoryOnHand(ItemCD, LocCD, LotNo);

            if (dto != null)
            {
                return(dto.ONHAND_QTY.StrongValue);
            }
            return(0);
        }
Example #19
0
        public AdjustmentEntryUIDM ConvertDTOToUIDM(InventoryTransactionDTO dto)
        {
            AdjustmentEntryUIDM model = new AdjustmentEntryUIDM();

            model.TransactionID = dto.TRANS_ID;
            model.AdjustNo      = dto.SLIP_NO;
            model.AdjustDate    = dto.TRANS_DATE;
            model.AdjustType    = dto.IN_OUT_CLS;
            model.ItemCode      = dto.ITEM_CD;

            model.StoredLoc     = dto.LOC_CD;
            model.LotNo         = dto.LOT_NO;
            model.PackNo        = dto.PACK_NO;
            model.FGNo          = dto.FG_NO;
            model.ExternalLotNo = dto.EXTERNAL_LOT_NO;
            model.AdjustWeight  = dto.WEIGHT;
            model.AdjustQty     = dto.QTY;
            model.Remark        = dto.REMARK;
            model.ReasonCode    = dto.TRAN_SUB_CLS;

            //== Get Item Description.
            ItemBIZ biz     = new ItemBIZ();
            ItemDTO itemDTO = biz.LoadItem(dto.ITEM_CD);

            model.ItemDesc = itemDTO.SHORT_NAME;

            //-- Get Customer Name
            DealingBIZ bizCust = new DealingBIZ();
            DealingDTO dtoCust = bizCust.LoadLocation(itemDTO.CUSTOMER_CD);

            model.CustomerName = dtoCust.LOC_DESC;

            //== Get OnHand.
            InventoryBIZ       inventoryBIZ       = new InventoryBIZ();
            InventoryPeriodBIZ inventoryPeriodBIZ = new InventoryPeriodBIZ();

            InventoryPeriodDTO inventoryPeriodDTO = inventoryPeriodBIZ.LoadCurrentPeriod();
            InventoryOnhandDTO inventoryOnhandDTO = inventoryBIZ.LoadInventoryOnHandByDate(inventoryPeriodDTO.YEAR_MONTH, dto.TRANS_DATE, dto.ITEM_CD, dto.LOC_CD, dto.LOT_NO, dto.PACK_NO);

            if (inventoryOnhandDTO == null)
            {
                model.OnHandQty.Value = 0;
            }
            else
            {
                model.OnHandQty = inventoryOnhandDTO.ON_HAND_QTY;
            }

            return(model);
        }
Example #20
0
        private bool CanEditDeletePacking(NZString groupTransactionID)
        {
            InventoryBIZ biz = new InventoryBIZ();
            DataTable    dt  = biz.CheckUnpackInventory(groupTransactionID);

            if (dt != null && dt.Rows.Count > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #21
0
        private void DeleteItem(NZString transactionID)
        {
            if (MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9002.ToString()), MessageDialogButtons.YesNo) == MessageDialogResult.No)
            {
                return;
            }

            InventoryBIZ biz = new InventoryBIZ();

            biz.DeleteInventoryTransaction(Common.CurrentDatabase, transactionID);

            //LoadData(dtPeriodBegin.NZValue, dtPeriodEnd.NZValue);
            shtView.RemoveRows(shtView.ActiveRowIndex, 1);

            CtrlUtil.SpreadUpdateColumnSorting(shtView);
        }
Example #22
0
        public ErrorItem CheckOnhandQty(NZString YearMonth, NZString ItemCD, NZString FromLoc, NZString LotNo)
        {
            InventoryBIZ        bizInv    = new InventoryBIZ();
            InventoryPeriodDTO  dtoPeriod = new InventoryPeriodBIZ().LoadByPK(YearMonth);
            ActualOnhandViewDTO dtoOnhand = bizInv.LoadActualInventoryOnHand(ItemCD, FromLoc, LotNo);

            if (dtoOnhand == null)
            {
                return(new ErrorItem(YearMonth.Owner, TKPMessages.eValidate.VLM0029.ToString()));
            }
            if (dtoOnhand.ONHAND_QTY.IsNull || dtoOnhand.ONHAND_QTY.StrongValue == 0)
            {
                return(new ErrorItem(YearMonth.Owner, TKPMessages.eValidate.VLM0029.ToString()));
            }

            return(null);
        }
Example #23
0
        public NZDecimal GetOnhandQty(NZDateTime adjustDate, NZString itemCode, NZString locationCode, NZString lotNo)
        {
            InventoryBIZ biz = new InventoryBIZ();

            if (itemCode.IsNull || locationCode.IsNull)
            {
                return((NZDecimal)0);
            }

            ActualOnhandViewDTO dto = biz.LoadActualInventoryOnHand(itemCode, locationCode, lotNo);

            if (dto == null)
            {
                return((NZDecimal)0);
            }

            return(dto.ONHAND_QTY);
        }
Example #24
0
        internal void DeleteProductionReport(NZString TransID)
        {
            InventoryBIZ      bizInv      = new InventoryBIZ();
            InventoryTransBIZ bizInvTrans = new InventoryTransBIZ();

            List <InventoryTransactionDTO> dtoList  = new List <InventoryTransactionDTO>();
            InventoryTransactionDTO        dtoTrans = null;

            ProductionReportEntryDTO dtoProduction = bizInvTrans.LoadProductionReport(TransID);

            if (dtoProduction != null)
            {
                //In
                dtoTrans          = new InventoryTransactionDTO();
                dtoTrans.TRANS_ID = dtoProduction.TRANS_ID;
                dtoList.Add(dtoTrans);

                //Out
                dtoTrans          = new InventoryTransactionDTO();
                dtoTrans.TRANS_ID = dtoProduction.REF_NO;
                dtoList.Add(dtoTrans);

                //NG
                DataTable dtNG = bizInvTrans.LoadNGTransaction(dtoProduction.TRANS_ID);
                if (dtNG != null && dtNG.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtNG.Rows)
                    {
                        NZString NGTrans = new NZString(null, dr[(int)ProductionReportEntryViewDTO.eColumns.NG_TRANS_ID]);
                        if (NGTrans == null)
                        {
                            continue;
                        }

                        dtoTrans          = new InventoryTransactionDTO();
                        dtoTrans.TRANS_ID = NGTrans;
                        dtoList.Add(dtoTrans);
                    }
                }
            }

            bizInv.DeleteTransactionList(dtoList);
        }
Example #25
0
        /// <summary>
        /// Update old data.
        /// </summary>
        /// <param name="oldTransactionID"></param>
        /// <param name="newDataModel"></param>
        public void SaveEdit(NZString oldTransactionID, AdjustmentEntryUIDM newDataModel)
        {
            try
            {
                CommonLib.Common.CurrentDatabase.KeepConnection = true;
                CommonLib.Common.CurrentDatabase.BeginTransaction(System.Data.IsolationLevel.Serializable);


                ValidateException    validateException   = new ValidateException();
                AdjustmentValidator  adjustmentValidator = new AdjustmentValidator();
                TransactionValidator valTran             = new TransactionValidator();
                ItemValidator        itemValidator       = new ItemValidator();
                DealingValidator     locationValidator   = new DealingValidator();

                //validateException.AddError(adjustmentValidator.CheckEmptyAdjustDate(newDataModel.AdjustDate));
                //validateException.AddError(adjustmentValidator.CheckEmptyReasonCode(newDataModel.ReasonCode));
                //validateException.AddError(valTran.DateIsInCurrentPeriod(newDataModel.AdjustDate));
                //validateException.AddError(itemValidator.CheckEmptyItemCode(newDataModel.ItemCode));

                BusinessException businessException = itemValidator.CheckItemNotExist(newDataModel.ItemCode);
                if (businessException != null)
                {
                    validateException.AddError(businessException.Error);
                }

                //validateException.AddError(locationValidator.CheckEmptyLocationCode(newDataModel.StoredLoc));
                validateException.AddError(locationValidator.CheckNotExistsLocationCode(newDataModel.StoredLoc));
                //validateException.AddError(adjustmentValidator.CheckEmptyAdjustQty(newDataModel.AdjustQty));
                //validateException.AddError(adjustmentValidator.CheckIsZeroAdjustQty(newDataModel.AdjustQty));
                validateException.ThrowIfHasError();

                InventoryBIZ inventoryBIZ = new InventoryBIZ();

                InventoryTransactionDTO dto = ConvertUIDMToDTO(newDataModel);
                inventoryBIZ.UpdateInventoryTransaction(CommonLib.Common.CurrentDatabase, oldTransactionID, dto);
                CommonLib.Common.CurrentDatabase.Commit();
            }
            catch (System.Exception)
            {
                CommonLib.Common.CurrentDatabase.Rollback();
                throw;
            }
        }
Example #26
0
        internal NZDecimal GetOnHandQty(IssueByItemUIDM uidmIssue)
        {
            InventoryBIZ        bizInv = new InventoryBIZ();
            ActualOnhandViewDTO dtoInvOnHand;

            //InventoryPeriodBIZ bizPeriod = new InventoryPeriodBIZ();

            //NZString YearMonth = bizPeriod.LoadCurrentPeriod().YEAR_MONTH; //new NZString(null, CommonLib.Common.GetDatabaseDateTime().ToString("yyyyMM"));
            //InventoryPeriodDTO dtoPeriod = bizPeriod.LoadCurrentPeriod();

            //if (dtoPeriod == null) return new NZDecimal();

            dtoInvOnHand = bizInv.LoadActualInventoryOnHand(uidmIssue.ITEM_CD, uidmIssue.FROM_LOC_CD, uidmIssue.LOT_NO);
            if (dtoInvOnHand != null)
            {
                return(dtoInvOnHand.ONHAND_QTY);
            }

            return(new NZDecimal());
        }
Example #27
0
        /// <summary>
        /// Load data for Receiving Entry.
        /// </summary>
        /// <param name="receiveNo"></param>
        /// <returns></returns>
        public ReceivingEntryUIDM LoadData(NZString receiveNo)
        {
            InventoryBIZ biz = new InventoryBIZ();
            List <InventoryTransactionViewDTO> listViewDTO = biz.LoadTransactionViewByReceiveNo(receiveNo);

            if (listViewDTO != null)
            {
                if (listViewDTO.Count > 0)
                {
                    ReceivingEntryUIDM model = MapDTOToUIDM(listViewDTO[0]);
                    model.DATA_VIEW = DTOUtility.ConvertListToDataTable(listViewDTO);

                    //== Ensure that data has not modified.
                    model.DATA_VIEW.AcceptChanges();

                    return(model);
                }
            }
            return(new ReceivingEntryUIDM());
        }
Example #28
0
        private bool RunProcess(eMonthlyCloseProcess ePrcsType)
        {
            try {
                this.Cursor        = Cursors.WaitCursor;
                picWaiting.Visible = true;

                InventoryBIZ biz = new InventoryBIZ();

                NZString YearMonth = new NZString(null, Convert.ToDateTime(dtInventoryMonth.DateValue).ToString("yyyyMM"));
                //pgbProgress.PerformStep();
                biz.RunInventoryClosingProcess(ePrcsType);
                return(true);
            }
            catch (Exception ex) {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
            finally {
                this.Cursor        = Cursors.Default;
                picWaiting.Visible = false;
            }
            return(false);
        }
Example #29
0
        public ErrorItem CheckShipQTY(NZString ItemCD, NZString LocCD, NZString LotNo, NZDecimal ShipQTY)
        {
            if (ShipQTY.IsNull || ShipQTY.StrongValue == 0)
            {
                return(new ErrorItem(ShipQTY.Owner, TKPMessages.eValidate.VLM0039.ToString()));
            }

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


            if (dto == null || dto.ONHAND_QTY.IsNull || dto.ONHAND_QTY.StrongValue == 0)
            {
                return(new ErrorItem(null, TKPMessages.eValidate.VLM0029.ToString()));
            }

            if (ShipQTY.StrongValue > dto.ONHAND_QTY.StrongValue)
            {
                return(new ErrorItem(ShipQTY.Owner, TKPMessages.eValidate.VLM0040.ToString()));
            }
            return(null);
        }
Example #30
0
        internal void DeleteMovePart(NZString TransIDFrom, NZString TransIDTo)
        {
            InventoryBIZ      bizInv   = new InventoryBIZ();
            InventoryTransBIZ bizTrans = new InventoryTransBIZ();

            List <InventoryTransactionDTO> dtoList = new List <InventoryTransactionDTO>();
            InventoryTransactionDTO        dto     = bizTrans.LoadByTransactionID(TransIDFrom);

            bizInv.DeleteGroupTransaction(dto.GROUP_TRANS_ID);
            ////From
            //dto = new InventoryTransactionDTO();
            //dto.TRANS_ID = TransIDFrom;
            //dtoList.Add(dto);

            ////To
            //dto = new InventoryTransactionDTO();
            //dto.TRANS_ID = TransIDTo;
            //dtoList.Add(dto);

            //bizInv.DeleteTransactionList(dtoList);
            //bizInv.DeleteInventoryTransactions(CommonLib.Common.CurrentDatabase, dtoList);
        }