From b3f28f51ef169d246f42fd4fa4656cff2bcfe05d Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期五, 06 二月 2026 16:06:12 +0800
Subject: [PATCH] 完善组盘/换盘/拆盘接口及机器人业务流程
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs | 76 +++++++++++++++++++++++++++++---------
1 files changed, 58 insertions(+), 18 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
index ddb4821..e338e6f 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
@@ -1,7 +1,13 @@
-锘縰sing Quartz;
+锘縰sing HslCommunication;
+using Newtonsoft.Json;
+using Quartz;
using System.Collections.Concurrent;
using System.Net.Sockets;
+using System.Text.Json;
+using WIDESEAWCS_Common.HttpEnum;
+using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_Core.Http;
using WIDESEAWCS_DTO.Stock;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
@@ -123,6 +129,7 @@
/// <returns></returns>
private async Task<string?> _TcpSocket_MessageReceived(string message, bool isJson, TcpClient client, RobotSocketState state)
{
+ WebResponseContent content = new WebResponseContent();
string messageLower = message.ToLowerInvariant();
if (IsSimpleCommand(messageLower, state))
@@ -146,13 +153,6 @@
if (cmd.StartsWith("pickfinished"))
{
- state.LastPickPositions = positions;
- state.CurrentAction = "PickFinished";
- }
- else if (cmd.StartsWith("putfinished"))
- {
- state.LastPutPositions = positions;
- // 鍙戦�佹暟鎹粰WMS缁勭洏/鎹㈢洏
StockDTO stockDTO = new StockDTO
{
SourceLineNo = state.CurrentTask?.RobotSourceAddressLineCode,
@@ -160,17 +160,57 @@
TargetPalletNo = state.CurrentTask?.RobotTargetAddressPalletCode,
TargetLineNo = state.CurrentTask?.RobotTargetAddressLineCode,
Details = positions
- .Where(x => x > 0)
- .OrderBy(x => x)
- .Select((x, idx) => new StockDetailDTO
- {
- Quantity = state.CurrentTask?.RobotTaskTotalNum ?? 1,
- Channel = x > 0 ? x : throw new ArgumentOutOfRangeException(nameof(x), "Channel must be positive"),
- CellBarcode = state.CellBarcode[idx]
- })
- .ToList()
+ .Where(x => x > 0)
+ .OrderBy(x => x)
+ .Select((x, idx) => new StockDetailDTO
+ {
+ Quantity = state.CurrentTask?.RobotTaskTotalNum ?? 1,
+ Channel = x > 0 ? x : throw new ArgumentOutOfRangeException(nameof(x), "Channel must be positive"),
+ CellBarcode = state.CellBarcode[idx]
+ })
+ .ToList()
};
- state.CurrentAction = "PutFinished";
+ state.LastPickPositions = positions;
+
+ var result = await HttpRequestHelper.HTTPPostAsync(nameof(Category.WMS), stockDTO.ToJsonString(), state.CurrentTask?.RobotTaskType == 2 ? nameof(ConfigKey.ChangePalletAsync) : nameof(ConfigKey.SplitPalletAsync));
+ content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+
+ if (content.Status)
+ {
+ state.CurrentAction = "PickFinished";
+ }
+ }
+ else if (cmd.StartsWith("putfinished"))
+ {
+ state.LastPutPositions = positions;
+ if (state.CurrentTask?.RobotTaskType == 1)
+ {
+ // 鍙戦�佹暟鎹粰WMS缁勭洏/鎹㈢洏
+ StockDTO stockDTO = new StockDTO
+ {
+ SourceLineNo = state.CurrentTask?.RobotSourceAddressLineCode,
+ SourcePalletNo = state.CurrentTask?.RobotSourceAddressPalletCode,
+ TargetPalletNo = state.CurrentTask?.RobotTargetAddressPalletCode,
+ TargetLineNo = state.CurrentTask?.RobotTargetAddressLineCode,
+ Details = positions
+ .Where(x => x > 0)
+ .OrderBy(x => x)
+ .Select((x, idx) => new StockDetailDTO
+ {
+ Quantity = state.CurrentTask?.RobotTaskTotalNum ?? 1,
+ Channel = x > 0 ? x : throw new ArgumentOutOfRangeException(nameof(x), "Channel must be positive"),
+ CellBarcode = state.CellBarcode[idx]
+ })
+ .ToList()
+ };
+ var result = await HttpRequestHelper.HTTPPostAsync(nameof(Category.WMS), stockDTO.ToJsonString(), nameof(ConfigKey.GroupPalletAsync));
+ content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+
+ if (content.Status)
+ {
+ state.CurrentAction = "PutFinished";
+ }
+ }
}
}
}
--
Gitblit v1.9.3