From 45af2754d00347ec86492707e15b3884557ee851 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 24 十二月 2024 09:02:54 +0800
Subject: [PATCH] PDA
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/油墨仓/StackerCraneJob_YM.cs | 106 +++++++++++++++++++++++++----------------------------
1 files changed, 50 insertions(+), 56 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/StackerCraneJob_YM.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/StackerCraneJob_YM.cs"
index 0b1a496..17fbe79 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/StackerCraneJob_YM.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/StackerCraneJob_YM.cs"
@@ -7,7 +7,9 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Enums;
+using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
@@ -19,10 +21,12 @@
using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
using WIDESEAWCS_Tasks.HoisterJob;
using WIDESEAWCS_Tasks.StackerCraneJob;
-using WIDESEAWCS_Tasks.闃荤剨浠�;
namespace WIDESEAWCS_Tasks
{
+ /// <summary>
+ /// 娌瑰ⅷ浠撳爢鍨涙満
+ /// </summary>
[DisallowConcurrentExecution]
public class StackerCraneJob_YM : JobBase, IJob
{
@@ -43,34 +47,32 @@
public Task Execute(IJobExecutionContext context)
{
+ CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
try
{
- CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
if (commonStackerCrane != null)
{
if (!commonStackerCrane.IsEventSubscribed)
{
commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//璁㈤槄浠诲姟瀹屾垚浜嬩欢
}
-
- if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal)
+ commonStackerCrane.CheckStackerCraneTaskCompleted();//闃叉浠诲姟瀹屾垚浜嬩欢鐩戞祴瓒呮椂锛屽啀鎵嬪姩瑙﹀彂涓�娆�
+ if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby)
{
- commonStackerCrane.CheckStackerCraneTaskCompleted();//闃叉浠诲姟瀹屾垚浜嬩欢鐩戞祴瓒呮椂锛屽啀鎵嬪姩瑙﹀彂涓�娆�
-
- if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby)
+ Dt_Task? task = GetTask(commonStackerCrane);
+ if (task != null)
{
- Dt_Task? task = GetTask(commonStackerCrane);
- if (task != null)
+ StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
+ if (stackerCraneTaskCommand != null)
{
- StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
- if (stackerCraneTaskCommand != null)
+ bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
+ if (sendFlag)
{
- bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
- if (sendFlag)
- {
- commonStackerCrane.LastTaskType = task.TaskType;
- _taskService.UpdateTaskStatusToNext(task.TaskNum);
- }
+ commonStackerCrane.LastTaskType = task.TaskType;
+ int oldState = task.TaskState;
+ task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt();
+ _taskRepository.UpdateData(task);
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"绯荤粺鑷姩娴佺▼锛屼换鍔$姸鎬佷粠銆恵oldState}銆戣浆鍒般�恵task.TaskState}銆�");
}
}
}
@@ -79,7 +81,7 @@
}
catch (Exception ex)
{
- WriteError(nameof(CommonStackerCraneJob), ex.Message, ex);
+ WriteError(commonStackerCrane.DeviceName, ex.Message, ex);
}
return Task.CompletedTask;
}
@@ -94,10 +96,20 @@
CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane;
if (commonStackerCrane != null)
{
+ WriteInfo(commonStackerCrane.DeviceName, $"璇诲彇鍒颁换鍔″畬鎴愪俊鍙�,{e.TaskNum}");
if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
{
- Console.Out.WriteLine("TaskCompleted" + e.TaskNum);
- _taskService.StackCraneTaskCompleted(e.TaskNum);
+ Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
+ if (task != null)
+ {
+ _taskExecuteDetailService.AddTaskExecuteDetail(e.TaskNum, $"绯荤粺鑷姩娴佺▼,浠诲姟瀹屾垚");
+ _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚);
+ HttpHelper.Post("", "");//todo 璋冪敤WMS浠诲姟瀹屾垚鏂规硶
+ }
+ else
+ {
+ WriteInfo(commonStackerCrane.DeviceName, $"璇诲彇鍒颁换鍔″畬鎴愪俊鍙�,鏈壘鍒板搴旂殑浠诲姟淇℃伅,{e.TaskNum}");
+ }
commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
}
}
@@ -166,7 +178,7 @@
/// <returns>濡傛灉鏈鍗犵敤锛岃繑鍥炰紶鍏ョ殑浠诲姟淇℃伅锛屽惁鍒欙紝杩斿洖null</returns>
private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task)
{
- Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway);
+ Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.DeviceCode);
if (stationManger != null)
{
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
@@ -208,9 +220,6 @@
stackerCraneTaskCommand.TrayType = 1;
if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//鍒ゆ柇鏄惁鏄叆搴撲换鍔�
{
- //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.CurrentAddress, task.Roadway);
- //if (routers.Count > 0)
- //{
string[] startCodes = task.CurrentAddress.Split("-");
stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]);
@@ -230,43 +239,28 @@
_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍏ュ簱浠诲姟缁堢偣閿欒锛岃捣鐐癸細銆恵task.NextAddress}銆�");
return null;
}
- //}
- //else
- //{
- // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鑾峰彇瀵瑰簲鐨勫爢鍨涙満鍙栬揣绔欏彴淇℃伅");
- // return null;
- //}
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
{
- //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress);
- //if (routers.Count > 0)
+ string[] targetCodes = task.NextAddress.Split("-");
+
+ stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]);
+ stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]);
+ stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]);
+
+ string[] sourceCodes = task.CurrentAddress.Split("-");
+ if (sourceCodes.Length == 3)
{
- string[] targetCodes = task.NextAddress.Split("-");
-
- stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]);
- stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]);
- stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]);
-
- string[] sourceCodes = task.CurrentAddress.Split("-");
- if (sourceCodes.Length == 3)
- {
- stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]);
- stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]);
- stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]);
- }
- else
- {
- //鏁版嵁閰嶇疆閿欒
- _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍑哄簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
- return null;
- }
+ stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]);
+ stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]);
+ stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]);
}
- //else
- //{
- // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鑾峰彇瀵瑰簲鐨勫爢鍨涙満鏀捐揣绔欏彴淇℃伅");
- // return null;
- //}
+ else
+ {
+ //鏁版嵁閰嶇疆閿欒
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍑哄簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
+ return null;
+ }
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
{
--
Gitblit v1.9.3