wangxinhui
2 天以前 2c889b38311883ceb703c4e0034c798fdaa2e21c
更新代码,货位分配优化等
已修改22个文件
849 ■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP仓/StackerCraneJob_PP.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/成品仓/AGV_CPExtend.cs 275 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/阻焊仓/AGV_ZHExtend.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/阻焊仓/AGV_ZHJob.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/ProInStaticDTO.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ProInStatisticsService.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs
@@ -100,6 +100,12 @@
        AGV_TakeError = 335,
        /// <summary>
        /// AGV放货写入异常
        /// </summary>
        [Description("AGV取货写入异常")]
        AGV_PutError = 340,
        /// <summary>
        /// ä»»åŠ¡å®Œæˆ
        /// </summary>
        [Description("任务完成")]
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs
@@ -46,22 +46,22 @@
            {
                var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode == x.AgvTaskNum);
                if (task == null) throw new Exception("未找到任务");
                if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                {
                    var content = TakeRequest(task.CurrentAddress);
                    //if (!content.Status)
                //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                    //{
                    //    throw new Exception(content.Message);
                //    var content = TakeRequest(task.CurrentAddress);
                //    //if (!content.Status)
                //    //{
                //    //    throw new Exception(content.Message);
                //    //}
                    //}
                }
                else
                {
                    var content = PutRequest(task.NextAddress, task.PalletType);
                    //if (!content.Status)
                //else
                    //{
                    //    throw new Exception(content.Message);
                //    var content = PutRequest(task.NextAddress, task.PalletType);
                //    //if (!content.Status)
                //    //{
                //    //    throw new Exception(content.Message);
                //    //}
                    //}
                }
                task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt();
                var up = _taskRepository.UpdateData(task);
                agvResponseContent.Code = up ? "0" : "1";
