1
hutongqing
2025-01-10 820c23dcc1d6464db9bae3e46554cf49e1bdbb0e
1
已删除7个文件
已修改27个文件
已添加11个文件
1273 ■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/04a591fe-b28c-4028-b55b-da260d0ae0cf.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/74867a10-626f-4e30-a018-f262a1dd62c2.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/80b0915e-3782-45ec-a657-a6f8cddf3d0e.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9a2aa82f-b430-4ff0-9e51-65e4c7ea2eae.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9abec897-03cc-4cc2-8e4d-b2088047069c.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/a7b0ac2a-d031-492c-9ae2-e15fa3e7349a.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/dc0a4ff7-0a6a-42ef-9227-841da99e5659.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/WIDESEAWCS_BasicInfoService.csproj 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService_Operate.cs 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/R_ConveyorLineDBName.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/WIDESEAWCS_Tasks.csproj 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/干膜仓/ConveyorLineJob_GM.cs 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/干膜仓/StackerCraneJob_GM.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/ConveyorLineJob_BC.cs 152 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/ConveyorLineJob_BC_Old.cs 295 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/RGVJob_BC.cs 184 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/StackerCraneJob_BC.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/油墨仓/CommonHoisterJob.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/油墨仓/StackerCraneJob_YM.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/测试架仓/GroundStationJob_CSJ.cs 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/测试架仓/StackerCraneJob_CSJ.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/07d8ffab-1017-4bc5-b1d6-9b0dbac4b1a0.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/20a5f0b4-0f4e-4c7b-ba91-4c7a50a996ab.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/68aadf08-0043-4085-8419-285f1df3a4b6.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/8094bf09-43c5-4dc2-9113-16a18b45e867.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/881d0eea-b27b-4997-b88b-dadb2843b1e3.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/04a591fe-b28c-4028-b55b-da260d0ae0cf.vsidx
Binary files differ
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/74867a10-626f-4e30-a018-f262a1dd62c2.vsidx
Binary files differ
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/80b0915e-3782-45ec-a657-a6f8cddf3d0e.vsidx
Binary files differ
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9a2aa82f-b430-4ff0-9e51-65e4c7ea2eae.vsidx
Binary files differ
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9abec897-03cc-4cc2-8e4d-b2088047069c.vsidx
Binary files differ
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/a7b0ac2a-d031-492c-9ae2-e15fa3e7349a.vsidx
Binary files differ
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/dc0a4ff7-0a6a-42ef-9227-841da99e5659.vsidx
Binary files differ
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/WIDESEAWCS_BasicInfoService.csproj
@@ -7,7 +7,7 @@
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="WIDESEAWCS_QuartzJob" Version="3.0.3" />
    <PackageReference Include="WIDESEAWCS_QuartzJob" Version="3.0.4" />
  </ItemGroup>
  <ItemGroup>
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs
@@ -31,6 +31,11 @@
        OutQuality = 130,
        /// <summary>
        /// MES出库
        /// </summary>
        [Description("MES出库")]
        MesOutbound = 200,
        /// <summary>
        /// é‡‡è´­å…¥åº“
        /// </summary>
        [Description("采购入库")]
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -160,5 +160,25 @@
        AgvResponseContent AgvUpdateTask(AgvUpdateDTO agvUpdateModel);
        WebResponseContent SendSecureReplyToAgv(int taskNum);
        /// <summary>
        /// æ›´æ–°ä»»åŠ¡ä¿¡æ¯åŠæ·»åŠ ä»»åŠ¡æ˜Žç»†è®°å½•
        /// </summary>
        /// <param name="task"></param>
        /// <param name="deviceCode"></param>
        /// <param name="sourceAddress"></param>
        /// <param name="targetAddress"></param>
        /// <param name="currentAddress"></param>
        /// <param name="nextAddress"></param>
        /// <param name="taskStatus"></param>
        void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "");
        /// <summary>
        /// è¯·æ±‚分配巷道
        /// </summary>
        /// <param name="taskNum"></param>
        /// <param name="roadwayNos"></param>
        /// <returns></returns>
        WebResponseContent RequestWMSAssignRoadway(int taskNum, List<string> roadwayNos);
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
@@ -22,6 +22,7 @@
    // æ³¨æ„ï¼Œhttp://127.0.0.1:1818 å’Œ http://localhost:1818 æ˜¯ä¸ä¸€æ ·çš„
    "IPs": "http://127.0.0.1:8080,http://localhost:8080"
  },
  "WMSApiAddress": "http://127.0.0.1:9293",
  "ApiName": "WIDESEA",
  "ExpMinutes": 120,
  "QuartzJobAutoStart": true
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -175,7 +175,7 @@
                        Dt_StationManger stationManger;
                        if (taskTypeGroup == TaskTypeGroup.InboundGroup)
                        {
                            stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress);
                            stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress);
                        }
                        else
                        {
@@ -186,7 +186,7 @@
                            return WebResponseContent.Instance.Error($"未找到站台配置信息");
                        }
                        List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi));
                        List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi || item.RoadWay == x.ChildPosiDeviceCode || item.RoadWay == x.ChildPosi));
                        router = routers.FirstOrDefault();
                        if (router == null)
                        {
@@ -199,6 +199,11 @@
                            {
                                task.NextAddress = router.NextPosi;
                                task.DeviceCode = stationManger.StationDeviceCode;
                            }
                            else if(item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt())
                            {
                                task.NextAddress = router.NextPosi;
                                task.DeviceCode = stationManger.StackerCraneCode;
                            }
                            else
                            {
@@ -289,8 +294,12 @@
                {
                    return WebResponseContent.Instance.Error($"未找到站台信息");
                }
                string responseStr = HttpHelper.Get($"http://127.0.0.1:9293/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={stationManger.StackerCraneCode}&palletCode={palletCode}");
                string address = AppSettings.Get("WMSApiAddress");
                if(string.IsNullOrEmpty(address))
                {
                    return WebResponseContent.Instance.Error($"未找到WMSApi地址");
                }
                string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={stationManger.StackerCraneCode}&palletCode={palletCode}");
                WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
                if (responseContent != null && responseContent.Status && responseContent.Data != null)
                {
@@ -309,6 +318,31 @@
            return content;
        }
        public WebResponseContent RequestWMSAssignRoadway(int taskNum, List<string> roadwayNos)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                string address = AppSettings.Get("WMSApiAddress");
                if (string.IsNullOrEmpty(address))
                {
                    return WebResponseContent.Instance.Error($"未找到WMSApi地址");
                }
                string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}",roadwayNos.Serialize());
                WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
                if (responseContent != null && responseContent.Status && responseContent.Data != null)
                {
                    return responseContent;
                }
            }
            catch (Exception ex)
            {
                content = WebResponseContent.Instance.Error(ex.Message);
            }
            return content;
        }
        /// <summary>
        /// å‘WMS申请分配货位
        /// </summary>
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService_Operate.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_Model.Models;
namespace WIDESEAWCS_TaskInfoService
{
    public partial class TaskService
    {
        public void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "")
        {
            StringBuilder stringBuilder = new StringBuilder(App.User?.UserId == 0 ? $"系统自动流程" : "人工手动流程");
            if (task.DeviceCode != deviceCode && !string.IsNullOrEmpty(deviceCode))
            {
                stringBuilder.Append($",设备编号由{task.DeviceCode}变更为{deviceCode}");
                task.DeviceCode = deviceCode;
            }
            if (task.SourceAddress != sourceAddress && !string.IsNullOrEmpty(sourceAddress))
            {
                stringBuilder.Append($",起始地址由{task.SourceAddress}变更为{sourceAddress}");
                task.SourceAddress = sourceAddress;
            }
            if (task.TargetAddress != targetAddress && !string.IsNullOrEmpty(targetAddress))
            {
                stringBuilder.Append($",目标地址由{task.TargetAddress}变更为{targetAddress}");
                task.TargetAddress = targetAddress;
            }
            if (task.CurrentAddress != currentAddress && !string.IsNullOrEmpty(currentAddress))
            {
                stringBuilder.Append($",当前位置由{task.CurrentAddress}变更为{currentAddress}");
                task.CurrentAddress = currentAddress;
            }
            if (task.NextAddress != nextAddress && !string.IsNullOrEmpty(nextAddress))
            {
                stringBuilder.Append($",下一位置由{task.NextAddress}变更为{nextAddress}");
                task.NextAddress = nextAddress;
            }
            if (task.TaskState != taskStatus.ObjToInt())
            {
                string newStatus = $"{taskStatus}";
                try
                {
                    List<int> enums = Enum.GetValues(typeof(TaskStatusEnum)).Cast<int>().ToList();
                    FieldInfo? fieldInfo = typeof(TaskStatusEnum).GetField((taskStatus).ToString());
                    if (fieldInfo != null)
                    {
                        DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                        if (description != null)
                        {
                            newStatus = $"{description.Description}({taskStatus})";
                        }
                    }
                }
                catch { }
                string oldStatus = $"{task.TaskState}";
                try
                {
                    FieldInfo? fieldInfo2 = typeof(RouterInOutType).GetField(((TaskStatusEnum)task.TaskState).ToString());
                    if (fieldInfo2 != null)
                    {
                        DescriptionAttribute? description2 = fieldInfo2.GetCustomAttribute<DescriptionAttribute>();
                        if (description2 != null)
                        {
                            oldStatus = $"{description2.Description}({task.TaskState})";
                        }
                    }
                }
                catch { }
                stringBuilder.Append($",任务状态由{oldStatus}变更为{newStatus}");
                task.TaskState = taskStatus.ObjToInt();
            }
            BaseDal.UpdateData(task);
            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, stringBuilder.ToString());
        }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs
