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 | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index 8f98594..49f6657 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -232,9 +232,45 @@
if (await StockInfo_HtyService.Repository.AddDataAsync(CreateStockHistory(new[] { sourceStock, targetStock }, "鎹㈢洏")) <= 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 ?? "鏈煡閿欒"}");
+ }
+
detailEntities.ForEach(d => d.StockId = targetStock.Id);
var result = await StockInfoDetailService.Repository.UpdateDataAsync(detailEntities);
if (!result) return content.Error("鎹㈢洏澶辫触");
+
+ // 璋冪敤MES缁戝畾鐩爣鎵樼洏鐢佃姱
+ var bindRequest = new BindContainerRequest
+ {
+ ContainerCode = stock.TargetPalletNo,
+ EquipmentCode = "STK-GROUP-001",
+ ResourceCode = "STK-GROUP-001",
+ LocalTime = DateTime.Now,
+ OperationType = 0,
+ ContainerSfcList = detailEntities.Select(d => new ContainerSfcItem
+ {
+ Sfc = d.SerialNumber,
+ Location = d.InboundOrderRowNo.ToString()
+ }).ToList()
+ };
+ var bindResult = _mesService.BindContainer(bindRequest);
+ if (bindResult == null || bindResult.Data == null || !bindResult.Data.IsSuccess)
+ {
+ return content.Error($"鎹㈢洏鎴愬姛锛屼絾MES缁戝畾澶辫触: {bindResult?.Data?.Msg ?? bindResult?.ErrorMessage ?? "鏈煡閿欒"}");
+ }
+
return content.OK("鎹㈢洏鎴愬姛");
});
}
--
Gitblit v1.9.3