public void CancelItemExchangeHu(ItemExchange itemExchange, DateTime effectiveDate)
        {
            if (itemExchange.IsVoid)
            {
                throw new BusinessException(Resources.EXT.ServiceLan.HuHasVoided);
            }

            IList<ItemExchange> itemExchangeList = new List<ItemExchange>();
            itemExchangeList.Add(itemExchange);
            locationDetailMgr.CancelInventoryExchange(itemExchangeList);
        }
        public Hu AgedHu(Hu hu, DateTime effectiveDate)
        {
            if (hu.HuOption == CodeMaster.HuOption.UnAging || hu.HuOption == CodeMaster.HuOption.NoNeed)
            {
                if (!hu.AgingStartTime.HasValue)
                {
                    throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnInNotStart);
                }

                var huLocationLotDetail = locationDetailMgr.GetHuLocationLotDetail(hu.HuId);
                if (huLocationLotDetail == null)
                {
                    throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnInNotInInventory);
                }
                Hu newHu = huMgr.CloneHu(hu, hu.Qty);
                newHu.HuOption = CodeMaster.HuOption.Aged;
                newHu.AgingEndTime = DateTime.Now;
                IList<ItemExchange> itemExchangeList = new List<ItemExchange>();

                ItemExchange itemExchange = new ItemExchange();
                itemExchange.BaseUom = hu.BaseUom;
                itemExchange.EffectiveDate = effectiveDate;
                itemExchange.OldHu = hu.HuId;
                itemExchange.IsVoid = false;
                itemExchange.ItemFrom = hu.Item;
                itemExchange.ItemTo = hu.Item;
                itemExchange.LocationFrom = huLocationLotDetail.Location;
                itemExchange.LocationTo = huLocationLotDetail.Location;
                itemExchange.ItemExchangeType = CodeMaster.ItemExchangeType.Aging;
                itemExchange.NewBaseUom = hu.BaseUom;
                itemExchange.NewHu = newHu.HuId;
                itemExchange.NewQty = newHu.Qty;
                itemExchange.NewUnitQty = newHu.UnitQty;
                itemExchange.NewUom = newHu.Uom;
                itemExchange.Qty = hu.Qty;
                itemExchange.QualityType = huLocationLotDetail.QualityType;
                string region = this.genericMgr.FindById<Location>(huLocationLotDetail.Location).Region;
                itemExchange.RegionFrom = region;
                itemExchange.RegionTo = region;
                itemExchange.UnitQty = hu.UnitQty;
                itemExchange.Uom = hu.Uom;
                itemExchange.LotNo = hu.LotNo;
                this.genericMgr.Create(itemExchange);

                itemExchangeList.Add(itemExchange);

                locationDetailMgr.InventoryExchange(itemExchangeList);

                newHu.RefId = itemExchange.Id;
                //newHu.HuTemplate = "BarCodeEX.xls";
                this.genericMgr.Update(newHu);

                return newHu;
            }
            else
            {
                throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnIn);
            }
        }
        public Hu FilterHu(Hu hu, decimal newQty, DateTime effectiveDate)
        {
            var huLocationLotDetail = locationDetailMgr.GetHuLocationLotDetail(hu.HuId);
            if (huLocationLotDetail == null)
            {
                throw new BusinessException(Resources.EXT.ServiceLan.CouldNotFilterNotInInventory);
            }

            Hu newHu = huMgr.CloneHu(hu, newQty);
            newHu.HuOption = CodeMaster.HuOption.Filtered;

            IList<ItemExchange> itemExchangeList = new List<ItemExchange>();
            ItemExchange itemExchange = new ItemExchange();
            itemExchange.BaseUom = hu.BaseUom;
            itemExchange.EffectiveDate = effectiveDate;
            itemExchange.OldHu = hu.HuId;
            itemExchange.IsVoid = false;
            itemExchange.ItemFrom = hu.Item;
            itemExchange.ItemTo = hu.Item;
            itemExchange.LocationFrom = huLocationLotDetail.Location;
            itemExchange.LocationTo = huLocationLotDetail.Location;
            itemExchange.ItemExchangeType = CodeMaster.ItemExchangeType.Filter;
            itemExchange.NewBaseUom = hu.BaseUom;
            itemExchange.NewHu = newHu.HuId;
            itemExchange.NewQty = newHu.Qty;
            itemExchange.NewUnitQty = newHu.UnitQty;
            itemExchange.NewUom = newHu.Uom;
            itemExchange.Qty = hu.Qty;
            itemExchange.QualityType = huLocationLotDetail.QualityType;
            string region = this.genericMgr.FindById<Location>(huLocationLotDetail.Location).Region;
            itemExchange.RegionFrom = region;
            itemExchange.RegionTo = region;
            itemExchange.UnitQty = hu.UnitQty;
            itemExchange.Uom = hu.Uom;
            itemExchange.LotNo = hu.LotNo;
            this.genericMgr.Create(itemExchange);

            itemExchangeList.Add(itemExchange);

            locationDetailMgr.InventoryExchange(itemExchangeList);

            newHu.RefId = itemExchange.Id;
            this.genericMgr.Update(newHu);

            return newHu;
        }
 public ActionResult New(ItemExchange itemExchange)
 {
     if (ModelState.IsValid)
     {
         IList<ItemExchange> itemExchangeList = new List<ItemExchange>();
         Location locationFrom = genericMgr.FindById<Location>(itemExchange.LocationFrom);
         Item itemFrom = genericMgr.FindById<Item>(itemExchange.ItemFrom);
         itemExchange.Uom = itemFrom.Uom;
         itemExchange.BaseUom = itemFrom.Uom;
         if (itemExchange.Uom != itemFrom.Uom)
         {
             itemExchange.UnitQty = itemMgr.ConvertItemUomQty(itemExchange.ItemFrom, itemFrom.Uom, 1, itemExchange.Uom);
         }
         else
         {
             itemExchange.UnitQty = 1;
         }
         Item itemTo = genericMgr.FindById<Item>(itemExchange.ItemTo);
         itemExchange.Uom = itemTo.Uom;
         itemExchange.NewUom = itemTo.Uom;
         itemExchange.NewBaseUom = itemTo.Uom;
         itemExchange.BaseUom = itemTo.Uom;
         itemExchange.NewUnitQty = 1;
         itemExchange.QualityType = Sconit.CodeMaster.QualityType.Qualified;
         itemExchange.RegionFrom = locationFrom.Region;
         itemExchange.RegionTo = locationFrom.Region;
         //itemExchange.LocationFrom = locationFrom.Code;
         itemExchange.LocationTo = itemExchange.LocationFrom;
         itemExchange.NewQty = itemExchange.Qty;
         itemExchangeList.Add(itemExchange);
         try
         {
             LocDetGeneMgr.InventoryExchange(itemExchangeList);
             SaveSuccessMessage(Resources.INV.ItemExchange.ItemExchange_Added);
             return RedirectToAction("Edit/" + itemExchange.Id);
         }
         catch (BusinessException ex)
         {
             SaveErrorMessage(ex.GetMessages()[0].GetMessageString());
         }
         catch (Exception ex)
         {
             SaveErrorMessage(ex);
         }
     }
     itemExchange.UomFrom = _GetUomOfItem(itemExchange.ItemFrom);
     itemExchange.UomTo = _GetUomOfItem(itemExchange.ItemTo);
     return View(itemExchange);
 }
