From 63d0a623484d720923201d647bac6ea99f88bb62 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 10:09:33 +0800
Subject: [PATCH] fix(StockService): 调整ChangePalletAsync的MES解绑顺序为换出前

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

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index 2657c1b..49f6657 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -232,8 +232,6 @@
                     if (await StockInfo_HtyService.Repository.AddDataAsync(CreateStockHistory(new[] { sourceStock, targetStock }, "鎹㈢洏")) <= 0)
                         return content.Error("鎹㈢洏鍘嗗彶璁板綍淇濆瓨澶辫触");
 
-                    detailEntities.ForEach(d => d.StockId = targetStock.Id);
-
                     // 璋冪敤MES瑙g粦婧愭墭鐩樼數鑺�
                     var unbindRequest = new UnBindContainerRequest
                     {
@@ -249,6 +247,7 @@
                         return content.Error($"鎹㈢洏鎴愬姛锛屼絾MES瑙g粦澶辫触: {unbindResult?.Data?.Msg ?? unbindResult?.ErrorMessage ?? "鏈煡閿欒"}");
                     }
 
+                    detailEntities.ForEach(d => d.StockId = targetStock.Id);
                     var result = await StockInfoDetailService.Repository.UpdateDataAsync(detailEntities);
                     if (!result) return content.Error("鎹㈢洏澶辫触");
 

--
Gitblit v1.9.3