wangxinhui
4 天以前 a0a0df2e824b6fe7e5a3c0afce78127fecf84fc9
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/Ô­ÁÏ¿â/ConveyorLineJob_YL1ndFloor.cs
@@ -67,10 +67,9 @@
            if (flag && value != null)
            {
                OtherDevice device = (OtherDevice)value;
                //获取所有协议的输送线站台
                List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
                //获取有协议的输送线-z
                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
                //让每个输送线启动-z
                foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode)))
                {
                    DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(WR_CLineYLDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
@@ -79,12 +78,21 @@
                        R_ConveyorLineYLInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineYLInfo>(deviceProRead.DeviceProAddress);
                        if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID)) //一楼来料称重站台允许入库申请
                        {
                            device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode);
                            WriteInfo(item.StationCode, $"请求入库条码:{conveyorLineInfoRead.WR_TMID}");
                            WebResponseContent content = _taskService.YLPurchaseBoxing(conveyorLineInfoRead.WR_TMID, weight: conveyorLineInfoRead.WR_Weight, thickness: conveyorLineInfoRead.WR_Height, wide: conveyorLineInfoRead.WR_Width);
                            if (content.Status)
                            {
                                device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode);
                                WriteInfo(item.StationCode, $"请求入库条码:{conveyorLineInfoRead.WR_TMID}");
                            }
                            else
                            {
                                WriteError(item.StationCode, $"请求入库失败:{content.Message}");
                            }
                        }
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && conveyorLineInfoRead.WR_Task <= 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID)) //一楼分配站台入库分配目标点
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && conveyorLineInfoRead.WR_Task <= 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID)) //一楼分配站台入库分配目标点(平台)
                        {
                            Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.WR_TMID && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.DeviceCode == device.DeviceCode);
                            Dt_Task task = _taskRepository.QueryFirst(x => x.RfidCode == conveyorLineInfoRead.WR_TMID && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.DeviceCode == device.DeviceCode);
                            if (task == null)
                            {
                                WebResponseContent content = _taskService.RequestYLWMSTaskSimple(conveyorLineInfoRead.WR_TMID, item.StationCode);
@@ -97,12 +105,13 @@
                            {
                                device.SetValue(WR_CLineYLDB.WR_Task, task.TaskNum, item.StationCode);
                                device.SetValue(WR_CLineYLDB.WR_ToHode, task.NextAddress, item.StationCode);
                                device.SetValue(WR_CLineYLDB.WR_Width, task.TaskLength, item.StationCode);
                                device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode);
                                _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
                                WriteInfo(item.StationCode, $"{conveyorLineInfoRead.Serialize()}");
                            }
                        }
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && conveyorLineInfoRead.WR_Task > 0) //一楼分配站台入库分配目标点
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && conveyorLineInfoRead.WR_Task > 0) //一楼分配站台入库分配目标点(库内)
                        {
                            Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.WR_Task && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.AGV_Finish.ObjToInt() && x.DeviceCode == device.DeviceCode);
                            //发送任务
@@ -164,9 +173,9 @@
                                
                            }
                        }
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 99 && conveyorLineInfoRead.WR_Task <= 0) //出站台分配目标点
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 99 && conveyorLineInfoRead.WR_Task > 0) //出站台分配目标点
                        {
                            Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode);
                            Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskNum == conveyorLineInfoRead.WR_Task && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode);
                            if (task != null)
                            {
                                //发送目标点
@@ -192,8 +201,8 @@
                            {
                                //任务回复
                                device.SetValue(WR_CLineYLDB.WR_Reresult, 98, item.StationCode);
                                _taskService.TaskCompleted(task.TaskNum);
                                WriteInfo(item.StationCode, $"任务号:{task.TaskNum}一楼出库至老厂房完成");
                                _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: "CL3_YL");
                                WriteInfo(item.StationCode, $"任务号:{task.TaskNum},RIFD{task.RfidCode}一楼出库至老厂房完成");
                            }
                        }
                    }