| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Security.Policy; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | |
| | | if (conveyorLineInfoRead.TaskNum == 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//éè´å
¥åº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && (x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt())); |
| | | if(task != null) |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | |
| | | string currentAddress = task.CurrentAddress; |
| | | string nextAddress = task.NextAddress; |
| | | TaskStatusEnum taskState = TaskStatusEnum.Line_Executing; |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, task.Roadway, task.TaskType); |
| | | if (routers == null || routers.Count == 0) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºè·¯ç±ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | if (routers.Count > 1) |
| | | { |
| | | WriteError(item.StationName, $"è·¯ç±ä¿¡æ¯é
ç½®é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | Dt_Router router = routers.FirstOrDefault(); |
| | | if (router.IsEnd) |
| | | { |
| | | currentAddress = item.StackerCraneStationCode; |
| | | nextAddress = task.TargetAddress; |
| | | taskState = TaskStatusEnum.SC_Execute; |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | } |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, 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); |
| | | } |
| | | List<Dt_Router> routers = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()); |
| | | |
| | | List<string> stations = routers.Select(x => x.NextPosi).ToList(); |
| | | |
| | | WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations); |
| | | if (responseContent.Status) |
| | | else |
| | | { |
| | | WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode, responseContent.Data.ToString()); |
| | | if (content.Status) |
| | | { |
| | | task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && (x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt())); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | List<Dt_Router> routers = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | List<string> stations = routers.Select(x => x.NextPosi).ToList(); |
| | | |
| | | WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations); |
| | | if (responseContent.Status) |
| | | { |
| | | WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode, responseContent.Data.ToString()); |
| | | if (content.Status) |
| | | { |
| | | task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && (x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt())); |
| | | if (task != null) |
| | | { |
| | | Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && x.StartPosi == item.StationCode); |
| | | if (router == null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºè·¯ç±ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | string currentAddress = task.CurrentAddress; |
| | | string nextAddress = task.NextAddress; |
| | | TaskStatusEnum taskState = TaskStatusEnum.Line_Executing; |
| | | |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | if (router.NextPosi != task.NextAddress) |
| | | { |
| | | currentAddress = item.StackerCraneStationCode; |
| | | nextAddress = task.TargetAddress; |
| | | taskState = TaskStatusEnum.SC_Execute; |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, 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); |
| | | //continue; |
| | | |
| | | //_taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | |
| | | //device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | //device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | //device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | //device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | //device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | else//ç产éåº |
| | | { |
| | |
| | | if (task != null) |
| | | { |
| | | Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && x.StartPosi == item.StationCode); |
| | | if(router == null) |
| | | if (router == null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºè·¯ç±ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |