wangxinhui
2025-11-30 f2b85c65234e0dcdd3fcce4dafbe16933b7f1b48
ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs
@@ -22,28 +22,21 @@
    {
        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)
@@ -62,16 +55,39 @@
        {
            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).Replace("\0", "");
                if (containerFlowDTO.ContainerCode!= PickBarCode) throw new Exception($"传入料箱码{containerFlowDTO.ContainerCode},输送料箱码{PickBarCode}数据错误");
                commonConveyorLine.SetValue(ConveyorLineDBName.W_PickToHode,(short)containerFlowDTO.Direction.ObjToInt(), stationManger.StationCode);
                content.OK();
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
        [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任务完成同步