肖洋
2024-12-24 e2655143a06ee42eec06a97b045f33a09fbb3a3f
合并更改
已删除2个文件
已修改6个文件
110 ■■■■■ 文件已修改
.gitignore 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -1589,3 +1589,5 @@
/Code Management/.vs/slnx.sqlite
/Code Management/.vs/Code Management/v17/.wsuo
/Code Management/.vs/Code Management/v17/workspaceFileList.bin
/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
ÎļþÒÑɾ³ý
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -505,12 +505,8 @@
                    }
                    if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
                    {
                        Dt_Task? tasks = UpdatePosition(task.TaskNum, task.CurrentAddress);
                        if (tasks != null)
                        {
                            task.CurrentAddress = tasks.CurrentAddress;
                            task.NextAddress = tasks.NextAddress;
                        }
                        content = StackCraneTaskCompleted(task.TaskNum);
                        return content;
                    }
                }
                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -22,6 +22,7 @@
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_SignalR;
using WIDESEAWCS_Tasks.ConveyorLineJob;
@@ -32,7 +33,7 @@
    [DisallowConcurrentExecution]
    public partial class CommonConveyorLineJob : JobBase, IJob
    {
        public readonly ITaskService _taskService;
        private readonly ITaskService _taskService;
        private readonly ITaskRepository _taskRepository;
        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
        private readonly IRouterService _routerService;
@@ -43,12 +44,13 @@
        private readonly IDt_StationManagerRepository _stationManagerRepository;
        private readonly ICacheService _cacheService;
        private readonly INoticeService _noticeService;
        private readonly IDeviceInfoRepository _deviceInfoRepository;
        private static List<string>? userTokenIds;
        private static List<int>? userIds;
        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService)
        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService, IDeviceInfoRepository deviceInfoRepository)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
@@ -61,13 +63,12 @@
            _stationManagerRepository = stationManagerRepository;
            _cacheService = cacheService;
            _noticeService = noticeService;
            _deviceInfoRepository = deviceInfoRepository;
        }
        public async Task Execute(IJobExecutionContext context)
        {
            string jobName = context.JobDetail.Key.Name;
            //if (MemoryLockManager.TryAcquireLock(jobName))
            //{
            try
            {
                // ä»ŽJobDataMap中获取传递的参数
@@ -76,9 +77,11 @@
                {
                    // æŸ¥è¯¢æ‰€æœ‰å­è®¾å¤‡çš„位置
                    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);
@@ -143,15 +146,6 @@
                // è¾“出异常信息
                Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
            }
            //    finally
            //    {
            //        MemoryLockManager.ReleaseLock(jobName);
            //    }
            // }
            // else
            // {
            //     ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]【{jobName}】任务已被锁定,无法处理");
            // }
            return;
        }
@@ -165,7 +159,6 @@
                ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand");
                if (command != null && commandWrite != null)
                {
                    #region è°ƒç”¨äº‹ä»¶æ€»çº¿é€šçŸ¥å‰ç«¯
                    // èŽ·å–ç¼“å­˜ä¸­çš„ç”¨æˆ·ä¿¡æ¯
@@ -255,7 +248,10 @@
                            }
                        }
                    }
                    //if (conveyorLine.DeviceCode == "1001")
                    //{
                    //    ConsoleHelper.WriteSuccessLine("ProcessDeviceAsync方法结束时间:" + DateTime.Now.ToString("G") + $"点位:{childDeviceCode}");
                    //}
                }
            }
            catch (Exception ex)
@@ -655,7 +651,7 @@
                else
                    taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
                // è°ƒç”¨æ£€æŸ¥å¹¶åˆ›å»ºä»»åŠ¡çš„æ–¹æ³•
                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform);
            }
            catch (Exception)
            {
@@ -666,7 +662,7 @@
        /// <summary>
        /// æ£€æŸ¥ä»»åŠ¡å¹¶åˆ›å»ºæ–°ä»»åŠ¡
        /// </summary>
        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, Platform platform)
        {
            // æŸ¥è¯¢æ•°æ®åº“中已有的任务
            var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
@@ -691,8 +687,11 @@
                }
                var wmsIpAddress = wmsBase + requestTrayOutTask;
                var device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && x.DeviceRemark == platform.Id.ToString());
                var deviceCode = device.Select(x => x.DeviceCode).ToList();
                // å‘送HTTP POST请求获取任务数据
                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString());
                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = platform.Stacker, AreaCdoes = deviceCode, platform.ProductionLine }.ToJsonString());
                // è§£æžè¿”回的JSON数据
                WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
