| | |
| | | { |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | private readonly IRouterExtension _routerExtension; |
| | | //private readonly WebSocketServer _webSocketServer; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | |
| | | public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IRouterExtension routerExtension/*, WebSocketServer webSocketServer*/, IStationMangerRepository stationMangerRepository) : base(service) |
| | | public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IRouterExtension routerExtension, IStationMangerRepository stationMangerRepository) : base(service) |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | _routerExtension = routerExtension; |
| | | _stationMangerRepository=stationMangerRepository; |
| | | //_webSocketServer = webSocketServer; |
| | | } |
| | | |
| | | [HttpPost, Route("ReceiveTask"), AllowAnonymous] |
| | | public WebResponseContent ReceiveWMSTask([FromBody] List<WMSTaskDTO> taskDTOs) |
| | | public WebResponseContent ReceiveWMSTask([FromBody] WMSTaskDTO taskDTO) |
| | | { |
| | | return Service.ReceiveWMSTask(taskDTOs); |
| | | return Service.ReceiveWMSTask(taskDTO); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("RequestAssignLocation"), AllowAnonymous] |
| | | public string? RequestAssignLocation(int taskNum, string roadwayNo) |
| | | { |
| | | return Service.RequestAssignLocation(taskNum, roadwayNo); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("UpdateTaskExceptionMessage")] |
| | | public WebResponseContent UpdateTaskExceptionMessage(int taskNum, string message) |
| | |
| | | { |
| | | return Service.RollbackTaskStatusToLast(taskNum); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 容卿µå¨æ¥å£ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("ContainerFlow"), AllowAnonymous] |
| | | public WebResponseContent ContainerFlow([FromBody] ContainerFlowDTO containerFlowDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x=>x.PickStationCode==containerFlowDTO.SlotCode) ?? throw new Exception($"{containerFlowDTO.SlotCode}æ£éä½ç½®ä¸åå¨"); |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºè®¾å¤{stationManger.StationDeviceCode}"); |
| | | } |
| | | CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device; |
| | | string PickBarCode = commonConveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.R_PickBarCode, stationManger.StationCode).Trim(); |
| | | if (containerFlowDTO.ContainerCode!= PickBarCode) throw new Exception($"ä¼ å
¥æç®±ç {containerFlowDTO.ContainerCode}ï¼è¾éæç®±ç {PickBarCode}æ°æ®é误"); |
| | | if (containerFlowDTO.Direction=="100") |
| | | { |
| | | WebResponseContent responseContent = Service.ContainerFlow(containerFlowDTO, stationManger.StationDeviceCode); |
| | | if (!responseContent.Status) throw new Exception(responseContent.Message); |
| | | } |
| | | commonConveyorLine.SetValue(ConveyorLineDBName.W_PickToHode,(short)containerFlowDTO.Direction.ObjToInt(), stationManger.StationCode); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// ç³è¯·å
¥åº |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("RequestInTask"), AllowAnonymous] |
| | | public WebResponseContent RequestInTask(string stationCode, string barCode) |
| | | { |
| | | return Service.RequestInTask(stationCode, barCode); |
| | | } |
| | | [HttpPost, HttpGet, Route("GetRouteEndPoint"), AllowAnonymous] |
| | | public WebResponseContent GetRouteEndPoint(string startPoint, int routeType) |
| | | { |
| | | return WebResponseContent.Instance.OK(data: _routerExtension.GetEndPoint(startPoint, routeType)); |
| | | } |
| | | [HttpPost, HttpGet, Route("AssignCPRoadwayNo"), AllowAnonymous] |
| | | public WebResponseContent AssignCPRoadwayNo() |
| | | { |
| | | return Service.AssignCPRoadwayNo(); |
| | | } |
| | | /// <summary> |
| | | /// WMSä»»å¡å®æåæ¥ |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("RecWMSTaskCompleted"), AllowAnonymous] |
| | | public WebResponseContent RecWMSTaskCompleted(int taskNum) |
| | | [HttpPost, HttpGet, Route("RecTaskCompleted"), AllowAnonymous] |
| | | public WebResponseContent RecTaskCompleted(int taskNum) |
| | | { |
| | | return Service.RecWMSTaskCompleted(taskNum); |
| | | return Service.TaskCompleted(taskNum); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// WMSä»»å¡åæ¶åæ¥ |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("CancelTask"), AllowAnonymous] |
| | | public WebResponseContent CancelTask(List<TaskCancel> taskCancels) |
| | | { |
| | | return WebResponseContent.Instance.Error(); |
| | | } |
| | | } |
| | | } |