From 843cc2ea1b104ecdf9da61318a4136a5d4096411 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期五, 24 四月 2026 11:07:21 +0800
Subject: [PATCH] 集成Quartz定时任务,支持NG出库自动化及WMS/WCS接口扩展
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 292 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 204 insertions(+), 88 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 5d5f6c9..e250ca5 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -1,4 +1,5 @@
-锘縰sing Mapster;
+锘縰sing Autofac.Core;
+using Mapster;
using Newtonsoft.Json;
using Quartz;
using System.Diagnostics.CodeAnalysis;
@@ -60,7 +61,6 @@
{
try
{
-
CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
if (commonStackerCrane != null)
{
@@ -81,35 +81,30 @@
StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
if (stackerCraneTaskCommand != null)
{
- var taskNum = commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.TaskNum);
- //var taskBarCode = commonStackerCrane.GetValue<StackerCraneDBName, string>(StackerCraneDBName.Barcode);
- ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満浠诲姟鍙凤細銆恵taskNum}銆戜换鍔′换鍔″彿锛氥�恵task.TaskNum}銆�", ConsoleColor.DarkBlue);
- if (taskNum == 0)
+ bool IsInStock = commonStackerCrane.Communicator.Read<bool>("DB14.4.3");
+ if (!IsInStock)
{
- ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″彿涓恒�恵0}銆�,浠诲姟鍙蜂笉涓�鑷村彲浠ヤ笅鍙戜换鍔�", ConsoleColor.DarkBlue);
-
- Thread.Sleep(1000);
- bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
- if (sendFlag)
+ var taskNum = commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.TaskNum);
+ ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満浠诲姟鍙凤細銆恵taskNum}銆戜换鍔′换鍔″彿锛氥�恵task.TaskNum}銆�", ConsoleColor.DarkBlue);
+ if (taskNum == 0)
{
- StringBuilder builder = new StringBuilder();
- builder.AppendLine();
- builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満鐘舵�侊細銆恵commonStackerCrane.StackerCraneStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�");
- builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戞墜鑷姩鐘舵�侊細銆恵commonStackerCrane.StackerCraneAutoStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�");
- builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戜綔涓氱姸鎬侊細銆恵commonStackerCrane.StackerCraneWorkStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�");
- builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戜笅鍙戜换鍔℃垚鍔�,銆恵JsonConvert.SerializeObject(stackerCraneTaskCommand, Formatting.Indented)}銆�");
- builder.AppendLine($"鏃堕棿锛氥�恵DateTime.Now}銆�");
- builder.AppendLine();
- ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue);
- commonStackerCrane.LastTaskType = task.TaskType;
-
-
- _taskService.UpdateTaskStatusToNext(task.TaskNum);
+ Thread.Sleep(1000);
+ bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
+ if (sendFlag)
+ {
+ commonStackerCrane.LastTaskType = task.TaskType;
+ _taskService.UpdateTaskStatusToNext(task.TaskNum);
+ }
+ }
+ else
+ {
+ ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″彿涓嶄负銆恵0}銆�,涓嶅彲浠ヤ笅鍙戜换鍔�", ConsoleColor.DarkBlue);
}
}
else
{
- ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″彿涓嶄负銆恵0}銆�,涓嶅彲浠ヤ笅鍙戜换鍔�", ConsoleColor.DarkBlue);
+ ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戞湁璐т俊鎭笉涓恒�恵0}銆�,涓嶅彲浠ヤ笅鍙戜换鍔�", ConsoleColor.DarkBlue);
+ WriteInfo("鍫嗗灈鏈烘湁璐т俊鍙�", $"銆恵commonStackerCrane.DeviceName}銆戞湁璐т俊鎭笉涓恒�恵IsInStock}銆�,涓嶅彲浠ヤ笅鍙戜换鍔�");
}
}
}
@@ -162,8 +157,6 @@
{
if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
{
- ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満浣滀笟鐘舵�侊細銆恵(int)commonStackerCrane.StackerCraneWorkStatusValue}銆戞椂闂淬�恵DateTime.Now}銆�", ConsoleColor.Magenta);
-
string str = $"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�";
WriteInfo(commonStackerCrane.DeviceName, str);
ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
@@ -171,23 +164,72 @@
if (task == null) commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
- if (commonStackerCrane.DeviceCode.Contains("CW") && task.TaskType==(int)TaskOutboundTypeEnum.InToOut)
+ if (commonStackerCrane.DeviceCode.Contains("CW") && task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
{
- var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1017" && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode);
+ var stationinfo = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017" || x.stationPLC == "1024") && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode);
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC);
if (device != null)
{
- CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
- conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(1815), stationinfo.stationChildCode);
- Thread.Sleep(100);
- conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+ if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
+ {
+ CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode);
+ Thread.Sleep(100);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+ }
+ else
+ {
+ CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode);
+ Thread.Sleep(100);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+ }
}
- WriteInfo(commonStackerCrane.DeviceName, $"銆愭墜鍔ㄥ嚭搴撹褰曘��");
+ WriteInfo(commonStackerCrane.DeviceName, $"銆愭墜鍔ㄥ嚭搴撹褰曘�戜换鍔″彿銆恵e.TaskNum}銆戞墭鐩樺彿銆恵task.PalletCode}銆�");
}
+ if (task.TaskType == (int)TaskOutboundTypeEnum.OutNG)
+ {
+ Dt_StationManager stationinfo = null;
+ if (commonStackerCrane.DeviceCode.Contains("CW"))
+ stationinfo = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017" || x.stationPLC == "1024") && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode);
+ else
+ stationinfo = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.stationChildCode == task.TargetAddress);
-
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC);
+ if (device != null)
+ {
+ if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
+ {
+ CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode);
+ Thread.Sleep(100);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, stationinfo.stationChildCode);
+ Thread.Sleep(100);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+ }
+ else if (device.DeviceCode == "1015" || device.DeviceCode == "2025")
+ {
+ CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(1815), stationinfo.stationChildCode);
+ Thread.Sleep(100);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, stationinfo.stationChildCode);
+ Thread.Sleep(100);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+ }
+ else
+ {
+ CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode);
+ Thread.Sleep(100);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, stationinfo.stationChildCode);
+ Thread.Sleep(100);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+ }
+ }
+ WriteInfo(commonStackerCrane.DeviceName, $"銆愭墜鍔ㄥ嚭搴撹褰曘�戜换鍔″彿銆恵e.TaskNum}銆戞墭鐩樺彿銆恵task.PalletCode}銆�");
+ }
if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
{
@@ -212,19 +254,23 @@
}
var content = _taskService.StackCraneTaskCompleted(e.TaskNum);
+
if (commonStackerCrane.DeviceCode.Contains("CH") && task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
{
task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
_taskService.UpdateData(newTask);
}
+
if ((task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && (task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001"))|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm)
{
var TASKHTY = task.Adapt<Dt_Task_Hty>();
_taskRepository.DeleteData(task);
_htyRepository.AddData(TASKHTY);
}
+
var isWorkType = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
+
str = $"{commonStackerCrane.DeviceName}銆慦MS|WCS浠诲姟瀹屾垚锛氥�恵content.Status}銆�,鍫嗗灈鏈哄畬鎴愪俊鍙峰啓鍏ワ細銆恵isWorkType}銆�,浠诲姟鍙凤細銆恵e.TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�";
WriteInfo(commonStackerCrane.DeviceName, str);
ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
@@ -281,7 +327,7 @@
_noticeService.Logs(userTokenIds, new { commonStackerCrane.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
WriteInfo(commonStackerCrane.DeviceName, log);
- task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task.TaskId);
+ task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task);
if (task == null)
{
@@ -308,96 +354,166 @@
/// <returns>濡傛灉鏈鍗犵敤锛岃繑鍥炰紶鍏ョ殑浠诲姟淇℃伅锛屽惁鍒欙紝杩斿洖null</returns>
private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task)
{
- Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault();
- if (task.Roadway.Contains("GW") || task.Roadway.Contains("CW"))
+ if (task.TaskType == (int)TaskOutboundTypeEnum.OutNG)
{
- if (router != null)
+ if (task.Roadway.Contains("CW"))
{
- IDevice? device = null;
- if (task.Roadway.Contains("CW"))
+ var stationinfo = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017" || x.stationPLC == "1024") && x.stationType == 10 && x.Roadway == task.Roadway);
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC);
+ if (device != null)
{
- device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
- if (device != null)
+ if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
{
- CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
- if (conveyorLine.IsOccupied(task.NextAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+ CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
+
+ if (conveyorLine.IsOccupied(task.TargetAddress))//鍑哄簱绔欏彴鏈鍗犵敤
{
return task;
}
+
}
else
{
- _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
- }
- }
- }
- else
- {
- IDevice? device = null;
- if (task.Roadway.Contains("GW"))
- {
- device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1015");
- if (device != null)
- {
- CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
+ CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
+
if (conveyorLine.IsOccupied(task.TargetAddress))//鍑哄簱绔欏彴鏈鍗犵敤
{
return task;
}
}
- else
- {
- _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.TargetAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
- }
}
- //_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.TargetAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
- }
- }
- else
- {
- if ((task.NextAddress == ("002-021-001") || task.NextAddress == ("001-021-001")) && task.Roadway.Contains("JZ"))
- {
- return task;
+ else
+ {
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+ }
}
else
{
- //Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault();
- if (router != null)
+ var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.stationChildCode == task.TargetAddress);
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC);
+ if (device != null)
{
- IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
- if (device != null)
+ CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
+ if (conveyorLine.IsOccupied(task.TargetAddress))//鍑哄簱绔欏彴鏈鍗犵敤
{
- CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
- if (conveyorLine.IsOccupiedx(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤
- {
- return task;
- }
- }
- else
- {
- _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵router.ChildPosiDeviceCode}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+ return task;
}
}
else
{
- _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+ }
+ }
+ }
+ else
+ {
+ Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault();
+ if (task.Roadway.Contains("GW") || task.Roadway.Contains("CW"))
+ {
+ if (router != null)
+ {
+ IDevice? device = null;
+ if (task.Roadway.Contains("CW"))
+ {
+ device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
+ if (device != null)
+ {
+ if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
+ {
+ CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
+
+ if (conveyorLine.IsOccupied(task.NextAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+ {
+ return task;
+ }
+
+ }
+ else
+ {
+ CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
+
+ if (conveyorLine.IsOccupied(task.NextAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+ {
+ return task;
+ }
+ }
+ }
+ else
+ {
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+ }
+ }
+ }
+ else
+ {
+ IDevice? device = null;
+ if (task.Roadway.Contains("GW"))
+ {
+ string targetDeviceCode = task.Roadway == "GWSC3" ? "2025" : "1015";
+ device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == targetDeviceCode);
+
+ if (device != null)
+ {
+ CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
+ if (conveyorLine.IsOccupied(task.TargetAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+ {
+ return task;
+ }
+ }
+ else
+ {
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.TargetAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+ }
+ }
+ //_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.TargetAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
+ }
+ }
+ else
+ {
+ if ((task.NextAddress == ("002-021-001") || task.NextAddress == ("001-021-001")) && task.Roadway.Contains("JZ"))
+ {
+ return task;
+ }
+ else
+ {
+ //Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault();
+ if (router != null)
+ {
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
+ if (device != null)
+ {
+ CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
+ if (conveyorLine.IsOccupiedx(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤
+ {
+ return task;
+ }
+ }
+ else
+ {
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵router.ChildPosiDeviceCode}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+ }
+ }
+ else
+ {
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
+ }
}
}
}
return null;
}
-
+
/// <summary>
/// 鏌ユ壘鍏朵粬鍑哄簱浠诲姟鐨勮緟鍔╂柟娉曪紙鎺掗櫎鎸囧畾浠诲姟ID鐨勪换鍔★級
/// </summary>
/// <param name="deviceCode">璁惧浠g爜</param>
/// <param name="excludedTaskId">瑕佹帓闄ょ殑浠诲姟ID</param>
/// <returns></returns>
- private Dt_Task? FindAnotherOutboundTask(string deviceCode, int excludedTaskId)
+ private Dt_Task? FindAnotherOutboundTask(string deviceCode, Dt_Task task)
{
// 鍏堣幏鍙栨墍鏈夌鍚堟潯浠讹紙鎺掗櫎鎸囧畾浠诲姟ID锛夌殑鍑哄簱浠诲姟鍒楄〃
var allOutboundTasks = _taskService.QueryAllOutboundTasks(deviceCode);
- var availableTasks = allOutboundTasks?.Where(t => excludedTaskId != t.TaskId && t.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup).ToList();
+ var availableTasks = allOutboundTasks?.Where(t => t.TargetAddress != task.TargetAddress && t.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup).ToList();
if (availableTasks == null || availableTasks.Count == 0)
{
@@ -503,7 +619,7 @@
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
{
- if (task.Roadway.Contains("GW")|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm)
+ if (task.Roadway.Contains("GW")|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm || task.TaskType == (int)TaskOutboundTypeEnum.OutNG)
{
string[] endCodes = task.NextAddress.Split("-");
stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]);
--
Gitblit v1.9.3