yanjinhui
9 天以前 4babfcfde8b26c755850e0066f1c07fac38e96a2
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs
@@ -6,6 +6,7 @@
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
@@ -34,7 +35,9 @@
                if (materielInfo.Business_qty >= materielInfo.MinQty) return response;
                Dt_Tactics tactics = _tacticsService.Repository.QueryFirst(x => x.TacticeName == "出库策略");
                List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
                List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == materielInfo.MaterielCode && x.StockStatus == StockStatusEmun.入库完成.ObjToInt() && x.StockQuantity > x.OutboundQuantity && x.WarehouseCode == WareCode);
                //// æŸ¥è¯¢å¤§ä»¶åº“中可用的库存
                List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == materielInfo.MaterielCode && x.StockStatus == StockStatusEmun.入库完成.ObjToInt() && x.AvailableQuantity > 0 && x.WarehouseCode == WareCode);
                if (dt_InventoryInfos.Count < 1) throw new Exception($"物料编号【{materielInfo.MaterielCode}】大件库无库存!");
                if (tactics.SelectTactice == TacticsEnum.ComeOutonFirstTime.ObjToInt())
                    dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.ValidityPeriod).ToList();
                else
@@ -51,9 +54,15 @@
                        item.OutboundQuantity += materielInfo.BoxQty;
                    }
                    item.AvailableQuantity = item.StockQuantity - item.OutboundQuantity;
                    //添加报警信息
                    if (materielInfo.Business_qty < materielInfo.MinQty || item.StockQuantity <= 0) {
                        _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, $"【{materielInfo.MaterielName}】", "$【物料编码{materielInfo.MaterielCode}大件库库存过低】");
                    }
                }
                #region å¤§ä»¶åº“补立库后立库业务库存数还是小于立库最小库存数,添加提示信息
                #endregion
                #region æ·»åŠ è°ƒæ‹¨å‡ºåº“å•
                Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder()
@@ -64,7 +73,7 @@
                    Details = new List<Dt_DeliveryOrderDetail>()
                };
                dt_InventoryInfos = dt_InventoryInfos.Where(X => X.StockStatus == StockStatusEmun.出库锁定.ObjToInt()).ToList();
                foreach (var item in dt_InventoryInfos.GroupBy(x => x.BatchNo))
                foreach (var item in dt_InventoryInfos.GroupBy(x => x.BatchNo)) //这里按批次分组了
                {
                    Dt_DeliveryOrderDetail deliveryOrderDetail = new Dt_DeliveryOrderDetail()
                    {
@@ -142,6 +151,7 @@
            catch (Exception ex)
            {
                _unitOfWorkManage.RollbackTran();
                _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, "大件库补货立库", ex.Message);
                response.Error(ex.Message);
            }
            return response;