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/StackerStationJob/CommonStackerStationCraneJob.cs | 33 ++++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
index b9db636..2d0a34d 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
@@ -2,6 +2,7 @@
using Newtonsoft.Json;
using Quartz;
using System.Diagnostics.CodeAnalysis;
+using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_Common.TaskEnum;
@@ -21,6 +22,7 @@
using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
using WIDESEAWCS_SignalR;
using WIDESEAWCS_Tasks.StackerCraneJob;
+using WIDESEAWCS_Common;
namespace WIDESEAWCS_Tasks
{
@@ -50,10 +52,6 @@
{
try
{
- // speStackerCrane.GetStackerCraneStatus<StackerCraneAutoStatus>();
- // speStackerCrane.GetStackerCraneStatus<StackerCraneWorkStatus>();
- // speStackerCrane.GetStackerCraneStatus<StackerCraneStatus>();
-
CommonStackerStationCrane commonStackerCrane = (CommonStackerStationCrane)context.JobDetail.JobDataMap.Get("JobParams");
if (commonStackerCrane != null)
{
@@ -70,12 +68,18 @@
if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby)
{
- Dt_Task? task = GetTask(commonStackerCrane);
+ Dt_Task? task = null;
+ if (StaticVariable.isLineRun)
+ {
+ StaticVariable.isStackerRun = false;
+ task = GetTask(commonStackerCrane);
+ }
if (task != null)
{
StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
if (stackerCraneTaskCommand != null)
{
+ Thread.Sleep(1000);
bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
if (sendFlag)
{
@@ -118,6 +122,10 @@
WriteError("CommonStackerStationCraneJob", "test", ex);
//Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString());
}
+ finally
+ {
+ StaticVariable.isStackerRun = true;
+ }
//WriteDebug("CommonStackerStationCraneJob", "test");
return Task.CompletedTask;
}
@@ -134,7 +142,7 @@
{
if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
{
- string str = $"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆�";
+ string str = $"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�";
WriteInfo(commonStackerCrane.DeviceName, str);
ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
@@ -142,7 +150,7 @@
commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
var isWorkType = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
- str = $"WMS|WCS浠诲姟瀹屾垚锛氥�恵content.Status}銆�,鍫嗗灈鏈哄畬鎴愪俊鍙峰啓鍏ワ細銆恵isWorkType}銆�,浠诲姟鍙凤細銆恵e.TaskNum}銆�";
+ str = $"{commonStackerCrane.DeviceName}銆慦MS|WCS浠诲姟瀹屾垚锛氥�恵content.Status}銆�,鍫嗗灈鏈哄畬鎴愪俊鍙峰啓鍏ワ細銆恵isWorkType}銆�,浠诲姟鍙凤細銆恵e.TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�";
WriteInfo(commonStackerCrane.DeviceName, str);
ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
}
@@ -157,6 +165,11 @@
private Dt_Task? GetTask(CommonStackerStationCrane commonStackerCrane)
{
Dt_Task task;
+ task = _taskService.QueryOutFireAlarmTask(commonStackerCrane.DeviceCode);
+ if (task != null)
+ {
+ return task;
+ }
task = _taskService.QueryRelocationTask(commonStackerCrane.DeviceCode);
if (task != null)
@@ -197,6 +210,11 @@
else
{
return task;
+ }
+
+ if (task == null)
+ {
+ task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
}
}
else if (task == null)
@@ -280,6 +298,7 @@
stackerCraneTaskCommand.WorkType = 1;
stackerCraneTaskCommand.TrayType = 0;
stackerCraneTaskCommand.StartCommand = 1;
+ stackerCraneTaskCommand.FireCommand = Convert.ToInt16(task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm ? 2 : 0);
string[] sourceCodes = task.SourceAddress.Split("-");
if (sourceCodes.Length == 3)
--
Gitblit v1.9.3