Пример #5
0
        private void RecordLocationTransaction(ItemExchange itemExchange, IList<InventoryTransaction> inventoryTransactionList, bool isIssue, bool isVoid)
        {
            //OutQty,OutUom,OutBaseUom,OutUnitQty,InHu,OutHu,OrderType 
            DateTime dateTimeNow = DateTime.Now;

            LocationTransaction locationTransaction = new LocationTransaction();

            //locationTransaction.OrderNo = ;
            //locationTransaction.OrderType = itemExchange.OrderType;
            //locationTransaction.OrderSubType = ;
            //locationTransaction.OrderDetailSequence = ;
            locationTransaction.OrderDetailId = itemExchange.Id;
            //locationTransaction.OrderBomDetId = 
            //locationTransaction.IpNo = 
            //locationTransaction.IpDetailId = 
            //locationTransaction.IpDetailSequence = 
            //locationTransaction.ReceiptNo = 
            //locationTransaction.ReceiptDetailId = 
            //locationTransaction.ReceiptDetailSequence = 
            //locationTransaction.SequenceNo = 
            //locationTransaction.TraceCode = ;
            locationTransaction.Item = isIssue ? itemExchange.ItemFrom : itemExchange.ItemTo;
            locationTransaction.Uom = isIssue ? itemExchange.Uom : itemExchange.NewUom;
            locationTransaction.BaseUom = isIssue ? itemExchange.BaseUom : itemExchange.NewBaseUom;
            locationTransaction.Qty = isIssue ? (-itemExchange.Qty / itemExchange.UnitQty) : (itemExchange.NewQty / itemExchange.NewUnitQty); //转为订单单位
            locationTransaction.UnitQty = isIssue ? itemExchange.UnitQty : itemExchange.NewUnitQty;
            locationTransaction.IsConsignment = false;
            //locationTransaction.PlanBill = null;
            //locationTransaction.ActingBill = null;
            //locationTransaction.ActingBillQty = 0;  //转为订单单位
            locationTransaction.QualityType = itemExchange.QualityType;
            locationTransaction.HuId = isIssue ? itemExchange.OldHu : itemExchange.NewHu;
            locationTransaction.LotNo = itemExchange.LotNo;

            #region 库存事务类型
            locationTransaction.LocationIOReason = itemExchange.ItemExchangeType.ToString();
            if (isIssue)
            {
                if (isVoid)
                {
                    locationTransaction.TransactionType = CodeMaster.TransactionType.ISS_IIC_VOID;
                }
                else
                {
                    locationTransaction.TransactionType = CodeMaster.TransactionType.ISS_IIC;
                }
            }
            else
            {
                if (isVoid)
                {
                    locationTransaction.TransactionType = CodeMaster.TransactionType.RCT_IIC_VOID;
                }
                else
                {
                    locationTransaction.TransactionType = CodeMaster.TransactionType.RCT_IIC;
                }
            }
            #endregion

            locationTransaction.IOType = isIssue ? CodeMaster.TransactionIOType.Out : CodeMaster.TransactionIOType.In;
            locationTransaction.PartyFrom = itemExchange.RegionFrom;
            locationTransaction.PartyTo = itemExchange.RegionTo;
            locationTransaction.LocationFrom = itemExchange.LocationFrom;
            locationTransaction.LocationTo = itemExchange.LocationTo;
            if (itemExchange.ItemExchangeType == CodeMaster.ItemExchangeType.Aging)
            {
                locationTransaction.LocationIOReason = "老化";
            }
            else if (itemExchange.ItemExchangeType == CodeMaster.ItemExchangeType.Filter)
            {
                locationTransaction.LocationIOReason = "过滤";
            }
            locationTransaction.EffectiveDate = itemExchange.EffectiveDate;
            locationTransaction.CreateUserId = SecurityContextHolder.Get().Id;
            locationTransaction.CreateDate = dateTimeNow;

            this.genericMgr.Create(locationTransaction);
            RecordLocationTransactionDetail(locationTransaction, inventoryTransactionList);
        }
