From c2bed218cc875e59fff53ef43a187d5934bdf35c Mon Sep 17 00:00:00 2001
From: chengsc <11752@DESKTOP-DS49RCP>
Date: 星期日, 27 四月 2025 14:59:20 +0800
Subject: [PATCH] 修改优化问题
---
Admin.NET/WCS.Application/Util/FourWayCarUtil.cs | 107 +++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 87 insertions(+), 20 deletions(-)
diff --git a/Admin.NET/WCS.Application/Util/FourWayCarUtil.cs b/Admin.NET/WCS.Application/Util/FourWayCarUtil.cs
index aaa4238..5116b4d 100644
--- a/Admin.NET/WCS.Application/Util/FourWayCarUtil.cs
+++ b/Admin.NET/WCS.Application/Util/FourWayCarUtil.cs
@@ -14,16 +14,67 @@
{
private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId);
-
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="list">闆嗗悎</param>
+ /// <param name="moveType">绉诲姩绫诲瀷 0:绉诲姩 1:绉昏揣 </param>
+ /// <returns></returns>
+ public static List<CarModel> GetCarPathUp(List<CarModel> list,int moveType)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ if (i > 0 && i < list.Count - 1)
+ {
+ if (list[i].X == list[i + 1].X)
+ {
+ list[i].NodeCom = 2;
+ }
+ else if (list[i].Y == list[i + 1].Y)
+ {
+ list[i].NodeCom = 3;
+ }
+ }
+ if (i== 0)
+ {
+ list[i].IsSendPlc = true;
+ if (moveType == 0)
+ {
+ if (list[i + 1] == null)
+ {
+ continue;
+ }
+
+ }
+ else
+ {
+ list[i].NodeCom = 1;
+ }
+ }
+ if (i == list.Count-1)
+ {
+ list[i].IsSendPlc = true;
+ if (moveType == 0)
+ {
+ list[i].NodeCom = list[i + 1].NodeCom;
+ }
+ else
+ {
+ list[i].NodeCom = 4;
+ }
+ }
+ }
+ return list;
+ }
+
/// <summary>
/// 鑾峰彇灏忚溅璺緞
/// </summary>
/// <param name="startLocation">璧峰浣嶇疆</param>
/// <param name="endLocation">鐩爣浣嶇疆</param>
- /// <param name="moveType">绉诲姩绫诲瀷 0:绉诲姩 1:鍙栬揣 2:鏀捐揣</param>
/// <param name="isLoad">鏄惁杞借揣0锛氭湭杞借揣 1锛氬凡杞借揣</param>
/// <returns></returns>
- public static List<CarModel> GetCarPath(string startLocation, string endLocation, int moveType, string isLoad = "0")
+ public static List<CarModel> GetCarPath(string startLocation, string endLocation, string isLoad = "0")
{
if (string.IsNullOrEmpty(startLocation) || string.IsNullOrEmpty(endLocation))
{
@@ -174,25 +225,41 @@
if (!gScore.ContainsKey(neighbor) || tentativeGScore < gScore[neighbor])
{
neighbor.IsSendPlc = false;
- // 琛ュ厖鍙傛暟
- if (neighbor.Equals(end))
- {
- neighbor.NodeCom = moveType;
- neighbor.IsSendPlc = true;
- }
- else if (currentModel.Make != locationModel.Make)
- {
- if (current.X == neighbor.X)
- {
- neighbor.NodeCom = 3;
- }
- else if (current.Y == neighbor.Y)
- {
- neighbor.NodeCom = 2;
- }
- neighbor.IsSendPlc = true;
+ //if (current.X == neighbor.X)
+ //{
+ // current.NodeCom = 2;
+ //}
+ //else if (current.Y == neighbor.Y)
+ //{
+ // current.NodeCom = 3;
+ //}
+
+ //// 琛ュ厖鍙傛暟
+ //if (current.Equals(start))
+ //{
+ // current.NodeCom = moveType;
+ // current.IsSendPlc = true;
+ //}
+ //if (neighbor.Equals(end))
+ //{
+ // //neighbor.NodeCom = moveType != 0 ? 2:0 ;
+ // if (moveType == 1)
+ // {
+ // neighbor.NodeCom = 4;
+ // }
+ // else
+ // {
+ // neighbor.NodeCom = current.NodeCom;
+ // }
+
+ // neighbor.IsSendPlc = true;
+ //}
+ if (currentModel.Make != locationModel.Make)
+ {
+ neighbor.IsSendPlc = true;
}
+
// 鏇存柊瀹為檯璺濈涓庨浼拌窛绂�
cameFrom[neighbor] = current;
--
Gitblit v1.8.0