| | |
| | | { |
| | | var task = _taskRepository.QueryFirst(x => secureApplyModel.ReceiveTaskID.ObjToInt() == x.TaskNum); |
| | | if (task == null) throw new Exception("æªæ¾å°ä»»å¡"); |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | var content = TakeRequest(task.CurrentAddress); |
| | | if (!content.Status) |
| | |
| | | if (task == null) throw new Exception($"æªæ¾å°ä»»å¡,ä»»å¡å·ã{agvUpdateModel.ReceiveTaskID}ã"); |
| | | switch (agvUpdateModel.GoodsState) |
| | | { |
| | | //case 1://åºåºæ ¹æ®è¿ä¸ªä¿¡å·å¤æåè´§å®æ |
| | | // if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | // { |
| | | // var content = TakeFinish(task.CurrentAddress); |
| | | // if (!content.Status) throw new Exception(content.Message); |
| | | // task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); |
| | | // var up = _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.èªå¨å®æ); |
| | | // _taskService.TaskCompleted(task.TaskNum); |
| | | // } |
| | | // break; |
| | | case 2://å
¥åºæ ¹æ®è¿ä¸ªä¿¡å·å¤ææ¾è´§å®æ |
| | | case "1"://åºåºæ ¹æ®è¿ä¸ªä¿¡å·å¤æåè´§å®æ |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | var content = TakeFinish(task.CurrentAddress); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | | }; |
| | | return agvResponse.OK("æå", "0"); |
| | | } |
| | | break; |
| | | case "2"://å
¥åºæ ¹æ®è¿ä¸ªä¿¡å·å¤ææ¾è´§å®æ |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress); |
| | |
| | | task.DeviceCode = dt_Station.StationDeviceCode; |
| | | var up = _taskRepository.UpdateData(task); |
| | | return agvResponse.OK("æå","0"); |
| | | } |
| | | else if(task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | return agvResponse.OK("æå", "0"); |
| | | } |
| | | break; |
| | | default: |
| | |
| | | [HttpPost, HttpGet, Route("TakeRequest"), AllowAnonymous] |
| | | public WebResponseContent TakeRequest(string code) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == code); |
| | | if (stationManger == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°é
ç½®"); |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°é
ç½®{code}"); |
| | | } |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºè®¾å¤"); |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºè®¾å¤{stationManger.StationDeviceCode}"); |
| | | } |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | |
| | | bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); |
| | | if (canPut) |
| | | short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); |
| | | if (Command == 2) |
| | | { |
| | | otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); |
| | | return WebResponseContent.Instance.OK(); |
| | | content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); |
| | | Thread.Sleep(1000); |
| | | canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); |
| | | if (canPut) |
| | | { |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error($"åè´§ç³è¯·ä¸"); |
| | | } |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == code); |
| | | if (stationManger == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°é
ç½®"); |
| | |
| | | } |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode); |
| | | Thread.Sleep(1000); |
| | | otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode); |
| | | if (device.DeviceCode.Contains("CP")) |
| | | { |
| | | otherDevice.SetValue(W_ConveyorLineCPDB.W_Command, 2, stationManger.StationCode); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |