刘磊
2025-01-08 1d044540ee1b7041c7e89bdfe6d1339c99e80a4e
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_BZ/CommonConveyorLine_BZJob.cs
@@ -112,21 +112,21 @@
                        }
                        #region 调用事件总线通知前端
                        var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
                        if (tokenInfos == null || !tokenInfos.Any())
                        {
                            //throw new Exception(conveyorLine.DeviceName + "缓存中未找到Token缓存");
                            continue;
                        }
                        var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
                        var userIds = tokenInfos?.Select(x => x.UserId).ToList();
                        //var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
                        //if (tokenInfos == null || !tokenInfos.Any())
                        //{
                        //    //throw new Exception(conveyorLine.DeviceName + "缓存中未找到Token缓存");
                        //    continue;
                        //}
                        //var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
                        //var userIds = tokenInfos?.Select(x => x.UserId).ToList();
                        object obj = new
                        {
                            station.stationChildCode,
                            commandAfter = command,
                        };
                        _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
                        //object obj = new
                        //{
                        //    station.stationChildCode,
                        //    commandAfter = command,
                        //};
                        //_noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
                        #endregion 调用事件总线通知前端
                    }
@@ -193,7 +193,7 @@
        public void RequestOutbound(CommonConveyorLine_BZ conveyorLine, ConveyorLineTaskCommand_After command, Dt_StationManager station)
        {
            //查询对应产线的在途数据
            dt_needBarcode needBarcode = _needBarcodeRepository.QueryFirst(x => x.productLine == station.productLine);
            dt_needBarcode needBarcode = _needBarcodeRepository.QueryFirst(x => x.productLine == station.productLine && x.toArea == station.stationChildCode);
            needBarcode.inLineNum = _taskRepository.QueryData(x => x.TargetAddress == station.stationChildCode).Count();
@@ -221,15 +221,15 @@
            dt_needBarcode needBarcode = _needBarcodeRepository.QueryFirst(x => x.toArea == station.stationChildCode);
            if (needBarcode == null) throw new Exception($"未配置相关{station.stationChildCode}的产线在途数据");
            if (task != null) //如任务不为空 则为送包装料
            if (task != null) //如任务不为空 则为送包装料 写入下一地址 清除对应任务 并更新在途数据
            {
                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, station.stationChildCode);
                _taskRepository.DeleteData(task);
                needBarcode.inLineNum--;
                if (needBarcode.inLineNum-- <= 0) needBarcode.inLineNum = 0;
                _needBarcodeRepository.UpdateData(needBarcode);
            }
            else
            else  //如无任务 则判定为从NG口上料 调取MOM接口  判断返回参数 无异常则送入包装,有异常则退回NG口
            {
                var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
                var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.MOMIP_BASE)?.ConfigValue;
@@ -254,10 +254,23 @@
                var result = HttpHelper.PostAsync(MOMIpAddress, trayCells.ToJsonString()).Result;
                ResultTrayCellsStatus result1 = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(result);
                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, station.stationNGChildCode, station.stationChildCode);
                if (!result1.Success)
                {
                    conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, station.stationNGChildCode, station.stationChildCode);
                }
                else
                {
                    //写入对应产线的目标地址
                    if (station.productLine == "ZJ-7")
                    {
                        conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, "", station.stationChildCode);
                    }
                    else
                    {
                        conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, "", station.stationChildCode);
                    }
                }
            }
        }
    }
}