@@ -114,16 +114,16 @@
                        break;
                    case "getSafetySignal"://安全信号申请
                        {
                            if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                            {
                                var content = TakeRequest(task.CurrentAddress);
                                //if (!content.Status) throw new Exception(content.Message);
                            }
                            else
                            {
                                var content = PutRequest(task.NextAddress, task.PalletType);
                                //if (!content.Status) throw new Exception(content.Message);
                            }
                            //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                            //{
                            //    var content = TakeRequest(task.CurrentAddress);
                            //    //if (!content.Status) throw new Exception(content.Message);
                            //}
                            //else
                            //{
                            //    var content = PutRequest(task.NextAddress, task.PalletType);
                            //    //if (!content.Status) throw new Exception(content.Message);
                            //}
                            task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt();
                            var up = _taskRepository.UpdateData(task);
                            agvResponseContent.Code = up ? "0" : "1";
@@ -134,7 +134,12 @@
                        if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt())
                        {
                            var content = PutFinish(task.NextAddress);
                            if (!content.Status) throw new Exception(content.Message);
                            if (!content.Status)
                            {
                                task.TaskState = TaskStatusEnum.AGV_PutError.ObjToInt();
                                _taskRepository.UpdateData(task);
                                throw new Exception(content.Message);
                            }
                            Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress);
                            if (dt_Station == null)
                            {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs
@@ -46,22 +46,22 @@
            {
                var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode == x.AgvTaskNum);
                if (task == null) throw new Exception("未找到任务");
                if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                {
                    var content = TakeRequest(task.CurrentAddress);
                    //if (!content.Status)
                //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                    //{
                    //    throw new Exception(content.Message);
                //    var content = TakeRequest(task.CurrentAddress);
                //    //if (!content.Status)
                //    //{
                //    //    throw new Exception(content.Message);
                //    //}
                    //}
                }
                else
                {
                    var content = PutRequest(task.NextAddress, task.PalletType);
                    //if (!content.Status)
                //else
                    //{
                    //    throw new Exception(content.Message);
                //    var content = PutRequest(task.NextAddress, task.PalletType);
                //    //if (!content.Status)
                //    //{
                //    //    throw new Exception(content.Message);
                //    //}
                    //}
                }
                task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt();
                var up = _taskRepository.UpdateData(task);
                agvResponseContent.Code = up ? "0" : "1";
@@ -101,7 +101,12 @@
                        if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                        {
                            var content = TakeFinish(task.CurrentAddress);
                            if (!content.Status) throw new Exception(content.Message);
                            if (!content.Status)
                            {
                                task.TaskState = TaskStatusEnum.AGV_TakeError.ObjToInt();
                                _taskRepository.UpdateData(task);
                                throw new Exception(content.Message);
                            }
                            task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt();
                            var up = _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.自动完成);
                            _taskService.TaskCompleted(task.TaskNum);
@@ -112,16 +117,16 @@
                        break;
                    case "getSafetySignal"://安全信号申请
                        {
                            if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                            {
                                var content = TakeRequest(task.CurrentAddress);
                                //if (!content.Status) throw new Exception(content.Message);
                            }
                            else
                            {
                                var content = PutRequest(task.NextAddress, task.PalletType);
                                //if (!content.Status) throw new Exception(content.Message);
                            }
                            //if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                            //{
                            //    var content = TakeRequest(task.CurrentAddress);
                            //    //if (!content.Status) throw new Exception(content.Message);
                            //}
                            //else
                            //{
                            //    var content = PutRequest(task.NextAddress, task.PalletType);
                            //    //if (!content.Status) throw new Exception(content.Message);
                            //}
                            task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt();
                            var up = _taskRepository.UpdateData(task);
                            agvResponseContent.Code = up ? "0" : "1";
@@ -132,7 +137,12 @@
                        if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt())
                        {
                            var content = PutFinish(task.NextAddress);
                            if (!content.Status) throw new Exception(content.Message);
                            if (!content.Status)
                            {
                                task.TaskState = TaskStatusEnum.AGV_PutError.ObjToInt();
                                _taskRepository.UpdateData(task);
                                throw new Exception(content.Message);
                            }
                            Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress);
                            if (dt_Station == null)
                            {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs
@@ -13,6 +13,7 @@
using WIDESEAWCS_DTO.Agv;
using SqlSugar;
using static Dm.net.buffer.ByteArrayBuffer;
using WIDESEAWCS_Core.Enums;
namespace WIDESEAWCS_Tasks
{
@@ -190,6 +191,8 @@
                    }
                }
                _taskService.UpdateData(WaitToTasks);
                //取放货完成写入异常处理
                Dt_Task? TakeErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_TakeError.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).First();
                if (TakeErroeTask!=null)
                {
@@ -207,8 +210,31 @@
                    otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode);
                    Thread.Sleep(1000);
                    otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode);
                    TakeErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt();
                    var up = _taskRepository.DeleteAndMoveIntoHty(TakeErroeTask, OperateTypeEnum.自动完成);
                    _taskService.TaskCompleted(TakeErroeTask.TaskNum);
                }
                Dt_Task? PutErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_PutError.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).First();
                if (PutErroeTask != null)
                {
                    Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == PutErroeTask.NextAddress);
                    if (stationManger == null)
                    {
                        throw new Exception($"未找到站台配置");
                    }
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device == null)
                    {
                        throw new Exception($"未找到站台配置");
                    }
                    OtherDevice otherDevice = (OtherDevice)device;
                    otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode);
                    PutErroeTask.CurrentAddress = stationManger.StationCode;
                    PutErroeTask.NextAddress = "";
                    PutErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt();
                    PutErroeTask.DeviceCode = "SC01_CSJ";
                    var up = _taskRepository.UpdateData(PutErroeTask);
                }
            }
            catch (Exception ex)
            {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs
@@ -13,6 +13,7 @@
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
@@ -28,14 +29,16 @@
        private readonly IRouterService _routerService;
        private readonly IStationMangerRepository _stationMangerRepository;
        private readonly IMapper _mapper;
        private readonly ITaskRepository _taskRepository;
        public AGV_CSJJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper)
        public AGV_CSJJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper, ITaskRepository taskRepository)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
            _routerService = routerService;
            _stationMangerRepository = stationMangerRepository;
            _mapper = mapper;
            _taskRepository = taskRepository;
        }
        public Task Execute(IJobExecutionContext context)
        {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP²Ö/StackerCraneJob_PP.cs
@@ -52,6 +52,20 @@
            _stationMangerRepository = stationMangerRepository;
            _cacheService = cacheService;
            _mapper=mapper;
            string? apiInfoStr = _cacheService.Get("apiInfos");
            if (!string.IsNullOrEmpty(apiInfoStr))
            {
                List<Dt_ApiInfo>? infos = JsonConvert.DeserializeObject<List<Dt_ApiInfo>>(apiInfoStr);
                if (infos == null || infos.Count == 0)
                {
                    apiInfos = new List<Dt_ApiInfo>();
                }
                else
                {
                    apiInfos = infos;
                }
            }
        }
        public Task Execute(IJobExecutionContext context)
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/³ÉÆ·²Ö/AGV_CPExtend.cs
@@ -21,11 +21,14 @@
        {
            try
            {
                var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()|| x.TaskState == TaskStatusEnum.New.ObjToInt()) && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.TaskType!=999).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList();
                if (newTasks.Count>0)
                var AllTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (nameof(AGV_CPJob).Contains(x.DeviceCode))).ToList();
                var stationMangers = _stationMangerRepository.QueryData();
                #region å…¥åº“任务推送
                {
                    foreach (var task in newTasks)
                    var newTasksIn = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType>=TaskTypeEnum.Inbound.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.TaskType!=999).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList();
                    if (newTasksIn.Count>0)
                    {
                        foreach (var task in newTasksIn)
                    {
                        try
                        {
@@ -87,11 +90,269 @@
                            task.ExceptionMessage = ex.Message;
                        }
                    }
                    if (newTasks.Count > 0)
                        if (newTasksIn.Count > 0)
                    {
                        _taskService.UpdateData(newTasks);
                            _taskService.UpdateData(newTasksIn);
                    }
                }
                }
                #endregion
                #region å‡ºåº“推送任务1线
                {
                    var newTasksOut1 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress=="5236").OrderBy(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList();
                    var downTasksOut1 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5236").ToList();
                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5236");
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device != null)
                    {
                        OtherDevice otherDevice = (OtherDevice)device;
                        short stationCurrentStatus = device.Communicator.Read<short>("DB29.112");
                        if (newTasksOut1.Count > 0 && downTasksOut1.Count <= 0 && stationCurrentStatus == 1)
                        {
                            foreach (var task in newTasksOut1)
                            {
                                try
                                {
                                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                                        task.CurrentAddress = GetAGVAddress(task.CurrentAddress);
                                    else
                                        task.NextAddress = GetAGVAddress(task.NextAddress);
                                    AgvTaskDTO taskDTO = new AgvTaskDTO()
                                    {
                                        TaskCode = task.AgvTaskNum,
                                        ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum,
                                        TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR",
                                        ctnrCode = task.PalletCode,
                                        PositionCodePath = new List<CodePath>()
                                    {
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.CurrentAddress
                                        },
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.NextAddress
                                        }
                                    }
                                    };
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        taskDTO.Priority = task.Grade.ToString();
                                    }
                                    if (task.GroupId.IsNotEmptyOrNull())
                                    {
                                        taskDTO.GroupId = task.GroupId;
                                    }
                                    if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt())
                                    {
                                        taskDTO.Priority = "127";
                                    }
                                    //发送AGV任务
                                    WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask);
                                    if (!content.Status)
                                        throw new Exception(content.Message);
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
                                    }
                                    else
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    task.TaskState = TaskStatusEnum.Exception.ObjToInt();
                                    task.ExceptionMessage = ex.Message;
                                }
                            }
                            if (newTasksOut1.Count > 0)
                            {
                                _taskService.UpdateData(newTasksOut1);
                            }
                        }
                    }
                }
                #endregion
                #region å‡ºåº“推送任务2线
                {
                    var newTasksOut2 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").OrderBy(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList();
                    var downTasksOut2 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").ToList();
                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5243");
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device != null)
                    {
                        OtherDevice otherDevice = (OtherDevice)device;
                        short stationCurrentStatus = device.Communicator.Read<short>("DB29.126");
                        if (newTasksOut2.Count > 0 && downTasksOut2.Count <= 0 && stationCurrentStatus == 1)
                        {
                            foreach (var task in newTasksOut2)
                            {
                                try
                                {
                                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                                        task.CurrentAddress = GetAGVAddress(task.CurrentAddress);
                                    else
                                        task.NextAddress = GetAGVAddress(task.NextAddress);
                                    AgvTaskDTO taskDTO = new AgvTaskDTO()
                                    {
                                        TaskCode = task.AgvTaskNum,
                                        ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum,
                                        TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR",
                                        ctnrCode = task.PalletCode,
                                        PositionCodePath = new List<CodePath>()
                                    {
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.CurrentAddress
                                        },
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.NextAddress
                                        }
                                    }
                                    };
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        taskDTO.Priority = task.Grade.ToString();
                                    }
                                    if (task.GroupId.IsNotEmptyOrNull())
                                    {
                                        taskDTO.GroupId = task.GroupId;
                                    }
                                    if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt())
                                    {
                                        taskDTO.Priority = "127";
                                    }
                                    //发送AGV任务
                                    WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask);
                                    if (!content.Status)
                                        throw new Exception(content.Message);
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
                                    }
                                    else
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    task.TaskState = TaskStatusEnum.Exception.ObjToInt();
                                    task.ExceptionMessage = ex.Message;
                                }
                            }
                            if (newTasksOut2.Count > 0)
                            {
                                _taskService.UpdateData(newTasksOut2);
                            }
                        }
                        //else
                        //{
                        //    WriteInfo(nameof(AGV_CPJob), $"2线无任务,状态{stationCurrentStatus}");
                        //}
                    }
                }
                #endregion
                #region å‡ºåº“推送任务3线
                {
                    var newTasksOut3 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").OrderBy(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList();
                    var downTasksOut3 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").ToList();
                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5250");
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device != null)
                    {
                        OtherDevice otherDevice = (OtherDevice)device;
                        short stationCurrentStatus = device.Communicator.Read<short>("DB29.140");
                        if (newTasksOut3.Count > 0 && downTasksOut3.Count <= 0 && stationCurrentStatus == 1)
                        {
                            foreach (var task in newTasksOut3)
                            {
                                try
                                {
                                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                                        task.CurrentAddress = GetAGVAddress(task.CurrentAddress);
                                    else
                                        task.NextAddress = GetAGVAddress(task.NextAddress);
                                    AgvTaskDTO taskDTO = new AgvTaskDTO()
                                    {
                                        TaskCode = task.AgvTaskNum,
                                        ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum,
                                        TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR",
                                        ctnrCode = task.PalletCode,
                                        PositionCodePath = new List<CodePath>()
                                    {
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.CurrentAddress
                                        },
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.NextAddress
                                        }
                                    }
                                    };
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        taskDTO.Priority = task.Grade.ToString();
                                    }
                                    if (task.GroupId.IsNotEmptyOrNull())
                                    {
                                        taskDTO.GroupId = task.GroupId;
                                    }
                                    if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt())
                                    {
                                        taskDTO.Priority = "127";
                                    }
                                    //发送AGV任务
                                    WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask);
                                    if (!content.Status)
                                        throw new Exception(content.Message);
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
                                    }
                                    else
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    task.TaskState = TaskStatusEnum.Exception.ObjToInt();
                                    task.ExceptionMessage = ex.Message;
                                }
                            }
                            if (newTasksOut3.Count > 0)
                            {
                                _taskService.UpdateData(newTasksOut3);
                            }
                        }
                        //else
                        //{
                        //    WriteInfo(nameof(AGV_CPJob), $"3线无任务,状态{stationCurrentStatus}");
                        //}
                    }
                }
                #endregion
                #region ç©ºæ¡†æ¬è¿
                {
                var newTasksLocations = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.Remark == "测试空框").ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList();
                if (newTasksLocations.Count>0)
                {
@@ -138,6 +399,8 @@
                    }
                }
            }
                #endregion
            }
            catch (Exception ex)
            {
                WriteError(nameof(AGV_CPJob), ex.Message, ex);
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/×躸²Ö/AGV_ZHExtend.cs
@@ -7,6 +7,7 @@
using WIDESEAWCS_Common.APIEnum;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
@@ -176,6 +177,50 @@
                    }
                }
                _taskService.UpdateData(WaitToTasks);
                //取放货完成写入异常处理
                Dt_Task? TakeErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_TakeError.ObjToInt() && nameof(AGV_ZHJob).Contains(x.DeviceCode)).First();
                if (TakeErroeTask != null)
                {
                    Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == TakeErroeTask.CurrentAddress);
                    if (stationManger == null)
                    {
                        throw new Exception($"未找到站台配置");
                    }
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device == null)
                    {
                        throw new Exception($"未找到对应设备");
                    }
                    OtherDevice otherDevice = (OtherDevice)device;
                    otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode);
                    Thread.Sleep(1000);
                    otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode);
                    TakeErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt();
                    var up = _taskRepository.DeleteAndMoveIntoHty(TakeErroeTask, OperateTypeEnum.自动完成);
                    _taskService.TaskCompleted(TakeErroeTask.TaskNum);
                }
                Dt_Task? PutErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_PutError.ObjToInt() && nameof(AGV_ZHJob).Contains(x.DeviceCode)).First();
                if (PutErroeTask != null)
                {
                    Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == PutErroeTask.NextAddress);
                    if (stationManger == null)
                    {
                        throw new Exception($"未找到站台配置");
                    }
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device == null)
                    {
                        throw new Exception($"未找到站台配置");
                    }
                    OtherDevice otherDevice = (OtherDevice)device;
                    otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode);
                    PutErroeTask.CurrentAddress = stationManger.StationCode;
                    PutErroeTask.NextAddress = "";
                    PutErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt();
                    PutErroeTask.DeviceCode = "SC01_ZH";
                    var up = _taskRepository.UpdateData(PutErroeTask);
                }
            }
            catch (Exception ex)
            {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/×躸²Ö/AGV_ZHJob.cs
@@ -13,6 +13,7 @@
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
@@ -28,14 +29,16 @@
        private readonly IRouterService _routerService;
        private readonly IStationMangerRepository _stationMangerRepository;
        private readonly IMapper _mapper;
        private readonly ITaskRepository _taskRepository;
        public AGV_ZHJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper)
        public AGV_ZHJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper, ITaskRepository taskRepository)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
            _routerService = routerService;
            _stationMangerRepository = stationMangerRepository;
            _mapper = mapper;
            _taskRepository = taskRepository;
        }
        public Task Execute(IJobExecutionContext context)
        {
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs
@@ -74,11 +74,13 @@
                    int maxDepth = locationInfos.Max(x => x.Depth);
                    if (beRelocation.Row <= maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList();
                        //过滤当前移库的同列同层
                        locationInfos = locationInfos.Where(x => x.Row <= maxDepth && x.Column!= beRelocation.Column && x.Layer!=beRelocation.Layer).ToList();
                    }
                    else if (beRelocation.Row > maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList();
                        //过滤当前移库的同列同层
                        locationInfos = locationInfos.Where(x => x.Row > maxDepth && x.Column != beRelocation.Column && x.Layer != beRelocation.Layer).ToList();
                    }
                }
