From 06f5f3e474bb8d9e255a899b62d16f671cfdb940 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 26 六月 2025 17:34:33 +0800
Subject: [PATCH] 代码更新

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index 87bf3af..98f3311 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -112,6 +112,7 @@
                 {
                     WarehouseId = stockInfos.FirstOrDefault().WarehouseId,
                     TakeStockStatus = TakeStockStatusEnum.鐩樼偣涓�.ObjToInt(),
+                    OrderNo = _outboundService.OutboundOrderService.CreateCodeByRule(nameof(RuleCodeEnum.PDCodeRule)),
                     Details = new List<Dt_TakeStockOrderDetail>()
                 };
                 foreach (var item in stockInfos)
@@ -152,6 +153,10 @@
                 stockInfos.ForEach(x =>
                 {
                     x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+                });
+                tasks.ForEach(x =>
+                {
+                    x.OrderNo = takeStockOrder.OrderNo;
                 });
                 LocationStatusEnum locationStatus = LocationStatusEnum.Lock;
                 _unitOfWorkManage.BeginTran();
@@ -601,13 +606,14 @@
         public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType)
         {
             List<Dt_Task> tasks = new List<Dt_Task>();
+            List<Dt_LocationInfo> locationInfos = _basicService.LocationInfoService.Repository.QueryData(x => stockInfos.Select(x=>x.LocationCode).Contains(x.LocationCode));
             for (int i = 0; i < stockInfos.Count; i++)
             {
                 Dt_StockInfo stockInfo = stockInfos[i];
 
                 if (stockInfo != null)
                 {
-                    Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
+                    Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == stockInfo.LocationCode);
                     if (!tasks.Exists(x => x.PalletCode == stockInfo.PalletCode))
                     {
                         Dt_Task task = new()
@@ -628,8 +634,8 @@
                         };
                         if (taskType != TaskTypeEnum.OutEmpty)
                         {
-                            task.MaterielCode = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode;
-                            task.Quantity = (float)stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.StockQuantity;
+                            task.MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode;
+                            task.Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity);
                         }
                         if (stockInfo.StockLength>0)
                         {

--
Gitblit v1.9.3