From ddb526c5e10f3b985c4b65c1a12a1a166d87db9b Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 10:14:55 +0800
Subject: [PATCH] feat(StockService): SplitPalletAsync添加MES解绑调用

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

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index 49f6657..c253b80 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -315,6 +315,21 @@
                     if (await StockInfo_HtyService.Repository.AddDataAsync(CreateStockHistory(new[] { sourceStock }, "鎷嗙洏")) <= 0)
                         return content.Error("鎷嗙洏鍘嗗彶璁板綍淇濆瓨澶辫触");
 
+                    // 璋冪敤MES瑙g粦鐢佃姱
+                    var unbindRequest = new UnBindContainerRequest
+                    {
+                        EquipmentCode = "STK-GROUP-001",
+                        ResourceCode = "STK-GROUP-001",
+                        LocalTime = DateTime.Now,
+                        ContainCode = stock.SourcePalletNo,
+                        SfcList = detailEntities.Select(d => d.SerialNumber).ToList()
+                    };
+                    var unbindResult = _mesService.UnBindContainer(unbindRequest);
+                    if (unbindResult == null || unbindResult.Data == null || !unbindResult.Data.IsSuccess)
+                    {
+                        return content.Error($"鎷嗙洏鎴愬姛锛屼絾MES瑙g粦澶辫触: {unbindResult?.Data?.Msg ?? unbindResult?.ErrorMessage ?? "鏈煡閿欒"}");
+                    }
+
                     var result = await StockInfoDetailService.Repository.DeleteDataAsync(detailEntities);
                     if (!result) return content.Error("鎷嗙洏澶辫触");
                     return content.OK("鎷嗙洏鎴愬姛");

--
Gitblit v1.9.3