1
刘磊
2024-12-26 e5642daf4b6820d0706967e486b16e8d33a46d6d
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -101,7 +101,7 @@
                                    // 输出警告信息
                                    ConsoleHelper.WriteWarningLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】空托盘请求扫码入库");
                                    // 处理入库请求
                                    NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation);
                                    NGRequestTaskInbound(conveyorLine, command, station, 0);
                                }
                                else
                                {
@@ -162,26 +162,12 @@
                    #region 调用事件总线通知前端
                    // 获取缓存中的用户信息
                    if (userTokenIds == null && userIds == null)
                    var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
                    if (tokenInfos != null && tokenInfos.Any())
                    {
                        var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
                        if (tokenInfos != null && tokenInfos.Any())
                        {
                            userTokenIds = tokenInfos.Select(x => x.Token_ID).ToList();
                            userIds = tokenInfos.Select(x => x.UserId).ToList();
                        userTokenIds = tokenInfos.Select(x => x.Token_ID).ToList();
                        userIds = tokenInfos.Select(x => x.UserId).ToList();
                            // 构造通知数据
                            object obj = new
                            {
                                command,
                                commandWrite
                            };
                            // 发送通知
                            _noticeService.LineData(userIds.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, childDeviceCode, data = obj });
                        }
                    }
                    else
                    {
                        // 构造通知数据
                        object obj = new
                        {
@@ -726,7 +712,7 @@
        #region 设备NG口入库
        public void NGRequestTaskInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue, string TargetAddress)
        public void NGRequestTaskInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, Dt_StationManager stationManager, int ProtocalDetailValue)
        {
            var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
            var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.MOMIP_BASE)?.ConfigValue;
@@ -735,7 +721,6 @@
            {
                throw new InvalidOperationException("MOM IP 未配置");
            }
            Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
            TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
            {
                Software = "WMS",
@@ -750,9 +735,9 @@
            var MOMIpAddress = wmsBase + ipAddress;
            var result = HttpHelper.PostAsync(MOMIpAddress, trayCells.ToJsonString()).Result;
            WriteInfo("入站校验", $"【{childDeviceCode}】入站校验请求参数【{trayCells.ToJsonString()}】");
            WriteInfo("入站校验", $"【{stationManager.stationChildCode}】入站校验请求参数【{trayCells.ToJsonString()}】");
            WriteInfo("入站校验", "");
            WriteInfo("入站校验", $"【{childDeviceCode}】入站校验返回参数【{result}】");
            WriteInfo("入站校验", $"【{stationManager.stationChildCode}】入站校验返回参数【{result}】");
            ResultTrayCellsStatus result1 = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(result);
            if (result1.Success)
@@ -765,28 +750,16 @@
                if (result1.SerialNos.Count <= 0)
                {
                    // 空托盘入库逻辑
                    Dt_Task dt_Task = new Dt_Task()
                    {
                        TargetAddress = TargetAddress,
                        PalletCode = command.Barcode,
                        NextAddress = TargetAddress,
                        TaskNum = 0
                    };
                    var next = dt_Task.NextAddress;
                    var taskCommand = MapTaskCommand(dt_Task, command);
                    dt_Task.NextAddress = next;
                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, stationManager.stationLocation, stationManager.stationChildCode);
                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                    ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true);
                }
                else
                {
                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, 1000, childDeviceCode);
                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, 1000, stationManager.stationChildCode);
                    ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                    ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true);
                }
            }
            else