@@ -120,12 +122,14 @@
                                {
                                    continue;
                                }
                                if (locationInfoExist.LocationType>0)
                                {
                                Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType);
                                if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount)
                                {
                                    continue;
                                }
                                }
                            }
                            else
                            {
@@ -306,10 +310,10 @@
                        else
                        {
                            List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList();
                            moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                            moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                            List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList();
                            littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                            littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                        }
                        //if (moreDepthFlag && littleDepthFlag)
                        //{
@@ -337,10 +341,10 @@
                        else
                        {
                            List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList();
                            moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                            moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                            List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList();
                            littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                            littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                        }
                        //List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList();
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs
@@ -221,15 +221,20 @@
                                {
                                    continue;
                                }
                                if (locationInfoExist.LocationType > 0)
                                {
                                Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType);
                                if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount)
                                {
                                    continue;
                                }
                                }
                                if (locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() || locationInfoExist.EnableStatus != EnableStatusEnum.Normal.ObjToInt())
                                {
                                    continue;
                                }
                            }
                            locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
                            return locationInfo;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs
@@ -56,14 +56,15 @@
                        throw new Exception($"未找到货位信息");
                    }
                    int maxDepth = locationInfos.Max(x => x.Depth);
                    int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2;
                    if (mathCurrentRow <= maxDepth)
                    if (beRelocation.Row <= maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList();
                        //过滤当前移库的同列同层
                        locationInfos = locationInfos.Where(x => x.Row <= maxDepth && x.Column != beRelocation.Column && x.Layer != beRelocation.Layer).ToList();
                    }
                    else
                    else if (beRelocation.Row > maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList();
                        //过滤当前移库的同列同层
                        locationInfos = locationInfos.Where(x => x.Row > maxDepth && x.Column != beRelocation.Column && x.Layer != beRelocation.Layer).ToList();
                    }
                }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs
