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/ConveyorLineJob_CW/CWTask/RequestInbound.cs | 135 ++++++++++++--------------------------------
1 files changed, 37 insertions(+), 98 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs
index 987db4f..33a03e9 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs
@@ -47,94 +47,46 @@
/// </summary>
private void HandleNewTask(CommonConveyorLine_CW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
{
- Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
-
- if (stationManager == null)
+ try
{
- // Handle the case where stationManager is not found, if necessary
- Console.WriteLine($"鏈壘鍒皗childDeviceCode}绔欏彴");
- return;
- }
- // 鏍规嵁绔欑被鍨嬫墽琛岀浉搴旂殑鏂规硶
- switch (stationManager.stationType)
- {
- case 8:
- case 9:
- case 11:
- case 12:
- var task = _taskService.QueryExecutingTaskByBarcode(command.ConveyorLineBarcode, childDeviceCode);
- if (task != null)
- {
+ Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
+
+ if (stationManager == null)
+ {
+ // Handle the case where stationManager is not found, if necessary
+ Console.WriteLine($"鏈壘鍒皗childDeviceCode}绔欏彴");
+ return;
+ }
+
+ // 鏍规嵁绔欑被鍨嬫墽琛岀浉搴旂殑鏂规硶
+ switch (stationManager.stationType)
+ {
+ case 8:
+ case 9:
+ case 11:
+ case 12:
+ var task = _taskService.QueryExecutingTaskByBarcode(command.ConveyorLineBarcode, childDeviceCode);
+ if (task != null)
+ {
+ ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
+ }
+ break;
+ case 1:
+ case 6:
+ case 10:
ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
- }
- break;
- case 1:
- case 6:
- case 10:
- ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
- break;
- //case 16:
- // ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
- // break;
+ break;
+ //case 16:
+ // ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
+ // break;
+ }
+
}
-
- #region
- //Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
-
- //if (stationManager.stationType == 8)
- //{
- // var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
- // if (task != null)
- // {
- // RequestInNextAddress(conveyorLine, command, childDeviceCode);
- // }
- //}
- //else if (stationManager.stationType == 9)
- //{
- // var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
- // if (task != null)
- // {
- // ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
- // }
- //}
- //else if (stationManager.stationType == 1)
- //{
- // if (stationManager.stationArea.Contains("GW"))
- // {
- // var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && x.TaskState == (int)TaskOutStatusEnum.OutFinish);
- // if (taskGW != null)
- // {
- // command.ConveyorLineBarcode = taskGW.PalletCode;
- // }
- // }
- // RequestWmsTask(conveyorLine, command, childDeviceCode);
- //}
- //else if (stationManager.stationType == 10)
- //{
- // var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
- // if (task != null)
- // {
- // RequestOutbound(conveyorLine, command, childDeviceCode);
- // }
- //}
- //else if (stationManager.stationType == 11)
- //{
- // var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
- // if (task != null)
- // {
- // RequestOutNextAddress(conveyorLine, command, childDeviceCode);
- // }
- //}
- //else if (stationManager.stationType == 12)
- //{
- // var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
- // if (task != null)
- // {
- // ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
- // }
- //}
- #endregion
+ catch (Exception ex)
+ {
+ WriteInfo("HandleNewTask", $"銆恵ex.Message}銆�");
+ }
}
private void ExecuteStationAction(Dt_StationManager stationManager, CommonConveyorLine_CW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
@@ -168,7 +120,6 @@
AbNormalStationBZTask(conveyorLine, command, childDeviceCode);
break;
case 1:
-
RequestWmsTask(conveyorLine, command, childDeviceCode, stationManager);
break;
}
@@ -237,8 +188,6 @@
taskExecuting.ExceptionMessage = "鏈帴鏀跺埌绾夸綋瀹屾垚淇″彿绯荤粺鍐呴儴鑷姩瀹屾垚";
_taskService.Delete(taskExecuting);
}
-
- ConsoleHelper.WriteErrorLine($"褰撳墠鎵樼洏瀛樺湪浠诲姟锛氥�恵command.ConveyorLineBarcode}銆�");
WriteInfo(conveyorLine.DeviceName, $"褰撳墠鎵樼洏瀛樺湪浠诲姟{command.ConveyorLineBarcode}");
}
@@ -309,16 +258,6 @@
var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode);
if (task != null)
{
- if (childDeviceCode == "1039")
- {
- var GWTask = _taskRepository.QueryData(x => x.Roadway.Contains("GWSC2") && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList();
- if (GWTask.Count >= 2 && childDeviceCode == "1039" && task.Roadway.Contains("GWSC2"))
- {
- ConsoleHelper.WriteErrorLine($"鎵樼洏鍙凤細銆恵command.ConveyorLineBarcode}銆戦珮娓╀簩宸插瓨鍦ㄣ�恵GWTask.Count}銆戜釜浠诲姟澶т簬2涓换鍔′笉鍙笅鍙�");
- return;
- }
- }
-
ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode);
@@ -332,7 +271,7 @@
}
else
{
- if (content.Message != "璇锋眰杩囦簬棰戠箒锛岃绋嶅悗鍐嶈瘯" && content.Message != "鏃犳硶鑾峰彇鐩爣鍦板潃")
+ if (content.Message != "璇锋眰杩囦簬棰戠箒锛岃绋嶅悗鍐嶈瘯" && content.Message != "鏃犳硶鑾峰彇鐩爣鍦板潃" && !content.Message.Contains("瀛樺湪浠诲姟") && !content.Message.Contains("瀛樺湪搴撳瓨涓嶅厑璁稿叆搴�"))
{
WriteInfo(conveyorLine.DeviceName, content.Message);
conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, stationManager.stationNGChildCode, childDeviceCode);
--
Gitblit v1.9.3