From 46908c0f79e7aab8a3fa41bfdcd8390bbc3659f2 Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期日, 04 一月 2026 11:48:15 +0800
Subject: [PATCH] 完善前端二期播种墙初始化和任务完成按钮,后端定期删除日志
---
项目代码/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs | 121 +++++++++++++++++++++++-----------------
1 files changed, 70 insertions(+), 51 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 6ed4caa..4babe88 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"
@@ -6,6 +6,7 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEA_DTO.Agv;
+using WIDESEAWCS_Common;
using WIDESEAWCS_Common.APIEnum;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
@@ -24,73 +25,90 @@
{
var newTasksOut = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType==TaskTypeEnum.Outbound.ObjToInt() && x.DeviceCode == "AGV").ToList().OrderBy(x => x.Grade).ThenBy(x => x.TaskNum).ToList();
var newTasksIn = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType == TaskTypeEnum.Inbound.ObjToInt() && x.DeviceCode == "AGV").ToList().OrderBy(x => x.Grade).ThenBy(x => x.TaskNum).ToList();
+ var taskDownOut = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState > TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType == TaskTypeEnum.Outbound.ObjToInt() && x.DeviceCode == "AGV").OrderBy(x => x.TaskNum).ToList();
#region 鍑哄簱浠诲姟涓嬪彂
if (newTasksOut.Count>0)
{
- List<string> GroupIds = newTasksOut.GroupBy(x => x.GroupId).Select(x => x.Key).ToList();
- foreach (var GroupId in GroupIds)
+ foreach (var GroupTask in newTasksOut.GroupBy(x=>x.NextAddress))
{
- var tasks = newTasksOut.Where(x => x.GroupId == GroupId).ToList();
- try
+ int taskCount = 6;
+ if (GroupTask.ObjToInt() > 201)
{
- AgvTaskSendDTO agvTaskSend = new AgvTaskSendDTO()
+ taskCount = 4;
+ }
+ var tasks = GroupTask.Take(taskCount).ToList();
+ TimeSpan span = DateTime.Now - tasks.FirstOrDefault().CreateDate;
+ int taskDownCount = taskDownOut.Where(x => x.NextAddress == GroupTask.Key).Count();
+ if (taskDownCount < (GroupTask.ObjToInt() > 201 ? 4 : 6) && (tasks.Count >= 4 || (int)span.TotalSeconds >= 20))
+ {
+ try
{
- MissionData = new List<MissionDataItem>()
- };
- foreach (var task in tasks)
- {
- //鑾峰彇鐩爣鐐硅揣浣�
- Dt_LocationInfo locationInfoStart = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.CurrentAddress);
- //鑾峰彇鎷i�夊嚭搴撶珯鍙�
- Dt_StationManger stationMangerEnd = _stationMangerRepository.QueryFirst(x => x.PickStationCode == task.NextAddress);
+ AgvTaskSendDTO agvTaskSend = new AgvTaskSendDTO()
+ {
+ MissionData = new List<MissionDataItem>()
+ };
+ string taskGroupId = Guid.NewGuid().ToString().Replace("-", "");
+
+ foreach (var task in tasks)
+ {
+ //鑾峰彇鐩爣鐐硅揣浣�
+ Dt_LocationInfo locationInfoStart = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.CurrentAddress);
+ //鑾峰彇鎷i�夊嚭搴撶珯鍙�
+ Dt_StationManger stationMangerEnd = _stationMangerRepository.QueryFirst(x => x.PickStationCode == task.NextAddress);
- if (locationInfoStart == null || stationMangerEnd == null) throw new Exception($"鏈壘鍒颁换鍔″彿${task.TaskNum}璧峰鐐箋task.CurrentAddress}鎴栫洰鏍囩偣{task.NextAddress}浣嶇疆淇℃伅");
- agvTaskSend.RequestId = GroupId;
- agvTaskSend.MissionCode = GroupId;
- if (task.Grade == 0)
+ if (locationInfoStart == null || stationMangerEnd == null) throw new Exception($"鏈壘鍒颁换鍔″彿${task.TaskNum}璧峰鐐箋task.CurrentAddress}鎴栫洰鏍囩偣{task.NextAddress}浣嶇疆淇℃伅");
+ agvTaskSend.RequestId = taskGroupId;
+ agvTaskSend.MissionCode = taskGroupId;
+ agvTaskSend.ViewBoardType = "W01";
+ //鏂欑瀛愭惉杩愪换鍔�
+ MissionDataItem missionDataItem = new MissionDataItem()
+ {
+ Sequence = task.TaskNum,
+ BinCode = task.PalletCode,
+ StartPosition = locationInfoStart.AgvPoint,
+ StartSlotCode = locationInfoStart.LocationCode,
+ EndPosition = stationMangerEnd.StationCode,
+ EndSlotCode = stationMangerEnd.CraneStationCode,
+ TakeActionConfirm = false,
+ TakeActionInform = false,
+ PutActionConfirm = true,
+ PutActionInform = true,
+ };
+ agvTaskSend.MissionData.Add(missionDataItem);
+ }
+ if (tasks.OrderByDescending(x => x.Grade).FirstOrDefault()?.Grade == 0)
{
agvTaskSend.Priority = 99;
}
else
{
- agvTaskSend.Priority = 99 - task.Grade;
+ agvTaskSend.Priority = 99 - tasks.OrderByDescending(x => x.Grade).FirstOrDefault().Grade;
}
- //鏂欑瀛愭惉杩愪换鍔�
- MissionDataItem missionDataItem = new MissionDataItem()
+ tasks.ForEach(x =>
{
- Sequence = task.TaskNum,
- BinCode = task.PalletCode,
- StartPosition = locationInfoStart.AgvPoint,
- StartSlotCode = locationInfoStart.LocationCode,
- EndPosition = stationMangerEnd.StationCode,
- EndSlotCode = stationMangerEnd.CraneStationCode,
- TakeActionConfirm = false,
- TakeActionInform = false,
- PutActionConfirm = true,
- PutActionInform = true,
- };
- agvTaskSend.MissionData.Add(missionDataItem);
+ x.GroupId = taskGroupId;
+ });
+ //鍙戦�丄GV浠诲姟
+ WebResponseContent content = _taskService.AgvSendTask(agvTaskSend, APIEnum.AgvSendTask);
+ if (!content.Status)
+ throw new Exception(content.Message);
+ tasks.ForEach(x =>
+ {
+ x.Dispatchertime = DateTime.Now;
+ x.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt();
+ });
+ _taskService.UpdateData(tasks);
+ Thread.Sleep(500);
}
- //鍙戦�丄GV浠诲姟
- WebResponseContent content = _taskService.AgvSendTask(agvTaskSend, APIEnum.AgvSendTask);
- if (!content.Status)
- throw new Exception(content.Message);
- tasks.ForEach(x =>
+ catch (Exception ex)
{
- x.Dispatchertime = DateTime.Now;
- x.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt();
- });
- _taskService.UpdateData(tasks);
- Thread.Sleep(500);
- }
- catch (Exception ex)
- {
- tasks.ForEach(x =>
- {
- x.TaskState = TaskStatusEnum.Exception.ObjToInt();
- x.ExceptionMessage = ex.Message;
- });
- _taskService.UpdateData(tasks);
+ tasks.ForEach(x =>
+ {
+ x.TaskState = TaskStatusEnum.Exception.ObjToInt();
+ x.ExceptionMessage = ex.Message;
+ });
+ _taskService.UpdateData(tasks);
+ }
}
}
}
@@ -113,6 +131,7 @@
if (locationInfoEnd == null || stationMangerStart == null) throw new Exception($"鏈壘鍒颁换鍔″彿${task.TaskNum}璧峰鐐箋task.CurrentAddress}鎴栫洰鏍囩偣{task.NextAddress}浣嶇疆淇℃伅");
agvTaskSend.RequestId = Guid.NewGuid().ToString().Replace("-", "");
agvTaskSend.MissionCode = task.TaskNum.ToString();
+ agvTaskSend.ViewBoardType = "W02";
if (task.Grade == 0)
{
agvTaskSend.Priority = 99;
--
Gitblit v1.9.3