dengjunjie
2024-11-14 c827fe7b0c5b3b444d76ba0d96a2649c764630dd
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -66,6 +66,8 @@
                    List<Task> tasks = new List<Task>();
                    foreach (string childDeviceCode in childDeviceCodes)
                    {
                        try
                        {
                        ConveyorLineTaskCommandR command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandR>(childDeviceCode);
                        if (command != null && command.Status == (ushort)ConveyorStatus.Stored)//添加输送线状态ConveyorLineStatus enum
                        {
@@ -88,6 +90,11 @@
                                    //    RequestOutNextAddress(conveyorLine, command, childDeviceCode);
                                    //    break;
                            }
                            }
                        }
                        catch (Exception ex)
                        {
                            continue;
                        }
                    }
                    Task.WaitAll(tasks.ToArray());
@@ -117,7 +124,7 @@
            {
                ConveyorLineDTO lineDTO = new ConveyorLineDTO()
                {
                    //TaskNum = task.TaskNum,
                    TaskNum = task.TaskNum,
                    stationCode = childDeviceCode,
                    Barcode = command.Barcode,
                    Spec = command.Spec,
@@ -127,8 +134,9 @@
                if (content.Status)
                {
                    task.TargetAddress = AppSettings.Configuration["OKAddress"];
                    task.NextAddress = task.TargetAddress;
                    task.CurrentAddress = childDeviceCode;
                    task.NextAddress = AppSettings.Configuration["OKAddress"];
                    task.ExceptionMessage = null;
                    ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task);
                    if (conveyorLine.SendCommand(taskCommand, childDeviceCode))
@@ -136,15 +144,15 @@
                }
                else
                {
                    if (content.Code == 404)//修改终点地址
                    {
                        task.TargetAddress = AppSettings.Configuration["NGAddress"];
                        task.NextAddress = task.TargetAddress;
                    //if (content.Code == 404)//修改终点地址
                    //{
                    task.CurrentAddress = childDeviceCode;
                    task.NextAddress = AppSettings.Configuration["NGAddress"];
                        task.ExceptionMessage = content.Message;
                        task.TaskState = (int)TaskInStatusEnum.InException;
                        ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task);
                        if (conveyorLine.SendCommand(taskCommand, childDeviceCode)) _taskService.UpdateData(task);
                    }
                    //}
                }
            }
        }