From d57815781381a23be2255f1f93b480950c6c39a8 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期五, 14 十一月 2025 17:20:24 +0800
Subject: [PATCH] 新增任务看板滚动功能及优化文档布局在 Home.vue中新增任务看板滚动显示功能,优化数据总览和图表样式新增 iconfont 字体文件及相关样式,提升页面视觉效果。在 TaskService.cs和 AGVSignal.cs中新增对RelocationGroup 的任务状态处理逻辑。新增EnumHelper.cs 中的枚举描述获取方法,支持动态描述解析优化按钮逻辑,统一“其他出库”和“调拨出库”的处理方式更新文档布局文件,调整引用路径、索引和视图状态。 在StockInfoService.cs中新增任务数据查询逻辑,支持任务状态描述返回。
---
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 377 ++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 257 insertions(+), 120 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 9e2d51d..4eceba9 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -3,6 +3,7 @@
using LogLibrary.Log;
using Mapster;
using Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using SqlSugar;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
@@ -44,19 +45,32 @@
private Dictionary<string, OrderByType> _taskOrderBy = new()
{
- {nameof(Dt_Task.Grade), OrderByType.Desc },
+ {nameof(Dt_Task.Grade), OrderByType.Asc },
{nameof(Dt_Task.CreateDate), OrderByType.Asc},
};
+
public Dictionary<string, OrderByType> TaskOrderBy
{ get { return _taskOrderBy; } set { _taskOrderBy = value; } }
+
+ #region 鑾峰彇鎵�鏈変换鍔$被鍨嬨�佺姸鎬�
public List<int> TaskInboundTypes => typeof(TaskInboundTypeEnum).GetEnumIndexList();
public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList();
- public List<int> TaskRelocationboundTypes => typeof(TaskRelocationStatusEnum).GetEnumIndexList();
- public List<int> TaskAGVCarryboundTypes => typeof(TaskAGVCarryStatusEnum).GetEnumIndexList();
- public List<int> TaskAcrossFloorboundTypes => typeof(TaskAcrossFloorStatusEnum).GetEnumIndexList();
+ public List<int> TaskRelocationboundTypes => typeof(TaskRelocationTypeEnum).GetEnumIndexList();
+ public List<int> TaskAGVCarryboundTypes => typeof(TaskAGVCarryTypeEnum).GetEnumIndexList();
+ public List<int> TaskAcrossFloorboundTypes => typeof(TaskAcrossFloorTypeEnum).GetEnumIndexList();
+
+ public List<int> TaskInboundStates => typeof(TaskInStatusEnum).GetEnumIndexList();
+
+ public List<int> TaskOutboundStates => typeof(TaskOutStatusEnum).GetEnumIndexList();
+ public List<int> TaskRelocationboundStates => typeof(TaskRelocationStatusEnum).GetEnumIndexList();
+ public List<int> TaskAGVCarryboundStates => typeof(TaskAGVCarryStatusEnum).GetEnumIndexList();
+ public List<int> TaskAcrossFloorboundStates => typeof(TaskAcrossFloorStatusEnum).GetEnumIndexList();
+
+ #endregion 鑾峰彇鎵�鏈変换鍔$被鍨嬨�佺姸鎬�
+
public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, IRouterRepository routerRepository, ITask_HtyRepository htyRepository) : base(BaseDal)
{
@@ -96,69 +110,27 @@
Dt_Task task = _mapper.Map<Dt_Task>(item);
// 璁剧疆浠诲姟鐨勫垱寤鸿�呬负"WMS"
task.Creater = "WMS";
+ task.Remark = item.Remark;
// 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓哄嚭搴撲换鍔�
if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
{
- var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1");
-
- task.TaskState = (int)TaskOutStatusEnum.OutNew;
-
- task.CurrentAddress = item.SourceAddress;
-
- task.NextAddress = station.stationChildCode;
-
- task.Floor = "1F";
-
- task.AGVSign = "";
- }
- // 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓哄叆搴撲换鍔�
- else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
- {
- var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1");
-
- task.TaskState = (int)TaskInStatusEnum.InNew;
-
- task.CurrentAddress = item.SourceAddress;
-
- task.NextAddress = station.stationChildCode;
-
- task.Floor = "1F";
-
- task.AGVSign= "";
- }
- else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
- {
- task.TaskState = (int)TaskRelocationStatusEnum.RelocationNew;
-
- task.CurrentAddress = item.SourceAddress;
-
- task.NextAddress = task.TargetAddress;
-
- task.Floor = "1F";
-
- task.AGVSign = "";
- }
- else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.CarryGroup)
- {
- var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
-
- task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew;
-
- task.CurrentAddress = item.SourceAddress;
-
- task.NextAddress = task.TargetAddress;
-
- task.Floor = station.stationFloor;
-
- task.AGVSign = "";
- }
- else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.AcrossFloorGroup)
- {
- var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
-
- if (station != null)
+ if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.OutbondGroup)
{
- var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+ var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1");
+
+ task.TaskState = (int)TaskOutStatusEnum.OutNew;
+
+ task.CurrentAddress = item.SourceAddress;
+
+ task.NextAddress = station.stationChildCode;
+
+ task.Floor = item.Floor;
+
+ task.AGVSign = "";
+ }
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
+ {
+ var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor);
task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
@@ -166,11 +138,135 @@
task.NextAddress = next.stationChildCode;
+ task.Floor = item.Floor;
+
+ task.AGVSign = "";
+ }
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
+ {
+ var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.TargetAddress);
+
+ task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew;
+
+ task.CurrentAddress = item.SourceAddress;
+
+ task.NextAddress = task.TargetAddress;
+
task.Floor = station.stationFloor;
task.AGVSign = "";
}
}
+ // 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓哄叆搴撲换鍔�
+ else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
+ {
+ if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.InboundGroup)
+ {
+ var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1");
+
+ task.TaskState = (int)TaskInStatusEnum.InNew;
+
+ task.CurrentAddress = item.SourceAddress;
+
+ task.NextAddress = station.stationChildCode;
+
+ task.Floor = "1F";
+
+ task.AGVSign = "";
+ }
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
+ {
+ var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor);
+
+ task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+
+ task.CurrentAddress = item.SourceAddress;
+
+ task.NextAddress = next.stationChildCode;
+
+ task.Floor = item.Floor;
+
+ task.AGVSign = "";
+ }
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
+ {
+ var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+
+ task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew;
+
+ task.CurrentAddress = item.SourceAddress;
+
+ task.NextAddress = task.TargetAddress;
+
+ task.Floor = station.stationFloor;
+
+ task.AGVSign = "";
+ }
+
+ }
+ // 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓虹Щ搴撲换鍔�
+ else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
+ {
+ if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.RelocationGroup)
+ {
+ //task.TaskState = (int)TaskRelocationStatusEnum.RelocationNew;
+
+ task.CurrentAddress = item.SourceAddress;
+
+ task.NextAddress = task.TargetAddress;
+
+ task.Floor = "1F";
+
+ task.AGVSign = "";
+ }
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
+ {
+ var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor);
+
+ task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+
+ task.CurrentAddress = item.SourceAddress;
+
+ task.NextAddress = next.stationChildCode;
+
+ task.Floor = item.Floor;
+
+ task.AGVSign = "";
+ }
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
+ {
+
+ task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew;
+
+ task.CurrentAddress = item.SourceAddress;
+
+ task.NextAddress = task.TargetAddress;
+
+ task.Floor = item.Floor;
+
+ task.AGVSign = "";
+ }
+ }
+ //鍒ゆ柇浠诲姟绫诲瀷鏄惁涓鸿法妤煎眰鎼繍浠诲姟
+ else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.AcrossFloorGroup)
+ {
+ if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
+ {
+ var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor);
+
+ task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+
+ task.CurrentAddress = item.SourceAddress;
+
+ task.NextAddress = next.stationChildCode;
+
+ task.Floor = item.Floor;
+
+ task.AGVSign = "";
+ }
+
+ }
+
// 灏嗚浆鎹㈠悗鐨勪换鍔℃坊鍔犲埌浠诲姟鍒楄〃涓�
tasks.Add(task);
}
@@ -272,7 +368,7 @@
/// <returns></returns>
public Dt_Task QueryRequestTSJSignalTask()
{
- return BaseDal.QueryFirst(x => TaskAcrossFloorboundTypes.Contains(x.TaskType) && x.TaskState > (int)TaskAcrossFloorStatusEnum.CarryNew && (x.AGVSign == "RequestPickUp" || x.AGVSign == "RequestPut"));
+ return BaseDal.QueryFirst(x => x.TaskState > (int)TaskAcrossFloorStatusEnum.CarryNew && (x.AGVSign == "RequestPickUp" || x.AGVSign == "RequestPut"));
}
#endregion
@@ -345,7 +441,7 @@
try
{
int oldState = task.TaskState;
- if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+ if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.OutbondGroup)
{
int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
@@ -370,8 +466,19 @@
content = StackCraneTaskCompleted(task.TaskNum);
return content;
}
+ if (task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
+ {
+ string TargetAddress = GetLocation(task.PalletCode);
+ if (TargetAddress == "")
+ {
+ return content.Error($"鏈幏鍙栧嚭搴撶粓鐐硅揣浣嶄俊鎭�");
+ }
+ task.NextAddress = TargetAddress;
+ task.TargetAddress = TargetAddress;
+ }
+
}
- else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.InboundGroup)
{
int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
task.TaskState = nextStatus;
@@ -380,52 +487,27 @@
{
#region 鍏ュ簱璋冪敤鎺ュ彛鑾峰彇璐т綅鍦板潃
- var taskDto = new RequestTaskDto()
+ string TargetAddress= GetLocation(task.PalletCode);
+ if (TargetAddress == null)
{
- Position = task.NextAddress,
- PalletCode = task.PalletCode,
- };
-
- // 鑾峰彇WMSip鍦板潃
- var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
- var wmsBasez = configz.Where(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE).FirstOrDefault()?.ConfigValue;
- var requestLocation = configz.Where(x => x.ConfigKey == SysConfigKeyConst.RequestLocation).FirstOrDefault()?.ConfigValue;
- if (wmsBasez == null || requestLocation == null)
- {
- throw new InvalidOperationException("WMS IP 鏈厤缃�");
+ return content.Error($"鏈幏鍙栧叆搴撶粓鐐硅揣浣嶄俊鎭�");
}
- var wmsIpAddrss = wmsBasez + requestLocation;
-
- // 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
- var abc = HttpHelper.PostAsync(wmsIpAddrss, taskDto.ToJsonString()).Result;
- if (abc == null)
- return content.Error();
- // 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
- content = JsonConvert.DeserializeObject<WebResponseContent>(abc);
-
- LogFactory.WriteError($"Info_鑾峰彇璐т綅", $"鑾峰彇璐т綅,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙凤細銆恵task.PalletCode}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}");
-
- // 妫�鏌ョ姸鎬佸苟杩斿洖
- if (!content.Status)
- {
- return content;
- }
-
- // 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
- var taskResult = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
task.CurrentAddress = task.NextAddress;
- task.NextAddress = taskResult.TargetAddress;
- task.TargetAddress = task.NextAddress;
+ task.NextAddress = TargetAddress;
+ task.TargetAddress = TargetAddress;
#endregion 鍏ュ簱璋冪敤鎺ュ彛鑾峰彇璐т綅鍦板潃
+ }
+ else if (task.TaskState == (int)TaskInStatusEnum.Line_InExecuting)
+ {
+ UpdateStartLocationInfo(task);
}
else if (task.TaskState == (int)TaskInStatusEnum.SC_InFinish)
{
if (App.User.UserId > 0)
{
content = StackCraneTaskCompleted(task.TaskNum);
- return content;
}
task.ModifyDate = DateTime.Now;
@@ -438,7 +520,7 @@
_taskHtyRepository.AddData(task_Hty);
}
}
- else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.CarryGroup)
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
{
int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskAGVCarryStatusEnum>();
@@ -446,6 +528,8 @@
if (task.TaskState == (int)TaskAGVCarryStatusEnum.AGV_CarryFinish)
{
+ CompletedTask(task.TaskNum);
+
task.ModifyDate = DateTime.Now;
task.Modifier = "System";
@@ -456,7 +540,27 @@
_taskHtyRepository.AddData(task_Hty);
}
}
- else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.AcrossFloorGroup)
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.RelocationGroup)
+ {
+ int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskRelocationStatusEnum>();
+
+ task.TaskState = nextStatus;
+
+ if (task.TaskState == (int)TaskRelocationStatusEnum.SC_RelocationFinish|| task.TaskState == (int)TaskRelocationStatusEnum.AGV_RelocationFinish)
+ {
+ CompletedTask(task.TaskNum);
+
+ task.ModifyDate = DateTime.Now;
+ task.Modifier = "System";
+
+ Dt_Task_Hty task_Hty = _mapper.Map<Dt_Task_Hty>(task);
+ task_Hty.TaskId = 0;
+
+ BaseDal.DeleteData(task);
+ _taskHtyRepository.AddData(task_Hty);
+ }
+ }
+ else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
{
int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskAcrossFloorStatusEnum>();
@@ -491,7 +595,7 @@
stationManager = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == "1F");
TaskTemplate = "CCC";
}
-
+
var taskDto = new RequestAcrossFloorTaskDto()
{
NextAddress = task.NextAddress,
@@ -527,7 +631,7 @@
taskNew.CurrentAddress = stationManager.stationChildCode;
- taskNew.NextAddress = task.TargetAddress;
+ taskNew.NextAddress = taskDTO.TargetAddress;
taskNew.Floor = stationManager.stationFloor;
@@ -546,22 +650,6 @@
BaseDal.AddData(taskNew);
SendAgvTask(TaskTemplate, taskNew.TaskNum);
- return content.OK();
- }
-
- if (task.TaskState == (int)TaskAGVCarryStatusEnum.AGV_CarryFinish)
- {
-
- CompletedTask(task.TaskNum);
-
- task.ModifyDate = DateTime.Now;
- task.Modifier = "System";
-
- Dt_Task_Hty task_Hty = _mapper.Map<Dt_Task_Hty>(task);
- task_Hty.TaskId = 0;
-
- BaseDal.DeleteData(task);
- _taskHtyRepository.AddData(task_Hty);
}
}
else
@@ -604,6 +692,46 @@
content = WebResponseContent.Instance.Error(ex.Message);
}
return content;
+ }
+
+ public string GetLocation(string palletCode)
+ {
+ var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+ var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+ var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestLocation)?.ConfigValue;
+ if (wmsBase == null || updateTask == null)
+ {
+ throw new InvalidOperationException("WMS IP 鏈厤缃�");
+ }
+ var wmsIpAddress = wmsBase + updateTask;
+ var keys = new Dictionary<string, object>()
+ {
+ {"palletCode", palletCode}
+ };
+ var result = HttpHelper.GetAsync(wmsIpAddress, keys).Result;
+ WebResponseContent? content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+ if (content.Status)
+ {
+ return content.Data.ToString();
+ }
+ else
+ {
+ return string.Empty;
+ }
+ }
+
+ public void UpdateStartLocationInfo(Dt_Task task)
+ {
+ var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+ var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+ var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.UpdateStartLocationInfo)?.ConfigValue;
+ if (wmsBase == null || updateTask == null)
+ {
+ throw new InvalidOperationException("WMS IP 鏈厤缃�");
+ }
+ var wmsIpAddress = wmsBase + updateTask;
+
+ var result = HttpHelper.PostAsync(wmsIpAddress, task.ToJsonString()).Result;
}
public void CompletedTask(int taskNum)
@@ -653,6 +781,10 @@
task.ModifyDate = DateTime.Now;
task.Modifier = "System";
BaseDal.UpdateData(task);
+
+ UpdateStartLocationInfo(task);
+
+ content.OK(data: task);
_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
}
@@ -800,6 +932,11 @@
return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskType == (int)TaskRelocationTypeEnum.Relocation && x.TaskState == (int)TaskRelocationStatusEnum.RelocationNew);
}
+ public Dt_Task QueryExecutingTask(string deviceNo)
+ {
+ return BaseDal.QueryFirst(x => x.Roadway == deviceNo &&( x.TaskState == (int)TaskRelocationStatusEnum.SC_RelocationExecuting || x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskInStatusEnum.SC_InExecuting));
+ }
+
private string GetIpAddress(string baseIp, string name)
{
--
Gitblit v1.9.3