@@ -114,10 +114,13 @@
                                {
                                    continue;
                                }
                                if (locationInfoExist.LocationType > 0)
                                {
                                Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType);
                                if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount)
                                {
                                    continue;
                                    }
                                }
                            }
                            else
@@ -137,11 +140,14 @@
                                {
                                    continue;
                                }
                                if (locationInfoExist.LocationType > 0)
                                {
                                Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType);
                                if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount)
                                {
                                    continue;
                                }
                                }
                                if (locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() || locationInfoExist.EnableStatus != EnableStatusEnum.Normal.ObjToInt())
                                {
                                    continue;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs
@@ -465,10 +465,52 @@
            for (int j = location.Depth + 1; j <= maxDepth; j++)
            {
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row + 1));
                if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
                #region æµ‹è¯•架、PP判断同组货位
                if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5))
                {
                    locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2));
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                }
                if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2);
                    }
                }
                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                    }
                }
                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                }
                #endregion
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
@@ -478,10 +520,41 @@
            for (int j = location.Depth - 1; j >= 1; j--)
            {
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row -1));
                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
                #region æµ‹è¯•架、PP判断同组货位
                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
                {
                    locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2));
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2);
                }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2);
                    }
                }
                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                    }
                }
                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                    }
                }
                #endregion
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
@@ -505,10 +578,52 @@
            for (int j = location.Depth + 1; j <= maxDepth; j++)
            {
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1));
                if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
                #region æµ‹è¯•架、PP判断同组货位
                if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5))
                {
                    locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2));
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                }
                if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2);
                    }
                }
                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                    }
                }
                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                }
                #endregion
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
@@ -518,10 +633,41 @@
            for (int j = location.Depth - 1; j >= 1; j--)
            {
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1));
                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
                #region æµ‹è¯•架、PP判断同组货位
                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
                {
                    locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2));
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2);
                }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2);
                    }
                }
                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                    }
                }
                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
                {
                    if (row <= maxDepth)
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
                    }
                    else
                    {
                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
                    }
                }
                #endregion
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/ProInStaticDTO.cs
@@ -11,8 +11,21 @@
    /// </summary>
    public class ProInStaticDTO
    {
        /// <summary>
        /// äº§å“ç¼–码
        /// </summary>
        public string ProductCode { get; set; }
        /// <summary>
        /// äº§å“ç‰ˆæœ¬
        /// </summary>
        public string ProductVersion { get; set; }
        /// <summary>
        /// æ€»PCS数
        /// </summary>
        public float SumPcs { get; set; }
        /// <summary>
        /// æ€»é¢ç§¯
        /// </summary>
        public float SumPcsArea { get; set; }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs
@@ -76,6 +76,10 @@
        /// </summary>
        public float OKPCSQTY { get; set; }
        /// <summary>
        /// å†…包总面积
        /// </summary>
        public float OKPCSArea { get; set; }
        /// <summary>
        /// å‘¨æœŸ
        /// </summary>
        public string DateCode { get; set; }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -1813,6 +1813,10 @@
                }
                return palletTypeInfo.PalletType;
            }
            else if (warehouse.WarehouseCode == WarehouseEnum.HA60.ObjToString())
            {
                return 4;
            }
            return -1;
        }
        /// <summary>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ProInStatisticsService.cs
@@ -30,33 +30,29 @@
            _invokeERPService = invokeERPService;
            _basicRepository = basicRepository;
        }
        /// <summary>
        /// ä¿å­˜æ•°æ®
        /// </summary>
        public void SaveStatic(MesBagInfoModel mesBagInfoModel)
        {
            List<ProInStaticDTO> mESBagDetails = mesBagInfoModel.BagDetails.GroupBy(x=>new { x.ProductCode, x.ProductVersion }).Select(x=>new ProInStaticDTO
            {
                ProductCode= x.Key.ProductCode,
                ProductVersion= x.Key.ProductVersion,
                SumPcs=x.Sum(x => x.OKPCSQTY)
                SumPcs = x.Sum(x => x.OKPCSQTY),
                SumPcsArea = x.Sum(x=>x.OKPCSArea)
            }).ToList();
            List<Dt_ProInStatistics> proInStatistics= new List<Dt_ProInStatistics>();
            Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==mesBagInfoModel.WarehouseCode);
            foreach (var m in mESBagDetails)
            {
                string response = _invokeERPService.InvokeProInErpStatic(m.ProductCode, m.ProductCode + m.ProductVersion);
                ErpProInErpStaticResponseContent erpProInErpStatic = response.DeserializeObject<ErpProInErpStaticResponseContent>();
                if (erpProInErpStatic.Code != 200)
                {
                    return;
                }
                float adjusted = (float)Math.Round(erpProInErpStatic.Data[0].UnitArea, 3);
                Dt_ProInStatistics inStatistics = new Dt_ProInStatistics()
                {
                    WarehouseId = warehouse.WarehouseId,
                    ProductCode = m.ProductCode,
                    ProductRev = m.ProductVersion,
                    PcsQty = m.SumPcs,
                    SquareMeter = (float)Math.Round((adjusted * m.SumPcs), 3),
                    SquareMeter = (float)Math.Round(m.SumPcsArea, 3),
                    Remark = mesBagInfoModel.BatchNo
                };
                proInStatistics.Add(inStatistics);
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs
@@ -285,39 +285,39 @@
                    _takeStockOrderDetailRepository.UpdateData(takeStockOrderDetail);
                    BaseDal.UpdateData(takeStockOrder);
                    //提交ERP逻辑
                    //if (takeStockOrder.TakeStockStatus== TakeStockStatusEnum.盘点完成.ObjToInt())
                    //{
                    //    ERPTakeStockModel eRPTakeStock = new ERPTakeStockModel()
                    //    {
                    //        Way = 1,
                    //        UniqueTag = takeStockOrder.Id.ToString(),
                    //        Code = takeStockOrder.OrderNo,
                    //        FiscalPeriotime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd"),
                    //        Name=takeStockOrder.OrderNo,
                    //        WarehouseCode= warehouse.WarehouseCode,
                    //        Createuser=takeStockOrder.Creater,
                    //        Createtime= takeStockOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
                    //        Details=new List<TakeDetailsItem>()
                    //    };
                    //    foreach (var item in takeStockOrderDetails)
                    //    {
                    //        TakeDetailsItem takeDetailsItem = new TakeDetailsItem()
                    //        {
                    //            MaterialsCode=item.MaterielCode,
                    //            LocationCode=item.LocationCode,
                    //            Lotno=item.BatchNo,
                    //            Sysqty=item.SysQty.ObjToDecimal(),
                    //            Qty=item.Qty.ObjToDecimal()
                    //        };
                    //        eRPTakeStock.Details.Add(takeDetailsItem);
                    //    }
                    //    string response = _invokeERPService.InvokeTakeStockApi(eRPTakeStock);
                    //    ErpRequestContent erpRequestContent = response.DeserializeObject<ErpRequestContent>();
                    //    if (erpRequestContent.res != 1)
                    //    {
                    //        throw new Exception("同步ERP失败,错误信息:" + erpRequestContent.Data);
                    //    }
                    //}
                    if (takeStockOrder.TakeStockStatus == TakeStockStatusEnum.盘点完成.ObjToInt())
                    {
                        ERPTakeStockModel eRPTakeStock = new ERPTakeStockModel()
                        {
                            Way = 1,
                            UniqueTag = takeStockOrder.Id.ToString(),
                            Code = takeStockOrder.OrderNo,
                            FiscalPeriotime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd"),
                            Name = takeStockOrder.OrderNo,
                            WarehouseCode = warehouse.WarehouseCode,
                            Createuser = takeStockOrder.Creater,
                            Createtime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
                            Details = new List<TakeDetailsItem>()
                        };
                        foreach (var item in takeStockOrderDetails)
                        {
                            TakeDetailsItem takeDetailsItem = new TakeDetailsItem()
                            {
                                MaterialsCode = item.MaterielCode,
                                LocationCode = item.LocationCode,
                                Lotno = item.BatchNo,
                                Sysqty = item.SysQty.ObjToDecimal(),
                                Qty = item.Qty.ObjToDecimal()
                            };
                            eRPTakeStock.Details.Add(takeDetailsItem);
                        }
                        string response = _invokeERPService.InvokeTakeStockApi(eRPTakeStock);
                        ErpRequestContent erpRequestContent = response.DeserializeObject<ErpRequestContent>();
                        if (erpRequestContent.res != 1)
                        {
                            throw new Exception("同步ERP失败,错误信息:" + erpRequestContent.Data);
                        }
                    }
                    _unitOfWorkManage.CommitTran();
                    content.OK("盘点成功");
                }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs
