From f49fa4b5027cfdc27b429985d023e8002abcca2e Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期三, 05 十一月 2025 23:54:12 +0800
Subject: [PATCH] 1
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 61 +++++++++++++-----------------
1 files changed, 27 insertions(+), 34 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 45f3ee6..5c96cff 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -49,6 +49,7 @@
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Service;
+using WIDESEAWCS_TaskInfoRepository;
using static Microsoft.IO.RecyclableMemoryStreamManager;
namespace WIDESEAWCS_TaskInfoService
@@ -59,6 +60,7 @@
private readonly ITaskExecuteDetailService _taskExecuteDetailService;
private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository;
private readonly ITask_HtyService _task_HtyService;
+ private readonly ITask_HtyRepository _task_HtyRepository;
private readonly IMapper _mapper;
private Dictionary<string, OrderByType> _taskOrderBy = new()
@@ -73,12 +75,13 @@
public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList();
- public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ITask_HtyService task_HtyService) : base(BaseDal)
+ public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ITask_HtyService task_HtyService, ITask_HtyRepository task_HtyRepository) : base(BaseDal)
{
_routerService = routerService;
_taskExecuteDetailService = taskExecuteDetailService;
_taskExecuteDetailRepository = taskExecuteDetailRepository;
_task_HtyService = task_HtyService;
+ _task_HtyRepository = task_HtyRepository;
_mapper = mapper;
}
@@ -241,11 +244,11 @@
WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"绌烘墭鍑哄簱澶辫触锛岃鎯咃細{content.Message}", "闇�瑕佺┖鎵�");
}
}
- return content = WebResponseContent.Instance.Error();
+ return content;
}
catch (Exception ex)
{
- return content = WebResponseContent.Instance.Error(ex.Message);
+ return content.Error(ex.Message);
}
}
@@ -364,7 +367,7 @@
if (task.TaskNum != _Task.TaskNum)
{
WriteLog.GetLog("鎺ユ敹浠诲姟").Write("绉诲簱浠诲姟锛�" + JsonConvert.SerializeObject(task), "鎺ユ敹浠诲姟");
- task.TaskState = (int)TaskRelocationTypeEnum.Relocation;
+ task.TaskState = (int)TaskOutStatusEnum.ResRestNet;
task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02";
task.TaskNum = task.TaskNum;
task.Grade = 3;
@@ -622,13 +625,10 @@
return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
}
- int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
+ //int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
- task.TaskState = nextStatus;
- if (task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
- {
- task.Dispatchertime = DateTime.Now;
- }
+ task.TaskState = (int)TaskOutStatusEnum.SC_OutExecuting;
+ task.Dispatchertime = DateTime.Now;
}
else if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
{
@@ -637,34 +637,17 @@
return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
}
- int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
- task.TaskState = nextStatus;
- if (task.TaskState == (int)TaskInStatusEnum.SC_InExecuting)
- {
- task.Dispatchertime = DateTime.Now;
- }
- if (task.TaskState == (int)TaskRelocationTypeEnum.Relocation)
- {
- Random random = new Random();
- task.CurrentAddress = task.NextAddress;
- task.NextAddress = $"{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}";
- task.TargetAddress = task.NextAddress;
- }
+ //int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
+ task.TaskState = (int)TaskInStatusEnum.SC_InExecuting;
+ task.Dispatchertime = DateTime.Now;
}
- else if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
+ else if (task.TaskType == (int)TaskRelocationTypeEnum.Relocation)
{
- if (task.TaskState <= (int)TaskRelocationStatusEnum.SC_RelocationFinish)
+ if (task.TaskState != (int)TaskOutStatusEnum.ResRestNet)
{
-
return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
}
-
- int nextStatus = (int)TaskRelocationStatusEnum.SC_RelocationExecuting;
- task.TaskState = nextStatus;
- if (task.TaskState == (int)TaskRelocationStatusEnum.SC_RelocationExecuting)
- {
- task.Dispatchertime = DateTime.Now;
- }
+ task.TaskState = (int)TaskOutStatusEnum.ResRest; //涓嬪彂绉诲簱浠诲姟
}
else
{
@@ -756,7 +739,7 @@
content = HttpHelper.Get<WebResponseContent>($"{urlTaskCompleted}?TaskNum={task.TaskNum}&HowWorks=2");
- wcs_PLCto09("鍑哄簱浠诲姟",$"鏉$爜锛歿task.PalletCode},浠诲姟鍙凤細{task.TaskNum}",$"璋冨彇wms浠诲姟鍙嶉锛歿JsonConvert.SerializeObject(content)}");
+ wcs_PLCto09("鍑哄簱浠诲姟", $"鏉$爜锛歿task.PalletCode},浠诲姟鍙凤細{task.TaskNum}", $"璋冨彇wms浠诲姟鍙嶉锛歿JsonConvert.SerializeObject(content)}");
task.ModifyDate = DateTime.Now;
BaseDal.DeleteData(task);
@@ -814,6 +797,16 @@
return content;
}
+ public WebResponseContent StackCraneTashty(int taskNum)
+ {
+ WebResponseContent content = new WebResponseContent();
+ int taskcount = _task_HtyRepository.QueryData(x =>x.TaskNum == taskNum && x.CreateDate >= DateTime.Now.AddMinutes(-30)).Count();
+
+ if (taskcount>0) return WebResponseContent.Instance.OK();
+
+ return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅锛屾椂闂翠笉鍦ㄨ寖鍥村唴,浠诲姟鍙蜂负锛歿taskNum}");
+ }
+
/// <summary>
/// 鎭㈠鎸傝捣浠诲姟
/// </summary>
--
Gitblit v1.9.3