From 234bec78dd54ca0e2952b8d31d0c17ee1dc89ba9 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 18 四月 2026 15:51:32 +0800
Subject: [PATCH] feat: 添加MES设备动态凭证支持
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs | 37 +++++++++++++++++++++++++------------
1 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
index 0a1f053..c532f7a 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
@@ -4,7 +4,9 @@
using WIDESEA_Common.TaskEnum;
using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
+using WIDESEA_DTO.MES;
using WIDESEA_DTO.Task;
+using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
namespace WIDESEA_TaskInfoService
@@ -149,19 +151,30 @@
var updateStockResult = await _stockInfoService.UpdateStockAsync(stockInfo);
if (!updateLocationResult || !updateStockResult)
return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
+ // 鏍规嵁搴撳瓨Remark閫夋嫨闈欑疆璁惧锛屾煡MES鍔ㄦ�佸嚟璇�
+ string deviceName = stockInfo.Remark == "GW_1" ? "楂樻俯闈欑疆1"
+ : stockInfo.Remark == "GW_2" ? "楂樻俯闈欑疆2"
+ : "甯告俯闈欑疆1";
+ var mesConfig = _mesDeviceConfigService.GetByDeviceName(deviceName);
+ string equipmentCode = mesConfig?.EquipmentCode ?? StockConstants.MES_EQUIPMENT_CODE;
+ string resourceCode = mesConfig?.ResourceCode ?? StockConstants.MES_RESOURCE_CODE;
+ string token = mesConfig?.Token;
+
// 璋冪敤MES鎵樼洏杩涚珯
- //var inboundRequest = new InboundInContainerRequest
- //{
- // EquipmentCode = "STK-GROUP-001",
- // ResourceCode = "STK-GROUP-001",
- // LocalTime = DateTime.Now,
- // ContainerCode = taskDto.PalletCode
- //};
- //var inboundResult = _mesService.InboundInContainer(inboundRequest);
- //if (inboundResult == null || inboundResult.Data == null || !inboundResult.Data.IsSuccess)
- //{
- // return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES杩涚珯澶辫触: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
- //}
+ var inboundRequest = new InboundInContainerRequest
+ {
+ EquipmentCode = equipmentCode,
+ ResourceCode = resourceCode,
+ LocalTime = DateTime.Now,
+ ContainerCode = taskDto.PalletCode
+ };
+ var inboundResult = string.IsNullOrWhiteSpace(token)
+ ? _mesService.InboundInContainer(inboundRequest)
+ : _mesService.InboundInContainer(inboundRequest, token);
+ if (inboundResult == null || inboundResult.Data == null || !inboundResult.Data.IsSuccess)
+ {
+ return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES杩涚珯澶辫触: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
+ }
return await CompleteTaskAsync(task, "鍏ュ簱瀹屾垚");
});
}
--
Gitblit v1.9.3