@@ -525,6 +525,7 @@
        /// <returns></returns>
        public MesResponseContent SubstrateOut(SubstrateOutModel model)
        {
            MesResponseContent content = new MesResponseContent();
            try
            {
                string line = string.Empty;
@@ -539,15 +540,15 @@
                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == line);
                if (warehouse == null)
                {
                    return MesResponseContent.Instance.Error($"仓库基础信息未配置");
                    return content.Error($"仓库基础信息未配置");
                }
                Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == model.MaterialCode);
                if (materielInfo == null)
                {
                    return MesResponseContent.Instance.Error($"未找到该物料信息");
                    return content.Error($"未找到该物料信息");
                }
                //生成MES板料出库单据
                Dt_MesOutboundOrder mesOutboundOrder = new Dt_MesOutboundOrder()
                {
                    CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(),
@@ -563,7 +564,6 @@
                };
                List<Dt_Task> tasks = new List<Dt_Task>();
                List<Dt_StockInfo>? stockInfos = null;
                List<Dt_OutStockLockInfo>? outStockLockInfos = null;
                List<Dt_LocationInfo>? locationInfos = null;
@@ -606,23 +606,26 @@
                _outboundService.MesOutboundOrderService.Repository.AddData(mesOutboundOrder);
                if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0)
                {
                    WebResponseContent content = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks);
                    WebResponseContent contentResponse = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks);
                    if (!content.Status)
                    if (!contentResponse.Status)
                    {
                        _unitOfWorkManage.RollbackTran();
                        return MesResponseContent.Instance.Error(content.Message);
                        return content.Error(contentResponse.Message);
                    }
                }
                _unitOfWorkManage.CommitTran();
                PushTasksToWCS(tasks);
                return MesResponseContent.Instance.OK();
                //将开料分配的库存托盘返回给MES
                content.Content = new
                {
                    VehicleCode = stockInfos?.Select(x => x.PalletCode).ToList()
                };
                return content.OK();
            }
            catch (Exception ex)
            {
                return MesResponseContent.Instance.Error(ex.Message);
                return content.Error(ex.Message);
            }
        }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs
