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/.omc/state/mission-state.json | 144 +++++++++++++
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs | 26 ++
Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/SplitPalletConfirmRequestDto.cs | 5
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 5
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockController.cs | 4
Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/GroupPalletConfirmRequestDto.cs | 5
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs | 94 +++++++-
Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MesService.cs | 40 +++
Code/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMesService.cs | 20 +
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs | 36 ++-
Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockService.cs | 6
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs | 10
Code/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Mes/Dt_MESDeviceConfig.cs | 49 ++++
项目资料/设备协议/上位系统对接/~$高温2常温1及机械手设备账号信息表(1).xlsx | 0
项目资料/设备协议/上位系统对接/高温2常温1及机械手设备账号信息表(1).xlsx | 0
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/MESDeviceConfigService.cs | 61 +++++
Code/.omc/state/last-tool-error.json | 8
Code/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Mes/Dt_MESDeviceConfig.sql | 28 ++
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs | 12
Code/.omc/state/subagent-tracking.json | 78 ++++++
Code/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMESDeviceConfigService.cs | 27 ++
21 files changed, 610 insertions(+), 48 deletions(-)
diff --git a/Code/.omc/state/last-tool-error.json b/Code/.omc/state/last-tool-error.json
index c78317a..1f18ea3 100644
--- a/Code/.omc/state/last-tool-error.json
+++ b/Code/.omc/state/last-tool-error.json
@@ -1,7 +1,7 @@
{
- "tool_name": "Bash",
- "tool_input_preview": "{\"command\":\"node -e \\\"\\nconst f=require('fs'),p=require('path'),h=require('os').homedir();\\nconst d=process.env.CLAUDE_CONFIG_DIR||p.join(h,'.claude');\\nconst cf=p.join(d,'.omc-config.json');\\nconst e...",
- "error": "Exit code 1\n<anonymous_script>:1\r\n\r\n\r\nSyntaxError: Unexpected end of JSON input\r\n at JSON.parse (<anonymous>)\r\n at [eval]:5:38\r\n at runScriptInThisContext (node:internal/vm:219:10)\r\n at node:internal/process/execution:451:12\r\n at [eval]-wrapper:6:24\r\n at runScriptInContext (node:internal/process/execution:449:60)\r\n at evalFunction (node:internal/process/execution:283:30)\r\n at evalTypeScript (node:internal/process/execution:295:3)\r\n at node:internal/main/eval_string:71:...",
- "timestamp": "2026-04-18T06:15:45.665Z",
+ "tool_name": "Read",
+ "tool_input_preview": "{\"file_path\":\"D:\\\\Git\\\\ShanMeiXinNengYuan\\\\Code\\\\WMS\\\\WIDESEA_WMSServer\\\\WIDESEA_TaskInfoService\\\\WCS\\\\TaskService.cs\"}",
+ "error": "File does not exist. Note: your current working directory is D:\\Git\\ShanMeiXinNengYuan\\Code.",
+ "timestamp": "2026-04-18T07:45:29.125Z",
"retry_count": 1
}
\ No newline at end of file
diff --git a/Code/.omc/state/mission-state.json b/Code/.omc/state/mission-state.json
index 85d14d8..82a351a 100644
--- a/Code/.omc/state/mission-state.json
+++ b/Code/.omc/state/mission-state.json
@@ -1,5 +1,5 @@
{
- "updatedAt": "2026-04-16T13:59:54.835Z",
+ "updatedAt": "2026-04-18T07:46:50.058Z",
"missions": [
{
"id": "session:9007b9ea-1eb6-4d24-8fe7-2c3a949eac88:none",
@@ -1070,6 +1070,148 @@
"sourceKey": "session-stop:a93149b10e8b430e7"
}
]
+ },
+ {
+ "id": "session:f36717d7-c4c4-4816-8723-6f7d562203f6:none",
+ "source": "session",
+ "name": "none",
+ "objective": "Session mission",
+ "createdAt": "2026-04-18T06:36:59.451Z",
+ "updatedAt": "2026-04-18T07:46:50.058Z",
+ "status": "done",
+ "workerCount": 8,
+ "taskCounts": {
+ "total": 8,
+ "pending": 0,
+ "blocked": 0,
+ "inProgress": 0,
+ "completed": 8,
+ "failed": 0
+ },
+ "agents": [
+ {
+ "name": "Explore:a1ab626",
+ "role": "Explore",
+ "ownership": "a1ab62633715919c8",
+ "status": "done",
+ "currentStep": null,
+ "latestUpdate": "completed",
+ "completedSummary": null,
+ "updatedAt": "2026-04-18T06:39:31.702Z"
+ },
+ {
+ "name": "general-purpose:ae116cb",
+ "role": "general-purpose",
+ "ownership": "ae116cb86a435866d",
+ "status": "done",
+ "currentStep": null,
+ "latestUpdate": "completed",
+ "completedSummary": null,
+ "updatedAt": "2026-04-18T06:50:41.503Z"
+ },
+ {
+ "name": "general-purpose:a4e061e",
+ "role": "general-purpose",
+ "ownership": "a4e061e4a6d17c682",
+ "status": "done",
+ "currentStep": null,
+ "latestUpdate": "completed",
+ "completedSummary": null,
+ "updatedAt": "2026-04-18T06:52:02.047Z"
+ },
+ {
+ "name": "general-purpose:afdf6ef",
+ "role": "general-purpose",
+ "ownership": "afdf6efad435c036a",
+ "status": "done",
+ "currentStep": null,
+ "latestUpdate": "completed",
+ "completedSummary": null,
+ "updatedAt": "2026-04-18T06:50:50.428Z"
+ },
+ {
+ "name": "general-purpose:ab1f8d2",
+ "role": "general-purpose",
+ "ownership": "ab1f8d2625bd8a667",
+ "status": "done",
+ "currentStep": null,
+ "latestUpdate": "completed",
+ "completedSummary": null,
+ "updatedAt": "2026-04-18T06:54:35.702Z"
+ },
+ {
+ "name": "general-purpose:a99f2fa",
+ "role": "general-purpose",
+ "ownership": "a99f2fa258ad9b5a1",
+ "status": "done",
+ "currentStep": null,
+ "latestUpdate": "completed",
+ "completedSummary": null,
+ "updatedAt": "2026-04-18T06:50:30.602Z"
+ },
+ {
+ "name": "general-purpose:aa71986",
+ "role": "general-purpose",
+ "ownership": "aa71986c72a8dd1f4",
+ "status": "done",
+ "currentStep": null,
+ "latestUpdate": "completed",
+ "completedSummary": null,
+ "updatedAt": "2026-04-18T07:46:50.058Z"
+ },
+ {
+ "name": "general-purpose:aadbd70",
+ "role": "general-purpose",
+ "ownership": "aadbd702e8fdf756c",
+ "status": "done",
+ "currentStep": null,
+ "latestUpdate": "completed",
+ "completedSummary": null,
+ "updatedAt": "2026-04-18T07:46:15.279Z"
+ }
+ ],
+ "timeline": [
+ {
+ "id": "session-stop:ab1f8d2625bd8a667:2026-04-18T06:54:35.702Z",
+ "at": "2026-04-18T06:54:35.702Z",
+ "kind": "completion",
+ "agent": "general-purpose:ab1f8d2",
+ "detail": "completed",
+ "sourceKey": "session-stop:ab1f8d2625bd8a667"
+ },
+ {
+ "id": "session-start:aa71986c72a8dd1f4:2026-04-18T07:45:17.089Z",
+ "at": "2026-04-18T07:45:17.089Z",
+ "kind": "update",
+ "agent": "general-purpose:aa71986",
+ "detail": "started general-purpose:aa71986",
+ "sourceKey": "session-start:aa71986c72a8dd1f4"
+ },
+ {
+ "id": "session-start:aadbd702e8fdf756c:2026-04-18T07:45:17.153Z",
+ "at": "2026-04-18T07:45:17.153Z",
+ "kind": "update",
+ "agent": "general-purpose:aadbd70",
+ "detail": "started general-purpose:aadbd70",
+ "sourceKey": "session-start:aadbd702e8fdf756c"
+ },
+ {
+ "id": "session-stop:aadbd702e8fdf756c:2026-04-18T07:46:15.279Z",
+ "at": "2026-04-18T07:46:15.279Z",
+ "kind": "completion",
+ "agent": "general-purpose:aadbd70",
+ "detail": "completed",
+ "sourceKey": "session-stop:aadbd702e8fdf756c"
+ },
+ {
+ "id": "session-stop:aa71986c72a8dd1f4:2026-04-18T07:46:50.058Z",
+ "at": "2026-04-18T07:46:50.058Z",
+ "kind": "completion",
+ "agent": "general-purpose:aa71986",
+ "detail": "completed",
+ "sourceKey": "session-stop:aa71986c72a8dd1f4"
+ }
+ ]
}
]
}
\ No newline at end of file
diff --git a/Code/.omc/state/subagent-tracking.json b/Code/.omc/state/subagent-tracking.json
index f507a23..40d7562 100644
--- a/Code/.omc/state/subagent-tracking.json
+++ b/Code/.omc/state/subagent-tracking.json
@@ -686,10 +686,82 @@
"status": "completed",
"completed_at": "2026-04-16T13:59:54.835Z",
"duration_ms": 111569
+ },
+ {
+ "agent_id": "a1ab62633715919c8",
+ "agent_type": "Explore",
+ "started_at": "2026-04-18T06:36:59.451Z",
+ "parent_mode": "none",
+ "status": "completed",
+ "completed_at": "2026-04-18T06:39:31.702Z",
+ "duration_ms": 152251
+ },
+ {
+ "agent_id": "ae116cb86a435866d",
+ "agent_type": "general-purpose",
+ "started_at": "2026-04-18T06:49:33.031Z",
+ "parent_mode": "none",
+ "status": "completed",
+ "completed_at": "2026-04-18T06:50:41.503Z",
+ "duration_ms": 68472
+ },
+ {
+ "agent_id": "a4e061e4a6d17c682",
+ "agent_type": "general-purpose",
+ "started_at": "2026-04-18T06:49:33.090Z",
+ "parent_mode": "none",
+ "status": "completed",
+ "completed_at": "2026-04-18T06:52:02.047Z",
+ "duration_ms": 148957
+ },
+ {
+ "agent_id": "afdf6efad435c036a",
+ "agent_type": "general-purpose",
+ "started_at": "2026-04-18T06:49:33.151Z",
+ "parent_mode": "none",
+ "status": "completed",
+ "completed_at": "2026-04-18T06:50:50.428Z",
+ "duration_ms": 77277
+ },
+ {
+ "agent_id": "ab1f8d2625bd8a667",
+ "agent_type": "general-purpose",
+ "started_at": "2026-04-18T06:49:33.209Z",
+ "parent_mode": "none",
+ "status": "completed",
+ "completed_at": "2026-04-18T06:54:35.702Z",
+ "duration_ms": 302493
+ },
+ {
+ "agent_id": "a99f2fa258ad9b5a1",
+ "agent_type": "general-purpose",
+ "started_at": "2026-04-18T06:49:33.266Z",
+ "parent_mode": "none",
+ "status": "completed",
+ "completed_at": "2026-04-18T06:50:30.602Z",
+ "duration_ms": 57336
+ },
+ {
+ "agent_id": "aa71986c72a8dd1f4",
+ "agent_type": "general-purpose",
+ "started_at": "2026-04-18T07:45:17.089Z",
+ "parent_mode": "none",
+ "status": "completed",
+ "completed_at": "2026-04-18T07:46:50.058Z",
+ "duration_ms": 92969
+ },
+ {
+ "agent_id": "aadbd702e8fdf756c",
+ "agent_type": "general-purpose",
+ "started_at": "2026-04-18T07:45:17.153Z",
+ "parent_mode": "none",
+ "status": "completed",
+ "completed_at": "2026-04-18T07:46:15.279Z",
+ "duration_ms": 58126
}
],
- "total_spawned": 77,
- "total_completed": 74,
+ "total_spawned": 82,
+ "total_completed": 82,
"total_failed": 0,
- "last_updated": "2026-04-16T13:59:54.939Z"
+ "last_updated": "2026-04-18T07:46:50.164Z"
}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs
index 2edc39f..62cb7ba 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs
@@ -647,10 +647,11 @@
/// 褰撴媶鐩樹换鍔″叏閮ㄥ彇瀹屾椂璋冪敤锛屼竴娆℃�т笂浼犳暣涓墭鐩樼殑瑙g粦鏁版嵁鍒� MES銆�
/// </remarks>
/// <param name="palletCode">婧愭墭鐩樺彿</param>
+ /// <param name="deviceName">璁惧鍚嶇О锛岀敤浜庝紶閫掑埌 WMS</param>
/// <returns>HTTP 鍝嶅簲缁撴灉</returns>
- public HttpResponseResult<WebResponseContent> PostSplitPalletConfirmAsync(string palletCode)
+ public HttpResponseResult<WebResponseContent> PostSplitPalletConfirmAsync(string palletCode, string deviceName)
{
- var request = new { PalletCode = palletCode };
+ var request = new { PalletCode = palletCode, DeviceName = deviceName };
return _httpClientHelper.Post<WebResponseContent>(nameof(ConfigKey.SplitPalletConfirm), request.ToJson());
}
@@ -661,10 +662,11 @@
/// 褰撶粍鐩樹换鍔″叏閮ㄦ斁瀹屾椂璋冪敤锛屼竴娆℃�т笂浼犳暣涓墭鐩樼殑缁戝畾鏁版嵁鍒� MES銆�
/// </remarks>
/// <param name="palletCode">鐩爣鎵樼洏鍙�</param>
+ /// <param name="deviceName">璁惧鍚嶇О锛岀敤浜庝紶閫掑埌 WMS</param>
/// <returns>HTTP 鍝嶅簲缁撴灉</returns>
- public HttpResponseResult<WebResponseContent> PostGroupPalletConfirmAsync(string palletCode)
+ public HttpResponseResult<WebResponseContent> PostGroupPalletConfirmAsync(string palletCode, string deviceName)
{
- var request = new { PalletCode = palletCode };
+ var request = new { PalletCode = palletCode, DeviceName = deviceName };
return _httpClientHelper.Post<WebResponseContent>(nameof(ConfigKey.GroupPalletConfirm), request.ToJson());
}
}
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs
index 00abc18..6c13f96 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs
@@ -150,7 +150,7 @@
{
// 璋冪敤鎵归噺鎷嗙洏纭鎺ュ彛锛堟崲鐩樺彇瀹岄樁娈碉級
var sourcePallet = state.CurrentTask.RobotSourceAddressPalletCode;
- var confirmResult = _taskProcessor.PostSplitPalletConfirmAsync(sourcePallet);
+ var confirmResult = _taskProcessor.PostSplitPalletConfirmAsync(sourcePallet, state.RobotCrane?.DeviceName);
if (!confirmResult.IsSuccess)
{
QuartzLogger.Error($"鎵归噺鎷嗙洏纭澶辫触: {confirmResult.ErrorMessage}", state.RobotCrane?.DeviceName ?? "Unknown");
@@ -180,7 +180,7 @@
{
// 璋冪敤鎵归噺鎷嗙洏纭鎺ュ彛
var sourcePallet = state.CurrentTask.RobotSourceAddressPalletCode;
- var confirmResult = _taskProcessor.PostSplitPalletConfirmAsync(sourcePallet);
+ var confirmResult = _taskProcessor.PostSplitPalletConfirmAsync(sourcePallet, state.RobotCrane?.DeviceName);
if (!confirmResult.IsSuccess)
{
QuartzLogger.Error($"鎵归噺鎷嗙洏纭澶辫触: {confirmResult.ErrorMessage}", state.RobotCrane?.DeviceName ?? "Unknown");
@@ -221,7 +221,7 @@
{
// 璋冪敤鎵归噺缁勭洏纭鎺ュ彛锛堟崲鐩樻斁瀹岄樁娈碉級
var targetPallet = state.CurrentTask.RobotTargetAddressPalletCode;
- var confirmResult = _taskProcessor.PostGroupPalletConfirmAsync(targetPallet);
+ var confirmResult = _taskProcessor.PostGroupPalletConfirmAsync(targetPallet, state.RobotCrane?.DeviceName);
if (!confirmResult.IsSuccess)
{
QuartzLogger.Error($"鎵归噺缁勭洏纭澶辫触: {confirmResult.ErrorMessage}", state.RobotCrane?.DeviceName ?? "Unknown");
@@ -257,11 +257,7 @@
{
// 璋冪敤鎵归噺缁勭洏纭鎺ュ彛
//var targetPallet = state.CurrentTask.RobotTargetAddressPalletCode;
- //var confirmResult = _taskProcessor.PostGroupPalletConfirmAsync(targetPallet);
- //if (!confirmResult.IsSuccess)
- //{
- // QuartzLogger.Error($"鎵归噺缁勭洏纭澶辫触: {confirmResult.ErrorMessage}", state.RobotCrane?.DeviceName ?? "Unknown");
- //}
+ //_taskProcessor.PostGroupPalletConfirmAsync(targetPallet, state.RobotCrane?.DeviceName);
// 澶勭悊鍏ュ簱浠诲姟鍥炰紶
// useSourceAddress: false 琛ㄧず浣跨敤鐩爣鍦板潃锛堢粍鐩樺満鏅級
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MesService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MesService.cs
index ccae68c..3234a69 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MesService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MesService.cs
@@ -43,10 +43,30 @@
};
}
+ private HttpRequestConfig BuildConfig(string token)
+ {
+ return new HttpRequestConfig
+ {
+ Headers = new Dictionary<string, string>
+ {
+ { "Authorization", token }
+ },
+ TimeoutMs = 30000,
+ MaxRetryCount = 0,
+ EnableLogging = true
+ };
+ }
+
private HttpResponseResult<MesResponse> Post<T>(string url, T request)
{
string json = JsonConvert.SerializeObject(request);
return _httpClient.Post<MesResponse>(url, json, "application/json", BuildConfig());
+ }
+
+ private HttpResponseResult<MesResponse> Post<T>(string url, T request, HttpRequestConfig config)
+ {
+ string json = JsonConvert.SerializeObject(request);
+ return _httpClient.Post<MesResponse>(url, json, "application/json", config);
}
public HttpResponseResult<MesResponse> BindContainer(BindContainerRequest request)
@@ -57,6 +77,16 @@
public HttpResponseResult<MesResponse> UnBindContainer(UnBindContainerRequest request)
{
return Post(_baseUrl + UnBindContainerPath, request);
+ }
+
+ public HttpResponseResult<MesResponse> BindContainer(BindContainerRequest request, string token)
+ {
+ return Post(_baseUrl + BindContainerPath, request, BuildConfig(token));
+ }
+
+ public HttpResponseResult<MesResponse> UnBindContainer(UnBindContainerRequest request, string token)
+ {
+ return Post(_baseUrl + UnBindContainerPath, request, BuildConfig(token));
}
public HttpResponseResult<MesResponse> ContainerNgReport(ContainerNgReportRequest request)
@@ -73,5 +103,15 @@
{
return Post(_baseUrl + OutboundInContainerPath, request);
}
+
+ public HttpResponseResult<MesResponse> InboundInContainer(InboundInContainerRequest request, string token)
+ {
+ return Post(_baseUrl + InboundInContainerPath, request, BuildConfig(token));
+ }
+
+ public HttpResponseResult<MesResponse> OutboundInContainer(OutboundInContainerRequest request, string token)
+ {
+ return Post(_baseUrl + OutboundInContainerPath, request, BuildConfig(token));
+ }
}
}
\ No newline at end of file
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/GroupPalletConfirmRequestDto.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/GroupPalletConfirmRequestDto.cs
index 4afa6b1..e0f4a2d 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/GroupPalletConfirmRequestDto.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/GroupPalletConfirmRequestDto.cs
@@ -9,5 +9,10 @@
/// 鐩爣鎵樼洏鍙�
/// </summary>
public string PalletCode { get; set; }
+
+ /// <summary>
+ /// 璁惧鍚嶇О锛堢敤浜庡姩鎬丮ES鍑瘉鏌ヨ锛�
+ /// </summary>
+ public string DeviceName { get; set; }
}
}
\ No newline at end of file
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/SplitPalletConfirmRequestDto.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/SplitPalletConfirmRequestDto.cs
index 6f5ef2c..803a886 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/SplitPalletConfirmRequestDto.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/SplitPalletConfirmRequestDto.cs
@@ -9,5 +9,10 @@
/// 婧愭墭鐩樺彿
/// </summary>
public string PalletCode { get; set; }
+
+ /// <summary>
+ /// 璁惧鍚嶇О锛堢敤浜庡姩鎬丮ES鍑瘉鏌ヨ锛�
+ /// </summary>
+ public string DeviceName { get; set; }
}
}
\ No newline at end of file
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMESDeviceConfigService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMESDeviceConfigService.cs
new file mode 100644
index 0000000..93c47d9
--- /dev/null
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMESDeviceConfigService.cs
@@ -0,0 +1,27 @@
+using WIDESEA_Core;
+using WIDESEA_Model.Models;
+
+namespace WIDESEA_IBasicService
+{
+ /// <summary>
+ /// MES璁惧閰嶇疆淇℃伅鏈嶅姟鎺ュ彛
+ /// </summary>
+ public interface IMESDeviceConfigService : IDependency
+ {
+ /// <summary>
+ /// 鏍规嵁璁惧鍚嶇О鑾峰彇MES璁惧閰嶇疆锛堢簿纭尮閰嶏級
+ /// </summary>
+ /// <param name="deviceName">璁惧鍚嶇О</param>
+ /// <returns>MES璁惧閰嶇疆锛屽鏋滄湭鎵惧埌鍒欒繑鍥瀗ull</returns>
+ Dt_MESDeviceConfig? GetByDeviceName(string deviceName);
+
+ /// <summary>
+ /// 鏍规嵁璁惧鍚嶇О鍜屼粨搴撶紪鐮佽幏鍙朚ES璁惧閰嶇疆
+ /// 鍖归厤鏉′欢锛欴eviceName绮剧‘鍖归厤涓旓紙WarehouseCode涓虹┖鎴栫瓑浜庢寚瀹氱殑浠撳簱缂栫爜锛�
+ /// </summary>
+ /// <param name="deviceName">璁惧鍚嶇О</param>
+ /// <param name="warehouseCode">浠撳簱缂栫爜</param>
+ /// <returns>MES璁惧閰嶇疆锛屽鏋滄湭鎵惧埌鍒欒繑鍥瀗ull</returns>
+ Dt_MESDeviceConfig? GetByDeviceNameAndWarehouse(string deviceName, string warehouseCode);
+ }
+}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMesService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMesService.cs
index b9b27a1..3118962 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMesService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMesService.cs
@@ -20,6 +20,16 @@
HttpResponseResult<MesResponse> UnBindContainer(UnBindContainerRequest request);
/// <summary>
+ /// 鎵樼洏鐢佃姱缁戝畾锛堟敮鎸佸姩鎬乀oken锛�
+ /// </summary>
+ HttpResponseResult<MesResponse> BindContainer(BindContainerRequest request, string token);
+
+ /// <summary>
+ /// 鎵樼洏鐢佃姱瑙g粦锛堟敮鎸佸姩鎬乀oken锛�
+ /// </summary>
+ HttpResponseResult<MesResponse> UnBindContainer(UnBindContainerRequest request, string token);
+
+ /// <summary>
/// 鎵樼洏NG鐢佃姱涓婃姤
/// </summary>
HttpResponseResult<MesResponse> ContainerNgReport(ContainerNgReportRequest request);
@@ -30,8 +40,18 @@
HttpResponseResult<MesResponse> InboundInContainer(InboundInContainerRequest request);
/// <summary>
+ /// 鎵樼洏杩涚珯锛堟敮鎸佸姩鎬乀oken锛�
+ /// </summary>
+ HttpResponseResult<MesResponse> InboundInContainer(InboundInContainerRequest request, string token);
+
+ /// <summary>
/// 鎵樼洏鍑虹珯
/// </summary>
HttpResponseResult<MesResponse> OutboundInContainer(OutboundInContainerRequest request);
+
+ /// <summary>
+ /// 鎵樼洏鍑虹珯锛堟敮鎸佸姩鎬乀oken锛�
+ /// </summary>
+ HttpResponseResult<MesResponse> OutboundInContainer(OutboundInContainerRequest request, string token);
}
}
\ No newline at end of file
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockService.cs
index 82306b3..6dc1603 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockService.cs
@@ -60,14 +60,16 @@
/// 鎵归噺鎷嗙洏纭 - 涓�娆℃�ц皟鐢∕ES瑙g粦鏁翠釜鎵樼洏
/// </summary>
/// <param name="palletCode">婧愭墭鐩樺彿</param>
+ /// <param name="deviceName">璁惧鍚嶇О锛堢敤浜庡姩鎬丮ES鍑瘉鏌ヨ锛�</param>
/// <returns>鎿嶄綔缁撴灉</returns>
- Task<WebResponseContent> SplitPalletConfirmAsync(string palletCode);
+ Task<WebResponseContent> SplitPalletConfirmAsync(string palletCode, string deviceName);
/// <summary>
/// 鎵归噺缁勭洏纭 - 涓�娆℃�ц皟鐢∕ES缁戝畾鏁翠釜鎵樼洏
/// </summary>
/// <param name="palletCode">鐩爣鎵樼洏鍙�</param>
+ /// <param name="deviceName">璁惧鍚嶇О锛堢敤浜庡姩鎬丮ES鍑瘉鏌ヨ锛�</param>
/// <returns>鎿嶄綔缁撴灉</returns>
- Task<WebResponseContent> GroupPalletConfirmAsync(string palletCode);
+ Task<WebResponseContent> GroupPalletConfirmAsync(string palletCode, string deviceName);
}
}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Mes/Dt_MESDeviceConfig.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Mes/Dt_MESDeviceConfig.cs
new file mode 100644
index 0000000..4dbeb5b
--- /dev/null
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Mes/Dt_MESDeviceConfig.cs
@@ -0,0 +1,49 @@
+using SqlSugar;
+using System;
+using WIDESEA_Core.DB.Models;
+
+namespace WIDESEA_Model.Models
+{
+ /// <summary>
+ /// MES璁惧閰嶇疆瀹炰綋
+ /// </summary>
+ [SugarTable(nameof(Dt_MESDeviceConfig))]
+ public class Dt_MESDeviceConfig : BaseEntity
+ {
+ /// <summary>
+ /// 涓婚敭ID锛岃嚜澧�
+ /// </summary>
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭ID")]
+ public int Id { get; set; }
+
+ /// <summary>
+ /// 璁惧鍚嶇О锛屽"娉ㄦ恫缁勭洏鏈烘鎵�"
+ /// </summary>
+ [SugarColumn(Length = 50, IsNullable = false, ColumnDescription = "璁惧鍚嶇О")]
+ public string DeviceName { get; set; }
+
+ /// <summary>
+ /// MES璁惧缂栫爜锛屽"A02-YZHJJS-001"
+ /// </summary>
+ [SugarColumn(Length = 50, IsNullable = false, ColumnDescription = "MES璁惧缂栫爜")]
+ public string EquipmentCode { get; set; }
+
+ /// <summary>
+ /// MES璧勬簮缂栫爜锛屽"ZY25091001"
+ /// </summary>
+ [SugarColumn(Length = 50, IsNullable = false, ColumnDescription = "MES璧勬簮缂栫爜")]
+ public string ResourceCode { get; set; }
+
+ /// <summary>
+ /// MES API JWT浠ょ墝
+ /// </summary>
+ [SugarColumn(Length = 500, IsNullable = false, ColumnDescription = "MES API JWT浠ょ墝")]
+ public string Token { get; set; }
+
+ /// <summary>
+ /// 浠撳簱缂栫爜锛岀敤浜庨渶瑕佸尯鍒嗕粨搴撶殑鏈烘鎵嬶紙鍙负绌猴級
+ /// </summary>
+ [SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "浠撳簱缂栫爜")]
+ public string WarehouseCode { get; set; }
+ }
+}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Mes/Dt_MESDeviceConfig.sql b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Mes/Dt_MESDeviceConfig.sql
new file mode 100644
index 0000000..45e2bb1
--- /dev/null
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Mes/Dt_MESDeviceConfig.sql
@@ -0,0 +1,28 @@
+-- Dt_MESDeviceConfig SQL Script
+-- 瀵瑰簲瀹炰綋 Dt_MESDeviceConfig锛岀户鎵胯嚜 BaseEntity锛堝寘鍚� Creater, CreateDate, Modifier, ModifyDate锛�
+DROP TABLE IF EXISTS Dt_MESDeviceConfig;
+
+CREATE TABLE Dt_MESDeviceConfig (
+ Id INT IDENTITY(1,1) PRIMARY KEY,
+ DeviceName NVARCHAR(50) NOT NULL,
+ EquipmentCode NVARCHAR(50) NOT NULL,
+ ResourceCode NVARCHAR(50) NOT NULL,
+ Token NVARCHAR(500) NOT NULL,
+ WarehouseCode NVARCHAR(50) NULL,
+ Creater NVARCHAR(50) NOT NULL,
+ CreateDate DATETIME NOT NULL,
+ Modifier NVARCHAR(50) NULL,
+ ModifyDate DATETIME NULL
+);
+
+-- INSERT device configuration data
+INSERT INTO Dt_MESDeviceConfig (DeviceName, EquipmentCode, ResourceCode, Token, WarehouseCode, Creater, CreateDate)
+VALUES
+(N'娉ㄦ恫缁勭洏鏈烘鎵�', N'A02-YZHJJS-001', N'ZY25091001', N'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwODkyNjQ4MzYzODUzODI0MCIsIm5hbWUiOiLkuIDms6jlkI7mnLrmorDmiYsiLCJGYWN0b3J5SWQiOiI0Mjg3NDU2MTc3ODI1MzgyNCIsIlNpdGVJZCI6IjQyODc0NTYxNzc4MjUzODI0IiwiQ29kZSI6IkEwMi1ZWkhKSlMtMDAxIiwibmJmIjoxNzc2NDExODk0LCJleHAiOjIyMTc5MTU4OTQsImlzcyI6Imh0dHBzOi8vd3d3Lmh5bXNvbi5jb20iLCJhdWQiOiJodHRwczovL3d3dy5oeW1zb24uY29tIn0.HCBK-mq7zrbn6s335Ddn1ZwUffCXdFAmflgHFtOyOXg', NULL, N'Admin', GETDATE()),
+(N'楂樻俯1鎹㈢洏鏈烘鎵�', N'A02-GW1HJJS-001', N'ZY25091002', N'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwODkyNjUxOTA3NDExNTU4NCIsIm5hbWUiOiLpq5jmuKkx5ZCO5py65qKw5omLIiwiRmFjdG9yeUlkIjoiNDI4NzQ1NjE3NzgyNTM4MjQiLCJTaXRlSWQiOiI0Mjg3NDU2MTc3ODI1MzgyNCIsIkNvZGUiOiJBMDItR1cxSEpKUy0wMDEiLCJuYmYiOjE3NzY0MTE5MDgsImV4cCI6MjIxNzkxNTkwOCwiaXNzIjoiaHR0cHM6Ly93d3cuaHltc29uLmNvbSIsImF1ZCI6Imh0dHBzOi8vd3d3Lmh5bXNvbi5jb20ifQ.A8frl5Txy6F3hCM2AuMbrPk_0x-rYmwjvL4a1RbxdeY', NULL, N'Admin', GETDATE()),
+(N'鍖栨垚鎹㈢洏鏈烘鎵�', N'A02-HCHJJS-001', N'ZY25091003', N'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwODkyNjU0ODk2NTg3MTYxNiIsIm5hbWUiOiLljJbmiJDlkI7mnLrmorDmiYvvvIjpq5jmuKky77yJIiwiRmFjdG9yeUlkIjoiNDI4NzQ1NjE3NzgyNTM4MjQiLCJTaXRlSWQiOiI0Mjg3NDU2MTc3ODI1MzgyNCIsIkNvZGUiOiJBMDItSENISkpTLTAwMSIsIm5iZiI6MTc3NjQxMTkxNiwiZXhwIjoyMjE3OTE1OTE2LCJpc3MiOiJodHRwczovL3d3dy5oeW1zb24uLmNvbSIsImF1ZCI6Imh0dHBzOi8vd3d3Lmh5bXNvbi5jb20ifQ.SHxbsdYoV2m4oUkaJauOBu4A-TfuX__J8-W-mqghg_A', NULL, N'Admin', GETDATE()),
+(N'甯告俯鏈烘鎵�', N'A02-CW1JJS-001', N'ZY25091004', N'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwODkyNjU4MDA2ODczMjkyOCIsIm5hbWUiOiLluLjmuKkx5py65qKw5omLIiwiRmFjdG9yeUlkIjoiNDI4NzQ1NjE3NzgyNTM4MjQiLCJTaXRlSWQiOiI0Mjg3NDU2MTc3ODI1MzgyNCIsIkNvZGUiOiJBMDItQ1cxSkpTLTAwMSIsIm5iZiI6MTc3NjQxMTkyNCwiZXhwIjoyMjE3OTE1OTI0LCJpc3MiOiJodHRwczovL3d3dy5oeW1zb24uY29tIiwiYXVkIjoiaHR0cHM6Ly93d3cuaHltc29uLmNvbSJ9.CnBUKdmdSGURyW-YzW_JZvtP93o17zG2r5ZxHx867PQ', NULL, N'Admin', GETDATE()),
+(N'鎴愬搧缁勭洏鏈烘鎵�', N'A02-EHJJS-001', N'ZY25091005', N'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwODkyNjYwOTU1OTkzMjkyOCIsIm5hbWUiOiLkuozmrKHmsKbmo4DlkI7mnLrmorDmiYsiLCJGYWN0b3J5SWQiOiI0Mjg3NDU2MTc3ODI1MzgyNCIsIlNpdGVJZCI6IjQyODc0NTYxNzc4MjUzODI0IiwiQ29kZSI6IkEwMi1FSEpKUy0wMDEiLCJuYmYiOjE3NzY0MTE5MzIsImV4cCI6MjIxNzkxNTkzMiwiaXNzIjoiaHR0cHM6Ly93d3cuaHltc29uLmNvbSIsImF1ZCI6Imh0dHRwczovL3d3dy5oeW1zb24uY29tIn0.Imc2-8pDFrXgPrE_ro9Riasb8eGJ3Vi6gDyUDnUTpfY', NULL, N'Admin', GETDATE()),
+(N'楂樻俯闈欑疆1', N'A02-GWJZ-001', N'ZY25030001', N'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwNzU0NjM1MTU4NDY5NDI3MiIsIm5hbWUiOiLpq5jmuKnpnZnnva4xIiwiRmFjdG9yeUlkIjoiNDI4NzQ1NjE3NzgyNTM4MjQiLCJTaXRlSWQiOiI0Mjg3NDU2MTc3ODI1MzgyNCIsIkNvZGUiOiJBMDItR1dKWi0wMDEiLCJuYmYiOjE3NzUwOTkzMDEsImV4cCI6MjIxNjYwMzMwMSwiaXNzIjoiaHR0cHM6Ly93d3cuaHltc29uLmNvbSIsImF1ZCI6Imh0dHBzOi8vd3d3Lmh5bXNvbi5jb20ifQ.EI3Q6kHieKk5q4a6Nmf9fozi0haan0WuqkA9QNA-bHk', NULL, N'Admin', GETDATE()),
+(N'楂樻俯闈欑疆2', N'A02-GWJZ-002', N'ZY25060001', N'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwNzU0NjUxNTA0NTEwNTY2NCIsIm5hbWUiOiLpq5jmuKnpnZnnva4yIiwiRmFjdG9yeUlkIjoiNDI4NzQ1NjE3NzgyNTM4MjQiLCJTaXRlSWQiOiI0Mjg3NDU2MTc3ODI1MzgyNCIsIkNvZGUiOiJBMDItR1dKWi0wMDIiLCJuYmYiOjE3NzUwOTkzNDAsImV4cCI6MjIxNjYwMzM0MCwiaXNzIjoiaHR0cHM6Ly93d3cuaHltc29uLmNvbSIsImF1ZCI6Imh0dHBzOi8vd3d3Lmh5bXNvbi5jb20ifQ.imaa_1Xd9bHZKF3cy6c82Lb1ODXJC2MVytks4_eIyR4', NULL, N'Admin', GETDATE()),
+(N'甯告俯闈欑疆1', N'A02-CWJZ-001', N'ZY25070001', N'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwNzU0NjU1ODU5OTgxMTA3MiIsIm5hbWUiOiLluLjmuKnpnZnnva4xIiwiRmFjdG9yeUlkIjoiNDI4NzQ1NjE3NzgyNTM4MjQiLCJTaXRlSWQiOiI0Mjg3NDU2MTc3ODI1MzgyNCIsIkNvZGUiOiJBMDItQ1dKWi0wMDEiLCJuYmYiOjE3NzUwOTkzNDgsImV4cCI6MjIxNjYwMzM0OCwiaXNzIjoiaHR0cHM6Ly93d3cuaHltc29uLmNvbSIsImF1ZCI6Imh0dHRzOi8vd3d3Lmh5bXNvbi5jb20ifQ.-WmBS4g4T0ZpJZ2qHszZMfe2pseMWCh6zyVeYgzsho4', NULL, N'Admin', GETDATE());
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/MESDeviceConfigService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/MESDeviceConfigService.cs
new file mode 100644
index 0000000..b3189e8
--- /dev/null
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/MESDeviceConfigService.cs
@@ -0,0 +1,61 @@
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
+using WIDESEA_Core.BaseServices;
+using WIDESEA_IBasicService;
+using WIDESEA_Model.Models;
+
+namespace WIDESEA_StockService
+{
+ /// <summary>
+ /// MES璁惧閰嶇疆鏈嶅姟瀹炵幇绫�
+ /// </summary>
+ public class MESDeviceConfigService : ServiceBase<Dt_MESDeviceConfig, IRepository<Dt_MESDeviceConfig>>, IMESDeviceConfigService
+ {
+ /// <summary>
+ /// 鑾峰彇MES璁惧閰嶇疆浠撳偍鎺ュ彛
+ /// </summary>
+ public IRepository<Dt_MESDeviceConfig> Repository => BaseDal;
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ /// <param name="baseDal">鍩虹鏁版嵁璁块棶瀵硅薄</param>
+ public MESDeviceConfigService(IRepository<Dt_MESDeviceConfig> baseDal) : base(baseDal)
+ {
+ }
+
+ /// <summary>
+ /// 鏍规嵁璁惧鍚嶇О鑾峰彇MES璁惧閰嶇疆锛堢簿纭尮閰嶏級
+ /// </summary>
+ /// <param name="deviceName">璁惧鍚嶇О</param>
+ /// <returns>MES璁惧閰嶇疆锛屽鏋滄湭鎵惧埌鍒欒繑鍥瀗ull</returns>
+ public Dt_MESDeviceConfig? GetByDeviceName(string deviceName)
+ {
+ if (string.IsNullOrWhiteSpace(deviceName))
+ {
+ return null;
+ }
+
+ return BaseDal.QueryFirst(x => x.DeviceName == deviceName);
+ }
+
+ /// <summary>
+ /// 鏍规嵁璁惧鍚嶇О鍜屼粨搴撶紪鐮佽幏鍙朚ES璁惧閰嶇疆
+ /// 鍖归厤鏉′欢锛欴eviceName绮剧‘鍖归厤涓旓紙WarehouseCode涓虹┖鎴栫瓑浜庢寚瀹氱殑浠撳簱缂栫爜锛�
+ /// </summary>
+ /// <param name="deviceName">璁惧鍚嶇О</param>
+ /// <param name="warehouseCode">浠撳簱缂栫爜</param>
+ /// <returns>MES璁惧閰嶇疆锛屽鏋滄湭鎵惧埌鍒欒繑鍥瀗ull</returns>
+ public Dt_MESDeviceConfig? GetByDeviceNameAndWarehouse(string deviceName, string warehouseCode)
+ {
+ if (string.IsNullOrWhiteSpace(deviceName))
+ {
+ return null;
+ }
+
+ return BaseDal.QueryFirst(x =>
+ x.DeviceName == deviceName &&
+ (string.IsNullOrEmpty(x.WarehouseCode) || x.WarehouseCode == warehouseCode));
+ }
+ }
+}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index d2f1044..9ea94a7 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -392,8 +392,9 @@
/// 鎵归噺鎷嗙洏纭 - 涓�娆℃�ц皟鐢∕ES瑙g粦鏁翠釜鎵樼洏
/// </summary>
/// <param name="palletCode">婧愭墭鐩樺彿</param>
+ /// <param name="deviceName">璁惧鍚嶇О锛堢敤浜庡姩鎬丮ES鍑瘉鏌ヨ锛�</param>
/// <returns>鎿嶄綔缁撴灉</returns>
- public async Task<WebResponseContent> SplitPalletConfirmAsync(string palletCode)
+ public async Task<WebResponseContent> SplitPalletConfirmAsync(string palletCode, string deviceName)
{
WebResponseContent content = new WebResponseContent();
try
@@ -412,22 +413,40 @@
if (sfcList == null || !sfcList.Any())
return content.Error("涓存椂琛ㄤ腑鐢佃姱鍒楄〃涓虹┖");
- // 2. 璋冪敤MES瑙g粦
+ // 2. 鑾峰彇MES璁惧閰嶇疆锛堝姩鎬佸嚟璇侊級
+ string equipmentCode = StockConstants.MES_EQUIPMENT_CODE;
+ string resourceCode = StockConstants.MES_RESOURCE_CODE;
+ string token = null;
+
+ if (!string.IsNullOrWhiteSpace(deviceName))
+ {
+ var mesConfig = ResolveMesConfig(deviceName, palletCode);
+ if (mesConfig != null)
+ {
+ equipmentCode = mesConfig.EquipmentCode;
+ resourceCode = mesConfig.ResourceCode;
+ token = mesConfig.Token;
+ }
+ }
+
+ // 3. 璋冪敤MES瑙g粦
var unbindRequest = new UnBindContainerRequest
{
- EquipmentCode = StockConstants.MES_EQUIPMENT_CODE,
- ResourceCode = StockConstants.MES_RESOURCE_CODE,
+ EquipmentCode = equipmentCode,
+ ResourceCode = resourceCode,
LocalTime = DateTime.Now,
ContainCode = palletCode,
SfcList = sfcList
};
- var unbindResult = _mesService.UnBindContainer(unbindRequest);
+ var unbindResult = string.IsNullOrWhiteSpace(token)
+ ? _mesService.UnBindContainer(unbindRequest)
+ : _mesService.UnBindContainer(unbindRequest, token);
if (unbindResult == null || unbindResult.Data == null || !unbindResult.Data.IsSuccess)
{
return content.Error($"MES瑙g粦澶辫触: {unbindResult?.Data?.Msg ?? unbindResult?.ErrorMessage ?? "鏈煡閿欒"}");
}
- // 3. 鍒犻櫎涓存椂琛ㄨ褰�
+ // 4. 鍒犻櫎涓存椂琛ㄨ褰�
await SqlSugarClient.Deleteable<Dt_SplitTemp>().Where(t => t.PalletCode == palletCode).ExecuteCommandAsync();
return content.OK("鎵归噺鎷嗙洏纭鎴愬姛");
@@ -442,8 +461,9 @@
/// 鎵归噺缁勭洏纭 - 涓�娆℃�ц皟鐢∕ES缁戝畾鏁翠釜鎵樼洏
/// </summary>
/// <param name="palletCode">鐩爣鎵樼洏鍙�</param>
+ /// <param name="deviceName">璁惧鍚嶇О锛堢敤浜庡姩鎬丮ES鍑瘉鏌ヨ锛�</param>
/// <returns>鎿嶄綔缁撴灉</returns>
- public async Task<WebResponseContent> GroupPalletConfirmAsync(string palletCode)
+ public async Task<WebResponseContent> GroupPalletConfirmAsync(string palletCode, string deviceName)
{
WebResponseContent content = new WebResponseContent();
try
@@ -460,12 +480,28 @@
if (details == null || !details.Any())
return content.Error("鎵樼洏涓嬫棤鐢佃姱鏁版嵁");
- // 2. 璋冪敤MES缁戝畾
+ // 2. 鑾峰彇MES璁惧閰嶇疆锛堝姩鎬佸嚟璇侊級
+ string equipmentCode = StockConstants.MES_EQUIPMENT_CODE;
+ string resourceCode = StockConstants.MES_RESOURCE_CODE;
+ string token = null;
+
+ if (!string.IsNullOrWhiteSpace(deviceName))
+ {
+ var mesConfig = ResolveMesConfig(deviceName, palletCode);
+ if (mesConfig != null)
+ {
+ equipmentCode = mesConfig.EquipmentCode;
+ resourceCode = mesConfig.ResourceCode;
+ token = mesConfig.Token;
+ }
+ }
+
+ // 3. 璋冪敤MES缁戝畾
var bindRequest = new BindContainerRequest
{
ContainerCode = palletCode,
- EquipmentCode = StockConstants.MES_EQUIPMENT_CODE,
- ResourceCode = StockConstants.MES_RESOURCE_CODE,
+ EquipmentCode = equipmentCode,
+ ResourceCode = resourceCode,
LocalTime = DateTime.Now,
OperationType = StockConstants.MES_BIND_OPERATION_TYPE,
ContainerSfcList = details.Select(d => new ContainerSfcItem
@@ -474,7 +510,9 @@
Location = d.InboundOrderRowNo.ToString()
}).ToList()
};
- var bindResult = _mesService.BindContainer(bindRequest);
+ var bindResult = string.IsNullOrWhiteSpace(token)
+ ? _mesService.BindContainer(bindRequest)
+ : _mesService.BindContainer(bindRequest, token);
if (bindResult == null || bindResult.Data == null || !bindResult.Data.IsSuccess)
{
return content.Error($"MES缁戝畾澶辫触: {bindResult?.Data?.Msg ?? bindResult?.ErrorMessage ?? "鏈煡閿欒"}");
@@ -487,5 +525,39 @@
return content.Error($"鎵归噺缁勭洏纭澶辫触: {ex.Message}");
}
}
+
+ /// <summary>
+ /// 鏍规嵁璁惧鍚嶇О鍜屾墭鐩樺彿瑙f瀽MES璁惧閰嶇疆
+ /// </summary>
+ /// <param name="deviceName">璁惧鍚嶇О</param>
+ /// <param name="palletCode">鎵樼洏鍙凤紙鐢ㄤ簬鏌ヨ浠撳簱缂栫爜锛�</param>
+ /// <returns>MES璁惧閰嶇疆锛屼笉瀛樺湪鏃惰繑鍥瀗ull</returns>
+ private Dt_MESDeviceConfig ResolveMesConfig(string deviceName, string palletCode)
+ {
+ // 鎹㈢洏鏈烘鎵嬮渶瑕佸尯鍒嗕粨搴�
+ if (deviceName.Contains("鎹㈢洏"))
+ {
+ // 鏌ヨ鎵樼洏瀵瑰簲鐨勪粨搴撶紪鐮�
+ var stockInfo = StockInfoService.Repository.QueryFirst(s => s.PalletCode == palletCode);
+ if (stockInfo != null && stockInfo.WarehouseId > 0)
+ {
+ var warehouse = _warehouseService.Repository.QureyDataById(stockInfo.WarehouseId);
+ if (warehouse != null && !string.IsNullOrWhiteSpace(warehouse.WarehouseCode))
+ {
+ // 鍏堟寜璁惧鍚�+浠撳簱缂栫爜鏌ヨ
+ var config = SqlSugarClient.Queryable<Dt_MESDeviceConfig>()
+ .Where(c => c.DeviceName == deviceName && c.WarehouseCode == warehouse.WarehouseCode)
+ .First();
+ if (config != null)
+ return config;
+ }
+ }
+ }
+
+ // 鎸夎澶囧悕绉版煡璇紙閫傜敤浜庣粍鐩樻満姊版墜鎴栨崲鐩樻満姊版墜鏈壘鍒颁粨搴撳尮閰嶇殑鎯呭喌锛�
+ return SqlSugarClient.Queryable<Dt_MESDeviceConfig>()
+ .Where(c => c.DeviceName == deviceName)
+ .First();
+ }
}
}
\ No newline at end of file
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index f64135c..0b7d8e4 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -40,6 +40,7 @@
private readonly IStockInfo_HtyService _stockInfo_HtyService;
private readonly IUnitOfWorkManage _unitOfWorkManage;
private readonly IRecordService _recordService;
+ private readonly IMESDeviceConfigService _mesDeviceConfigService;
public IRepository<Dt_Task> Repository => BaseDal;
@@ -64,7 +65,8 @@
ITask_HtyService task_HtyService,
IStockInfo_HtyService stockInfo_HtyService,
IUnitOfWorkManage unitOfWorkManage,
- IRecordService recordService) : base(BaseDal)
+ IRecordService recordService,
+ IMESDeviceConfigService mesDeviceConfigService) : base(BaseDal)
{
_mapper = mapper;
_stockInfoService = stockInfoService;
@@ -77,6 +79,7 @@
_stockInfo_HtyService = stockInfo_HtyService;
_unitOfWorkManage = unitOfWorkManage;
_recordService = recordService;
+ _mesDeviceConfigService = mesDeviceConfigService;
}
/// <summary>
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 2ac74fe..c532f7a 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
@@ -6,6 +6,7 @@
using WIDESEA_Core;
using WIDESEA_DTO.MES;
using WIDESEA_DTO.Task;
+using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
namespace WIDESEA_TaskInfoService
@@ -150,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, "鍏ュ簱瀹屾垚");
});
}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs
index 1a085ab..499b063 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.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
@@ -117,6 +119,30 @@
inboundTaskDto = _mapper.Map<WMSTaskDTO>(inboundTask);
}
+ // 璋冪敤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;
+
+ var outboundRequest = new OutboundInContainerRequest
+ {
+ EquipmentCode = equipmentCode,
+ ResourceCode = resourceCode,
+ LocalTime = DateTime.Now,
+ ContainerCode = taskDto.PalletCode
+ };
+ var outboundResult = string.IsNullOrWhiteSpace(token)
+ ? _mesService.OutboundInContainer(outboundRequest)
+ : _mesService.OutboundInContainer(outboundRequest, token);
+ if (outboundResult == null || outboundResult.Data == null || !outboundResult.Data.IsSuccess)
+ {
+ return content.Error($"鍑哄簱瀹屾垚澶辫触锛歁ES鍑虹珯澶辫触: {outboundResult?.Data?.Msg ?? outboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
+ }
+
var completeResult = await CompleteTaskAsync(task, "鍑哄簱瀹屾垚");
if (!completeResult.Status)
return completeResult;
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockController.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockController.cs
index 2076b82..6fecdfb 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockController.cs
@@ -72,7 +72,7 @@
[HttpPost("SplitPalletConfirm"), AllowAnonymous]
public async Task<WebResponseContent> SplitPalletConfirm([FromBody] SplitPalletConfirmRequestDto dto)
{
- return await Service.SplitPalletConfirmAsync(dto.PalletCode);
+ return await Service.SplitPalletConfirmAsync(dto.PalletCode, dto.DeviceName);
}
/// <summary>
@@ -83,7 +83,7 @@
[HttpPost("GroupPalletConfirm"), AllowAnonymous]
public async Task<WebResponseContent> GroupPalletConfirm([FromBody] GroupPalletConfirmRequestDto dto)
{
- return await Service.GroupPalletConfirmAsync(dto.PalletCode);
+ return await Service.GroupPalletConfirmAsync(dto.PalletCode, dto.DeviceName);
}
}
}
diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\344\270\212\344\275\215\347\263\273\347\273\237\345\257\271\346\216\245/~$\351\253\230\346\270\2512\345\270\270\346\270\2511\345\217\212\346\234\272\346\242\260\346\211\213\350\256\276\345\244\207\350\264\246\345\217\267\344\277\241\346\201\257\350\241\250\0501\051.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\344\270\212\344\275\215\347\263\273\347\273\237\345\257\271\346\216\245/~$\351\253\230\346\270\2512\345\270\270\346\270\2511\345\217\212\346\234\272\346\242\260\346\211\213\350\256\276\345\244\207\350\264\246\345\217\267\344\277\241\346\201\257\350\241\250\0501\051.xlsx"
new file mode 100644
index 0000000..e4caca3
--- /dev/null
+++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\344\270\212\344\275\215\347\263\273\347\273\237\345\257\271\346\216\245/~$\351\253\230\346\270\2512\345\270\270\346\270\2511\345\217\212\346\234\272\346\242\260\346\211\213\350\256\276\345\244\207\350\264\246\345\217\267\344\277\241\346\201\257\350\241\250\0501\051.xlsx"
Binary files differ
diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\344\270\212\344\275\215\347\263\273\347\273\237\345\257\271\346\216\245/\351\253\230\346\270\2512\345\270\270\346\270\2511\345\217\212\346\234\272\346\242\260\346\211\213\350\256\276\345\244\207\350\264\246\345\217\267\344\277\241\346\201\257\350\241\250\0501\051.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\344\270\212\344\275\215\347\263\273\347\273\237\345\257\271\346\216\245/\351\253\230\346\270\2512\345\270\270\346\270\2511\345\217\212\346\234\272\346\242\260\346\211\213\350\256\276\345\244\207\350\264\246\345\217\267\344\277\241\346\201\257\350\241\250\0501\051.xlsx"
new file mode 100644
index 0000000..9bd278e
--- /dev/null
+++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\344\270\212\344\275\215\347\263\273\347\273\237\345\257\271\346\216\245/\351\253\230\346\270\2512\345\270\270\346\270\2511\345\217\212\346\234\272\346\242\260\346\211\213\350\256\276\345\244\207\350\264\246\345\217\267\344\277\241\346\201\257\350\241\250\0501\051.xlsx"
Binary files differ
--
Gitblit v1.9.3