肖洋
2024-12-22 cdabe47ad8128c5006202e55c29746a617e988d6
添加静置NG入库功能,更新相关接口和配置,优化代码结构
已修改11个文件
370 ■■■■■ 文件已修改
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs
@@ -69,6 +69,9 @@
        /// </summary>
        public const string RequestOutTaskToBZ = "RequestOutTaskToBZ";
        /// <summary>
        /// 静置NG入库
        /// </summary>
        public const string RequestInBoundTaskNG = "RequestInBoundTaskNG";
    }
}
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
@@ -13,8 +13,8 @@
  //连接字符串
  //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
  //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=True",
  "ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //跨域
  "Cors": {
    "PolicyName": "CorsIpAccess", //策略名称
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -90,10 +90,11 @@
                    task.Creater = "WMS";
                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                    {
                        if (task.TargetAddress == "002-021-001")
                        if (task.TargetAddress == "002-021-001" && task.Roadway.Contains("JZ") && task.TaskType == (int)TaskOutboundTypeEnum.OutTray)
                        {
                            task.TaskState = (int)TaskOutStatusEnum.OutNew;
                            task.CurrentAddress = item.SourceAddress;
                            task.NextAddress = item.TargetAddress;
                        }
                        else
                        {
@@ -128,6 +129,11 @@
                                task.NextAddress = routers.FirstOrDefault().ChildPosi;
                            }
                        }
                        else
                        {
                            task.CurrentAddress = "002-021-001";
                            task.NextAddress = item.TargetAddress;
                        }
                    }
                    tasks.Add(task);
                }
@@ -155,20 +161,31 @@
            WebResponseContent content = new WebResponseContent();
            try
            {
                var hasTask = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode);
                if (hasTask != null)
                {
                    return content.OK("当前托盘存在任务");
                }
                var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
                var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
                var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTask)?.ConfigValue;
                if (wmsBase == null || requestTask == null)
                var wmsIpAddrss = string.Empty;
                var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == sourceAddress);
                if (stationManager.stationType == 5)
                {
                    throw new InvalidOperationException("WMS IP 未配置");
                    wmsIpAddrss = GetIpAddress(SysConfigKeyConst.WMSIP_BASE, SysConfigKeyConst.RequestInBoundTaskNG);
                }
                var wmsIpAddrss = wmsBase + requestTask;
                else
                {
                    wmsIpAddrss = GetIpAddress(SysConfigKeyConst.WMSIP_BASE, SysConfigKeyConst.RequestTask);
                }
                //var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
                //var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
                //var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTask)?.ConfigValue;
                //if (wmsBase == null || requestTask == null)
                //{
                //    throw new InvalidOperationException("WMS IP 未配置");
                //}
                //var wmsIpAddrss = wmsBase + requestTask;
                var result = await HttpHelper.PostAsync(wmsIpAddrss, new { Position = sourceAddress, PalletCode = palletCode }.ToJsonString());
                content = JsonConvert.DeserializeObject<WebResponseContent>(result);