@@ -758,7 +757,6 @@
            if (result1.Success)
            {
                var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1).ToList();
                if (serialNosError.Count > 0)
                {
@@ -793,7 +791,7 @@
            }
            else
            {
                ConsoleHelper.WriteErrorLine(result1.MOMMessage);
            }
        }
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -41,6 +41,7 @@
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_SignalR;
using WIDESEAWCS_Tasks.ConveyorLineJob;
@@ -62,8 +63,9 @@
        private readonly IDt_StationManagerRepository _stationManagerRepository;
        private readonly ICacheService _cacheService;
        private readonly INoticeService _noticeService;
        private readonly IDeviceInfoRepository _deviceInfoRepository;
        public CommonConveyorLine_GWJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService)
        public CommonConveyorLine_GWJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService, IDeviceInfoRepository deviceInfoRepository)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
@@ -75,6 +77,7 @@
            _stationManagerRepository = stationManagerRepository;
            _cacheService = cacheService;
            _noticeService = noticeService;
            _deviceInfoRepository = deviceInfoRepository;
        }
        public Task Execute(IJobExecutionContext context)
@@ -434,7 +437,7 @@
                    taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray;
                else
                    taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform);
            }
            catch (Exception)
            {
@@ -444,7 +447,7 @@
        /// <summary>
        /// æ£€æŸ¥ä»»åŠ¡å¹¶åˆ›å»ºæ–°ä»»åŠ¡
        /// </summary>
        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, Platform platform)
        {
            var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
            if (tasks.Count < index)
@@ -463,10 +466,11 @@
                }
                var wmsIpAddress = wmsBase + requestTrayOutTask;
                var device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && x.DeviceRemark == platform.Id.ToString());
                var deviceCode = device.Select(x => x.DeviceCode).ToList();
                List<string> strings = platform.Location.Split(',').ToList();
                var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = roadWay, AreaCdoes = strings, platform.ProductionLine }.ToJsonString());
                var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = platform.Stacker, AreaCdoes = strings, platform.ProductionLine }.ToJsonString());
                //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
                WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -81,7 +81,6 @@
                                    bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                    if (sendFlag)
                                    {
                                        commonStackerCrane.SetValue(StackerCraneDBName.StartCommand, 1);
                                        commonStackerCrane.LastTaskType = task.TaskType;
                                        _taskService.UpdateTaskStatusToNext(task.TaskNum);
                                    }
@@ -358,7 +357,7 @@
            stackerCraneTaskCommand.TaskNum = task.TaskNum;
            stackerCraneTaskCommand.WorkType = 1;
            stackerCraneTaskCommand.TrayType = 0;
            //stackerCraneTaskCommand.StartCommand = 1;
            stackerCraneTaskCommand.StartCommand = 1;
            if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//判断是否是入库任务
            {
                if (task.SourceAddress == "1359-4" && task.Roadway.Contains("JZ"))
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1,5 +1,6 @@
using Mapster;
using Masuit.Tools;
using SixLabors.Fonts.Tables.AdvancedTypographic;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WIDESEA_Core.Const;
@@ -1028,7 +1029,7 @@
        {
            // æ ¹æ®æ‰˜ç›˜ç±»åž‹æŸ¥è¯¢åº“存信息
            DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound
                ? areaCodes == null ? await QueryStockInfoForRealTrayAsync(areaCode, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine)
                ? areaCode != "CWSC1" ? await QueryStockInfoForRealTrayAsync(areaCode, areaCodes, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine)
                : await QueryStockInfoForEmptyTrayAsync(areaCode);
            if (stockInfo == null)
@@ -1076,7 +1077,7 @@
    /// <summary>
    /// æŸ¥è¯¢å®žç›˜åº“存信息
    /// </summary>
    private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, string productionLine)
    private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> devices, string productionLine)
    {
        var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode);
@@ -1086,6 +1087,7 @@
            .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // è¿‡æ»¤æ¡ä»¶
            .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // è¿‡æ»¤æ¡ä»¶
            .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo))
            .OrderBy(x => x.OutboundTime) // æŽ’序
            .FirstAsync(); // èŽ·å–ç¬¬ä¸€ä¸ªå…ƒç´ 
@@ -1096,7 +1098,7 @@
    }
    /// <summary>
    /// æŸ¥è¯¢å®žç›˜åº“存信息
    /// æŸ¥è¯¢å¸¸æ¸©å®žç›˜åº“存信息
    /// </summary>
    private async Task<DtStockInfo> QueryStockInfoForRealTrayCWAsync(List<string> areaCodes, string productionLine)
    {
@@ -1145,7 +1147,7 @@
    {
        return new Dt_Task
        {
            Grade = 1,
            Grade = tag == 104 ? 2 : 1,
            Roadway = stockInfo.LocationInfo.RoadwayNo,
            TargetAddress = position,
            Dispatchertime = DateTime.Now,
@@ -1172,7 +1174,7 @@
        return new WMSTaskDTO
        {
            TaskNum = task.TaskNum.Value,
            Grade = 1,
            Grade = task.Grade.Value,
            PalletCode = task.PalletCode,
            RoadWay = task.Roadway,
            SourceAddress = task.SourceAddress,