@@ -85,11 +85,16 @@
        /// </summary>
        public short RunStatus { get; set; }
        private string _barcode;
        /// <summary>
        /// æ¡ç 
        /// </summary>
        [DataLength(20)]
        public string Barcode { get; set; }
        public string Barcode
        {
            get { return _barcode; }
            set { _barcode = value.Replace("\0", "").Replace("\\0", ""); }
        }
        /// <summary>
        /// é¢„ç•™
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/R_ConveyorLineDBName.cs
@@ -121,4 +121,8 @@
        ACK
    }
    public enum R_ConveyorLineWorkType
    {
        ConveyorLineWorkType
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/WIDESEAWCS_Tasks.csproj
@@ -13,7 +13,7 @@
    </ItemGroup>
    <ItemGroup>
      <PackageReference Include="WIDESEAWCS_QuartzJob" Version="3.0.3" />
      <PackageReference Include="WIDESEAWCS_QuartzJob" Version="3.0.4" />
    </ItemGroup>
    <ItemGroup>
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/¸ÉĤ²Ö/ConveyorLineJob_GM.cs
@@ -104,14 +104,7 @@
                                Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && string.IsNullOrEmpty(x.NextAddress));
                                if(task != null)
                                {
                                    string oldAddress = task.NextAddress;
                                    int oldStatus = task.TaskState;
                                    task.NextAddress = item.StationCode;
                                    task.DeviceCode = item.StackerCraneCode;
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                    task.TargetAddress = item.StationCode;
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, nextAddress: item.StationCode, deviceCode: item.StackerCraneCode, targetAddress: item.StationCode);
                                }
                            }
@@ -132,16 +125,7 @@
                                        WriteInfo(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                        continue;
                                    }
                                    string oldAddress = task.NextAddress;
                                    int oldStatus = task.TaskState;
                                    task.CurrentAddress = stationManger.StackerCraneStationCode;
                                    task.TargetAddress = locationCode;
                                    task.NextAddress = locationCode;
                                    task.DeviceCode = stationManger.StackerCraneCode;
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: stationManger.StackerCraneStationCode, targetAddress: locationCode, nextAddress: locationCode, deviceCode: stationManger.StackerCraneCode);
                                    device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
                                    device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
@@ -172,14 +156,7 @@
                                            continue;
                                        }
                                        string oldAddress = task.NextAddress;
                                        int oldStatus = task.TaskState;
                                        task.NextAddress = router.NextPosi;
                                        task.TargetAddress = router.NextPosi;
                                        task.TaskState = TaskStatusEnum.Line_Executing.ObjToInt();
                                        _taskRepository.UpdateData(task);
                                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                        _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, nextAddress: router.NextPosi, targetAddress: router.NextPosi);
                                        device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode);
@@ -206,13 +183,7 @@
                                    if (task != null)
                                    {
                                        //todo è¾“送线工作模式需要判断
                                        string oldAddress = task.NextAddress;
                                        int oldStatus = task.TaskState;
                                        task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt();
                                        _taskRepository.UpdateData(task);
                                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                        _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute);
                                        device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode);
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/¸ÉĤ²Ö/StackerCraneJob_GM.cs
@@ -90,12 +90,9 @@
                                if (sendFlag)
                                {
                                    commonStackerCrane.LastTaskType = task.TaskType;
                                    int oldState = task.TaskState;
                                    task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt();
                                    task.Dispatchertime = DateTime.Now;
                                    task.ExceptionMessage = "";
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"系统自动流程,任务状态从【{oldState}】转到【{task.TaskState}】");
                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing);
                                    commonStackerCrane.Communicator.Write("DB105.54", (short)1);
                                }
