| | |
| | | { |
| | | #region çæä»»å¡åç»è¾é线å¯å¨ä¿¡å· |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) /*&& x.DeviceCode == item.StationDeviceCode*/ && (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.WarehouseId == warehouseDevice.WarehouseId); |
| | | if (task != null && conveyorLineInfoWrite.Spare2 == 0) |
| | | if (task != null && conveyorLineInfoWrite.Spare2 == 0 && conveyorLineStatus.Goods) |
| | | { |
| | | List<string> stations = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()).Select(x => x.NextPosi).ToList(); |
| | | WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations, task.TaskNum, conveyorLineInfoRead.Spare2); |
| | |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.Spare2, 1, item.StationCode); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: item.StationDeviceCode, roadwayNo: responseContent.Data.ToString() ?? ""); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (conveyorLineInfoWrite.Spare2 != 0) |
| | | { |
| | | WriteDebug(device.DeviceName, $"å¯å¨ä¿¡å·å·²åå
¥"); |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress, targetAddress: targetAddress, deviceCode: deviceCode); |
| | | } |
| | | else |
| | | { |
| | | WriteInfo(device.DeviceName, $"æªæ¾å°æç{conveyorLineInfoRead.Barcode}对åºçä»»å¡ä¿¡æ¯"); |
| | | } |
| | | #endregion |
| | | } |
| | | else//ç产éåº |
| | |
| | | WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations, task.TaskNum, conveyorLineInfoRead.Spare2); |
| | | if (responseContent.Status) |
| | | { |
| | | //string currentAddress = task.CurrentAddress; |
| | | //string nextAddress = task.NextAddress; |
| | | //string targetAddress = task.TargetAddress; |
| | | string roadwayNo = task.Roadway; |
| | | |
| | | string currentAddress = task.CurrentAddress; |
| | | string nextAddress = task.NextAddress; |
| | | string targetAddress = task.TargetAddress; |
| | | string deviceCode = task.DeviceCode; |
| | | TaskStatusEnum taskState = TaskStatusEnum.Line_Executing; |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, task.Roadway, task.TaskType); |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString(), task.TaskType); |
| | | Dt_Router? router = routers.FirstOrDefault(); |
| | | if (routers == null || routers.Count == 0 || router == null) |
| | | { |
| | |
| | | |
| | | if (router.IsEnd) |
| | | { |
| | | string? targetLoca = _taskService.RequestAssignLocationByHeight(task.TaskNum, task.Roadway, conveyorLineInfoRead.Spare2); |
| | | string? targetLoca = _taskService.RequestAssignLocationByHeight(task.TaskNum, responseContent.Data.ToString(), conveyorLineInfoRead.Spare2); |
| | | if (!string.IsNullOrEmpty(targetLoca)) |
| | | { |
| | | currentAddress = item.StackerCraneStationCode; |
| | | nextAddress = targetAddress; |
| | | taskState = TaskStatusEnum.SC_Execute; |
| | | targetAddress = targetLoca; |
| | | nextAddress = targetLoca; |
| | | taskState = TaskStatusEnum.SC_Execute; |
| | | deviceCode = item.StackerCraneCode; |
| | | roadwayNo = responseContent.Data.ToString(); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); |
| | | } |
| | | else |
| | |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress, targetAddress: targetAddress); |
| | | _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress, targetAddress: targetAddress, deviceCode: deviceCode, roadwayNo: roadwayNo); |
| | | } |
| | | #endregion |
| | | } |