| | |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | |
| | | private readonly IDeliveryOrderDetailServices _deliveryOrderDetailServices; |
| | | private readonly ISupplyTaskService _supplyTaskService; |
| | | private readonly ICabinOrderServices _cabinOrderServices; |
| | | private readonly ITacticsService _tacticsService; |
| | | public IRepository<Dt_DeliveryOrder> Repository => BaseDal; |
| | | public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices) : base(BaseDal) |
| | | public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices, ITacticsService tacticsService) : base(BaseDal) |
| | | { |
| | | _basicService = basicService; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _inventory_BatchServices = inventory_BatchServices; |
| | | _inventoryInfoService = inventoryInfoService; |
| | | _cabinOrderServices = cabinOrderServices; |
| | | _tacticsService = tacticsService; |
| | | } |
| | | public WebResponseContent GetUpstreamOutOrder() |
| | | { |
| | |
| | | WebResponseContent webResponseContent = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Tactics tactics = _tacticsService.Repository.QueryFirst(x => x.TacticeName == "åºåºçç¥"); |
| | | if (outorder.warehouse_no == WarehouseEnum.麻精åº.ObjToInt().ToString("000") || outorder.warehouse_no == WarehouseEnum.å·å»åº.ObjToInt().ToString("000")) |
| | | { |
| | | #region æ·»å åºåºå |
| | |
| | | OutStatus = "æ°å»º", |
| | | Details = outorder.details.Select(d => new Dt_DeliveryOrderDetail |
| | | { |
| | | Reservoirarea = outorder.warehouse_no, |
| | | Goods_no = d.goods_no, |
| | | Order_qty = Math.Abs(d.order_qty), // åºåºæ°éè½¬ä¸ºæ£æ° |
| | | Batch_num = d.batch_num, |
| | |
| | | }; |
| | | BaseDal.Db.InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand(); |
| | | #endregion |
| | | List<Dt_InventoryInfo> dt_InventoryInfos = new List<Dt_InventoryInfo>(); |
| | | #region å¤çåºåãæ·»å åºåºä»»å¡ |
| | | foreach (var item in entityOrder.Details) |
| | | { |
| | | dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == item.Goods_no && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt() && x.StockQuantity > x.OutboundQuantity && x.WarehouseCode == item.Reservoirarea); |
| | | #region æåºåºçç¥æ¥æ¾åºå |
| | | if (tactics.SelectTactice == TacticsEnum.ComeOutonFirstTime.ObjToInt()) |
| | | dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.ValidityPeriod).ToList(); |
| | | else |
| | | dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.InDate).ToList(); |
| | | #endregion |
| | | var Order_qty = item.Order_qty; |
| | | foreach (var InventoryInfo in dt_InventoryInfos) |
| | | { |
| | | if (InventoryInfo.AvailableQuantity < Order_qty) |
| | | { |
| | | |
| | | #region å¤çåºå |
| | | |
| | | #endregion |
| | | |
| | | #region æ·»å åºåºä»»å¡ |
| | | |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | else |