@@ -824,5 +841,18 @@
        {
            return BaseDal.QueryFirst(x => x.PalletCode == barcode && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy);
        }
        private string GetIpAddress(string baseIp,string name)
        {
            var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
            var wcsBasez = configz.Where(x => x.ConfigKey == baseIp).FirstOrDefault()?.ConfigValue;
            var address = configz.Where(x => x.ConfigKey == name).FirstOrDefault()?.ConfigValue;
            if (wcsBasez == null || address == null)
            {
                throw new InvalidOperationException("WMS IP 未配置");
            }
            return wcsBasez + address;
        }
    }
}
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -24,6 +24,7 @@
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_SignalR;
using WIDESEAWCS_Tasks.ConveyorLineJob;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
using ICacheService = WIDESEAWCS_Core.Caches.ICacheService;
namespace WIDESEAWCS_Tasks
@@ -61,54 +62,76 @@
        public async Task Execute(IJobExecutionContext context)
        {
            string jobName = context.JobDetail.Key.Name;
            if (MemoryLockManager.TryAcquireLock(jobName))
            //if (MemoryLockManager.TryAcquireLock(jobName))
            //{
            try
            {
                try
                CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
                if (conveyorLine != null)
                {
                    CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
                    if (conveyorLine != null)
                    {
                        List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
                        var tasks = childDeviceCodes.Select(childDeviceCode => ProcessDeviceAsync(conveyorLine, childDeviceCode)).ToList();
                        await Task.WhenAll(tasks);
                    List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
                    var tasks = childDeviceCodes.Select(childDeviceCode => ProcessDeviceAsync(conveyorLine, childDeviceCode)).ToList();
                    await Task.WhenAll(tasks);
                        List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode);
                        foreach (var station in stationManagers)
                    List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode);
                    foreach (var station in stationManagers)
                    {
                        if (station.stationType == 11)
                        {
                            if (station.stationType == 11)
                            ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode);
                            ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand");
                            if (command != null && commandWrite != null)
                            {
                                ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode);
                                ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand");
                                if (command != null && commandWrite != null)
                                var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray();
                                if (structs[0] == true)
                                {
                                    var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray();
                                    if (structs[0] == true)
                                    ConsoleHelper.WriteWarningLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】空托盘请求扫码入库");
                                    NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation);
                                }
                                else
                                {
                                    ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false);
                                }
                            }
                        }
                        else if (station.stationType == 5)
                        {
                            ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode);
                            ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand");
                            if (command != null && commandWrite != null)
                            {
                                var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray();
                                if (structs[0] == true)
                                {
                                    if (_taskRepository.QueryData(x => x.SourceAddress == station.stationChildCode).Count() > 0)
                                    {
                                        ConsoleHelper.WriteWarningLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】空托盘请求扫码入库");
                                        NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation);
                                        return;
                                    }
                                    else
                                    {
                                        ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false);
                                    }
                                    ConsoleHelper.WriteWarningLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】异常口请求扫码入库");
                                    HandleNewTask(conveyorLine, command, station.stationChildCode, 0);
                                }
                                else
                                {
                                    ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
                }
                finally
                {
                    MemoryLockManager.ReleaseLock(jobName);
                }
            }
            else
            catch (Exception ex)
            {
                ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]【{jobName}】任务已被锁定,无法处理");
                Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
            }
            //    finally
            //    {
            //        MemoryLockManager.ReleaseLock(jobName);
            //    }
            //}
            //else
            //{
            //    ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]【{jobName}】任务已被锁定,无法处理");
            //}
            return;
        }
@@ -361,7 +384,7 @@
            {
                if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress)
                {
                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode);
                    //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode);
                    ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】输送线入库完成,下一目标地址【等待分配货位,并写入1000】");
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
@@ -79,19 +79,6 @@
                default:
                    break;
            }
            //if ((conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016") || (conveyorLine.DeviceCode == "1005" && childDeviceCode == "1048"))
            //{
            //    await CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
            //}
            //else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088") || (conveyorLine.DeviceCode == "1004" && childDeviceCode == "1339"))
            //{
            //    await RequestWmsTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
            //}
            //else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1068"))
            //{
            //    ConveyorLineOutFinish(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
            //}
        }
        /// <summary>
