1
xiazhengtongxue
2026-03-27 5d55a31d8ce95e511ffb408f38ed06e81742b67e
ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.IO;
using System.Text;
using WIDESEA_External.Model;
using WIDESEAWCS_Common.TaskEnum;
@@ -88,22 +89,29 @@
                        //    WebResponseContent responseContent = Service.ContainerFlow(containerFlowDTO, stationManger.StationDeviceCode, stationManger.PickStationCode);
                        //    if (!responseContent.Status) throw new Exception(responseContent.Message);
                        //}
                        WriteLog.Write_Log("一期容器流动入库接口", "任务信息", $"返回输送线{stationManger.PickStationCode}", $"返回给输送线的任务信息:{containerFlowDTO.ToJson()}");
                        commonConveyorLine.Communicator.Write("22", (containerFlowDTO.Direction == "100" ? new byte[] { 1, 0 } : new byte[] { 2, 0 }));
                    }
                    else
                    {
                        Thread.Sleep(500);
                        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}数据错误");
                        int W_PickToHode = commonConveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.W_PickToHode, stationManger.StationDeviceCode);
                        if (containerFlowDTO.Direction == "100" && W_PickToHode == 300)
                        if (containerFlowDTO.Direction == "100")
                        {
                            short W_PickToHode = commonConveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.W_PickToHode, stationManger.StationCode);
                            if (W_PickToHode != 300)
                            {
                                commonConveyorLine.SetValue(ConveyorLineDBName.W_PickToHode, (short)300, stationManger.StationCode);
                                WriteLog.Write_Log("二期容器流动入库接口", "任务信息", $"PLC信号300", $"输送料状态:{W_PickToHode},不满足入库条件,强制入库写入300");
                            }
                            WebResponseContent responseContent = Service.ContainerFlow(containerFlowDTO, stationManger.StationDeviceCode, stationManger.PickStationCode);
                            if (!responseContent.Status) throw new Exception(responseContent.Message);
                        }
                        WriteLog.Write_Log($"容器流动{stationManger.StationCode}", $"输送线信息", "开始入库", $"状态{containerFlowDTO.Direction},料箱码{containerFlowDTO.ContainerCode}");
                        WriteLog.Write_Log("二期容器流动入库接口", "任务信息", $"返回输送线{stationManger.PickStationCode}", $"返回给输送线的任务信息:{containerFlowDTO.ToJson()}");
                        commonConveyorLine.SetValue(ConveyorLineDBName.W_PickToHode, (short)containerFlowDTO.Direction.ObjToInt(), stationManger.StationCode);
                    }
                    content.OK();
@@ -196,5 +204,15 @@
        {
            return Service.ResetAllExceptionTask(taskNum);
        }
        /// <summary>
        /// WMS异常恢复
        /// </summary>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("WmsRecovery"), AllowAnonymous]
        public WebResponseContent WmsRecovery()
        {
            return Service.WmsRecovery();
        }
    }
}