From 04b4e2ca4bbbc147036a0bf15ce0b8b1c45cc74b Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期六, 11 十月 2025 16:26:22 +0800
Subject: [PATCH] 新增设备状态上传与包装站台换型功能在CommonConveyorLine_BZJob.cs和CommonConveyorLine_GWJob.cs中新增对信号状态判断逻辑。 在 ConfigConst.cs`中新增常量 EqptRun,用于设备状态上传。新增 EqptRunDTO类,支持设备运行状态的数据传输。在 IAgingInOrOutInputService.cs中定义 Change方法接口,并在AgingInOrOutInputService.cs中实现设备型号修改逻辑。优化 Dt_TaskService.cs中的异常电芯处理、组盘信息获取、库存查询逻辑,并新增包装站台换型功能。 - 增强日志记录,便于问题排查。
---
CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 119 +++++++++++++++++++++++------------------------------------
1 files changed, 46 insertions(+), 73 deletions(-)
diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index 82cde70..73763b3 100644
--- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -257,67 +257,30 @@
// 鏌ヨ骞冲彴淇℃伅
Platform platform = _platFormRepository.QueryFirst(x => x.DeviceCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
- if (platform != null && !string.IsNullOrEmpty(platform.Location))
+ var platformNotusable = new List<string> { "2028", "2024","2032","2036","2040" };
+ if (platform != null && !string.IsNullOrEmpty(platform.Location) && !platformNotusable.Contains(platform.PlatCode))
{
- if (platform.PlatCode == "1299" || platform.PlatCode == "1295" || platform.PlatCode == "1291" || platform.PlatCode == "1287" || platform.PlatCode == "1283")
+ var strings = platform.Location.Split(',').ToList();
+ foreach (var ite in strings)
{
- Platform platformJZ = _platFormRepository.QueryFirst(x => x.PlatCode == "10086" && x.Status == "Active");
- if (platformJZ != null)
+ // 璇诲彇浠诲姟鍛戒护
+ ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
+ if (command1.InteractiveSignal != 2)
{
- var strings = platform.Location.Split(',').ToList();
- foreach (var ite in strings)
+ command.InteractiveSignal = writeInteractiveSignal;
+ int count = strings.Count;
+ // 鑾峰彇澶勭悊鏂规硶
+ MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
+ if (method != null)
{
- // 璇诲彇浠诲姟鍛戒护
- ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
- if (command1.InteractiveSignal != 2)
- {
- command.InteractiveSignal = writeInteractiveSignal;
- int count = strings.Count;
- // 鑾峰彇澶勭悊鏂规硶
- MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
- if (method != null)
- {
- command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
- // 璋冪敤澶勭悊鏂规硶
- method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
- }
-
- }
+ command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+ // 璋冪敤澶勭悊鏂规硶
+ method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
}
+
}
- //else
- //{
- // //ConsoleHelper.WriteErrorLine("闈欑疆绌烘墭涓嶅厑璁稿嚭鏂�");
- //}
}
- else
- {
- var strings = platform.Location.Split(',').ToList();
- foreach (var ite in strings)
- {
- // 璇诲彇浠诲姟鍛戒护
- ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
- if (command1.InteractiveSignal != 2)
- {
- command.InteractiveSignal = writeInteractiveSignal;
- int count = strings.Count;
- // 鑾峰彇澶勭悊鏂规硶
- MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
- if (method != null)
- {
- command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
- // 璋冪敤澶勭悊鏂规硶
- method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
- }
-
- }
- }
- }
}
- //if (conveyorLine.DeviceCode == "1001")
- //{
- // ConsoleHelper.WriteSuccessLine("ProcessDeviceAsync鏂规硶缁撴潫鏃堕棿锛�" + DateTime.Now.ToString("G") + $"鐐逛綅锛歿childDeviceCode}");
- //}
}
}
catch (Exception ex)
@@ -369,30 +332,31 @@
{
// 鑾峰彇浠诲姟鐨勪笅涓�鐩爣鍦板潃
var next = task.NextAddress;
- // 灏嗕换鍔℃槧灏勪负鍛戒护
- var taskCommand = MapTaskCommand(task, command);
- // 鎭㈠浠诲姟鐨勪笅涓�鐩爣鍦板潃
- task.NextAddress = next;
- // 鍙戦�佸懡浠ゅ埌瀛愯澶�
- conveyorLine.SendCommand(taskCommand, childDeviceCode);
+ // 灏嗕换鍔℃槧灏勪负鍛戒护
+ var taskCommand = MapTaskCommand(task, command);
+ // 鎭㈠浠诲姟鐨勪笅涓�鐩爣鍦板潃
+ task.NextAddress = next;
+ // 鍙戦�佸懡浠ゅ埌瀛愯澶�
+ conveyorLine.SendCommand(taskCommand, childDeviceCode);
- // 杈撳嚭璀﹀憡淇℃伅锛岃〃绀轰换鍔″凡鍒拌揪瀛愯澶囧苟璇锋眰鎵爜鍏ュ簱锛屼笅涓�鐩爣鍦板潃
- var logs = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�,涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�";
- ConsoleHelper.WriteWarningLine(logs);
+ // 杈撳嚭璀﹀憡淇℃伅锛岃〃绀轰换鍔″凡鍒拌揪瀛愯澶囧苟璇锋眰鎵爜鍏ュ簱锛屼笅涓�鐩爣鍦板潃
+ var logs = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�,涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�";
+ ConsoleHelper.WriteWarningLine(logs);
- await _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = logs, time = DateTime.Now.ToString("G"), color = "red" });
- WriteInfo(conveyorLine.DeviceName, logs);
+ await _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = logs, time = DateTime.Now.ToString("G"), color = "red" });
+ WriteInfo(conveyorLine.DeviceName, logs);
- // 鍙戦�佷换鍔″畬鎴愰�氱煡
- ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
- // 鏇存柊浠诲姟鐘舵�佷负涓嬩竴鐘舵��
- _taskService.UpdateTaskStatusToNext(task);
+ // 鍙戦�佷换鍔″畬鎴愰�氱煡
+ ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+ // 鏇存柊浠诲姟鐘舵�佷负涓嬩竴鐘舵��
+ _taskService.UpdateTaskStatusToNext(task);
}
}
}
else
{
- var taskInTray = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ //var taskInTray = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ var taskInTray = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode,command.Barcode);
if (taskInTray != null && taskInTray.TaskType == (int)TaskInboundTypeEnum.InTray)
{
RequestInNextAddress(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
@@ -493,7 +457,8 @@
_noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
WriteInfo(conveyorLine.DeviceName, log);
- Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ //Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode);
if (task != null)
{
if (command.Barcode == task.PalletCode)
@@ -501,6 +466,7 @@
Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
if (newTask != null)
{
+
//ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask);
//taskCommand.InteractiveSignal = command.InteractiveSignal;
var next = newTask.NextAddress;
@@ -516,6 +482,7 @@
conveyorLine.SendCommand(taskCommand, childDeviceCode);
ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
_taskService.UpdateData(newTask);
}
}
@@ -541,7 +508,8 @@
_noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
WriteInfo(conveyorLine.DeviceName, log);
- var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ //var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode);
if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
{
if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress)
@@ -599,6 +567,7 @@
{
// 鏌ヨ杈撻�佺嚎浠诲姟锛屾牴鎹緭閫佺嚎璁惧鍜屽瓙璁惧浠g爜鑾峰彇浠诲姟淇℃伅
var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+ //var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode, command.Barcode);
// 杈撳嚭鎴愬姛淇℃伅锛屽寘鎷緭閫佺嚎鍚嶇О銆佷换鍔″彿銆佹墭鐩樻潯鐮佸拰瀛愯澶囦唬鐮侊紝浠ュ強浠诲姟淇℃伅
var logs = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎璇锋眰鍑哄簱,task{task.ToJsonString()}";
@@ -663,7 +632,8 @@
WriteInfo(conveyorLine.DeviceName, log);
// 鏌ヨ姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟锛屾牴鎹换鍔″彿鍜屽瓙璁惧浠g爜鑾峰彇浠诲姟淇℃伅
- Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ //Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode);
// 濡傛灉浠诲姟瀛樺湪
if (task != null)
@@ -677,6 +647,7 @@
// 濡傛灉鏇存柊鍚庣殑浠诲姟瀵硅薄涓嶄负绌�
if (newTask != null)
{
+ //_taskService.UpdateData(newTask);
// 鑾峰彇涓嬩竴鐩爣鍦板潃
var next = newTask.NextAddress;
@@ -698,6 +669,7 @@
// 鏍囪杈撻�佺嚎鍙戦�佷换鍔″畬鎴�
ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
_taskService.UpdateData(newTask);
}
}
@@ -722,7 +694,8 @@
WriteInfo(conveyorLine.DeviceName, logs);
// 鏌ヨ姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟
- var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ //var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode);
// 濡傛灉浠诲姟瀛樺湪
if (task != null)
--
Gitblit v1.9.3