@@ -215,16 +202,17 @@
        /// </summary>
        private async Task RequestWmsTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
        {
            var content = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
            if (content.Status)
            {
                var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
                if (task != null)
                {
                    if (task.TargetAddress == childDeviceCode)
                    if (task.SourceAddress == "1059-4")
                    {
                        conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode);
                        //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode);
                        ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{task.TaskNum}】,托盘条码:【{task.PalletCode}】已到达【{childDeviceCode}】请求扫码入库(实盘),下一目标地址【{1000}】");
                        ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -370,7 +370,7 @@
            stackerCraneTaskCommand.StartCommand = 1;
            if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//判断是否是入库任务
            {
                if (task.Roadway.Contains("JZ"))
                if (task.SourceAddress == "1359-4" && task.Roadway.Contains("JZ"))
                {
                    string[] souredCodes = task.CurrentAddress.Split("-");
                    if (souredCodes.Length == 3)
@@ -444,31 +444,46 @@
                }
                else
                {
                    List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress);
                    if (routers.Count > 0)
                    {
                        stackerCraneTaskCommand.EndRow = Convert.ToInt16(routers.FirstOrDefault().SrmRow);
                        stackerCraneTaskCommand.EndColumn = Convert.ToInt16(routers.FirstOrDefault().SrmColumn);
                        stackerCraneTaskCommand.EndLayer = Convert.ToInt16(routers.FirstOrDefault().SrmLayer);
                        string[] sourceCodes = task.CurrentAddress.Split("-");
                        if (sourceCodes.Length == 3)
                        {
                            stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2;
                            stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]);
                            stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]);
                        }
                        else
                        {
                            //数据配置错误
                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                            return null;
                        }
                    if (task.TargetAddress == "002-021-001" && task.Roadway.Contains("JZ") && task.TaskType == (int)TaskOutboundTypeEnum.OutTray)
                    {
                        string[] endCodes = task.NextAddress.Split("-");
                        stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]);
                        stackerCraneTaskCommand.EndColumn = Convert.ToInt16(endCodes[1]);
                        stackerCraneTaskCommand.EndLayer = Convert.ToInt16(endCodes[2]);
                        string[] sourceCodes = task.SourceAddress.Split("-");
                        stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2;
                        stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]);
                        stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]);
                    }
                    else
                    {
                        _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法获取对应的堆垛机放货站台信息");
                        return null;
                        List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress);
                        if (routers.Count > 0)
                        {
                            stackerCraneTaskCommand.EndRow = Convert.ToInt16(routers.FirstOrDefault().SrmRow);
                            stackerCraneTaskCommand.EndColumn = Convert.ToInt16(routers.FirstOrDefault().SrmColumn);
                            stackerCraneTaskCommand.EndLayer = Convert.ToInt16(routers.FirstOrDefault().SrmLayer);
                            string[] sourceCodes = task.CurrentAddress.Split("-");
                            if (sourceCodes.Length == 3)
                            {
                                stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2;
                                stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]);
                                stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]);
                            }
                            else
                            {
                                //数据配置错误
                                _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
                                return null;
                            }
                        }
                        else
                        {
                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法获取对应的堆垛机放货站台信息");
                            return null;
                        }
                    }
                }
            }
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs
@@ -190,6 +190,14 @@
    Task<WebResponseContent> CreateAndSendOutboundTask(string locationCode, string palletCode);
    /// <summary>
    /// 指定任务出库
    /// </summary>
    /// <param name="palletCode">托盘号</param>
    /// <param name="position">位置</param>
    /// <returns></returns>
    Task<WebResponseContent> CreateAndSendInboundTask(string palletCode, string position);
    /// <summary>
    /// 常温补空托盘至分容
    /// </summary>
    /// <param name="taskDTO"></param>
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1,6 +1,7 @@
using Mapster;
using Masuit.Tools;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WIDESEA_Core.Const;
using WIDESEA_DTO.MOM;
using WIDESEA_DTO.WMS;
@@ -285,7 +286,7 @@
        WebResponseContent content = new WebResponseContent();
        try
        {
            if (task.TaskType == (int)TaskInboundTypeEnum.InNG)
            if (task.TaskType == (int)TaskInboundTypeEnum.InNG || task.TaskType == (int)TaskInboundTypeEnum.InQuality)
            {
                task.TaskState = (int)TaskInStatusEnum.SC_InFinish;
                // 创建历史任务实例模型
@@ -430,6 +431,8 @@
                area = _areaInfoRepository.QueryFirst(x => x.AreaID == 6);
            else if (boxing.ProcessCode == "OCVB")
                area = _areaInfoRepository.QueryFirst(x => x.AreaID == 7);
            else
                area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId);
            if (area == null)
                throw new Exception("未找到对应区域信息");
@@ -537,6 +540,7 @@
            case (int)TaskInboundTypeEnum.Inbound:
            case (int)TaskInboundTypeEnum.InTray:
            case (int)TaskInboundTypeEnum.InNG:
            case (int)TaskInboundTypeEnum.InQuality:
                LogFactory.GetLog("任务完成").InfoFormat(true, "入库任务", "");
                return await CompleteInboundTaskAsync(task);
@@ -1332,65 +1336,82 @@
            var stockInfo = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == palletCode);
            if (stockInfo == null)
            {
                var taskOld = BaseDal.QueryFirst(x => x.PalletCode == palletCode);
                if (!taskOld.IsNullOrEmpty())
                {// 创建WMS任务
                    WMSTaskDTO taskDTO = new WMSTaskDTO()
                    {
                        TaskNum = taskOld.TaskNum.Value,
                        Grade = 1,
                        PalletCode = taskOld.PalletCode,
                        RoadWay = taskOld.Roadway,
                        SourceAddress = taskOld.CurrentAddress,
                        TargetAddress = taskOld.TargetAddress,
                        TaskState = taskOld.TaskState.Value,
                        Id = 0,
                        TaskType = taskOld.TaskType,
                    };
                    return content.OK(data: taskDTO);
                }
                var area = _areaInfoRepository.QueryFirst(x => x.AreaID == 2);
                var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == position);
                TrayCellsStatusDto trayCells = CreateTrayCellsStatusDto(area, palletCode);
                content = await GetTrayCellStatusAsync(trayCells);
                if (!content.Status) return content;
                ConsoleHelper.WriteErrorLine(content.ToJsonString());
                var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
                if (!result.Success)
                if (result.SerialNos.Count > 0)
                {
                    if (result.SerialNos.Count <= 0)
                    var location = await GetLocationDistributeAsync(station.Roadway);
                    ConsoleHelper.WriteErrorLine(location.ToJsonString());
                    // 创建新任务实例
                    var task = new Dt_Task
                    {
                        var location = await GetLocationDistributeAsync(station.Roadway);
                        // 创建新任务实例
                        var task = new Dt_Task
                        {
                            CurrentAddress = station.stationLocation,
                            Grade = 1,
                            Roadway = station.Roadway,
                            TargetAddress = location.LocationCode,
                            Dispatchertime = DateTime.Now,
                            MaterialNo = "",
                            NextAddress = location.LocationCode,
                            OrderNo = null,
                            PalletCode = palletCode,
                            SourceAddress = position,
                            TaskState = (int)TaskInStatusEnum.Line_InFinish,
                            TaskType = (int)TaskInboundTypeEnum.Inbound,
                            TaskNum = await BaseDal.GetTaskNo(),
                            Creater = "Systeam"
                        };
                        CurrentAddress = station.stationLocation,
                        Grade = 1,
                        Roadway = station.Roadway,
                        TargetAddress = location.LocationCode,
                        Dispatchertime = DateTime.Now,
                        MaterialNo = "",
                        NextAddress = location.LocationCode,
                        OrderNo = null,
                        PalletCode = palletCode,
                        SourceAddress = position,
                        TaskState = (int)TaskInStatusEnum.Line_InFinish,
                        TaskType = (int)TaskInboundTypeEnum.Inbound,
                        TaskNum = await BaseDal.GetTaskNo(),
                        Creater = "Systeam"
                    };
                        // 创建WMS任务
                        WMSTaskDTO taskDTO = new WMSTaskDTO()
                        {
                            TaskNum = task.TaskNum.Value,
                            Grade = 1,
                            PalletCode = task.PalletCode,
                            RoadWay = task.Roadway,
                            SourceAddress = task.SourceAddress,
                            TargetAddress = task.Roadway,
                            TaskState = task.TaskState.Value,
                            Id = 0,
                            TaskType = task.TaskType,
                        };
                    // 创建WMS任务
                    WMSTaskDTO taskDTO = new WMSTaskDTO()
                    {
                        TaskNum = task.TaskNum.Value,
                        Grade = 1,
                        PalletCode = task.PalletCode,
                        RoadWay = task.Roadway,
                        SourceAddress = task.SourceAddress,
                        TargetAddress = task.TargetAddress,
                        TaskState = task.TaskState.Value,
                        Id = 0,
                        TaskType = task.TaskType,
                    };
                        await _unitOfWorkManage.UseTranAsync(async () =>
                        {
                            // 添加任务到数据库
                            await BaseDal.AddDataAsync(task);
                            // 更新库存位置状态为不可用
                            location.LocationStatus = (int)LocationEnum.InStockDisable;
                            await _locationRepository.UpdateDataAsync(location);
                        });
                    await _unitOfWorkManage.UseTranAsync(async () =>
                    {
                        // 添加任务到数据库
                        await BaseDal.AddDataAsync(task);
                        // 更新库存位置状态为不可用
                        location.LocationStatus = (int)LocationEnum.InStockDisable;
                        await _locationRepository.UpdateDataAsync(location);
                    });
                        content.OK(data: taskDTO);
                    }
                    else
                        content.Error(result.MOMMessage);
                    content.OK(data: taskDTO);
                }
                else
                    content.Error(result.MOMMessage);
            }
            else
            {
@@ -1688,6 +1709,14 @@
            var content = new WebResponseContent();
            // 获取目标地址和更新任务状态
            input.Position = Regex.Replace(input.Position, @"-(\d+)", "");
            if (Convert.ToInt32(input.Position) > 1999)
            {
                input.Position = (Convert.ToInt32(input.Position) - 1000).ToString();
            }
            if (task.TaskType == (int)TaskInboundTypeEnum.InNG)
            {
                // TODO 根据巷道查找对应NG口,现在默认去静置堆垛机的异常口货位号
@@ -1700,7 +1729,7 @@
            }
            else if (task.TaskType == (int)TaskInboundTypeEnum.InQuality)
            {
                var stockInfo = _stockInfoRepository.QueryFirst(x => x.PalletCode == input.PalletCode);
                var stockInfo = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == input.PalletCode);
                task.CurrentAddress = input.Position;
                task.TargetAddress = stockInfo.LocationInfo.LocationCode;
                task.NextAddress = stockInfo.LocationInfo.LocationCode;
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs
@@ -44,7 +44,7 @@
        //var station = stationManagers.Select(x => x.stationChildCode).ToList();
        //// 获取WCSip地址相关配置
        //var wcsIpAddrss = GetWCSIpAddress();
        var wcsIpAddrss = GetWCSIpAddress();
        //if (wcsIpAddrss == null)
        //{
        //    throw new InvalidOperationException("WCS IP 未配置");
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
@@ -146,6 +146,18 @@
    }
    /// <summary>
    /// 静置NG入库
    /// </summary>
    /// <param name="locationCode">货位号</param>
    /// <param name="palletCode">托盘号</param>
    /// <returns></returns>
    [HttpPost, AllowAnonymous, Route("RequestInBoundTaskNG")]
    public async Task<WebResponseContent> RequestInBoundTaskNG([FromBody] RequestTaskDto input)
    {
        return await Service.CreateAndSendInboundTask(input.PalletCode, input.Position);
    }
    /// <summary>
    /// 常温补空托盘至分容
    /// </summary>
    /// <param name="input">请求数据</param>
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -10,9 +10,9 @@
  "MainDB": "DB_WIDESEA", //当前项目的主库,所对应的连接字符串的Enabled必须为true
  //连接字符串
  //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
  //"ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //跨域