| | |
| | | using System.Text.RegularExpressions; |
| | | using WIDESEA_DTO.Agv; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEAWCS_Common.APIEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Enums; |
| | |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Finish); |
| | | PutFinish(oldAddress, task.TaskNum); |
| | | } |
| | | else if (task.TaskType == TaskTypeEnum.WFBLMYLBackInbound.ObjToInt() || task.TaskType == TaskTypeEnum.WFBYLInbound.ObjToInt()) |
| | | { |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | } |
| | | else |
| | | { |
| | | task.CurrentAddress = dt_Station.StationCode; |
| | |
| | | /// <summary> |
| | | /// è·åæ¡æ¶æ¾æä¿¡å· |
| | | /// </summary> |
| | | public W_TrussCartonDB GetCartonPut(string StationCode) |
| | | private W_TrussCartonDB GetCartonPut(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | | { |
| | |
| | | /// <summary> |
| | | /// è·åæ¡æ¶è¯·æ±ä¿¡å· |
| | | /// </summary> |
| | | public W_TrussCartonDB GetCartonRequest(string StationCode) |
| | | private W_TrussCartonDB GetCartonRequest(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | | { |
| | |
| | | /// <summary> |
| | | /// è·åæ¡æ¶è¿å
¥ä¿¡å· |
| | | /// </summary> |
| | | public R_TrussCartonDB GetCarton(string StationCode) |
| | | private R_TrussCartonDB GetCarton(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | | { |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// AGVç¡®è®¤å®ææ¥å£(åæ¾) |
| | | /// </summary> |
| | | /// <param name="code"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("AGVFinish"), AllowAnonymous] |
| | | public WebResponseContent AGVFinish(string address,int taskNum) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x=>x.TaskNum==taskNum && x.DeviceCode=="AGV"); |
| | | if (task==null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"{taskNum}AGVä»»å¡ä¸åå¨"); |
| | | } |
| | | //è·å对åºçåæ ç¹ |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x=>x.AGVStationCode== address); |
| | | if (stationManger==null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"{address}AGVå°åç¼å·ä¸åå¨"); |
| | | } |
| | | if (task.TaskState == TaskStatusEnum.AGV_Executing.ObjToInt())//åè´§ |
| | | { |
| | | if (task.CurrentAddress != stationManger.StationCode) |
| | | { |
| | | return WebResponseContent.Instance.Error($"{taskNum}AGVä»»å¡åè´§å°åç¼å·ä¸æ¯{address}"); |
| | | } |
| | | AgvFinishDTO agvFinishDTO = new AgvFinishDTO() |
| | | { |
| | | ReceiveTaskID = task.TaskNum.ToString(), |
| | | Variables = new List<PointDetail>() |
| | | { |
| | | new PointDetail() |
| | | { |
| | | Code="isPick", |
| | | Value="true" |
| | | } |
| | | } |
| | | }; |
| | | //åéAGV宿éç¥ |
| | | WebResponseContent content = _taskService.AGVFinish(agvFinishDTO); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | } |
| | | else//æ¾è´§ |
| | | { |
| | | if (task.NextAddress != stationManger.StationCode) |
| | | { |
| | | return WebResponseContent.Instance.Error($"{taskNum}AGV任塿¾è´§å°åç¼å·ä¸æ¯{address}"); |
| | | } |
| | | AgvFinishDTO agvFinishDTO = new AgvFinishDTO() |
| | | { |
| | | ReceiveTaskID = task.TaskNum.ToString(), |
| | | Variables = new List<PointDetail>() |
| | | { |
| | | new PointDetail() |
| | | { |
| | | Code="isDown", |
| | | Value="true" |
| | | } |
| | | } |
| | | }; |
| | | //åéAGV宿éç¥ |
| | | WebResponseContent content = _taskService.AGVFinish(agvFinishDTO); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |