From 28bfb5dc1e3c0ce432e93e7af5a1c78a1a09e061 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 15 十月 2025 15:45:57 +0800
Subject: [PATCH] 更新 ResponeAgingInputDto 属性类型及数据库文件
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/RouterService.cs | 78 ++++++++++++++++++++++++++++++++++++--
1 files changed, 73 insertions(+), 5 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/RouterService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/RouterService.cs
index a656551..2d7637b 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/RouterService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/RouterService.cs
@@ -1,4 +1,5 @@
-锘縰sing SqlSugar;
+锘縰sing Masuit.Tools;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -30,13 +31,79 @@
/// <param name="startPosi">璧风偣/褰撳墠浣嶇疆銆�</param>
/// <param name="endPosi">缁堢偣銆�</param>
/// <returns>杩斿洖璺敱瀹炰綋闆嗗悎銆�</returns>
+ //public List<Dt_Router> QueryNextRoutes(string startPosi, string endPosi)
+ //{
+ // //todo 鏂规硶闇�浼樺寲
+ // List<Dt_Router> routers = new List<Dt_Router>();
+ // try
+ // {
+ // List<Dt_Router> dt_Routers = BaseDal.QueryData(x => x.NextPosi == endPosi || x.ChildPosi == endPosi, new Dictionary<string, OrderByType> { { nameof(Dt_Router.IsEnd), OrderByType.Desc } });
+ // if (dt_Routers.Count > 0)
+ // {
+ // foreach (var item in dt_Routers)
+ // {
+ // if (item.StartPosi == startPosi && !routers.Any(x => x.Id == item.Id))
+ // {
+ // routers.Add(item);
+ // }
+ // else
+ // {
+ // List<Dt_Router> tempRouters = QueryNextRoutes(startPosi, item.StartPosi);
+ // foreach (var router in tempRouters)
+ // {
+ // if (router.StartPosi == startPosi && !routers.Any(x => x.Id == router.Id))
+ // {
+ // routers.Add(router);
+ // }
+ // }
+ // }
+ // }
+ // }
+ // else
+ // {
+ // throw new Exception($"璇ヨ矾寰勬湭閰嶇疆鎴栭厤缃敊璇�,璇锋鏌ヨ澶囪矾鐢变俊鎭�,璧风偣:銆恵startPosi}銆�,缁堢偣:銆恵endPosi}銆�");
+ // }
+ // }
+ // catch (Exception ex)
+ // {
+ // //throw new Exception(ex.Message);
+ // //璁板綍閿欒淇℃伅
+ // }
+ // return routers;
+ //}
+
+ /// <summary>
+ /// 鏍规嵁璧风偣/褰撳墠浣嶇疆銆佺粓鐐硅幏鍙栦笅涓�涓瓙鑺傜偣銆�
+ /// </summary>
+ /// <param name="startPosi">璧风偣/褰撳墠浣嶇疆銆�</param>
+ /// <param name="endPosi">缁堢偣銆�</param>
+ /// <returns>杩斿洖璺敱瀹炰綋闆嗗悎銆�</returns>
public List<Dt_Router> QueryNextRoutes(string startPosi, string endPosi)
{
- //todo 鏂规硶闇�浼樺寲
+ // 鐢ㄤ簬璁板綍宸茬粡璁块棶杩囩殑璧风偣鍜岀粓鐐圭粍鍚堬紝閬垮厤閲嶅璁块棶杩涘叆姝诲惊鐜�
+ HashSet<string> visitedRoutes = new HashSet<string>();
+ return QueryNextRoutesInternal(startPosi, endPosi, visitedRoutes);
+ }
+
+ private List<Dt_Router> QueryNextRoutesInternal(string startPosi, string endPosi, HashSet<string> visitedRoutes)
+ {
List<Dt_Router> routers = new List<Dt_Router>();
try
{
- List<Dt_Router> dt_Routers = BaseDal.QueryData(x => x.NextPosi == endPosi || x.ChildPosi == endPosi, new Dictionary<string, OrderByType> { { nameof(Dt_Router.IsEnd), OrderByType.Desc } });
+ // 鏋勫缓涓�涓敮涓�鏍囪瘑褰撳墠璧风偣鍜岀粓鐐圭粍鍚堢殑瀛楃涓�
+ string routeKey = $"{startPosi}_{endPosi}";
+ if (visitedRoutes.Contains(routeKey))
+ {
+ // 濡傛灉宸茬粡璁块棶杩囷紝鐩存帴杩斿洖绌哄垪琛紝閬垮厤閲嶅杩涘叆鐩稿悓鐨勯�掑綊鍒嗘敮
+ return routers;
+ }
+ visitedRoutes.Add(routeKey);
+
+ List<Dt_Router> dt_Routers = BaseDal.QueryData(x => (x.NextPosi == endPosi || x.ChildPosi == endPosi) && x.StartPosi == startPosi, new Dictionary<string, OrderByType> { { nameof(Dt_Router.IsEnd), OrderByType.Desc } });
+ if (dt_Routers.IsNullOrEmpty())
+ {
+ dt_Routers = BaseDal.QueryData(x => x.NextPosi == endPosi || x.ChildPosi == endPosi, new Dictionary<string, OrderByType> { { nameof(Dt_Router.IsEnd), OrderByType.Desc } });
+ }
if (dt_Routers.Count > 0)
{
foreach (var item in dt_Routers)
@@ -47,7 +114,7 @@
}
else
{
- List<Dt_Router> tempRouters = QueryNextRoutes(startPosi, item.StartPosi);
+ List<Dt_Router> tempRouters = QueryNextRoutesInternal(startPosi, item.StartPosi, visitedRoutes);
foreach (var router in tempRouters)
{
if (router.StartPosi == startPosi && !routers.Any(x => x.Id == router.Id))
@@ -65,6 +132,7 @@
}
catch (Exception ex)
{
+ // 杩欓噷鍙互鏍规嵁瀹為檯闇�姹傛洿濂藉湴澶勭悊寮傚父锛屾瘮濡傝褰曟棩蹇楃瓑锛岀洰鍓嶅彧鏄敞閲婃帀浜嗙洿鎺ユ姏鍑哄紓甯�
//throw new Exception(ex.Message);
//璁板綍閿欒淇℃伅
}
@@ -201,7 +269,7 @@
{
if (routerType == (int)RouterInOutType.Out)
router.ChildPosi = routersAddDTOs[i + 1].ChildPositionCode;
- router.IsEnd = true;
+ router.IsEnd = true;
}
routers.Add(router);
}
--
Gitblit v1.9.3