| | |
| | | ConveyorLineSignal conveyorLineSignalRead = conveyorLineInfoRead.Signal.ByteToBoolObject<ConveyorLineSignal>(); |
| | | |
| | | ConveyorLineSignal conveyorLineSignalWrite = conveyorLineInfoWrite.Signal.ByteToBoolObject<ConveyorLineSignal>(); |
| | | if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) |
| | | { |
| | | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK) |
| | | { |
| | | if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode)) |
| | | { |
| | | WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode); |
| | | if (content.Status) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: item.StackerCraneStationCode, deviceCode: task.Roadway, nextAddress: task.TargetAddress); |
| | | } |
| | | #region |
| | | //if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) |
| | | //{ |
| | | // if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK) |
| | | // { |
| | | // if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode)) |
| | | // { |
| | | // WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode); |
| | | // if (content.Status) |
| | | // { |
| | | // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | // } |
| | | // } |
| | | // } |
| | | // else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) |
| | | // { |
| | | // Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); |
| | | // if (task != null) |
| | | // { |
| | | // _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: item.StackerCraneStationCode, deviceCode: task.Roadway, nextAddress: task.TargetAddress); |
| | | // } |
| | | |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | } |
| | | // device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | // } |
| | | |
| | | } |
| | | else if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) |
| | | //} |
| | | #endregion |
| | | //2016åºåºç«å°ä»»å¡å®æ |
| | | if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) |
| | | { |
| | | if (conveyorLineSignalRead.STB) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | Thread.Sleep(500); |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | _taskService.TaskCompleted(conveyorLineInfoRead.TaskNum); |
| | | } |
| | | Thread.Sleep(500); |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | } |
| | | else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt()) |
| | | { |
| | | //å¤æç©ºä¸è¿å»åºåºç©ºé² |
| | | if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && !conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && !string.IsNullOrEmpty(x.NextAddress)); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StackerCraneCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && !string.IsNullOrEmpty(x.NextAddress)); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, nextAddress: item.StationCode, deviceCode: item.StackerCraneCode, targetAddress: item.StationCode); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, nextAddress: item.StackerCraneStationCode, deviceCode: item.StackerCraneCode, targetAddress: item.StationCode); |
| | | } |
| | | } |
| | | |
| | | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)//å
¥åº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.DeviceCode == item.StationDeviceCode && x.NextAddress == item.StationCode); |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | |
| | | } |
| | | else |
| | | { |
| | | #region åºåº |
| | | if (!conveyorLineSignalWrite.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == item.StationDeviceCode); |
| | |
| | | _taskService.TaskCompleted(conveyorLineInfoRead.TaskNum); |
| | | device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | | else if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt()) |
| | |
| | | { |
| | | WriteInfo(device.DeviceName, $"æªæ¾å°è®¾å¤åç¼å·{item.StationCode}çå议信æ¯"); |
| | | } |
| | | R_ConveyorLineInfo conveyorLineInfoRead1 = device.Communicator.ReadCustomer<R_ConveyorLineInfo>(deviceProRead.DeviceProAddress); |
| | | W_ConveyorLineInfo conveyorLineInfoWrite1 = device.Communicator.ReadCustomer<W_ConveyorLineInfo>(deviceProWrite.DeviceProAddress); |
| | | R_ConveyorLineStatus conveyorLineStatus1 = conveyorLineInfoRead1.Status.ByteToBoolObject<R_ConveyorLineStatus>(); |
| | | ConveyorLineSignal conveyorLineSignalRead1 = conveyorLineInfoRead1.Signal.ByteToBoolObject<ConveyorLineSignal>(); |
| | | ConveyorLineSignal conveyorLineSignalWrite1 = conveyorLineInfoWrite1.Signal.ByteToBoolObject<ConveyorLineSignal>(); |
| | | if (item.StationCode == "2005") |
| | | { |
| | | if (conveyorLineSignalRead1.STB && conveyorLineStatus1.Online && conveyorLineStatus1.Goods && !conveyorLineStatus1.Alarm && !conveyorLineSignalWrite1.ACK) |
| | | { |
| | | StackerCraneJob_PP.pPReadData.R_PP_Boxcode = device.Communicator.Read<string>("DB900.578.0"); |
| | | } |
| | | StackerCraneJob_PP.pPReadData.R_PP_HandShake5 = conveyorLineStatus1.HandShake; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Online5 = conveyorLineStatus1.Online; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Free5 = conveyorLineStatus1.Free; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Goods5 = conveyorLineStatus1.Goods; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Alarm5 = conveyorLineStatus1.Alarm; |
| | | StackerCraneJob_PP.pPReadData.R_PP_STB5 = conveyorLineSignalRead1.STB; |
| | | StackerCraneJob_PP.pPReadData.R_PP_ACK5 = conveyorLineSignalRead1.ACK; |
| | | StackerCraneJob_PP.pPReadData.W_PP_STB5 = conveyorLineSignalWrite1.STB; |
| | | StackerCraneJob_PP.pPReadData.W_PP_ACK5 = conveyorLineSignalWrite1.ACK; |
| | | }else if(item.StationCode == "2016") |
| | | { |
| | | StackerCraneJob_PP.pPReadData.R_PP_HandShake6 = conveyorLineStatus1.HandShake; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Online6 = conveyorLineStatus1.Online; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Free6 = conveyorLineStatus1.Free; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Goods6 = conveyorLineStatus1.Goods; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Alarm6 = conveyorLineStatus1.Alarm; |
| | | StackerCraneJob_PP.pPReadData.R_PP_STB6 = conveyorLineSignalRead1.STB; |
| | | StackerCraneJob_PP.pPReadData.R_PP_ACK6 = conveyorLineSignalRead1.ACK; |
| | | StackerCraneJob_PP.pPReadData.W_PP_STB6 = conveyorLineSignalWrite1.STB; |
| | | StackerCraneJob_PP.pPReadData.W_PP_ACK6 = conveyorLineSignalWrite1.ACK; |
| | | } |
| | | else if (item.StationCode == "2016") |
| | | { |
| | | StackerCraneJob_PP.pPReadData.R_PP_HandShake7 = conveyorLineStatus1.HandShake; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Online7 = conveyorLineStatus1.Online; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Free7 = conveyorLineStatus1.Free; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Goods7 = conveyorLineStatus1.Goods; |
| | | StackerCraneJob_PP.pPReadData.R_PP_Alarm7 = conveyorLineStatus1.Alarm; |
| | | StackerCraneJob_PP.pPReadData.R_PP_STB7 = conveyorLineSignalRead1.STB; |
| | | StackerCraneJob_PP.pPReadData.R_PP_ACK7 = conveyorLineSignalRead1.ACK; |
| | | StackerCraneJob_PP.pPReadData.W_PP_STB7 = conveyorLineSignalWrite1.STB; |
| | | StackerCraneJob_PP.pPReadData.W_PP_ACK7 = conveyorLineSignalWrite1.ACK; |
| | | } |
| | | } |
| | | } |
| | | |