From 1a8dc6279c478a1b8e4cea78fa91ee856a720e3a Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 10:07:28 +0800
Subject: [PATCH] feat(StockService): ChangePalletAsync添加MES解绑和绑定调用
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 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..2657c1b 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -233,8 +233,45 @@
return content.Error("鎹㈢洏鍘嗗彶璁板綍淇濆瓨澶辫触");
detailEntities.ForEach(d => d.StockId = targetStock.Id);
+
+ // 璋冪敤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.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