xiazhengtongxue
2026-02-09 e81c782b3e7a632ffb8e32be56fce931a8c89ae6
ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs
@@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Text;
using WIDESEA_External.Model;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseController;
@@ -12,6 +13,7 @@
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_TaskInfoService;
using WIDESEAWCS_Tasks;
using WIDESEAWCS_Tasks.DBNames;
@@ -33,7 +35,7 @@
        }
        [HttpPost, Route("ReceiveTask"), AllowAnonymous]
        public WebResponseContent ReceiveWMSTask([FromBody] WMSTaskDTO taskDTO)
        public WMSReceiveTaskContent ReceiveWMSTask([FromBody] WMSTaskDTO taskDTO)
        {
            return Service.ReceiveWMSTask(taskDTO);
        }
@@ -81,22 +83,33 @@
                        byte[] bytesPick = commonConveyorLine.Communicator.Read("2", 5);
                        string PickBarCode = Encoding.UTF8.GetString(bytesPick).Replace("\0", "").Replace("\\0", "");
                        if (containerFlowDTO.ContainerCode != PickBarCode) throw new Exception($"传入料箱码{containerFlowDTO.ContainerCode},输送料箱码{PickBarCode}数据错误");
                        if (containerFlowDTO.Direction == "100")
                        {
                            WebResponseContent responseContent = Service.ContainerFlow(containerFlowDTO, stationManger.StationDeviceCode, stationManger.PickStationCode);
                            if (!responseContent.Status) throw new Exception(responseContent.Message);
                        }
                        //if (containerFlowDTO.Direction == "100")
                        //{
                        //    WebResponseContent responseContent = Service.ContainerFlow(containerFlowDTO, stationManger.StationDeviceCode, stationManger.PickStationCode);
                        //    if (!responseContent.Status) throw new Exception(responseContent.Message);
                        //}
                        commonConveyorLine.Communicator.Write("22", (containerFlowDTO.Direction == "100" ? new byte[] { 1, 0 } : new byte[] { 2, 0 }));
                    }
                    else
                    {
                        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, stationManger.PickStationCode);
                            if (!responseContent.Status) throw new Exception(responseContent.Message);
                            short W_PickToHode = commonConveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.W_PickToHode, stationManger.StationCode);
                            if (W_PickToHode == 300)
                            {
                                WebResponseContent responseContent = Service.ContainerFlow(containerFlowDTO, stationManger.StationDeviceCode, stationManger.PickStationCode);
                                if (!responseContent.Status) throw new Exception(responseContent.Message);
                            }
                            else
                            {
                                throw new Exception($"传入料箱码{containerFlowDTO.ContainerCode},输送料状态:{W_PickToHode},不满足入库条件");
                            }
                        }
                        commonConveyorLine.SetValue(ConveyorLineDBName.W_PickToHode, (short)containerFlowDTO.Direction.ObjToInt(), stationManger.StationCode);
                    }
@@ -115,7 +128,7 @@
        /// <returns></returns>
        [HttpPost, HttpGet, Route("InitLight"), AllowAnonymous]
        public WebResponseContent InitLight()
        {
        {
            return Service.InitLight();
        }
        /// <summary>
@@ -160,16 +173,35 @@
        {
            return Service.TaskCompleted(taskNum);
        }
        /// <summary>
        /// äººå·¥æ‰‹åŠ¨å–æ¶ˆæŒ‡å®šä»»åŠ¡
        /// </summary>
        /// <param name="taskNum">任务编号</param>
        /// <returns>操作结果</returns>
        [HttpPost, HttpGet, Route("ManualTaskCancellation"), AllowAnonymous]
        public WebResponseContent ManualTaskCancellation(int taskNum)
        {
            return Service.ManualTaskCancellation(taskNum);
        }
        /// WMS任务取消同步
        /// </summary>
        /// <param name="taskCancels"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("CancelTask"), AllowAnonymous]
        public WebResponseContent CancelTask([FromBody] List<TaskCancel> taskCancels)
        {
            return Service.TaskCancel(taskCancels); ;
        }
        /// <summary>
        /// WMS任务取消同步
        /// æŠŠä»»åС异叏900修改为AGV执行中300
        /// </summary>
        /// <param name="taskNum"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("CancelTask"), AllowAnonymous]
        public WebResponseContent CancelTask(List<TaskCancel> taskCancels)
        [HttpPost, HttpGet, Route("ResetAllExceptionTask"), AllowAnonymous]
        public WebResponseContent ResetAllExceptionTask(int taskNum)
        {
            return WebResponseContent.Instance.Error();
            return Service.ResetAllExceptionTask(taskNum);
        }
    }
}