From b5fe109b08ce6e1e78696bb7cf41f415dc6a4587 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期四, 05 十二月 2024 13:33:35 +0800
Subject: [PATCH] 添加任务历史
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs | 153 ++++++++++++++++++++++++++++++--------------------
1 files changed, 91 insertions(+), 62 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
index e5ded63..baf6ad8 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
@@ -54,7 +54,7 @@
private readonly IMapper _mapper;
private readonly IDt_StationManagerService _stationManagerService;
- public CommonConveyorLine_AfterJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository,IDt_StationManagerService stationManagerService)
+ public CommonConveyorLine_AfterJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IDt_StationManagerService stationManagerService)
{
_taskService = taskService;
_taskExecuteDetailService = taskExecuteDetailService;
@@ -72,13 +72,9 @@
if (conveyorLine != null)
{
List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode);
- List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
- //List<Task> tasks = new List<Task>();
- foreach (string childDeviceCode in childDeviceCodes)
+ foreach (var station in stationManagers)
{
- ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode);
-
- if (command.ConveyorLineBarcode.Trim().Contains("\0")) command.ConveyorLineBarcode = "";
+ ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(station.stationChildCode);
DeviceProtocolDetailDTO? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand_After.InteractiveSignal) && x.ProtocalDetailValue == command.InteractiveSignal.ToString());
if (deviceProtocolDetails != null)
@@ -86,16 +82,35 @@
MethodInfo? method = GetType().GetMethod(deviceProtocolDetails.ProtocolDetailType);
if (method != null)
{
- method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode });
+ method.Invoke(this, new object[] { conveyorLine, command, station });
}
}
}
- //Task.WaitAll(tasks.ToArray());
+
+ #region 璺敱鏂瑰紡
+ //List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
+ //foreach (string childDeviceCode in childDeviceCodes)
+ //{
+ // ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode);
+
+ // if (command.ConveyorLineBarcode.Trim().Contains("\0")) command.ConveyorLineBarcode = "";
+
+ // DeviceProtocolDetailDTO? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand_After.InteractiveSignal) && x.ProtocalDetailValue == command.InteractiveSignal.ToString());
+ // if (deviceProtocolDetails != null)
+ // {
+ // MethodInfo? method = GetType().GetMethod(deviceProtocolDetails.ProtocolDetailType);
+ // if (method != null)
+ // {
+ // method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode });
+ // }
+ // }
+ //}
+ #endregion
}
}
catch (Exception ex)
{
- Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+ Console.Out.WriteLine(nameof(CommonConveyorLine_AfterJob) + ":" + ex.ToString());
}
finally
{
@@ -111,82 +126,96 @@
/// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
/// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
/// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
- public void RequestInbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+ public void RequestInbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, Dt_StationManager stationInfo)
{
-
- var taskNew = _taskService.QueryCraneConveyorLineTask(command.ConveyorLineTaskNum.ObjToInt(), childDeviceCode);
+ var taskNew = _taskService.QueryTaskByPalletCode(command.ConveyorLineBarcode, stationInfo.Roadway);
if (taskNew == null)
{
- string barcode = command.ConveyorLineBarcode.TrimEnd();
- if (_taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode).Result.Status)
+ if (_taskService.RequestTask(command.ConveyorLineBarcode, stationInfo).Result.Status)
{
- Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+ Dt_Task task = _taskService.QueryTaskByPalletCode(command.ConveyorLineBarcode, stationInfo.Roadway);
if (task != null)
{
- ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
+ //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
//taskCommand.InteractiveSignal = command.InteractiveSignal;
- taskCommand.ResponState = 1;
- taskCommand.ConveyorLineTaskNum = task.TaskNum;
- taskCommand.ConveyorLineTargetAddress = Convert.ToInt16(task.NextAddress);
- conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
+ //taskCommand.ResponState = 1;
+ //taskCommand.ConveyorLineTaskNum = task.TaskNum;
+ //taskCommand.ConveyorLineTargetAddress = Convert.ToInt16(task.NextAddress);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, stationInfo.stationChildCode);
+ //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, 1, task.NextAddress);
//ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-
- _taskService.UpdateTaskStatusToNext(task);
}
}
}
+ }
- var inTask = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum.ObjToInt(), childDeviceCode);
- if (inTask != null)
+ /// <summary>
+ /// 杈撻�佺嚎璇锋眰绌烘
+ /// </summary>
+ /// <param name="conveyorLine"></param>
+ /// <param name="command"></param>
+ /// <param name="stationInfo"></param>
+ public void RequestEmptyOutbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, Dt_StationManager stationInfo)
+ {
+ if (stationInfo.stationType != 7) return;
+ var taskNew = _taskRepository.QueryFirst(x => x.Roadway == stationInfo.Roadway && x.TaskType == (int)TaskOutboundTypeEnum.OutTray);
+ if (taskNew == null) //涓嶅瓨鍦ㄧ┖妗嗗嚭搴撲换鍔� 鍒欒姹俉MS鍑虹┖搴�
{
- ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(inTask);
- //taskCommand.InteractiveSignal = command.InteractiveSignal;
- taskCommand.ResponState = 1;
- conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
- _taskService.UpdateTaskStatusToNext(inTask);
+ if (_taskService.RequestTask(command.ConveyorLineBarcode, stationInfo).Result.Status)
+ {
+ Dt_Task task = _taskService.QueryTaskByPalletCode(command.ConveyorLineBarcode, stationInfo.Roadway);
+ if (task != null)
+ {
+ //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
+ //taskCommand.InteractiveSignal = command.InteractiveSignal;
+ //taskCommand.ResponState = 1;
+ //taskCommand.ConveyorLineTaskNum = task.TaskNum;
+ //taskCommand.ConveyorLineTargetAddress = Convert.ToInt16(task.NextAddress);
+ //conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, stationInfo.stationChildCode);
+ //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, 1, task.NextAddress);
+ //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+ }
+ }
}
}
/// <summary>
- /// 杈撻�佺嚎鍏ュ簱瀹屾垚
+ /// 杈撻�佺嚎璇锋眰鍏ュ簱
/// </summary>
/// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
/// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
/// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
- /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
- public void ConveyorLineInFinish(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
- {
- Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
- if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
- {
- //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+ //public void RequestInbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+ //{
+ // var stationInfo = _stationManagerService.GetStationInfoByChildCode(childDeviceCode);
+ // if (stationInfo != null)
+ // {
+ // //_taskService.r
+ // }
+ // var taskNew = _taskService.QueryCraneConveyorLineTask(command.ConveyorLineTaskNum.ObjToInt(), childDeviceCode);
+ // if (taskNew == null)
+ // {
+ // string barcode = command.ConveyorLineBarcode.TrimEnd();
+ // if (_taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode).Result.Status)
+ // {
+ // Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+ // if (task != null)
+ // {
+ // ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
+ // //taskCommand.InteractiveSignal = command.InteractiveSignal;
+ // taskCommand.ResponState = 1;
+ // taskCommand.ConveyorLineTaskNum = task.TaskNum;
+ // taskCommand.ConveyorLineTargetAddress = Convert.ToInt16(task.NextAddress);
+ // conveyorLine.SendCommand(taskCommand, childDeviceCode);
- //conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
- WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
- Console.Out.WriteLine(content.Serialize());
- }
- }
+ // //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
- /// <summary>
- /// 杈撻�佺嚎璇锋眰鍑轰俊鎭�
- /// </summary>
- /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
- /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
- /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
- public void RequestOutbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
- {
- Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
- if (task != null)
- {
- // ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
- //taskCommand.InteractiveSignal = command.InteractiveSignal;
- // conveyorLine.SendCommand(taskCommand, childDeviceCode);
+ // _taskService.UpdateTaskStatusToNext(task);
+ // }
+ // }
+ // }
+ //}
- _taskService.UpdateTaskStatusToNext(task);
- }
- }
}
}
#endregion
\ No newline at end of file
--
Gitblit v1.9.3