wanshenmean
2026-03-27 59bc10620e483c7f558eac4127d04d08871f0e27
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/RouterService.cs
@@ -409,9 +409,9 @@
                    // 返回去重后的位置列表
                    return positions.GroupBy(x => x).Select(x => x.Key).ToList();
                }
                catch
                catch (Exception ex)
                {
                    ConsoleHelper.WriteErrorLine($"RouterService.QueryAllPositions 查询失败: {ex.Message}");
                }
                finally
                {
@@ -604,6 +604,20 @@
                // 添加新的路由信息
                BaseDal.AddData(routers);
                // 重新查询全量路由(此时才包含新增的路由),再写入缓存
                List<Dt_Router> updatedRouters = BaseDal.QueryData(x => x.InOutType == routerType);
                string cacheKey = $"Router:AllRouters:{(routerType == RouterInOutType.In.ObjToInt() ? "In" : "Out")}";
                try
                {
                    _cacheService.AddOrUpdate(cacheKey, updatedRouters);
                }
                catch
                {
                    // 缓存更新失败时静默忽略,下次查询会从DB自动重建缓存
                }
                content = WebResponseContent.Instance.OK();
            }
            catch (Exception ex)