From 1630f0dbdae793427744548d38bcce9793aec3d6 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 09 二月 2026 09:44:04 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/SuZhouGuanHong/ShanMeiXinNengYuan
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs | 91 +++++++++++++++++++++++++++++++++++----------
1 files changed, 71 insertions(+), 20 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..6a945d5 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
@@ -1,8 +1,15 @@
-锘縰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_DTO.TaskInfo;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
@@ -123,6 +130,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 +154,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 +161,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";
+ }
+ }
}
}
}
@@ -210,7 +251,7 @@
case "allpickfinished":
state.CurrentAction = "AllPickFinished";
- if(state.CurrentTask?.RobotTaskType == 2|| state.CurrentTask?.RobotTaskType == 3)
+ if (state.CurrentTask?.RobotTaskType == 2 || state.CurrentTask?.RobotTaskType == 3)
{
// TODO 鏈烘鎵嬪彇璐у畬鎴愶紝鍒ゆ柇鏄惁鎹㈢洏銆佹媶鐩樹换鍔★紝鍒涘缓绌烘墭鐩樺洖搴撲换鍔�
}
@@ -218,9 +259,19 @@
case "allputfinished":
state.CurrentAction = "AllPutFinished";
- if (state.CurrentTask?.RobotTaskType == 1 )
+ if (state.CurrentTask?.RobotTaskType == 1)
{
// TODO 鏈烘鎵嬪彇璐у畬鎴愶紝鍒ゆ柇鏄惁缁勭洏浠诲姟锛屽垱寤虹粍鐩樺叆搴撲换鍔�
+ CreateTaskDto taskDto = new CreateTaskDto()
+ {
+ PalletCode = state.CurrentTask?.RobotTargetAddressPalletCode ?? string.Empty,
+ SourceAddress = state.CurrentTask?.RobotTargetAddress ?? string.Empty,
+ TargetAddress = state.CurrentTask?.RobotTargetAddress ?? string.Empty,
+ Roadway = state.CurrentTask?.RobotRoadway == "1" ? "GWSC001" : state.CurrentTask?.RobotRoadway == "2" ? "HCSC001" : "SC001" ?? string.Empty,
+ WarehouseId = state.CurrentTask?.RobotRoadway == "1" ? 1 : state.CurrentTask?.RobotRoadway == "2" ? 2 : 3,
+ PalletType = 1,
+ TaskType = 4
+ };
}
return true;
--
Gitblit v1.9.3