1
huangxiaoqiang
2025-06-05 c87ea81736b138f3969ab58850830ede2f060212
CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -259,65 +259,27 @@
                    Platform platform = _platFormRepository.QueryFirst(x => x.DeviceCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
                    if (platform != null && !string.IsNullOrEmpty(platform.Location))
                    {
                        if (platform.PlatCode == "2040" || platform.PlatCode == "2036" || platform.PlatCode == "2032" || platform.PlatCode == "2028" || platform.PlatCode == "2024")
                        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,24 +331,24 @@
                        {
                            // 获取任务的下一目标地址
                            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);
                        }
                    }
                }
@@ -448,7 +410,6 @@
                                // 如果已有任务数量小于指定索引
                                if (tasks.Count < Location.Count)
                                {
                                    ConsoleHelper.WriteSuccessLine($"{childDeviceCode}");
                                    return childDeviceCode;
                                }
                                else