From b430ac7952d637b6eb9021cc37277402233c9c01 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 14:00:43 +0800
Subject: [PATCH] fix(StockInfoService): 修复 Get3DLayoutAsync 方法中 Details null 引用问题

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
index 71f1e9b..842fc27 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -98,6 +98,7 @@
 
             // 4. 鎻愬彇鐗╂枡缂栧彿鍜屾壒娆″彿鍒楄〃锛堝幓閲嶏級
             var materielCodeList = stockInfos
+                .Where(s => s.Details != null)
                 .SelectMany(s => s.Details)
                 .Select(d => d.MaterielCode)
                 .Where(c => !string.IsNullOrEmpty(c))
@@ -105,6 +106,7 @@
                 .ToList();
 
             var batchNoList = stockInfos
+                .Where(s => s.Details != null)
                 .SelectMany(s => s.Details)
                 .Select(d => d.BatchNo)
                 .Where(b => !string.IsNullOrEmpty(b))
@@ -130,7 +132,7 @@
                 };
 
                 // 灏濊瘯浠庡簱瀛樺瓧鍏镐腑鑾峰彇搴撳瓨淇℃伅
-                if (stockDict.TryGetValue(loc.Id, out var stockInfo))
+                if (stockDict.TryGetValue(loc.Id, out var stockInfo) && stockInfo.Details != null)
                 {
                     item.PalletCode = stockInfo.PalletCode;
                     item.StockQuantity = stockInfo.Details.Sum(d => d.StockQuantity);

--
Gitblit v1.9.3