From 5d55a31d8ce95e511ffb408f38ed06e81742b67e Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期五, 27 三月 2026 16:17:30 +0800
Subject: [PATCH] 1
---
项目代码/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs"
index 8d9aeaa..7f69379 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs"
@@ -14,6 +14,7 @@
using WIDESEAWCS_DTO.Agv;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_TaskInfoService;
namespace WIDESEAWCS_Tasks
{
@@ -29,12 +30,28 @@
#region 鍑哄簱浠诲姟涓嬪彂
if (newTasksOut.Count>0)
{
+ WriteLog.Write_Log("AGV鍑哄簱浠诲姟涓嬪彂", "鍑哄簱浠诲姟涓嬪彂鎺ュ彛", "娣诲姞浠诲姟", $"浠诲姟锛歿newTasksOut.ToJson()}");
foreach (var GroupTask in newTasksOut.GroupBy(x=>x.NextAddress))
{
- var tasks = GroupTask.OrderBy(x => x.TaskNum).ToList();
- TimeSpan span = DateTime.Now - tasks.FirstOrDefault().CreateDate;
+ int taskCount = 6;
+ if (GroupTask.ObjToInt() > 201)
+ {
+ taskCount = 4;
+ }
+ //var tasks = GroupTask.Take(taskCount).ToList();
+ // 闅忔満鍐冲畾浣跨敤鍗囧簭杩樻槸闄嶅簭
+ Random random = new Random();
+ bool useAscending = random.Next(0, 2) == 0; // 50%姒傜巼鍗囧簭锛�50%姒傜巼闄嶅簭
+ var tasks = useAscending
+ ? GroupTask.OrderBy(x => x.CurrentAddress).Take(taskCount).ToList() // 鍗囧簭
+ : GroupTask.OrderByDescending(x => x.CurrentAddress).Take(taskCount).ToList(); // 闄嶅簭
+ WriteLog.Write_Log("AGV鍑哄簱浠诲姟涓嬪彂", "鎺掑簭涓嬪彂鎺ュ彛", "娣诲姞浠诲姟", $"浠诲姟锛歿tasks.ToJson()}");
+
+ var earliestCreateTime = tasks.Min(x => x.CreateDate);
+ TimeSpan span = DateTime.Now - earliestCreateTime;
+ //TimeSpan span = DateTime.Now - tasks.FirstOrDefault().CreateDate;
int taskDownCount = taskDownOut.Where(x => x.NextAddress == GroupTask.Key).Count();
- if (taskDownCount < (GroupTask.ObjToInt() > 201 ? 4 : 6) && (int)span.TotalSeconds > 20)
+ if (taskDownCount < (GroupTask.ObjToInt() > 201 ? 4 : 6) && (tasks.Count >= 4 || (int)span.TotalSeconds >= 20))
{
try
{
@@ -43,6 +60,7 @@
MissionData = new List<MissionDataItem>()
};
string taskGroupId = Guid.NewGuid().ToString().Replace("-", "");
+
foreach (var task in tasks)
{
//鑾峰彇鐩爣鐐硅揣浣�
@@ -110,6 +128,7 @@
#region 鍏ュ簱浠诲姟涓嬪彂
if (newTasksIn.Count > 0)
{
+ WriteLog.Write_Log("AGV鍏ュ簱浠诲姟涓嬪彂", "鍑哄簱浠诲姟涓嬪彂鎺ュ彛", "娣诲姞浠诲姟", $"浠诲姟锛歿newTasksIn.ToJson()}");
foreach (var task in newTasksIn)
{
try
--
Gitblit v1.9.3