| | |
| | | ConveyorLineSignal conveyorLineSignalRead = conveyorLineInfoRead.Signal.ByteToBoolObject<ConveyorLineSignal>(); |
| | | |
| | | ConveyorLineSignal conveyorLineSignalWrite = conveyorLineInfoWrite.Signal.ByteToBoolObject<ConveyorLineSignal>(); |
| | | |
| | | //妿æéææè
å
¥åºä»»å¡è¿è¡ç®¡æ§ |
| | | Dt_Task taskInControl = _taskRepository.QueryFirst(x => x.TaskType>=TaskTypeEnum.Inbound.ObjToInt() && x.WarehouseId== warehouseDevice.WarehouseId); |
| | | if (item.StationCode=="1511") |
| | | { |
| | | short isControl = device.GetValue<W_ConveyorLineDB, short>(W_ConveyorLineDB.Spare2, item.StationCode); |
| | | if (taskInControl!=null && isControl == 0) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.Spare2, 1, item.StationCode); |
| | | WriteDebug($"{item.StationCode}管æ§", $"ç®¡æ§æ§å¶"); |
| | | } |
| | | else if (isControl==1 && taskInControl==null) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.Spare2, 0, item.StationCode); |
| | | WriteDebug($"{item.StationCode}管æ§", $"ç®¡æ§æ¢å¤"); |
| | | } |
| | | } |
| | | if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt()) |
| | | { |
| | | //if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//å
¥åº |
| | | //{ |
| | | // List<string> stations = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()).Select(x => x.NextPosi).ToList(); |
| | | // WebResponseContent responseContent = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode, conveyorLineInfoRead.Spare2, stations); |
| | | // if (responseContent.Status) |
| | | // { |
| | | // Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.Barcode && x.CurrentAddress == item.StationCode && x.DeviceCode == device.DeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); |
| | | // if (task != null) |
| | | // { |
| | | // device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | // _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//å
¥åº |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | else if (conveyorLineSignalRead.STB /*&& conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm*/ && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)//åºåº |
| | | else if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)//åºåº |
| | | { |
| | | WriteDebug(device.DeviceName, $"ä»»å¡å®æ,ä»»å¡å·:{conveyorLineInfoRead.TaskNum}"); |
| | | _taskService.TaskCompleted(conveyorLineInfoRead.TaskNum); |
| | |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | } |
| | | } |
| | | //å
许æ¾è¡ä¸å·å¼æå£åºåºä»»å¡ |
| | | bool outAllowLine1 = device.Communicator.Read<bool>("DB14.4.6"); |
| | | if (outAllowLine1) |
| | | { |
| | | Dt_Task taskExcuting = _taskRepository.QueryFirst(x => x.WarehouseId== warehouseDevice.WarehouseId && (x.TargetAddress== "SCUTL-001" || x.TargetAddress == "1101") |
| | | && (x.TaskState==TaskStatusEnum.SC_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt() |
| | | || x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt())); |
| | | Dt_Task? taskExecute = _taskRepository.QueryData(x => x.WarehouseId == warehouseDevice.WarehouseId && x.TargetAddress == "SCUTL-001" |
| | | && x.TaskState==TaskStatusEnum.MesPending.ObjToInt()).OrderByDescending(x=>x.Grade).ThenBy(x=>x.TaskNum).ThenBy(x=>x.CreateDate).FirstOrDefault(); |
| | | if (taskExcuting == null && taskExecute!=null) |
| | | { |
| | | _taskService.UpdateTask(taskExecute, TaskStatusEnum.SC_Execute); |
| | | WriteDebug($"ä¸å·å¼æå£æ¾è¡ä»»å¡", $"ä»»å¡å·{taskExecute.TaskNum}"); |
| | | } |
| | | } |
| | | //å
许æ¾è¡äºå·å¼æå£åºåºä»»å¡ |
| | | bool outAllowLine2 = device.Communicator.Read<bool>("DB14.12.6"); |
| | | if (outAllowLine2) |
| | | { |
| | | Dt_Task taskExcuting = _taskRepository.QueryFirst(x => x.WarehouseId == warehouseDevice.WarehouseId && (x.TargetAddress == "SCUTL-002" || x.TargetAddress == "1103") |
| | | && (x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt() |
| | | || x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt())); |
| | | Dt_Task? taskExecute = _taskRepository.QueryData(x => x.WarehouseId == warehouseDevice.WarehouseId && x.TargetAddress == "SCUTL-002" |
| | | && x.TaskState == TaskStatusEnum.MesPending.ObjToInt()).OrderByDescending(x => x.Grade).ThenBy(x => x.TaskNum).ThenBy(x => x.CreateDate).FirstOrDefault(); |
| | | if (taskExcuting == null && taskExecute != null) |
| | | { |
| | | _taskService.UpdateTask(taskExecute, TaskStatusEnum.SC_Execute); |
| | | WriteDebug($"äºå·å¼æå£æ¾è¡ä»»å¡", $"ä»»å¡å·{taskExecute.TaskNum}"); |
| | | } |
| | | } |
| | | //å
许æ¾è¡æå¨å¼æå£åºåºä»»å¡ |
| | | bool outAllowMusual = device.Communicator.Read<bool>("DB14.4.7"); |
| | | if (outAllowMusual) |
| | | { |
| | | Dt_Task taskExcuting = _taskRepository.QueryFirst(x => x.WarehouseId == warehouseDevice.WarehouseId && (x.TargetAddress == "SCUTL_04-001" || x.TargetAddress == "1102") |
| | | && (x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt() |
| | | || x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt())); |
| | | Dt_Task? taskExecute = _taskRepository.QueryData(x => x.WarehouseId == warehouseDevice.WarehouseId && x.TargetAddress == "SCUTL_04-001" |
| | | && x.TaskState == TaskStatusEnum.MesPending.ObjToInt()).OrderByDescending(x => x.Grade).ThenBy(x => x.TaskNum).ThenBy(x => x.CreateDate).FirstOrDefault(); |
| | | if (taskExcuting == null && taskExecute != null) |
| | | { |
| | | _taskService.UpdateTask(taskExecute, TaskStatusEnum.SC_Execute); |
| | | WriteDebug($"æå¨å¼æå£æ¾è¡ä»»å¡", $"ä»»å¡å·{taskExecute.TaskNum}"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |