wangxinhui
2025-10-26 733c975cd8647f6d006736f1863bad731e32e6fb
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs
@@ -7,9 +7,14 @@
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
{
@@ -20,11 +25,13 @@
        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;
        }
@@ -62,17 +69,6 @@
        public WebResponseContent RollbackTaskStatusToLast(int taskNum)
        {
            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]
@@ -119,10 +115,42 @@
        {
            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);
            }
        }
    }
}