Пример #6
0
        public ActionResult New(ItemExchange itemExchange)
        {
            if (ModelState.IsValid)
            {
                IList<ItemExchange> itemExchangeList = new List<ItemExchange>();

                Item itemFrom = base.genericMgr.FindById<Item>(itemExchange.ItemFrom);
                itemExchange.BaseUom = itemFrom.Uom;
                if (itemExchange.Uom != itemFrom.Uom)
                {
                    itemExchange.UnitQty = itemMgr.ConvertItemUomQty(itemExchange.ItemFrom, itemFrom.Uom, 1, itemExchange.Uom);
                }
                else
                {
                    itemExchange.UnitQty = 1;
                }

                itemExchangeList.Add(itemExchange);
                try
                {
                    LocDetGeneMgr.InventoryExchange(itemExchangeList);
                    SaveSuccessMessage(Resources.INV.ItemExchange.ItemExchange_Added);
                    return RedirectToAction("Edit/" + itemExchange.Id);
                }
                catch (BusinessException ex)
                {
                    SaveErrorMessage(ex.GetMessages()[0].GetMessageString());
                }
            }
            return View(itemExchange);
        }
Пример #7
0
        private void RecordLocationTransaction(ItemExchange itemExchange, IList<InventoryTransaction> inventoryTransactionList, bool isIssue, bool isVoid)
        {
            DateTime dateTimeNow = DateTime.Now;

            LocationTransaction locationTransaction = new LocationTransaction();

            //locationTransaction.OrderNo = ;
            //locationTransaction.OrderType = ;
            //locationTransaction.OrderSubType = ;
            //locationTransaction.OrderDetailSequence = ;
            locationTransaction.OrderDetailId = itemExchange.Id;
            //locationTransaction.OrderBomDetId = 
            //locationTransaction.IpNo = 
            //locationTransaction.IpDetailId = 
            //locationTransaction.IpDetailSequence = 
            //locationTransaction.ReceiptNo = 
            //locationTransaction.ReceiptDetailId = 
            //locationTransaction.ReceiptDetailSequence = 
            //locationTransaction.SequenceNo = 
            //locationTransaction.TraceCode = ;
            locationTransaction.Item = isIssue ? itemExchange.ItemFrom : itemExchange.ItemTo;
            locationTransaction.Uom = itemExchange.Uom;
            locationTransaction.BaseUom = itemExchange.BaseUom;
            locationTransaction.Qty = itemExchange.Qty / itemExchange.UnitQty; //转为订单单位
            locationTransaction.UnitQty = itemExchange.UnitQty;
            locationTransaction.IsConsignment = false;
            //locationTransaction.PlanBill = null;
            //locationTransaction.ActingBill = null;
            //locationTransaction.ActingBillQty = 0;  //转为订单单位
            locationTransaction.QualityType = itemExchange.QualityType;
            //locationTransaction.HuId = 
            //locationTransaction.LotNo = 
            if (!isVoid)
            {
                locationTransaction.TransactionType = isIssue ? CodeMaster.TransactionType.ISS_IIC : CodeMaster.TransactionType.RCT_IIC;
            }
            else
            {
                locationTransaction.TransactionType = isIssue ? CodeMaster.TransactionType.ISS_IIC_VOID : CodeMaster.TransactionType.RCT_IIC_VOID;
            }
            locationTransaction.IOType = isIssue ? CodeMaster.TransactionIOType.Out : CodeMaster.TransactionIOType.In;
            locationTransaction.PartyFrom = itemExchange.RegionFrom;
            locationTransaction.PartyTo = itemExchange.RegionTo;
            locationTransaction.LocationFrom = itemExchange.LocationFrom;
            locationTransaction.LocationTo = itemExchange.LocationTo;
            locationTransaction.LocationIOReason = string.Empty;
            locationTransaction.EffectiveDate = itemExchange.EffectiveDate;
            locationTransaction.CreateUserId = SecurityContextHolder.Get().Id;
            locationTransaction.CreateDate = dateTimeNow;

            this.genericMgr.Create(locationTransaction);
            RecordLocationTransactionDetail(locationTransaction, inventoryTransactionList);
        }