ÎļþÃû´Ó ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs ÐÞ¸Ä |
| | |
| | | _taskService = taskService; |
| | | _taskRepository = taskRepository; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// å®å
¨ä¿¡å·ç³è¯· AGV-WCS |
| | | /// </summary> |
| | |
| | | agvResponseContent.ReqCode = secureApplyModel.ReqCode; |
| | | try |
| | | { |
| | | var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode== x.AgvTaskNum); |
| | | var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode == x.AgvTaskNum); |
| | | if (task == null) throw new Exception("æªæ¾å°ä»»å¡"); |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | | var content = TakeRequest(task.CurrentAddress); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | | } |
| | | //if (!content.Status) |
| | | //{ |
| | | // throw new Exception(content.Message); |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | var content = PutRequest(task.NextAddress, task.PalletType); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | | } |
| | | //if (!content.Status) |
| | | //{ |
| | | // throw new Exception(content.Message); |
| | | //} |
| | | } |
| | | task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); |
| | | var up = _taskRepository.UpdateData(task); |
| | |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | | var content = TakeRequest(task.CurrentAddress); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | //if (!content.Status) throw new Exception(content.Message); |
| | | } |
| | | else |
| | | { |
| | | var content = PutRequest(task.NextAddress, task.PalletType); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | //if (!content.Status) throw new Exception(content.Message); |
| | | } |
| | | task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); |
| | | var up = _taskRepository.UpdateData(task); |
| | |
| | | { |
| | | var content = PutFinish(task.NextAddress); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | Dt_StationManger dt_Station=_stationMangerRepository.QueryFirst(x=>x.AGVStationCode== task.NextAddress); |
| | | if (dt_Station==null) |
| | | Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress); |
| | | if (dt_Station == null) |
| | | { |
| | | throw new Exception($"{task.NextAddress}AGVç«å°æªå®ä¹"); |
| | | } |
| | | task.CurrentAddress = dt_Station.StationCode; |
| | | task.NextAddress = ""; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); |
| | | task.DeviceCode = "SC01_CSJ"; |
| | | var up = _taskRepository.UpdateData(task); |
| | | agvResponseContent.Code = up ? "0" : "1"; |
| | |
| | | bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode); |
| | | if (canPut) |
| | | { |
| | | otherDevice.SetValue(GroundStationDBName.W_PutRequest, true, stationManger.StationCode); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | |
| | | bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); |
| | | if (canPut) |
| | | { |
| | | otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |