wanshenmean
昨天 c5c3e4e538a11f2a6391e6b2613375b1f92eb20a
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
@@ -133,8 +133,7 @@
                    if (childDeviceCodes == null || childDeviceCodes.Count == 0)
                    {
                        // 没有子设备,直接返回
                        _logger.LogInformation("输送线 {DeviceCode} 没有子设备", conveyorLine.DeviceCode);
                        QuartzLogger.Info($"输送线 {conveyorLine.DeviceCode} 没有子设备", conveyorLine.DeviceCode);
                        QuartzLogHelper.LogInfo(_logger, "输送线 {DeviceCode} 没有子设备", $"输送线 {conveyorLine.DeviceCode} 没有子设备", conveyorLine.DeviceCode, conveyorLine.DeviceCode);
                        return Task.CompletedTask;
                    }
@@ -162,8 +161,6 @@
                            // 如果命令为空,跳过
                            if (command == null)
                            {
                                _logger.LogDebug("Execute:子设备 {ChildDeviceCode} 命令为空,跳过", childDeviceCode);
                                QuartzLogger.Debug($"子设备 {childDeviceCode} 命令为空,跳过", conveyorLine.DeviceCode);
                                continue;
                            }
@@ -186,8 +183,7 @@
                                    {
                                        // 没有任务,向 WMS 请求出库托盘任务
                                        var position = checkPalletPositions.FirstOrDefault(x => x.Code == childDeviceCode);
                                        _logger.LogInformation("Execute:检查托盘位置 {ChildDeviceCode},请求WMS出库托盘任务", childDeviceCode);
                                        QuartzLogger.Info($"检查托盘位置 {childDeviceCode},请求WMS出库托盘任务", conveyorLine.DeviceCode);
                                        QuartzLogHelper.LogInfo(_logger, "Execute:检查托盘位置 {ChildDeviceCode},请求WMS出库托盘任务", $"检查托盘位置 {childDeviceCode},请求WMS出库托盘任务", conveyorLine.DeviceCode, childDeviceCode);
                                        var responseResult = _httpClientHelper.Post<WebResponseContent>("GetOutBoundTrayTaskAsync", new CreateTaskDto()
                                        {
@@ -229,8 +225,7 @@
                                }
                                catch (Exception ex)
                                {
                                    _logger.LogError(ex, "处理手动入库任务异常");
                                    QuartzLogger.Error($"处理手动入库任务异常: {ex.Message}", "CommonConveyorLineNewJob", ex);
                                    QuartzLogHelper.LogError(_logger, ex, "处理手动入库任务异常", $"处理手动入库任务异常: {ex.Message}", "CommonConveyorLineNewJob");
                                }
                                continue;
                            }
@@ -239,8 +234,6 @@
                            // 无托盘条码时,请求出库任务
                            if (command.Barcode.IsNullOrEmpty() || command.Barcode.Replace("\0", "") == "")
                            {
                                _logger.LogDebug("Execute:子设备 {ChildDeviceCode} 无托盘条码,请求出库任务", childDeviceCode);
                                QuartzLogger.Debug($"子设备 {childDeviceCode} 无托盘条码,请求出库任务", conveyorLine.DeviceCode);
                                _conveyorLineDispatch.RequestOutbound(conveyorLine, command, childDeviceCode);
                                continue;
                            }
@@ -252,8 +245,7 @@
                                Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNo, childDeviceCode);
                                if (!task.IsNullOrEmpty())
                                {
                                    _logger.LogInformation("Execute:子设备 {ChildDeviceCode} 处理任务 {TaskNum},状态: {Status}", childDeviceCode, task.TaskNum, task.TaskStatus);
                                    QuartzLogger.Info($"处理任务 {task.TaskNum},状态: {task.TaskStatus}", conveyorLine.DeviceCode);
                                    QuartzLogHelper.LogInfo(_logger, "Execute:子设备 {ChildDeviceCode} 处理任务 {TaskNum},状态: {Status}", $"处理任务 {task.TaskNum},状态: {task.TaskStatus}", conveyorLine.DeviceCode, childDeviceCode, task.TaskNum, task.TaskStatus);
                                    // 处理任务状态(根据状态分发到不同方法)
                                    ProcessTaskState(conveyorLine, command, task, childDeviceCode);
                                    return Task.CompletedTask;
@@ -263,8 +255,7 @@
                        catch (Exception innerEx)
                        {
                            // 记录异常,但不影响其他子设备的处理
                            _logger.LogError(innerEx, "Execute:子设备 {ChildDeviceCode} 处理异常,CorrelationId: {CorrelationId}", childDeviceCode, correlationId);
                            QuartzLogger.Error($"子设备处理异常: {innerEx.Message}", conveyorLine.DeviceCode, innerEx);
                            QuartzLogHelper.LogError(_logger, innerEx, "Execute:子设备 {ChildDeviceCode} 处理异常,CorrelationId: {CorrelationId}", $"子设备处理异常: {innerEx.Message}", conveyorLine.DeviceCode, childDeviceCode, correlationId);
                        }
                    }
                }
@@ -272,8 +263,7 @@
            catch (Exception ex)
            {
                // 记录整体异常
                _logger.LogError(ex, "Execute:输送线 {DeviceCode} 执行异常", ex.Message);
                QuartzLogger.Error($"输送线执行异常: {ex.Message}", "CommonConveyorLineNewJob", ex);
                QuartzLogHelper.LogError(_logger, ex, "Execute:输送线 {DeviceCode} 执行异常", $"输送线执行异常: {ex.Message}", "CommonConveyorLineNewJob", ex.Message);
            }
            return Task.CompletedTask;
        }