From 202cdf4c400f7b8507f129fab5766baac6bc7e45 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 11 三月 2025 17:40:20 +0800
Subject: [PATCH] 1
---
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 99 +++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 83 insertions(+), 16 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 3e45819..831607e 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"
@@ -61,6 +61,8 @@
public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList();
+ public List<int> TaskRelocationTypes => typeof(TaskRelocationTypeEnum).GetEnumIndexList();
+
public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, ITaskHtyService taskHtyService, IMapper mapper) : base(BaseDal)
{
_routerService = routerService;
@@ -135,6 +137,16 @@
{
return BaseDal.QueryFirst(x => (TaskInboundTypes.Contains(x.TaskType) && x.NextAddress == currentAddress && x.PalletCode == Barcode && x.TaskState == (int)TaskInStatusEnum.AGV_InFinish || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish && x.CurrentAddress == currentAddress), TaskOrderBy);
}
+ /// <summary>
+ /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟
+ /// </summary>
+ /// <param name="deviceNo">璁惧缂栧彿</param>
+ /// <param name="currentAddress">褰撳墠鍦板潃</param>
+ /// <returns></returns>
+ public Dt_Task QueryConveyorLineTaskNum(string deviceNo, string currentAddress, int TaskNum)
+ {
+ return BaseDal.QueryFirst(x => (TaskInboundTypes.Contains(x.TaskType) && x.NextAddress == currentAddress && x.TaskNum == TaskNum && x.TaskState == (int)TaskInStatusEnum.AGV_InFinish || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish && x.CurrentAddress == currentAddress), TaskOrderBy);
+ }
/// <summary>
/// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟
@@ -164,11 +176,18 @@
/// <param name="taskNum">浠诲姟鍙�</param>
/// <param name="currentAddress">褰撳墠鍦板潃</param>
/// <returns></returns>
- public Dt_Task QueryCompletedConveyorLineTask(int taskNum, string currentAddress)
+ public Dt_Task QueryCompletedConveyorLineTask(string Barcode, string currentAddress)
{
- return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy);
+ return BaseDal.QueryFirst(x => x.PalletCode == Barcode && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy);
}
+ public Dt_Task QuertOutProductionLineTask(bool NextAddIsNull)
+ {
+ if (NextAddIsNull)
+ return BaseDal.QueryFirst(x => x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish && string.IsNullOrEmpty(x.NextAddress), TaskOrderBy);
+ else
+ return BaseDal.QueryFirst(x => x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish, TaskOrderBy);
+ }
/// <summary>
/// 鏍规嵁璁惧缂栧彿銆佷换鍔$被鍨嬪垎缁�(鍙��)鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鏂板鐨勪换鍔�
/// </summary>
@@ -185,7 +204,26 @@
return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew, TaskOrderBy);
return null;
}
-
+ /// <summary>
+ /// 鏌ヨ搴撳唴绉诲簱浠诲姟
+ /// </summary>
+ /// <param name="deviceNo"></param>
+ /// <param name="currentAddress"></param>
+ /// <returns></returns>
+ public Dt_Task QueryStackerCraneRelocationTask(string deviceNo, string currentAddress = "")
+ {
+ Dt_Task task = null;
+ List<Dt_Task> tasks = new List<Dt_Task>();
+ if (string.IsNullOrEmpty(currentAddress))
+ tasks = BaseDal.QueryData(x => x.Roadway == deviceNo && TaskRelocationTypes.Contains(x.TaskType) && x.TaskState < TaskRelocationStatusEnum.SC_RelocationFinish.ObjToInt()).OrderBy(x => x.TaskNum).ToList();
+ else
+ tasks = BaseDal.QueryData(x => x.Roadway == deviceNo && x.CurrentAddress == currentAddress && TaskRelocationTypes.Contains(x.TaskType) && x.TaskState < TaskRelocationStatusEnum.SC_RelocationFinish.ObjToInt()).OrderBy(x => x.TaskNum).ToList();
+ if (tasks != null && tasks.Count > 0)
+ {
+ task = tasks.First();
+ }
+ return task;
+ }
/// <summary>
/// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鏂板鐨勪换鍔�
/// </summary>
@@ -327,8 +365,9 @@
}
int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
-
task.TaskState = nextStatus;
+ if (task.SourceIsPickPlace && task.TaskState == TaskOutStatusEnum.OutNew.ObjToInt())
+ task.TaskState = TaskOutStatusEnum.SC_OutExecuting.ObjToInt();
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
{
@@ -355,16 +394,31 @@
return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
}
int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskRelocationStatusEnum>();
- task.TaskState = nextStatus;
+ if (task.SourceIsPickPlace && task.TaskState == TaskRelocationStatusEnum.RelocationNew.ObjToInt())
+ task.TaskState = TaskRelocationStatusEnum.SC_RelocationExecuting.ObjToInt();
+ else
+ task.TaskState = nextStatus;
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OtherGroup)//搴撳唴绉昏溅
{
- if (task.TaskState >= (int)TaskCarStatusEnum.RelocationCarFinish)
+ if (task.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt())
{
- return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
+ if (task.TaskState >= (int)TaskCarStatusEnum.RelocationCarFinish)
+ {
+ return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
+ }
+ int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskCarStatusEnum>();
+ task.TaskState = nextStatus;
}
- int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskCarStatusEnum>();
- task.TaskState = nextStatus;
+ else if (task.TaskType == TaskOtherTypeEnum.RelocationCarCharging.ObjToInt())
+ {
+ if (task.TaskState >= (int)CarChargingTaskEnum.RelocationCarFinish)
+ {
+ return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
+ }
+ int nextStatus = task.TaskState.GetNextNotCompletedStatus<CarChargingTaskEnum>();
+ task.TaskState = nextStatus;
+ }
}
else
{
@@ -517,15 +571,18 @@
}
return content;
}
-
- /// <summary>
- /// 鏍规嵁浠诲姟鍙锋煡璇换鍔�
- /// </summary>
- /// <param name="taskNum"></param>
- /// <returns></returns>
public Dt_Task GetTaskInfo(int taskNum)
{
return BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+ }
+ /// <summary>
+ /// 鏍规嵁浠诲姟鍙峰拰浠诲姟鐘舵�佹煡璇换鍔�
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <returns></returns>
+ public Dt_Task GetTaskInfo(int taskNum, int taskState)
+ {
+ return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.TaskState == taskState);
}
/// <summary>
/// 鏍规嵁浠诲姟鐘舵�併�佺被鍨嬫煡璇换鍔�
@@ -555,13 +612,23 @@
/// <exception cref="NotImplementedException"></exception>
public WebResponseContent AddRelocationCarTask(string SourceAddress, string TargetAddress, string ShuttleCarCode = "", string remark = "")
{
+ if (!string.IsNullOrEmpty(SourceAddress) && SourceAddress != "")
+ {
+ Dt_Task? task = BaseDal.QueryFirst(x => x.SourceAddress == SourceAddress && x.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt());
+ if (task != null) return WebResponseContent.Instance.Error();
+ }
+ if (!string.IsNullOrEmpty(TargetAddress) && TargetAddress != "")
+ {
+ Dt_Task? task = BaseDal.QueryFirst(x => x.SourceAddress == TargetAddress && x.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt());
+ if (task != null) return WebResponseContent.Instance.Error();
+ }
#region 鍒涘缓鍫嗗灈鏈虹Щ杞︿换鍔�
Dt_Task dt_Task = new Dt_Task()
{
TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
Grade = 2,
Roadway = "SC01",
- TaskType = (int)TaskOtherTypeEnum.RelocationCar,
+ TaskType = string.IsNullOrEmpty(remark) ? (int)TaskOtherTypeEnum.RelocationCar : (int)TaskOtherTypeEnum.RelocationCarCharging,
SourceAddress = SourceAddress,
TargetAddress = TargetAddress,
CurrentAddress = SourceAddress,
--
Gitblit v1.9.3