@@ -853,7 +853,7 @@
            WebResponseContent content = new WebResponseContent();
            try
            {
                //获取测试架原库存信息
                //获取阻焊库存信息
                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString());
                //获取库存记录
                List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x =>
@@ -872,21 +872,21 @@
                {
                    return content.Error($"托盘类型信息不存在");
                }
                ////获取阻焊批次
                //WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot);
                //if (!requestLotInfo.Status)
                //{
                //    return content.Error($"请求阻焊批次信息失败,{requestLotInfo.Message}");
                //}
                //MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString());
                MesLotInfoModel mesLotInfo = new MesLotInfoModel()
                //获取阻焊批次
                WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot);
                if (!requestLotInfo.Status)
                {
                    Product="FH001",
                    ProductVersion="A1",
                    Qty=20,
                    LotNo= materialLot,
                    IsFullNumber=true
                };
                    return content.Error($"请求阻焊批次信息失败,{requestLotInfo.Message}");
                }
                MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString());
                //MesLotInfoModel mesLotInfo = new MesLotInfoModel()
                //{
                //    Product="FH001",
                //    ProductVersion="A1",
                //    Qty=20,
                //    LotNo= materialLot,
                //    IsFullNumber=true
                //};
                Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail()
                {
                    MaterielSpec = mesLotInfo.ProductVersion,
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs
@@ -197,7 +197,7 @@
            return _taskService.BoxStockin(model.Content);
        }
        /// <summary>
        /// MES成品出库接口调用
        /// MWMS同步成品出库信息至MES
        /// </summary>
        /// <returns></returns>
        [HttpPost, Route("ShipmentOrderSync"), AllowAnonymous]
@@ -206,7 +206,7 @@
            return _taskService.ShipmentOrderSync(model);
        }
        /// <summary>
        /// MES成品出库接口调用
        /// WMS同步成品出库信息至MES外包装机
        /// </summary>
        /// <returns></returns>
        [HttpPost, Route("ShipmentOrderMESSync"), AllowAnonymous]