From bc478c8fad0988f7021fbc80c4a9375551c8ffa0 Mon Sep 17 00:00:00 2001 From: helongyang <647556386@qq.com> Date: 星期五, 13 六月 2025 10:42:04 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs | 37 +++++++++++++++++++++++++++++-------- 1 files changed, 29 insertions(+), 8 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" index 1c3fe6f..74ab2e9 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" @@ -1,4 +1,5 @@ -锘縰sing OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; +锘縰sing MailKit.Search; +using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; using System; using System.Collections.Generic; using System.Linq; @@ -8,6 +9,7 @@ using WIDESEA_Common.LocationEnum; using WIDESEA_Common.OrderEnum; using WIDESEA_Common.StockEnum; +using WIDESEA_Common.WareHouseEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; @@ -47,7 +49,21 @@ _basicService = basicService; _recordService = recordService; } - + public WebResponseContent GetOutboundOrderDetails(SaveModel saveModel) + { + WebResponseContent content = new WebResponseContent(); + try + { + string orderNo = saveModel.MainData["orderNo"].ToString(); + Dt_OutboundOrder inboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == orderNo).Includes(x => x.Details).First(); + content.OK(data: inboundOrder.Details); + } + catch (Exception ex) + { + content.Error(ex.Message); + } + return content; + } /// <summary> /// 閿佸畾搴撳瓨锛岀敱绯荤粺鍒嗛厤(浠呴�昏緫杩愮畻锛屼笉鐢熸垚浠诲姟锛屼笉淇敼鏁版嵁搴撴暟鎹�) /// </summary> @@ -223,8 +239,8 @@ } Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId); List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); - List<Dt_OutboundOrderDetail> groupDetails = outboundOrderDetails.GroupBy(x => new { x.MaterielCode, x.BatchNo }).Select(x => new Dt_OutboundOrderDetail { OrderQuantity = x.Sum(v => v.OrderQuantity) - x.Sum(v => v.LockQuantity), MaterielCode = x.Key.MaterielCode, BatchNo = x.Key.BatchNo, }).ToList(); - + List<Dt_OutboundOrderDetail> groupDetails = outboundOrderDetails.GroupBy(x => new { x.MaterielCode, x.BatchNo }).Select(x => new Dt_OutboundOrderDetail { OrderQuantity = x.Sum(v => v.OrderQuantity) - x.Sum(v => v.LockQuantity), MaterielCode = x.Key.MaterielCode, BatchNo = x.Key.BatchNo }).ToList(); + Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x=>x.WarehouseId== outboundOrder.WarehouseId); List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); foreach (var item in groupDetails) @@ -239,6 +255,13 @@ throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨"); } List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out float residueQuantity); + if (warehouse.WarehouseCode==WarehouseEnum.HA152.ToString()) + { + if (needQuantity< autoAssignStocks.Count) + { + throw new Exception($"绯荤粺瓒呮椂,璇风◢鍚庡啀璇�"); + } + } item.LockQuantity += needQuantity - residueQuantity; outStocks.AddRange(autoAssignStocks); float assignQuantity = needQuantity - residueQuantity; @@ -282,8 +305,6 @@ locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList())); } - - return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos); } @@ -399,14 +420,14 @@ List<Dt_OutStockLockInfo> addOutStockLockInfos = outStockLockInfos.Where(x => x.Id == 0).ToList(); if (addOutStockLockInfos != null && addOutStockLockInfos.Any()) { - if(tasks != null) + if (tasks != null) { addOutStockLockInfos.ForEach(x => { x.TaskNum = tasks.FirstOrDefault(v => v.PalletCode == x.PalletCode)?.TaskNum; }); } - + _outStockLockInfoService.Repository.AddData(addOutStockLockInfos); } List<Dt_OutStockLockInfo> updateOutStockLockInfos = outStockLockInfos.Where(x => x.Id > 0).ToList(); -- Gitblit v1.9.3