From 9b3567a5a2f1a81bec684e8aecda3a1146906cca Mon Sep 17 00:00:00 2001
From: bklLiudl <673013083@qq.com>
Date: 星期一, 28 四月 2025 17:10:46 +0800
Subject: [PATCH] 托盘输送线交互
---
Admin.NET/WCS.Application/Util/FourWayCarUtil.cs | 144 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 124 insertions(+), 20 deletions(-)
diff --git a/Admin.NET/WCS.Application/Util/FourWayCarUtil.cs b/Admin.NET/WCS.Application/Util/FourWayCarUtil.cs
index aaa4238..25c77d6 100644
--- a/Admin.NET/WCS.Application/Util/FourWayCarUtil.cs
+++ b/Admin.NET/WCS.Application/Util/FourWayCarUtil.cs
@@ -7,6 +7,7 @@
using System.Text;
using System.Threading.Tasks;
using WCS.Application.Entity;
+using static Elastic.Clients.Elasticsearch.JoinField;
namespace WCS.Application.Util;
@@ -14,16 +15,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 +226,55 @@
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)
+ {
+ //if (current.X != neighbor.X)
+ //{
+ // current.IsSendPlc = true;
+ //}
+
+ if (current.Y > neighbor.Y)
+ {
+ current.IsSendPlc = true;
+ }
+ else if (current.Y < neighbor.Y)
+ {
+ neighbor.IsSendPlc = true;
+ }
+
+ //current.IsSendPlc = true;
}
+
// 鏇存柊瀹為檯璺濈涓庨浼拌窛绂�
cameFrom[neighbor] = current;
@@ -372,6 +454,28 @@
}
/// <summary>
+ /// 鑾峰彇鎬讳换鍔¤〃涓嬪彂ID涓婚敭
+ /// </summary>
+ /// <returns></returns>
+ public static int GetTaskId()
+ {
+ var list = _db.Queryable<WcsTask>().ToList();
+ var maxNo = list.Max(m => m.TaskId);
+
+ if (maxNo != null && maxNo > 0)
+ {
+ if (maxNo++ > 99999999)
+ {
+ return 1;
+ }
+
+ return (int)maxNo++;
+ }
+
+ return 1;
+ }
+
+ /// <summary>
/// 璁$畻鏇煎搱椤胯窛绂�
/// </summary>
/// <param name="start">璧峰浣嶇疆</param>
--
Gitblit v1.8.0