@@ -147,7 +144,7 @@
                        }
                        int oldStatus = task.TaskState;
                        task.DeviceCode = "CL01_GM";
                        task.DeviceCode = stationManger.StationDeviceCode;
                        task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt();
                        task.CurrentAddress = stationManger.StationCode;
                        _taskRepository.UpdateData(task);
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/°å²Ä²Ö/ConveyorLineJob_BC.cs
@@ -69,11 +69,12 @@
                        ConveyorLineSignal conveyorLineSignalRead = conveyorLineInfoRead.Signal.ByteToBoolObject<ConveyorLineSignal>();
                        ConveyorLineSignal conveyorLineSignalWrite = conveyorLineInfoWrite.Signal.ByteToBoolObject<ConveyorLineSignal>();
                        if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt())
                        if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt())
                        {
                            if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)
                            {
                                if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))
                                if (conveyorLineInfoRead.TaskNum == 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//采购入库
                                {
                                    WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode);
                                    if (content.Status)
@@ -81,155 +82,76 @@
                                        device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                                    }
                                }
                            }
                            else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK)
                                else//生产退库
                            {
                                Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode);
                                    Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); // å¸¦ä»»åŠ¡å·æŸ¥è¯¢ä»»åŠ¡
                                if (task != null)
                                {
                                    task.CurrentAddress = item.StackerCraneStationCode;
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                    task.DeviceCode = item.StackerCraneCode;
                                    _taskRepository.UpdateData(task);
                                }
                                device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode);
                            }
                        }
                        else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt())
                        {
                            if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && !conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK)
                            {
                                Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && string.IsNullOrEmpty(x.NextAddress));
                                if (task != null)
                                {
                                    string oldAddress = task.NextAddress;
                                    int oldStatus = task.TaskState;
                                    task.NextAddress = item.StationCode;
                                    task.DeviceCode = item.StackerCraneCode;
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                    task.TargetAddress = item.StationCode;
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                }
                            }
                            if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)//入库
                            {
                                Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode);
                                if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                                {
                                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                                    if (stationManger == null)
                                    {
                                        WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                            WriteError(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                        continue;
                                    }
                                    string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                                    if (string.IsNullOrEmpty(locationCode))
                                    {
                                        WriteInfo(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                            WriteError(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                        continue;
                                    }
                                    string oldAddress = task.NextAddress;
                                    int oldStatus = task.TaskState;
                                    task.CurrentAddress = stationManger.StackerCraneStationCode;
                                    task.TargetAddress = locationCode;
                                    task.NextAddress = locationCode;
                                    task.DeviceCode = stationManger.StackerCraneCode;
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                        _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: stationManger.StackerCraneCode, targetAddress: locationCode, currentAddress: stationManger.StackerCraneStationCode, nextAddress: locationCode);
                                    device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
                                    device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                                    }
                                }
                            }
                            else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK)
                            {
                                device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode);
                            }
                            else
                            else if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum == 0)//出库
                            {
                                if (!conveyorLineSignalWrite.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods)
                                Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt());
                                if (task != null)
                                {
                                    Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == item.StationDeviceCode);
                                    if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                                    {
                                        Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                                        if (stationManger == null)
                                        {
                                            WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                            continue;
                                        }
                                        Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && (task.CurrentAddress == x.StartPosi));
                                        if (router == null)
                                        {
                                            WriteInfo(item.StationName, $"未找到路由配置信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                            continue;
                                        }
                                        string oldAddress = task.NextAddress;
                                        int oldStatus = task.TaskState;
                                        task.NextAddress = router.NextPosi;
                                        task.TargetAddress = router.NextPosi;
                                        task.TaskState = TaskStatusEnum.Line_Executing.ObjToInt();
                                        _taskRepository.UpdateData(task);
                                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute);
                                        device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode);
                                    device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode);
                                    }
                                }
                                else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Goods)
                                {
                                    _taskService.TaskCompleted(conveyorLineInfoRead.TaskNum);
                                    device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode);
                                }
                            }
                        }
                        else if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt())
                        {
                            if (!conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK && !conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm)
                            {
                                Dt_Task outTask = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState != TaskStatusEnum.New.ObjToInt() && x.TaskState != TaskStatusEnum.SC_Execute.ObjToInt() && x.TargetAddress == item.StationCode);
                                if (outTask == null)
                                {
                                    Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType));
                                    if (task != null)
                                    {
                                        //todo è¾“送线工作模式需要判断
                                        string oldAddress = task.NextAddress;
                                        int oldStatus = task.TaskState;
                                        task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt();
                                        _taskRepository.UpdateData(task);
                                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                        device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode);
                                    }
                                }
                            }
                            else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && !conveyorLineStatus.Alarm)
                            else if (!conveyorLineSignalRead.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK)
                            {
                                device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode);
                            }
                            else if (!conveyorLineSignalRead.STB && conveyorLineSignalWrite.ACK && !conveyorLineStatus.Alarm)
                            {
                                device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode);
                            }
                        }
                        //else if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt())
                        //{
                        //    if (!conveyorLineSignalWrite.ACK && conveyorLineSignalRead.STB && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm)
                        //    {
                        //        if (conveyorLineInfoRead.TaskNum == 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//退料入库
                        //        {
                        //        }
                        //        else//出库完成
                        //        {
                        //        }
                        //    }
                        //    else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && !conveyorLineStatus.Alarm)
                        //    {
                        //        device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode);
                        //    }
                        //    else if (!conveyorLineSignalRead.STB && conveyorLineSignalWrite.ACK && !conveyorLineStatus.Alarm)
                        //    {
                        //        device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode);
                        //    }
                        //}
                    }
                    else
                    {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/°å²Ä²Ö/ConveyorLineJob_BC_Old.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,295 @@
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.Helper;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_Tasks.ConveyorLineJob;
namespace WIDESEAWCS_Tasks
{
    [DisallowConcurrentExecution]
    public class ConveyorLineJob_BC_Old : JobBase, IJob
    {
        private readonly ITaskService _taskService;
        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
        private readonly ITaskRepository _taskRepository;
        private readonly IStationMangerRepository _stationMangerRepository;
        private readonly IRouterRepository _routerRepository;
        public ConveyorLineJob_BC_Old(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
            _taskRepository = taskRepository;
            _stationMangerRepository = stationMangerRepository;
            _routerRepository = routerRepository;
        }
        public Task Execute(IJobExecutionContext context)
        {
            bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
            if (flag && value != null)
            {
                OtherDevice device = (OtherDevice)value;
                List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
                foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode)))
                {
                    DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
                    DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
                    if (deviceProRead != null && deviceProWrite != null)
                    {
                        R_ConveyorLineInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineInfo>(deviceProRead.DeviceProAddress);
                        W_ConveyorLineInfo conveyorLineInfoWrite = device.Communicator.ReadCustomer<W_ConveyorLineInfo>(deviceProWrite.DeviceProAddress);
                        if (conveyorLineInfoRead == null || conveyorLineInfoWrite == null)
                        {
                            continue;
                        }
                        R_ConveyorLineStatus conveyorLineStatus = conveyorLineInfoRead.Status.ByteToBoolObject<R_ConveyorLineStatus>();
                        ConveyorLineSignal conveyorLineSignalRead = conveyorLineInfoRead.Signal.ByteToBoolObject<ConveyorLineSignal>();
                        ConveyorLineSignal conveyorLineSignalWrite = conveyorLineInfoWrite.Signal.ByteToBoolObject<ConveyorLineSignal>();
                        if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt())
                        {
                            if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum == 0)
                            {
                                if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))
                                {
                                    WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode);
                                    if (content.Status)
                                    {
                                        device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                                    }
                                }
                            }
                            else if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)
                            {
                                Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType));
                                if(task != null)
                                {
                                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                                    if (stationManger == null)
                                    {
                                        WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                        continue;
                                    }
                                    string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                                    if (string.IsNullOrEmpty(locationCode))
                                    {
                                        WriteInfo(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                        continue;
                                    }
                                    string oldAddress = task.NextAddress;
                                    int oldStatus = task.TaskState;
                                    task.CurrentAddress = stationManger.StackerCraneStationCode;
                                    task.TargetAddress = locationCode;
                                    task.NextAddress = locationCode;
                                    task.DeviceCode = stationManger.StackerCraneCode;
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                    device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
                                    device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                                }
                            }
                            else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK)
                            {
                                Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode);
                                if (task != null)
                                {
                                    task.CurrentAddress = item.StackerCraneStationCode;
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                    task.DeviceCode = item.StackerCraneCode;
                                    _taskRepository.UpdateData(task);
                                }
                                device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode);
                            }
                        }
                        else if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt())
                        {
                            if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK)
                            {
                                Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.DeviceCode == item.StationDeviceCode && !string.IsNullOrEmpty(x.NextAddress));
                                if (task != null)
                                {
                                    int oldStatus = task.TaskState;
                                    task.TaskState = TaskStatusEnum.Line_Executing.ObjToInt();
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,任务状态由{oldStatus}变更为{task.TaskState}");
                                    device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
                                    device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode);
                                    device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode);
                                    device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode);
                                    device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode);
                                }
                            }
                        }
                        else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt())
                        {
                            if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && !conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK)
                            {
                                Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && string.IsNullOrEmpty(x.NextAddress));
                                if (task != null)
                                {
                                    string oldAddress = task.NextAddress;
                                    int oldStatus = task.TaskState;
                                    task.NextAddress = item.StationCode;
                                    task.DeviceCode = item.StackerCraneCode;
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                    task.TargetAddress = item.StationCode;
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                }
                            }
                            if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)//入库
                            {
                                Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode);
                                if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                                {
                                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                                    if (stationManger == null)
                                    {
                                        WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                        continue;
                                    }
                                    string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                                    if (string.IsNullOrEmpty(locationCode))
                                    {
                                        WriteInfo(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                        continue;
                                    }
                                    string oldAddress = task.NextAddress;
                                    int oldStatus = task.TaskState;
                                    task.CurrentAddress = stationManger.StackerCraneStationCode;
                                    task.TargetAddress = locationCode;
                                    task.NextAddress = locationCode;
                                    task.DeviceCode = stationManger.StackerCraneCode;
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                    device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
                                    device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                                }
                            }
                            else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK)
                            {
                                device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode);
                            }
                            else
                            {
                                if (!conveyorLineSignalWrite.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods)
                                {
                                    Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == item.StationDeviceCode);
                                    if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                                    {
                                        Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                                        if (stationManger == null)
                                        {
                                            WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                            continue;
                                        }
                                        Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && (task.CurrentAddress == x.StartPosi));
                                        if (router == null)
                                        {
                                            WriteInfo(item.StationName, $"未找到路由配置信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                            continue;
                                        }
                                        string oldAddress = task.NextAddress;
                                        int oldStatus = task.TaskState;
                                        task.NextAddress = router.NextPosi;
                                        task.TargetAddress = router.NextPosi;
                                        task.TaskState = TaskStatusEnum.Line_Executing.ObjToInt();
                                        _taskRepository.UpdateData(task);
                                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                        device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode);
                                    }
                                }
                                else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Goods)
                                {
                                    _taskService.TaskCompleted(conveyorLineInfoRead.TaskNum);
                                    device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode);
                                }
                            }
                        }
                        else if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt())
                        {
                            if (!conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK && !conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm)
                            {
                                Dt_Task outTask = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState != TaskStatusEnum.New.ObjToInt() && x.TaskState != TaskStatusEnum.SC_Execute.ObjToInt() && x.TargetAddress == item.StationCode);
                                if (outTask == null)
                                {
                                    Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType));
                                    if (task != null)
                                    {
                                        //todo è¾“送线工作模式需要判断
                                        string oldAddress = task.NextAddress;
                                        int oldStatus = task.TaskState;
                                        task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt();
                                        _taskRepository.UpdateData(task);
                                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                        device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode);
                                    }
                                }
                            }
                            else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && !conveyorLineStatus.Alarm)
                            {
                                device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode);
                            }
                            else if (!conveyorLineSignalRead.STB && conveyorLineSignalWrite.ACK && !conveyorLineStatus.Alarm)
                            {
                                device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode);
                            }
                        }
                    }
                    else
                    {
                        WriteInfo(device.DeviceName, $"未找到设备子编号{item.StationCode}的协议信息");
                    }
                }
            }
            return Task.CompletedTask;
        }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/°å²Ä²Ö/RGVJob_BC.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,184 @@
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.IdentityModel.Tokens;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.Helper;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_Tasks.ConveyorLineJob;
namespace WIDESEAWCS_Tasks
{
    [DisallowConcurrentExecution]
    public class RGVJob_BC : JobBase, IJob
    {
        private readonly ITaskService _taskService;
        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
        private readonly ITaskRepository _taskRepository;
        private readonly IStationMangerRepository _stationMangerRepository;
        private readonly IRouterRepository _routerRepository;
        private readonly IRouterService _routerService;
        public RGVJob_BC(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
            _taskRepository = taskRepository;
            _stationMangerRepository = stationMangerRepository;
            _routerRepository = routerRepository;
            _routerService = routerService;
        }
        public Task Execute(IJobExecutionContext context)
        {
            bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
            if (flag && value != null)
            {
                OtherDevice device = (OtherDevice)value;
                List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
                foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode)))
                {
                    DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
                    DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
                    if (deviceProRead != null && deviceProWrite != null)
                    {
                        R_ConveyorLineInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineInfo>(deviceProRead.DeviceProAddress);
                        W_ConveyorLineInfo conveyorLineInfoWrite = device.Communicator.ReadCustomer<W_ConveyorLineInfo>(deviceProWrite.DeviceProAddress);
                        if (conveyorLineInfoRead == null || conveyorLineInfoWrite == null)
                        {
                            continue;
                        }
                        R_ConveyorLineStatus conveyorLineStatus = conveyorLineInfoRead.Status.ByteToBoolObject<R_ConveyorLineStatus>();
                        ConveyorLineSignal conveyorLineSignalRead = conveyorLineInfoRead.Signal.ByteToBoolObject<ConveyorLineSignal>();
                        ConveyorLineSignal conveyorLineSignalWrite = conveyorLineInfoWrite.Signal.ByteToBoolObject<ConveyorLineSignal>();
                        if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt())
                        {
                            if (conveyorLineSignalRead.STB /*&& conveyorLineStatus.Online && conveyorLineStatus.Goods*/ && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//入库
                            {
                                Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.PalletCode == conveyorLineInfoRead.Barcode && string.IsNullOrEmpty(x.DeviceCode) && string.IsNullOrEmpty(x.NextAddress) && string.IsNullOrEmpty(x.TargetAddress));
                                if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                                {
                                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                                    if (stationManger == null)
                                    {
                                        WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                        continue;
                                    }
                                    List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && (task.Roadway == x.ChildPosiDeviceCode || task.Roadway == x.ChildPosi));
                                    Dt_Router? router = routers.FirstOrDefault();
                                    if (router == null)
                                    {
                                        WriteError(device.DeviceName, $"未找到任务类型{task.TaskType}对应的路由信息");
                                    }
                                    else
                                    {
                                        if (routers.Count == 1)
                                        {
                                            task.Dispatchertime = DateTime.Now;
                                            _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: router.ChildPosi, targetAddress: router.NextPosi, nextAddress: router.StartPosi, currentAddress: item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.EndPos, router.StartPosi, item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                                        }
                                        else
                                        {
                                            List<string> canInboundStations = new List<string>();
                                            List<string> stations = routers.Select(x => x.NextPosi).ToList();
                                            foreach (string station in stations)
                                            {
                                                Dt_StationManger stationManger1 = _stationMangerRepository.QueryFirst(x => x.StationCode == station);
                                                if (stationManger1 != null)
                                                {
                                                    IDevice? device1 = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger1.StationDeviceCode);
                                                    if (device1 != null)
                                                    {
                                                        OtherDevice otherDevice = (OtherDevice)device1;
                                                        //short workType = otherDevice.GetValue<R_ConveyorLineWorkType, short>(R_ConveyorLineWorkType.ConveyorLineWorkType, item.StationCode);
                                                        //if (workType == ConveyorWorkTypeEnum.Undefined.ObjToInt() || workType == ConveyorWorkTypeEnum.Inbound.ObjToInt())
                                                        {
                                                            canInboundStations.Add(stationManger1.Remark);
                                                        }
                                                    }
                                                }
                                            }
                                            WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(task.TaskNum, canInboundStations);
                                            if (responseContent.Status)
                                            {
                                                List<Dt_Router> dt_Routers = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType);
                                                Dt_Router? routerTemp = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType).FirstOrDefault();
                                                if (routerTemp != null)
                                                {
                                                    task.Dispatchertime = DateTime.Now;
                                                    task.Roadway = responseContent.Data.ToString() ?? task.Roadway;
                                                    _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: routerTemp.ChildPosiDeviceCode, targetAddress: routerTemp.NextPosi, nextAddress: routerTemp.NextPosi, currentAddress: item.StationCode);
                                                    device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode);
                                                    device.SetValue(W_ConveyorLineDB.EndPos, routerTemp.NextPosi, item.StationCode);
                                                    device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
                                                    device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
                                                    device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                                                }
                                                else
                                                {
                                                    WriteError(device.DeviceName, $"未找到任务类型{task.TaskType},起点{item.StationCode},终点{responseContent.Data.ToString()}的路由信息");
                                                }
                                            }
                                            else
                                            {
                                                WriteError(device.DeviceName, responseContent.Message);
                                            }
                                        }
                                    }
                                }
                            }
                            else if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)//出库
                            {
                                //_taskService.TaskCompleted(conveyorLineInfoRead.TaskNum);
                                device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                            }
                            else if (!conveyorLineSignalRead.STB && conveyorLineSignalWrite.ACK && !conveyorLineStatus.Alarm)
                            {
                                device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode);
                            }
                        }
                    }
                    else
                    {
                        WriteError(device.DeviceName, $"未找到设备子编号{item.StationCode}的协议信息");
                    }
                }
            }
            return Task.CompletedTask;
        }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/°å²Ä²Ö/StackerCraneJob_BC.cs
@@ -25,6 +25,7 @@
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Caches;
using Newtonsoft.Json;
using WIDESEAWCS_TaskInfoService;
namespace WIDESEAWCS_Tasks
{
@@ -87,12 +88,9 @@
                                if (sendFlag)
                                {
                                    commonStackerCrane.LastTaskType = task.TaskType;
                                    int oldState = task.TaskState;
                                    task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt();
                                    task.Dispatchertime = DateTime.Now;
                                    task.ExceptionMessage = "";
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"系统自动流程,任务状态从【{oldState}】转到【{task.TaskState}】");
                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing);
                                }
                            }
                        }
@@ -136,17 +134,11 @@
                        Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneStationCode == task.NextAddress);
                        if (stationManger == null)
                        {
                            _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"AGV站点未配置,{task.NextAddress}");
                            _taskService.UpdateTaskExceptionMessage(taskNum, $"AGV站点未配置,{task.NextAddress}");
                            return WebResponseContent.Instance.Error($"AGV站点未配置,{task.NextAddress}");
                            _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"输送线出库站点未配置,{task.NextAddress}");
                            _taskService.UpdateTaskExceptionMessage(taskNum, $"输送线出库站点未配置,{task.NextAddress}");
                            return WebResponseContent.Instance.Error($"输送线出库站点未配置,{task.NextAddress}");
                        }
                        int oldStatus = task.TaskState;
                        task.DeviceCode = "AGV_CSJ";
                        task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt();
                        task.CurrentAddress = stationManger.AGVStationCode;
                        task.NextAddress = task.TargetAddress;
                        _taskRepository.UpdateData(task);
                        _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"系统自动流程,,任务状态从【{oldStatus}】转到【{task.TaskState}】");
                        _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: task.TargetAddress);
                    }
                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
                    {
@@ -154,14 +146,14 @@
                    }
                    else
                    {
                        WriteInfo(deviceCode, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                        WriteError(deviceCode, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                        _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                        _taskService.UpdateTaskExceptionMessage(taskNum, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                    }
                }
                else
                {
                    WriteInfo(deviceCode, $"未找到任务信息,任务号:{taskNum}");
                    WriteError(deviceCode, $"未找到任务信息,任务号:{taskNum}");
                    return WebResponseContent.Instance.Error($"未找到任务信息,任务号:{taskNum}");
                }
@@ -234,7 +226,7 @@
                if (string.IsNullOrEmpty(url))
                {
                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"未找到WMS移库判断接口");
                    WriteInfo(commonStackerCrane.DeviceCode, $"未找到WMS移库判断接口");
                    WriteError(commonStackerCrane.DeviceCode, $"未找到WMS移库判断接口");
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到WMS移库判断接口");
                    return null;
                }
@@ -268,13 +260,13 @@
                }
                else
                {
                    WriteInfo(task.DeviceCode, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                    WriteError(task.DeviceCode, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                }
            }
            else
            {
                WriteInfo(task.DeviceCode, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
                WriteError(task.DeviceCode, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
                _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
            }
            return null;
@@ -306,7 +298,7 @@
                else
                {
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"入库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteInfo(task.DeviceCode, $"入库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteError(task.DeviceCode, $"入库任务起点错误,起点:【{task.CurrentAddress}】");
                    return null;
                }
@@ -321,7 +313,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"入库任务终点错误,终点:【{task.NextAddress}】");
                    WriteInfo(task.DeviceCode, $"入库任务终点错误,终点:【{task.NextAddress}】");
                    WriteError(task.DeviceCode, $"入库任务终点错误,终点:【{task.NextAddress}】");
                    return null;
                }
            }
@@ -339,7 +331,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务终点错误,终点:【{task.NextAddress}】");
                    WriteInfo(task.DeviceCode, $"出库任务终点错误,终点:【{task.NextAddress}】");
                    WriteError(task.DeviceCode, $"出库任务终点错误,终点:【{task.NextAddress}】");
                    return null;
                }
@@ -354,7 +346,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteInfo(task.DeviceCode, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteError(task.DeviceCode, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                    return null;
                }
            }
@@ -371,7 +363,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"移库任务终点错误,终点:【{task.NextAddress}】");
                    WriteInfo(task.DeviceCode, $"移库任务终点错误,终点:【{task.NextAddress}】");
                    WriteError(task.DeviceCode, $"移库任务终点错误,终点:【{task.NextAddress}】");
                    return null;
                }
                string[] sourceCodes = task.CurrentAddress.Split("-");
@@ -385,7 +377,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteInfo(task.DeviceCode, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteError(task.DeviceCode, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
                    return null;
                }
            }
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ÓÍÄ«²Ö/CommonHoisterJob.cs
@@ -48,7 +48,7 @@
                    List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == hoister.DeviceCode);
                    if (stationMangers == null || stationMangers.Count == 0)
                    {
                        WriteInfo(hoister.DeviceName, "未找到对应站台信息");
                        WriteError(hoister.DeviceName, "未找到对应站台信息");
                        return Task.CompletedTask;
                    }
@@ -68,7 +68,7 @@
                            if (task != null)
                            {
                                bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, true, deviceChildCode);
                                WriteInfo(hoister.DeviceName, $"请求入库,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                                WriteError(hoister.DeviceName, $"请求入库,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                            }
                        }
                        else if (!leisure && tray && requestIn && inbounding && !requestOut && !outbounding)
@@ -79,13 +79,13 @@
                                Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == deviceChildCode);
                                if (stationManger == null)
                                {
                                    WriteInfo(hoister.DeviceName, $"未找到对应站台信息,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                                    WriteError(hoister.DeviceName, $"未找到对应站台信息,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                                    break;
                                }
                                string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                                if (string.IsNullOrEmpty(locationCode))
                                {
                                    WriteInfo(hoister.DeviceName, $"请求分配货位返回信息错误,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                                    WriteError(hoister.DeviceName, $"请求分配货位返回信息错误,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                                    break;
                                }
                                task.CurrentAddress = stationManger.StackerCraneStationCode;
@@ -99,7 +99,7 @@
                            }
                            else
                            {
                                WriteInfo(hoister.DeviceName, $"未找到对应任务信息,{deviceChildCode}");
                                WriteError(hoister.DeviceName, $"未找到对应任务信息,{deviceChildCode}");
                            }
                        }
                        else if (leisure && !tray && !requestIn && !inbounding && !requestOut && !outbounding)
@@ -108,7 +108,7 @@
                            if (task != null)
                            {
                                bool isWrite = hoister.SetValue(HoisterDBName.RequestOut, true, deviceChildCode);
                                WriteInfo(hoister.DeviceName, $"请求出库,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                                WriteError(hoister.DeviceName, $"请求出库,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                            }
                        }
                        else if (!leisure && !tray && !requestIn && !inbounding && requestOut && outbounding)
@@ -119,7 +119,7 @@
                                Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == deviceChildCode);
                                if (stationManger == null)
                                {
                                    WriteInfo(hoister.DeviceName, $"未找到对应站台信息,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                                    WriteError(hoister.DeviceName, $"未找到对应站台信息,设备编号:{deviceChildCode},任务号:{task.TaskNum}");
                                    break;
                                }
@@ -133,7 +133,7 @@
                            }
                            else
                            {
                                WriteInfo(hoister.DeviceName, $"未找到对应站台信息,{deviceChildCode}");
                                WriteError(hoister.DeviceName, $"未找到对应站台信息,{deviceChildCode}");
                            }
                        }
                    }
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ÓÍÄ«²Ö/StackerCraneJob_YM.cs
@@ -77,12 +77,9 @@
                                    if (sendFlag)
                                    {
                                        commonStackerCrane.LastTaskType = task.TaskType;
                                        int oldState = task.TaskState;
                                        task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt();
                                        task.ExceptionMessage = "";
                                        task.Dispatchertime = DateTime.Now;
                                        _taskRepository.UpdateData(task);
                                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"系统自动流程,任务状态从【{oldState}】转到【{task.TaskState}】");
                                        task.ExceptionMessage = "";
                                        _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing);
                                    }
                                }
                            }
@@ -113,7 +110,7 @@
                {
                    if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
                    {
                        WriteInfo(commonStackerCrane.DeviceName, $"读取到任务完成信号,{e.TaskNum}");
                        WriteDebug(commonStackerCrane.DeviceName, $"读取到任务完成信号,{e.TaskNum}");
                        Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
                        if (task != null)
                        {
@@ -121,7 +118,7 @@
                        }
                        else
                        {
                            WriteInfo(commonStackerCrane.DeviceName, $"读取到任务完成信号,未找到对应的任务信息,{e.TaskNum}");
                            WriteError(commonStackerCrane.DeviceName, $"读取到任务完成信号,未找到对应的任务信息,{e.TaskNum}");
                        }
                        commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
                    }
@@ -130,7 +127,6 @@
            catch (Exception ex)
            {
                WriteError(commonStackerCrane?.DeviceCode ?? nameof(StackerCraneJob_YM), ex.Message, ex);
            }
        }
@@ -249,7 +245,7 @@
                else
                {
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"入库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteInfo(task.DeviceCode, $"入库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteError(task.DeviceCode, $"入库任务起点错误,起点:【{task.CurrentAddress}】");
                    return null;
                }
@@ -264,7 +260,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"入库任务终点错误,终点:【{task.NextAddress}】");
                    WriteInfo(task.DeviceCode, $"入库任务终点错误,终点:【{task.NextAddress}】");
                    WriteError(task.DeviceCode, $"入库任务终点错误,终点:【{task.NextAddress}】");
                    return null;
                }
            }
@@ -282,7 +278,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务终点错误,终点:【{task.NextAddress}】");
                    WriteInfo(task.DeviceCode, $"出库任务终点错误,终点:【{task.NextAddress}】");
                    WriteError(task.DeviceCode, $"出库任务终点错误,终点:【{task.NextAddress}】");
                    return null;
                }
@@ -297,7 +293,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteInfo(task.DeviceCode, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteError(task.DeviceCode, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                    return null;
                }
            }
@@ -314,7 +310,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"移库任务终点错误,终点:【{task.NextAddress}】");
                    WriteInfo(task.DeviceCode, $"移库任务终点错误,终点:【{task.NextAddress}】");
                    WriteError(task.DeviceCode, $"移库任务终点错误,终点:【{task.NextAddress}】");
                    return null;
                }
                string[] sourceCodes = task.CurrentAddress.Split("-");
@@ -328,7 +324,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteInfo(task.DeviceCode, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteError(task.DeviceCode, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
                    return null;
                }
            }
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/²âÊԼܲÖ/GroundStationJob_CSJ.cs
@@ -43,7 +43,7 @@
            {
                if (device == null)
                {
                    WriteInfo(nameof(GroundStationJob_CSJ), "调度错误,设备对象传值为null");
                    WriteError(nameof(GroundStationJob_CSJ), "调度错误,设备对象传值为null");
                    return Task.CompletedTask;
                }
                List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
@@ -64,12 +64,7 @@
                            Dt_Task task = _taskRepository.QueryFirst(x => x.DeviceCode == item.StackerCraneCode && x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt() && string.IsNullOrEmpty(x.NextAddress));
                            if (task != null && isCanPut && !isCanTake && !putRequest && !putFinish && !takeRequest && !takeFinish)
                            {
                                string oldAddress = task.NextAddress;
                                int oldStatus = task.TaskState;
                                task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                task.NextAddress = item.StationCode;
                                _taskRepository.UpdateData(task);
                                _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, nextAddress: item.StationCode);
                            }
                        }
                        if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt())
@@ -82,22 +77,16 @@
                                Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                                if (stationManger == null)
                                {
                                    WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                    WriteError(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                    continue;
                                }
                                string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                                if (string.IsNullOrEmpty(locationCode))
                                {
                                    WriteInfo(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                    WriteError(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                    continue;
                                }
                                task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                task.CurrentAddress = stationManger.StackerCraneStationCode;
                                task.TargetAddress = locationCode;
                                task.NextAddress = locationCode;
                                task.DeviceCode = stationManger.StackerCraneCode;
                                _taskRepository.UpdateData(task);
                                _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: stationManger.StackerCraneStationCode, targetAddress: locationCode, nextAddress: locationCode, deviceCode: stationManger.StackerCraneCode);
                            }
                        }
                    }
@@ -117,25 +106,16 @@
                            Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                            if (stationManger == null)
                            {
                                WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                WriteError(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                continue;
                            }
                            string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                            if (string.IsNullOrEmpty(locationCode))
                            {
                                WriteInfo(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                WriteError(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                continue;
                            }
                            string oldAddress = task.NextAddress;
                            int oldStatus = task.TaskState;
                            task.CurrentAddress = stationManger.StackerCraneStationCode;
                            task.TargetAddress = locationCode;
                            task.NextAddress = locationCode;
                            task.DeviceCode = stationManger.StackerCraneCode;
                            task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                            _taskRepository.UpdateData(task);
                            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                            _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: stationManger.StackerCraneStationCode, targetAddress: locationCode, nextAddress: locationCode, deviceCode: stationManger.StackerCraneCode);
                        }
                    }
                    catch (Exception ex)
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/²âÊԼܲÖ/StackerCraneJob_CSJ.cs
@@ -87,12 +87,9 @@
                                if (sendFlag)
                                {
                                    commonStackerCrane.LastTaskType = task.TaskType;
                                    int oldState = task.TaskState;
                                    task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt();
                                    task.Dispatchertime = DateTime.Now;
                                    task.ExceptionMessage = "";
                                    _taskRepository.UpdateData(task);
                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"系统自动流程,任务状态从【{oldState}】转到【{task.TaskState}】");
                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing);
                                }
                            }
                        }
@@ -140,13 +137,8 @@
                            _taskService.UpdateTaskExceptionMessage(taskNum, $"AGV站点未配置,{task.NextAddress}");
                            return WebResponseContent.Instance.Error($"AGV站点未配置,{task.NextAddress}");
                        }
                        int oldStatus = task.TaskState;
                        task.DeviceCode = "AGV_CSJ";
                        task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt();
                        task.CurrentAddress = stationManger.AGVStationCode;
                        task.NextAddress = task.TargetAddress;
                        _taskRepository.UpdateData(task);
                        _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"系统自动流程,,任务状态从【{oldStatus}】转到【{task.TaskState}】");
                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Execute, deviceCode: "AGV_CSJ", currentAddress: stationManger.AGVStationCode ?? throw new Exception($"agv站点错误"), nextAddress: task.TargetAddress);
                    }
                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
                    {
@@ -154,14 +146,14 @@
                    }
                    else
                    {
                        WriteInfo(deviceCode, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                        WriteError(deviceCode, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                        _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                        _taskService.UpdateTaskExceptionMessage(taskNum, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                    }
                }
                else
                {
                    WriteInfo(deviceCode, $"未找到任务信息,任务号:{taskNum}");
                    WriteError(deviceCode, $"未找到任务信息,任务号:{taskNum}");
                    return WebResponseContent.Instance.Error($"未找到任务信息,任务号:{taskNum}");
                }
@@ -234,7 +226,7 @@
                if (string.IsNullOrEmpty(url))
                {
                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"未找到WMS移库判断接口");
                    WriteInfo(commonStackerCrane.DeviceCode, $"未找到WMS移库判断接口");
                    WriteError(commonStackerCrane.DeviceCode, $"未找到WMS移库判断接口");
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到WMS移库判断接口");
                    return null;
                }
@@ -268,13 +260,13 @@
                }
                else
                {
                    WriteInfo(task.DeviceCode, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                    WriteError(task.DeviceCode, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                }
            }
            else
            {
                WriteInfo(task.DeviceCode, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
                WriteError(task.DeviceCode, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
                _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
            }
            return null;
@@ -306,7 +298,7 @@
                else
                {
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"入库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteInfo(task.DeviceCode, $"入库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteError(task.DeviceCode, $"入库任务起点错误,起点:【{task.CurrentAddress}】");
                    return null;
                }
@@ -321,7 +313,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"入库任务终点错误,终点:【{task.NextAddress}】");
                    WriteInfo(task.DeviceCode, $"入库任务终点错误,终点:【{task.NextAddress}】");
                    WriteError(task.DeviceCode, $"入库任务终点错误,终点:【{task.NextAddress}】");
                    return null;
                }
            }
@@ -339,7 +331,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务终点错误,终点:【{task.NextAddress}】");
                    WriteInfo(task.DeviceCode, $"出库任务终点错误,终点:【{task.NextAddress}】");
                    WriteError(task.DeviceCode, $"出库任务终点错误,终点:【{task.NextAddress}】");
                    return null;
                }
@@ -354,7 +346,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteInfo(task.DeviceCode, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteError(task.DeviceCode, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                    return null;
                }
            }
@@ -371,7 +363,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"移库任务终点错误,终点:【{task.NextAddress}】");
                    WriteInfo(task.DeviceCode, $"移库任务终点错误,终点:【{task.NextAddress}】");
                    WriteError(task.DeviceCode, $"移库任务终点错误,终点:【{task.NextAddress}】");
                    return null;
                }
                string[] sourceCodes = task.CurrentAddress.Split("-");
@@ -385,7 +377,7 @@
                {
                    //数据配置错误
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteInfo(task.DeviceCode, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
                    WriteError(task.DeviceCode, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
                    return null;
                }
            }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/07d8ffab-1017-4bc5-b1d6-9b0dbac4b1a0.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/20a5f0b4-0f4e-4c7b-ba91-4c7a50a996ab.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/68aadf08-0043-4085-8419-285f1df3a4b6.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/8094bf09-43c5-4dc2-9113-16a18b45e867.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/881d0eea-b27b-4997-b88b-dadb2843b1e3.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs
@@ -16,7 +16,7 @@
    public partial class LocationInfoService
    {
        double weightValue_BC = 0.25;
        double weightValue_BC = 0.5;
        private readonly static object _locker_BC = new object();
        static List<LocationCache> locationCaches_BC = new List<LocationCache>();
@@ -75,11 +75,24 @@
                List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).ToList();
                if ((locationInfos.Count * weightValue_BC >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//如果已定义类型货位未超过比例,且有未定义类型的货位
                if (definedTypeEmptyLocations.Any())
                {
                    for (int i = 0; i < definedTypeEmptyLocations.Count; i++)
                    {
                        Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i];
                        Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, definedTypeEmptyLocation, palletType, palletTypeInfo);
                        if (locationInfo != null)
                        {
                            locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
                            return locationInfo;
                        }
                    }
                }
                else if ((/*locationInfos.Count * weightValue_BC >= definedTypeLocations.Count &&*/ undefinedTypeEmptyLocations.Any()))//如果已定义类型货位未超过比例,且有未定义类型的货位
                {
                    if (palletTypeInfo.LocaitonCount == 2)
                    {
                        if (palletTypeInfo.IsOdd)
                        if (roadwayNo != "SC01_BC")
                            undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 1).ToList();
                        else
                            undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 0).ToList();
@@ -90,19 +103,7 @@
                        Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, undefinedTypeEmptyLocation, palletType, palletTypeInfo);
                        if (locationInfo != null)
                        {
                            locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
                            return locationInfo;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < definedTypeEmptyLocations.Count; i++)
                    {
                        Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i];
                        Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, definedTypeEmptyLocation, palletType, palletTypeInfo);
                        if (locationInfo != null)
                        {
                            UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, locationInfo.WarehouseId);
                            locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
                            return locationInfo;
                        }
@@ -124,10 +125,11 @@
            if (palletTypeInfo.LocaitonCount == 2)
            {
                if (palletTypeInfo.IsOdd && emptyLocation.Column % 2 != 1 || !palletTypeInfo.IsOdd && emptyLocation.Column % 2 != 0)
                    return null;
                Dt_LocationInfo? nearLocation = locationInfos.FirstOrDefault(x => x.Row == emptyLocation.Row && x.Layer == emptyLocation.Layer && x.Depth == emptyLocation.Depth && x.Column == emptyLocation.Column + 1);
                Dt_LocationInfo? nearLocation = null;
                if (emptyLocation.RoadwayNo != "SC01_BC" && emptyLocation.Column % 2 == 1)
                    nearLocation = locationInfos.FirstOrDefault(x => x.Row == emptyLocation.Row && x.Layer == emptyLocation.Layer && x.Depth == emptyLocation.Depth && x.Column == emptyLocation.Column + 1);
                else if (emptyLocation.RoadwayNo == "SC01_BC" && emptyLocation.Column % 2 == 0)
                    nearLocation = locationInfos.FirstOrDefault(x => x.Row == emptyLocation.Row && x.Layer == emptyLocation.Layer && x.Depth == emptyLocation.Depth && x.Column == emptyLocation.Column - 1);
                if (nearLocation != null && DepthLocationIsEmpty_BC(locationInfos, nearLocation) != null)
                {
                    Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_BC(locationInfos, emptyLocation);
@@ -137,7 +139,6 @@
                    }
                }
            }
            else
            {
                Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_BC(locationInfos, emptyLocation);
@@ -162,12 +163,22 @@
            bool moreDepthFlag = false;
            bool littleDepthFlag = false;
            if (emptyLocation.LocationType == 0)
            {
            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())) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == 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())) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
            }
            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,则表示深货位有未被使用的情况
                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,则表示浅货位被使用或者被禁用的情况
            }
            if (moreDepthFlag && littleDepthFlag)
            {
                return emptyLocation;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs
@@ -190,21 +190,60 @@
                case 3:
                case 4:
                    {
                        if (emptyLocation.LocationType == 0)
                        {
                        List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList();
                        moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                            moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == 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())) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                            littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                        }
                        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,则表示深货位有未被使用的情况
                            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,则表示浅货位被使用或者被禁用的情况
                        }
                        //if (moreDepthFlag && littleDepthFlag)
                        //{
                        //    return emptyLocation;
                        //}
                        //List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList();
                        //moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.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())) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                    }
                    break;
                case 1:
                case 2:
                    {
                        if (emptyLocation.LocationType == 0)
                        {
                        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())) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                            moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == 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())) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                            littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                        }
                        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,则表示深货位有未被使用的情况
                            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,则表示浅货位被使用或者被禁用的情况
                        }
                        //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())) == 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())) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                    }
                    break;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs
@@ -161,11 +161,22 @@
            bool moreDepthFlag = false;
            bool littleDepthFlag = false;
            if (emptyLocation.LocationType == 0)
            {
            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())) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == 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())) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
            }
            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,则表示深货位有未被使用的情况
                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,则表示浅货位被使用或者被禁用的情况
            }
            if (moreDepthFlag && littleDepthFlag)
            {
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs
@@ -134,11 +134,22 @@
            bool moreDepthFlag = false;
            bool littleDepthFlag = false;
            if (emptyLocation.LocationType == 0)
            {
            List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList();
            moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == 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()) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
            }
            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,则表示深货位有未被使用的情况
                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,则表示浅货位被使用或者被禁用的情况
            }
            if (moreDepthFlag && littleDepthFlag)
            {
                return emptyLocation;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs
@@ -149,11 +149,22 @@
            bool moreDepthFlag = false;
            bool littleDepthFlag = false;
            if (emptyLocation.LocationType == 0)
            {
            List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList();
            moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//查询大于当前货位深度的集合里是否有状态不为有货的货位,如果是true,则表示深货位有未被使用的情况
                moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == 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()) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
                littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != 0) == null; //查询小于当前货位深度的集合里是否有状态不为空,且禁用状态不为禁用以及只入的货位,如果是true,则表示浅货位被使用或者被禁用的情况
            }
            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,则表示深货位有未被使用的情况
                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,则表示浅货位被使用或者被禁用的情况
            }
            if (moreDepthFlag && littleDepthFlag)
            {
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs
@@ -165,6 +165,10 @@
                }
                Dt_LocationInfo? nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column + 1);
                if(location.RoadwayNo == "SC01_BC")
                {
                    nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column - 1);
                }
                if (nearLocation != null)
                {
                    List<Dt_LocationInfo> nearLocations = GetGroupLocations(locationInfos, nearLocation);
@@ -337,10 +341,19 @@
                        nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column - 1);
                    }
                    if (location.RoadwayNo == "SC01_BC")
                    {
                        nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column - 1);
                    }
                    if (nearLocation != null)
                    {
                        List<Dt_LocationInfo> nearLocations = GetGroupLocations(locationInfos, nearLocation);
                        for (int i = 0; i < nearLocations.Count; i++)
                        {
                            List<int> palletTypes = palletTypeInfos.Select(x => x.PalletType).ToList();
                            palletTypes.Add(0);
                            if (palletTypes.Contains(nearLocations[i].LocationType))
                        {
                            if (nearLocations[i].LocationType != palletType)
                            {
@@ -369,7 +382,7 @@
                                    nearLocations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt();
                                }
                            }
                            }
                        }
                        locations.AddRange(nearLocations);
                    }
@@ -430,9 +443,11 @@
        {
            List<Dt_LocationInfo> groupLocations = new List<Dt_LocationInfo>() { location };
            int maxDepth = locationInfos.Max(x => x.Depth);
            int row = location.Row;
            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);
                row += 1;
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row);
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
@@ -441,7 +456,8 @@
            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);
                row -= 1;
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row);
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
@@ -461,9 +477,11 @@
            List<Dt_LocationInfo> groupLocations = new List<Dt_LocationInfo>() { location };
            int maxDepth = locationInfos.Max(x => x.Depth);
            int row = location.Row;
            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);
                row += 1;
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row);
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
@@ -472,7 +490,8 @@
            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);
                row -= 1;
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row);
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs
@@ -195,5 +195,7 @@
        /// <param name="model"></param>
        /// <returns></returns>
        MesResponseContent SubstrateBack(SubstrateBackModel model);
        WebResponseContent AssignRoadway(int taskNum, List<string> roadwayNos);
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,58 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Core;
using WIDESEA_Core.Helper;
using WIDESEA_Model.Models;
namespace WIDESEA_TaskInfoService
{
    public partial class TaskService
    {
        /// <summary>
        /// å…¥åº“任务申请分配货位
        /// </summary>
        /// <param name="taskNum">任务号</param>
        /// <param name="roadwayNo">巷道号</param>
        /// <returns></returns>
        public WebResponseContent AssignRoadway(int taskNum, List<string> roadwayNos)
        {
            try
            {
                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                if (task == null)
                {
                    return WebResponseContent.Instance.Error($"未找到该入库任务");
                }
                if (_basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress) != null)
                {
                    return WebResponseContent.Instance.OK(data: task.TargetAddress);
                }
                List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == 0) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo)).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList();
                string roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? "";
                return !string.IsNullOrEmpty(roadwayNo) ? WebResponseContent.Instance.OK(data: roadwayNo): WebResponseContent.Instance.Error("未找到可分配巷道");
            }
            catch (Exception ex)
            {
                _unitOfWorkManage.RollbackTran();
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public class LocationCount
        {
            public string RoadwayNo { get; set; }
            public int Count { get; set; }
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs
@@ -465,8 +465,8 @@
                    CurrentAddress = "",
                    NextAddress = "",
                    PalletType = stockInfo.PalletType,
                    Roadway = "",
                    SourceAddress = "",
                    Roadway = "RGV01_BC",
                    SourceAddress = "RGV01_BC",
                    TargetAddress = "",
                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
                    TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(),
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs
@@ -77,17 +77,25 @@
            return Service.MaterielGroup(saveModel);
        }
        /// <summary>
        /// å…¥åº“完成后回传ERP
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        ///// <summary>
        ///// å…¥åº“完成后回传ERP
        ///// </summary>
        ///// <param name="id"></param>
        ///// <returns></returns>
        //[HttpPost, HttpGet, Route("FeedbackInboundOrder")]
        //public WebResponseContent FeedbackInboundOrder(int id)
        //{
        //    return Service.FeedbackInboundOrder(id);
        //}
        /// <summary>
        /// æ— å…¥åº“单组盘
        /// </summary>
        /// <param name="palletCode"></param>
        /// <param name="initiallife"></param>
        /// <param name="warehouseId"></param>
        /// <param name="serNums"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("ManualMaterielGroup")]
        public WebResponseContent MaterielGroup(string palletCode, int initiallife, int warehouseId, [FromBody] List<string> serNums)
        {
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs
@@ -173,5 +173,17 @@
        {
            return Service.Outbound(id);
        }
        /// <summary>
        /// åˆ†é…å··é“
        /// </summary>
        /// <param name="taskNum"></param>
        /// <param name="roadwayNos"></param>
        /// <returns></returns>
        [HttpPost, Route("AssignRoadway"), AllowAnonymous]
        public WebResponseContent AssignRoadway(int taskNum, [FromBody]List<string> roadwayNos)
        {
            return Service.AssignRoadway(taskNum, roadwayNos);
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -12,7 +12,7 @@
  "MainDB": "DB_WIDESEA", //当前项目的主库,所对应的连接字符串的Enabled必须为true
  //连接字符串
  //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_HUAIAN;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_HUAIAN;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //跨域
  "Cors": {
    "PolicyName": "CorsIpAccess", //策略名称