修复方法声明并重构命令发送逻辑在 ITaskService.cs中QueryExecutingConveyorLineTask方法的声明末尾添加了分号。注释掉了多处 conveyorLine.SendCommand的调用,并替换为 SendCommand方法,确保在发送命令时设置了必要的值。
在 RequestInbound.cs中,进行了类似的重构,更新了任务状态。
已修改3个文件
53 ■■■■ 文件已修改
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -157,7 +157,7 @@
        /// <param name="taskNum">任务号</param>
        /// <param name="nextAddress">下一地址</param>
        /// <returns></returns>
        Dt_Task QueryExecutingConveyorLineTask(string nextAddress, string Barcode)
        Dt_Task QueryExecutingConveyorLineTask(string nextAddress, string Barcode);
        /// <summary>
        /// 根据托盘号、下一地址查询输送线执行中的任务
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -25,6 +25,7 @@
using Newtonsoft.Json;
using Quartz;
using SqlSugar;
using System.ComponentModel.Design;
using System.Reflection;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_Common;
@@ -217,7 +218,10 @@
                        return;
                    }
                    ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    SendCommand(taskCommand, conveyorLine, childDeviceCode);
                    conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                    _taskService.UpdateTaskStatusToNext(task);
                }
@@ -249,7 +253,10 @@
                if (newTask != null)
                {
                    ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask);
                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    SendCommand(taskCommand, conveyorLine, childDeviceCode);
                    conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                    _taskService.UpdateData(newTask);
                }
@@ -292,7 +299,10 @@
            if (task != null)
            {
                ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
                conveyorLine.SendCommand(taskCommand, childDeviceCode);
                //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                SendCommand(taskCommand, conveyorLine, childDeviceCode);
                conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                _taskService.UpdateTaskStatusToNext(task);
@@ -346,7 +356,10 @@
                    if (newTask != null)
                    {
                        ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask);
                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
                        //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                        SendCommand(taskCommand, conveyorLine, childDeviceCode);
                        conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                        _taskService.UpdateData(newTask);
                    }
@@ -355,7 +368,10 @@
                {
                    ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
                    taskCommand.ConveyorLineTargetAddress = Convert.ToInt16(stationManager.stationNGChildCode);
                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    SendCommand(taskCommand, conveyorLine, childDeviceCode);
                    conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                    _taskService.UpdateTaskStatusToNext(task);
                }
@@ -404,7 +420,8 @@
                    }
                }
                conveyorLine.SendCommand(taskCommand, childDeviceCode);
                //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                SendCommand(taskCommand, conveyorLine, childDeviceCode);
                conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                content = _taskService.UpdateTaskStatusToNext(task);
            }
@@ -437,7 +454,8 @@
                        }
                    }
                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    SendCommand(taskCommand, conveyorLine, childDeviceCode);
                    conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                    taskNext.ExceptionMessage = log;
@@ -524,6 +542,15 @@
            }
            return content;
        }
        public void SendCommand(ConveyorLineTaskCommand_After taskCommand, CommonConveyorLine_GW conveyorLine, string childDeviceCode)
        {
            conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, taskCommand.ConveyorLineTargetAddress, childDeviceCode);
            Thread.Sleep(100);
            conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, taskCommand.ConveyorLineBarcode, childDeviceCode);
            Thread.Sleep(100);
            conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, taskCommand.ConveyorLineTaskNum, childDeviceCode);
        }
    }
}
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
@@ -267,7 +267,10 @@
                    if (task != null)
                    {
                        var taskCommand = MapTaskCommand(task, command);
                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
                        //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                        SendCommand(taskCommand, conveyorLine, childDeviceCode);
                        _taskService.UpdateTaskStatusToNext(task);
                    }
                }
@@ -324,7 +327,10 @@
                        return;
                    }
                    ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    SendCommand(taskCommand, conveyorLine, childDeviceCode);
                    conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                    _taskService.UpdateTaskStatusToNext(task);