From 2e7937ca43b0712ddf96b29b04cc7baf34fa1305 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 25 四月 2026 18:40:00 +0800
Subject: [PATCH] feat: 添加托盘库存明细查询功能并优化机械手任务处理
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs | 60 +++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 47 insertions(+), 13 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
index 7372d1a..fb56484 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
@@ -6,6 +6,7 @@
using Serilog;
using SqlSugar;
using WIDESEA_Core;
+using WIDESEAWCS_Common.HttpEnum;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
@@ -148,15 +149,6 @@
return Task.CompletedTask;
}
- // 鍒涘缓骞惰閫夐」锛岄檺鍒舵渶澶у苟鍙戞暟
- //var parallelOptions = new ParallelOptions
- //{
- // // 闄愬埗骞跺彂鏁帮細瀛愯澶囨暟閲忓拰 CPU 鏍稿績鏁�*2 鐨勮緝灏忓��
- // MaxDegreeOfParallelism = Math.Min(childDeviceCodes.Count, Environment.ProcessorCount * 2),
- //};
-
- // 骞惰澶勭悊姣忎釜瀛愯澶�
- //Parallel.For(0, childDeviceCodes.Count, parallelOptions, i =>
foreach (var childDeviceCode in childDeviceCodes)
{
//string childDeviceCode = childDeviceCodes[i];
@@ -274,15 +266,15 @@
QuartzLogHelper.LogInfo(_logger, $"澶勭悊浠诲姟 {task.TaskNum}锛岀姸鎬�: {task.TaskStatus}", conveyorLine.DeviceCode);
// 澶勭悊浠诲姟鐘舵�侊紙鏍规嵁鐘舵�佸垎鍙戝埌涓嶅悓鏂规硶锛�
ProcessTaskState(conveyorLine, command, task, childDeviceCode);
- return Task.CompletedTask;
+ continue;
}
else if (!command.Barcode.IsNullOrEmpty() && childDeviceCode == "11068")
{
- var isWcsTask = _taskService.Db.Queryable<Dt_Task>().Any(x => x.PalletCode == command.Barcode && x.TaskStatus == (int)TaskOutStatusEnum.OutNew);
- var isRobotTask = _robotTaskService.Db.Queryable<Dt_RobotTask>().Any(x => x.RobotTargetAddressPalletCode == command.Barcode);
+ var isWcsTask = _taskService.Db.Queryable<Dt_Task>().Any(x => x.PalletCode == command.Barcode && (x.TaskStatus == (int)TaskOutStatusEnum.OutNew || x.TaskStatus == (int)TaskInStatusEnum.InNew));
+ var isRobotTask = _robotTaskService.Db.Queryable<Dt_RobotTask>().Any(x => x.RobotTargetAddressPalletCode == command.Barcode || x.RobotRoadway == "娉ㄦ恫缁勭洏鏈烘鎵�");
if (isWcsTask || isRobotTask)
{
- return Task.CompletedTask;
+ continue;
}
// 鐩存帴娣诲姞鏈烘鎵嬬粍鐩樹换鍔�
@@ -306,6 +298,48 @@
conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, (short)1, childDeviceCode);
}
}
+ else if (!command.Barcode.IsNullOrEmpty() && (childDeviceCode == "11001" || childDeviceCode == "11010"))
+ {
+ var isWcsTask = _taskService.Db.Queryable<Dt_Task>().Any(x => x.PalletCode == command.Barcode && (x.TaskStatus == (int)TaskOutStatusEnum.OutNew || x.TaskStatus == (int)TaskInStatusEnum.InNew));
+ var isRobotTask = _robotTaskService.Db.Queryable<Dt_RobotTask>().Any(x => x.RobotTargetAddressPalletCode == command.Barcode);
+ if (isWcsTask || isRobotTask)
+ {
+ continue;
+ }
+
+ // 璋冪敤 WMS 鍒涘缓绌烘墭鐩樺叆搴撲换鍔�
+ string configKey = nameof(ConfigKey.CreateTaskInboundAsync);
+ string requestParam = new CreateTaskDto()
+ {
+ PalletCode = command.Barcode,
+ SourceAddress = childDeviceCode,
+ TargetAddress = "GWSC1", // 鐩爣鍦板潃
+ Roadway = "GWSC1", // 宸烽亾
+ WarehouseId = 1, // 浠撳簱 ID
+ PalletType = 1, // 鎵樼洏绫诲瀷锛堥粯璁や负1锛�
+ TaskType = TaskTypeEnum.InEmpty.GetHashCode() // 浠诲姟绫诲瀷锛堝叆搴�/绌烘墭鐩樺叆搴擄級
+ }.Serialize();
+ DateTime startTime = DateTime.Now;
+
+ var responseResult = _httpClientHelper.Post<WebResponseContent>(configKey, requestParam);
+
+ if (responseResult.IsSuccess && responseResult.Data.Status)
+ {
+ QuartzLogHelper.LogInfo(_logger, $"璋冪敤WMS鎺ュ彛鎴愬姛,鎺ュ彛:銆恵configKey}銆�,璇锋眰鍙傛暟:銆恵requestParam}銆�,鍝嶅簲鏁版嵁:銆恵responseResult.Data?.Data}銆�,鑰楁椂:{(DateTime.Now - startTime).TotalMilliseconds}ms", conveyorLine.DeviceCode);
+ var wmsTask = JsonConvert.DeserializeObject<WMSTaskDTO>(responseResult?.Data?.Data?.ToString());
+ List<WMSTaskDTO> taskDTOs = new List<WMSTaskDTO> { wmsTask };
+ if (wmsTask == null) continue;
+
+ if (_taskService.ReceiveWMSTask(taskDTOs).Status)
+ {
+ conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, (short)1, childDeviceCode);
+ }
+ }
+ else
+ {
+ QuartzLogHelper.LogError(_logger, $"璋冪敤WMS鎺ュ彛澶辫触,鎺ュ彛:銆恵configKey}銆�,璇锋眰鍙傛暟:銆恵requestParam}銆�,閿欒淇℃伅:銆恵responseResult.Data?.Message}銆�", conveyorLine.DeviceCode);
+ }
+ }
}
}
catch (Exception innerEx)
--
Gitblit v1.9.3