| | |
| | | if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) |
| | | { |
| | | |
| | | Dt_Task task = _taskRepository.QueryFirst(x =>x.DeviceCode== device.DeviceCode && x.TargetAddress==item.StationCode && x.NextAddress==item.StationCode && x.TaskState == TaskStatusEnum.AGV_Finish.ObjToInt() && x.CurrentAddress == item.Remark); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress==item.StationCode && string.IsNullOrEmpty(x.TargetAddress) && string.IsNullOrEmpty(x.NextAddress) && x.TaskState == TaskStatusEnum.AGV_Finish.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | if (isCanPut) |
| | | { |
| | | device.SetValue(GroundStationDBName.W_PutRequest, true, item.StationCode); |
| | | device.SetValue(GroundStationDBName.W_PutPalletType, task.PalletType, item.StationCode);//task.PalletType |
| | | } |
| | | //夿AGVä»»å¡å®æï¼ååç»å°é¢ç«æ¾è´§å®æ |
| | | device.SetValue(GroundStationDBName.W_PutFinish, true, item.StationCode); |
| | | |
| | | string oldAddress = task.NextAddress; |
| | | int oldStatus = task.TaskState; |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | | if (stationManger == null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | string? locationCode = "SC01_ZH-001-027-001-02";// _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode); |
| | | //string? locationCode = "SC01_ZH-001-027-001-02";// |
| | | string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode); |
| | | if (string.IsNullOrEmpty(locationCode)) |
| | | { |
| | | WriteError(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(device.DeviceCode, $"{item}交äºé误", ex); |
| | | } |
| | | } |
| | | |
| | | foreach (var item in stationMangers.Where(x => !deviceStations.Contains(x.StationCode))) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); |
| | | if (task != null) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | | if (stationManger == null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode); |
| | | if (string.IsNullOrEmpty(locationCode)) |
| | | { |
| | | WriteError(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: stationManger.StackerCraneStationCode, targetAddress: locationCode, nextAddress: locationCode, deviceCode: stationManger.StackerCraneCode); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |