| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseController; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_Tasks; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_Tasks.DBNames; |
| | | using WIDESEAWCS_Tasks.StackPlateJob; |
| | | |
| | | namespace WIDESEAWCS_WCSServer.Controllers.Task |
| | | { |
| | |
| | | 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*/) : base(service) |
| | | public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IRouterExtension routerExtension/*, WebSocketServer webSocketServer*/, IStationMangerRepository stationMangerRepository) : base(service) |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | _routerExtension = routerExtension; |
| | | _stationMangerRepository=stationMangerRepository; |
| | | //_webSocketServer = webSocketServer; |
| | | } |
| | | |
| | |
| | | return Service.RollbackTaskStatusToLast(taskNum); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åå¤AGVå®å
¨ä¿¡å· |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("SendSecureReplyToAgv")] |
| | | public WebResponseContent SendSecureReplyToAgv(int taskNum) |
| | | { |
| | | return Service.SendSecureReplyToAgv(taskNum); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("GetRouteEndPoint"), AllowAnonymous] |
| | | public WebResponseContent GetRouteEndPoint(string startPoint, int routeType) |
| | | { |
| | | return WebResponseContent.Instance.OK(data: _routerExtension.GetEndPoint(startPoint, routeType)); |
| | | } |
| | | [HttpPost, HttpGet, Route("AgvCarrying"), AllowAnonymous] |
| | | public WebResponseContent AgvCarrying(int row, int startColumn, int endColumn, int layer, int targetLayer) |
| | | /// <summary> |
| | | /// æµè¯å åæºåºåº |
| | | /// </summary> |
| | | [HttpPost, HttpGet, Route("SCOUT"), AllowAnonymous] |
| | | public WebResponseContent SCCarrying(string sourceAddress, string roadWay, int taskType) |
| | | { |
| | | return Service.AgvCarrying(row, startColumn, endColumn, layer, targetLayer); |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | { |
| | | Id = 1, |
| | | SourceAddress = sourceAddress, |
| | | TaskNum = DateTime.Now.ToString("mmss").ObjToInt(), |
| | | PalletCode= roadWay+ DateTime.Now.ToString("mmss"), |
| | | RoadWay = roadWay, |
| | | TaskType = taskType, |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TargetAddress = "", |
| | | Grade = 0, |
| | | WarehouseId = 1, |
| | | PalletType = 1 |
| | | }; |
| | | return Service.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | //[HttpPost, HttpGet, Route("WebSocketPushMessage"), AllowAnonymous] |
| | | //public WebResponseContent WebSocketPushMessage(string message) |
| | | //{ |
| | | // try |
| | | // { |
| | | // _webSocketServer.PublishAllClientPayload(message); |
| | | // return WebResponseContent.Instance.OK(); |
| | | // } |
| | | // catch(Exception ex) |
| | | // { |
| | | // return WebResponseContent.Instance.Error(ex.Message); |
| | | // } |
| | | //} |
| | | [HttpPost, HttpGet, Route("AssignCPRoadwayNo"), AllowAnonymous] |
| | | public WebResponseContent AssignCPRoadwayNo() |
| | | { |
| | | return Service.AssignCPRoadwayNo(); |
| | | } |
| | | /// <summary> |
| | | /// 请æ±å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// <param name="roadWay">å··é</param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("SCIN"), AllowAnonymous] |
| | | public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress, string roadWay, int taskType = 0) |
| | | { |
| | | return Service.RequestWMSTaskSimple(palletCode,sourceAddress, roadWay, taskType); |
| | | } |
| | | /// <summary> |
| | | /// WMSä»»å¡å®æåæ¥ |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("RecWMSTaskCompleted"), AllowAnonymous] |
| | | public WebResponseContent RecWMSTaskCompleted(int taskNum) |
| | | { |
| | | return Service.RecWMSTaskCompleted(taskNum); |
| | | } |
| | | [HttpPost, HttpGet, Route("YLPurchasePush"), AllowAnonymous] |
| | | public WebResponseContent YLPurchasePush(string code) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == code); |
| | | |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | return content.Error($"æªæ¾å°å¯¹åºè®¾å¤"); |
| | | } |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | short request = otherDevice.GetValue<WR_CLineYLDB, short>(WR_CLineYLDB.WR_Request, stationManger.StationCode); |
| | | if (request!=86) |
| | | { |
| | | return content.Error($"设å¤ç¶æä¸å
许å¯å¨"); |
| | | } |
| | | otherDevice.SetValue(WR_CLineYLDB.WR_Reresult, 86, stationManger.StationCode); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |