From 5171d3f59b89389bf75293afd210cfa6de4ccff7 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 10 四月 2026 23:03:49 +0800
Subject: [PATCH] feat: 添加堆垛机相关常量类并重构代码使用常量
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs | 40 +++++++++++++++++++++++++---------------
1 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
index d4d915d..c016c47 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
@@ -4,7 +4,6 @@
using Newtonsoft.Json;
using Quartz;
using SqlSugar;
-using System.Text.Json;
using WIDESEA_Core;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
@@ -78,6 +77,13 @@
private readonly ILogger<CommonConveyorLineNewJob> _logger;
/// <summary>
+ /// 鐩爣鍦板潃鍒拌澶囩被鍨嬬殑鏄犲皠
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ private static List<string> AddressToDeviceType = new List<string> { "11020", "11028" };
+
+ /// <summary>
/// 鏋勯�犲嚱鏁�
/// </summary>
/// <param name="taskService">浠诲姟鏈嶅姟</param>
@@ -138,8 +144,8 @@
// MaxDegreeOfParallelism = Math.Min(childDeviceCodes.Count, Environment.ProcessorCount * 2),
//};
- _logger.LogDebug("Execute锛氬紑濮嬪苟琛屽鐞嗚緭閫佺嚎 {DeviceCode}锛屽瓙璁惧鏁伴噺: {Count}", conveyorLine.DeviceCode, childDeviceCodes.Count);
- QuartzLogger.Debug($"寮�濮嬪苟琛屽鐞嗚緭閫佺嚎锛屽瓙璁惧鏁伴噺: {childDeviceCodes.Count}", conveyorLine.DeviceCode);
+ //_logger.LogDebug("Execute锛氬紑濮嬪苟琛屽鐞嗚緭閫佺嚎 {DeviceCode}锛屽瓙璁惧鏁伴噺: {Count}", conveyorLine.DeviceCode, childDeviceCodes.Count);
+ //QuartzLogger.Debug($"寮�濮嬪苟琛屽鐞嗚緭閫佺嚎锛屽瓙璁惧鏁伴噺: {childDeviceCodes.Count}", conveyorLine.DeviceCode);
// 骞惰澶勭悊姣忎釜瀛愯澶�
//Parallel.For(0, childDeviceCodes.Count, parallelOptions, i =>
@@ -157,12 +163,9 @@
{
_logger.LogDebug("Execute锛氬瓙璁惧 {ChildDeviceCode} 鍛戒护涓虹┖锛岃烦杩�", childDeviceCode);
QuartzLogger.Debug($"瀛愯澶� {childDeviceCode} 鍛戒护涓虹┖锛岃烦杩�", conveyorLine.DeviceCode);
- return Task.CompletedTask;
+ continue;
}
- // 濡傛灉 WCS_ACK 涓� 1锛屽厛娓呴櫎锛堣〃绀哄鐞嗚繃涓婁竴娆¤姹傦級
- if (command.WCS_ACK == 1)
- conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 0, childDeviceCode);
// ========== 妫�鏌ョ壒瀹氫綅缃槸鍚︽湁鎵樼洏 ==========
// 浠庨厤缃腑璇诲彇闇�瑕佹鏌ユ墭鐩樼殑浣嶇疆鍒楄〃
@@ -173,7 +176,7 @@
if (checkPalletPositions.Any(x => x.Code == childDeviceCode))
{
// 妫�鏌ヨ緭閫佺嚎鐘舵�侊紙鏄惁鏈夋墭鐩橈級
- if (command.CV_State == 1)
+ if (command.CV_State == 2)
{
// 妫�鏌ヨ浣嶇疆鏄惁宸叉湁浠诲姟
var existingTask = _taskService.Db.Queryable<Dt_Task>().First(x => x.TargetAddress == childDeviceCode);
@@ -206,9 +209,10 @@
// 鍙湁褰� PLC_STB 涓� 1 鏃舵墠澶勭悊浠诲姟
if (command.PLC_STB != 1)
{
- //_logger.LogDebug("Execute锛氬瓙璁惧 {ChildDeviceCode} PLC_STB 涓嶄负1锛岃烦杩�", childDeviceCode);
- //QuartzLogger.Debug($"瀛愯澶� {childDeviceCode} PLC_STB 涓嶄负1锛岃烦杩�", conveyorLine.DeviceCode);
- return Task.CompletedTask;
+ // 濡傛灉 WCS_ACK 涓� 1锛屽厛娓呴櫎锛堣〃绀哄鐞嗚繃涓婁竴娆¤姹傦級
+ if (command.WCS_ACK == 1)
+ conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, (short)0, childDeviceCode);
+ continue;
}
// ========== 澶勭悊鏃犳墭鐩樻潯鐮佺殑鎯呭喌 ==========
@@ -218,11 +222,11 @@
_logger.LogDebug("Execute锛氬瓙璁惧 {ChildDeviceCode} 鏃犳墭鐩樻潯鐮侊紝璇锋眰鍑哄簱浠诲姟", childDeviceCode);
QuartzLogger.Debug($"瀛愯澶� {childDeviceCode} 鏃犳墭鐩樻潯鐮侊紝璇锋眰鍑哄簱浠诲姟", conveyorLine.DeviceCode);
_conveyorLineDispatch.RequestOutbound(conveyorLine, command, childDeviceCode);
- return Task.CompletedTask;
+ continue;
}
// ========== 澶勭悊宸叉湁浠诲姟鍙风殑鎯呭喌 ==========
- if (command.TaskNo > 0)
+ if (command.TaskNo > 0 && !command.Barcode.IsNullOrEmpty())
{
// 鏌ヨ姝e湪鎵ц鐨勪换鍔�
Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNo, childDeviceCode);
@@ -287,7 +291,13 @@
{
case InExecuting:
// 鍏ュ簱鎵ц涓紝璋冪敤涓嬩竴鍦板潃澶勭悊
- _conveyorLineDispatch.RequestInNextAddress(conveyorLine, command, childDeviceCode);
+
+ if (AddressToDeviceType.Contains(childDeviceCode))
+ // 鍒拌揪鐩爣鍦板潃锛岃皟鐢ㄥ叆搴撳畬鎴�
+ _conveyorLineDispatch.ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
+ else
+ // 鏈埌杈剧洰鏍囧湴鍧�锛岃皟鐢ㄥ叆搴撲笅涓�鍦板潃澶勭悊
+ _conveyorLineDispatch.RequestInNextAddress(conveyorLine, command, childDeviceCode);
break;
case OutExecuting:
@@ -312,4 +322,4 @@
}
}
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3