From fe2a1e74780259605cd230e6f9c629c3dd7fdf15 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 10 四月 2026 20:19:06 +0800
Subject: [PATCH] feat: 添加消防任务支持并修复堆垛机状态处理
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 45 +++++++++++++++++++++++----------------------
1 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 4908aae..1370478 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -1,19 +1,16 @@
using Microsoft.Extensions.Logging;
using Quartz;
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.IO;
-using System.Threading.Tasks;
-using WIDESEAWCS_Common.TaskEnum;
+using WIDESEA_Core;
+using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
-using WIDESEAWCS_QuartzJob.StackerCrane;
-using WIDESEAWCS_Tasks.StackerCraneJob;
-using WIDESEA_Core;
-using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_QuartzJob.Service;
+using WIDESEAWCS_QuartzJob.StackerCrane;
+using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
+using WIDESEAWCS_Tasks.StackerCraneJob;
namespace WIDESEAWCS_Tasks
{
@@ -173,7 +170,7 @@
{
// 浠� JobDataMap 鑾峰彇鍫嗗灈鏈鸿澶囧弬鏁�
bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
- if (!flag || value is not IStackerCrane commonStackerCrane)
+ if (!flag || value is not CommonStackerCrane commonStackerCrane)
{
// 鍙傛暟鏃犳晥锛岀洿鎺ヨ繑鍥�
_logger.LogWarning("Execute锛氬弬鏁版棤鏁�");
@@ -194,11 +191,12 @@
// ========== 妫�鏌ュ爢鍨涙満浠诲姟瀹屾垚鐘舵�� ==========
commonStackerCrane.CheckStackerCraneTaskCompleted();
- _logger.LogDebug("Execute锛氭鏌ヤ换鍔″畬鎴愮姸鎬侊紝璁惧: {DeviceCode}", _deviceCode);
- QuartzLogger.Debug($"妫�鏌ヤ换鍔″畬鎴愮姸鎬侊紝璁惧: {_deviceCode}", _deviceCode);
+ //_logger.LogDebug("Execute锛氭鏌ヤ换鍔″畬鎴愮姸鎬侊紝璁惧: {DeviceCode}", _deviceCode);
+ //QuartzLogger.Debug($"妫�鏌ヤ换鍔″畬鎴愮姸鎬侊紝璁惧: {_deviceCode}", _deviceCode);
// ========== 妫�鏌ユ槸鍚﹀彲浠ュ彂閫佹柊浠诲姟 ==========
- if (!commonStackerCrane.IsCanSendTask(commonStackerCrane.Communicator, commonStackerCrane.DeviceProDTOs, commonStackerCrane.DeviceProtocolDetailDTOs))
+ //if (!commonStackerCrane.IsCanSendTask(commonStackerCrane.Communicator, commonStackerCrane.DeviceProDTOs, commonStackerCrane.DeviceProtocolDetailDTOs))
+ if (commonStackerCrane.StackerCraneStatusValue != StackerCraneStatus.Normal)
{
// 鍫嗗灈鏈轰笉鍙敤锛堝姝e湪鎵ц涓婁竴浠诲姟锛夛紝鐩存帴杩斿洖
_logger.LogDebug("Execute锛氬爢鍨涙満涓嶅彲鐢紝璁惧: {DeviceCode}", _deviceCode);
@@ -212,13 +210,13 @@
if (task == null)
{
// 娌℃湁鍙敤浠诲姟
- _logger.LogDebug("Execute锛氭病鏈夊彲鐢ㄤ换鍔★紝璁惧: {DeviceCode}", _deviceCode);
- QuartzLogger.Debug($"娌℃湁鍙敤浠诲姟锛岃澶�: {_deviceCode}", _deviceCode);
+ //_logger.LogDebug("Execute锛氭病鏈夊彲鐢ㄤ换鍔★紝璁惧: {DeviceCode}", _deviceCode);
+ //QuartzLogger.Debug($"娌℃湁鍙敤浠诲姟锛岃澶�: {_deviceCode}", _deviceCode);
return Task.CompletedTask;
}
- _logger.LogInformation("Execute锛氶�夋嫨浠诲姟锛岃澶�: {DeviceCode}锛屼换鍔″彿: {TaskNum}", _deviceCode, task.TaskNum);
- QuartzLogger.Info($"閫夋嫨浠诲姟锛屼换鍔″彿: {task.TaskNum}", _deviceCode);
+ //_logger.LogInformation("Execute锛氶�夋嫨浠诲姟锛岃澶�: {DeviceCode}锛屼换鍔″彿: {TaskNum}", _deviceCode, task.TaskNum);
+ //QuartzLogger.Info($"閫夋嫨浠诲姟锛屼换鍔″彿: {task.TaskNum}", _deviceCode);
// ========== 鏋勫缓鍛戒护 ==========
// 鍛戒护鏋勫缓涓嬫矇鍒颁笓鐢ㄦ瀯寤哄櫒
@@ -235,6 +233,8 @@
bool sendFlag = SendStackerCraneCommand(commonStackerCrane, stackerCraneTaskCommand);
if (sendFlag)
{
+ Task.Delay(1000).Wait();
+ commonStackerCrane.SetValue(StackerCraneDBName.WorkAction, (short)1);
// 鍙戦�佹垚鍔燂紝鏇存柊鐘舵��
commonStackerCrane.LastTaskType = task.TaskType;
_taskService.UpdateTaskStatusToNext(task.TaskNum);
@@ -280,10 +280,11 @@
QuartzLogger.Info($"浠诲姟瀹屾垚锛屼换鍔″彿: {e.TaskNum}", stackerCrane.DeviceCode);
// 鏇存柊浠诲姟鐘舵�佷负瀹屾垚
- _taskService.StackCraneTaskCompleted(e.TaskNum);
-
- // 娓呴櫎鍫嗗灈鏈虹殑浣滀笟鎸囦护锛堣缃负 2锛岃〃绀虹┖闂诧級
- stackerCrane.SetValue(StackerCraneDBName.WorkAction, 2);
+ if (_taskService.StackCraneTaskCompleted(e.TaskNum).Status)
+ {
+ // 娓呴櫎鍫嗗灈鏈虹殑浣滀笟鎸囦护锛堣缃负 2锛岃〃绀虹┖闂诧級
+ stackerCrane.SetValue(StackerCraneDBName.WorkAction, 2);
+ }
}
}
@@ -310,4 +311,4 @@
};
}
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3