dengjunjie
2024-11-14 c827fe7b0c5b3b444d76ba0d96a2649c764630dd
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -66,29 +66,36 @@
                    List<Task> tasks = new List<Task>();
                    foreach (string childDeviceCode in childDeviceCodes)
                    {
                        ConveyorLineTaskCommandR command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandR>(childDeviceCode);
                        if (command != null && command.Status == (ushort)ConveyorStatus.Stored)//添加输送线状态ConveyorLineStatus enum
                        try
                        {
                            switch (childDeviceCode)
                            ConveyorLineTaskCommandR command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandR>(childDeviceCode);
                            if (command != null && command.Status == (ushort)ConveyorStatus.Stored)//添加输送线状态ConveyorLineStatus enum
                            {
                                case "102":
                                    RequestInbound(conveyorLine, command, childDeviceCode);
                                    break;
                                case "104":
                                    ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
                                    break;
                                //case "105":
                                //    RequestOutbound(conveyorLine, command, childDeviceCode);
                                //    break;
                                case "108":
                                    ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
                                    break;
                                    //default:
                                    //    RequestInNextAddress(conveyorLine, command, childDeviceCode);
                                    //    RequestOutNextAddress(conveyorLine, command, childDeviceCode);
                                switch (childDeviceCode)
                                {
                                    case "102":
                                        RequestInbound(conveyorLine, command, childDeviceCode);
                                        break;
                                    case "104":
                                        ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
                                        break;
                                    //case "105":
                                    //    RequestOutbound(conveyorLine, command, childDeviceCode);
                                    //    break;
                                    case "108":
                                        ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
                                        break;
                                        //default:
                                        //    RequestInNextAddress(conveyorLine, command, childDeviceCode);
                                        //    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;
                        task.ExceptionMessage = content.Message;
                        task.TaskState = (int)TaskInStatusEnum.InException;
                        ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task);
                        if (conveyorLine.SendCommand(taskCommand, childDeviceCode)) _taskService.UpdateData(task);
                    }
                    //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);
                    //}
                }
            }
        }