From 8adbc609ea7b5982d5c7bd3c47beb2fa775c5399 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 29 十二月 2025 18:43:08 +0800
Subject: [PATCH] 1
---
WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 373 ++++++++--------------------------------------------
1 files changed, 59 insertions(+), 314 deletions(-)
diff --git a/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index 06fabd5..b2902c0 100644
--- a/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -16,67 +16,69 @@
#endregion << 鐗� 鏈� 娉� 閲� >>
using AutoMapper;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Quartz;
-using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
using System.Threading.Tasks;
-using WIDESEA_Common.Log;
using WIDESEAWCS_Core;
-using WIDESEAWCS_ISystemServices;
+using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
-using WIDESEAWCS_Model.Models.System;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DTO;
-using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_Tasks.ConveyorLineJob;
namespace WIDESEAWCS_Tasks
{
[DisallowConcurrentExecution]
- public class CommonConveyorLineJob : IJob
+ public class CommonConveyorLineJob : JobBase, IJob
{
private readonly ITaskService _taskService;
private readonly ITaskExecuteDetailService _taskExecuteDetailService;
private readonly IRouterService _routerService;
- private readonly IPlatformStationService _PlatformStationService;
-
private readonly IMapper _mapper;
- public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, IPlatformStationService platformStation)
+ public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper)
{
_taskService = taskService;
_taskExecuteDetailService = taskExecuteDetailService;
_routerService = routerService;
_mapper = mapper;
- _PlatformStationService = platformStation;
}
public Task Execute(IJobExecutionContext context)
{
+ //Console.Out.WriteLine(DateTime.Now);
try
{
CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
-
if (conveyorLine != null)
{
- //璇诲彇杈撻�佺嚎鍏ュ簱鐢宠
- RequestInbound(conveyorLine);
- //璇诲彇鍫嗗灈鏈哄叆搴撶珯鍙颁俊鍙�
- RequestInSCLine(conveyorLine);
+ List<string> childDeviceCodes = new List<string>();
- //鍫嗗灈鏈虹珯鍙拌繘琛屼笅鍙戣緭閫佺嚎浠诲姟
- RequestOutSCLine(conveyorLine);
- //璇诲彇Rgv鍑哄簱鍙d换鍔�
- RequestOutbound(conveyorLine);
- //璇诲彇鍑哄簱绔欏彴锛岃幏鍙栧嚭搴撳彛鏇存柊鍑哄簱浠诲姟
- RequestOutAdd(conveyorLine);
-
+ foreach (string childDeviceCode in childDeviceCodes)
+ {
+ R_ConveyorLineInfo command = conveyorLine.ReadCustomer<R_ConveyorLineInfo>(childDeviceCode);
+ if (command != null)
+ {
+
+ }
+ }
}
+
}
catch (Exception ex)
{
- //Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+ Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+ }
+ finally
+ {
+ //Console.Out.WriteLine(DateTime.Now);
}
return Task.CompletedTask;
}
@@ -85,323 +87,66 @@
/// 杈撻�佺嚎璇锋眰鍏ュ簱
/// </summary>
/// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
- public void RequestInbound(CommonConveyorLine conveyorLine)
+ /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+ public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
{
- List<PlatformStation> platformsList = _PlatformStationService.GetPlatformList(conveyorLine.DeviceCode);
- foreach (var RGVStationitem in platformsList)
- {
- ConveyorLineCommand command = lineCommand(conveyorLine,RGVStationitem.Station_code);
- if (command != null)
- {
- if (command.Online)
- {
- if (command.STB)
- {
- WebResponseContent content = _taskService.RequestWMSTask(command.BarCode, RGVStationitem.Station_code.ToString(), command.GoodsType);
- if (content.Status)
- {
- DeviceProDTO? deviceProDTO6 = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == RGVStationitem.Station_code.ToString() && x.DeviceProParamName == "ACK" && x.DeviceProParamType == "DeviceCommand");
- if (deviceProDTO6 != null)
- {
- conveyorLine.Communicator.Write(deviceProDTO6.DeviceProAddress, (bool)true);
- wcsWriteLog(RGVStationitem.Station_code.ToString(), "姝e父鏃ュ織", $"{RGVStationitem.Station_code}鍐欏叆杈撻�佺嚎淇″彿,妯″潡{deviceProDTO6.DeviceProAddress}锛歵rue");
- }
- else
- {
- wcsWriteLog(RGVStationitem.Station_code.ToString(), "閿欒鏃ュ織", $"鏈壘鍒板浜庣殑璇诲彇妯″潡{RGVStationitem.Station_code}");
- }
- }
- else
- {
- wcsWriteLog(RGVStationitem.Station_code.ToString(), "閿欒鏃ュ織", $"鍏ュ簱绔欏彴锛歿RGVStationitem.Station_code}锛岄敊璇俊鎭細{content.Message}");
- }
- }
- else
- {
- DeviceProDTO? deviceProDTO6 = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == RGVStationitem.Station_code.ToString() && x.DeviceProParamName == "ACK" && x.DeviceProParamType == "DeviceCommand");
- if (deviceProDTO6 != null)
- {
-
- conveyorLine.Communicator.Write(deviceProDTO6.DeviceProAddress, (bool)false);
- wcsWriteLog(RGVStationitem.Station_code.ToString(), "姝e父鏃ュ織", $"{RGVStationitem.Station_code}鍐欏叆杈撻�佺嚎淇″彿,妯″潡{deviceProDTO6.DeviceProAddress}锛歠alse");
- }
- else
- {
- wcsWriteLog(RGVStationitem.Station_code.ToString(), "閿欒鏃ュ織", $"鏈壘鍒板浜庣殑璇诲彇妯″潡{RGVStationitem.Station_code}");
- }
- }
- }
- else
- {
- wcsWriteLog(RGVStationitem.Station_code.ToString(), "閿欒鏃ュ織", $"璇ョ珯鍙皗RGVStationitem.Station_code}涓嶅浜庤仈鏈虹姸鎬�");
- }
-
- }
- }
}
/// <summary>
- /// 璇诲彇鍫嗗灈鏈哄叆搴撶珯鍙颁俊鎭紝杩涜浠诲姟瀹屾垚
+ /// 杈撻�佺嚎璇锋眰鍏ュ簱涓嬩竴鍦板潃
/// </summary>
/// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
- public void RequestInSCLine(CommonConveyorLine conveyorLine)
+ /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+ public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
{
- List<string> platformsList = _PlatformStationService.GetPlatIn(conveyorLine.DeviceCode); //璇诲彇绔欏彴淇℃伅
- foreach (var RGVStationitem in platformsList)
- {
- ConveyorLineCommand command = lineCommand(conveyorLine, RGVStationitem);
- if (command != null)
- {
- if (command.Online && command.STB && command.TaskNo != 0)
- {
- //鍐欏叆鍙嶉
- DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == RGVStationitem && x.DeviceProParamName == "ACK" && x.DeviceProParamType == "DeviceCommand");
-
- if (conveyorLine.Communicator.Write(deviceProDTO.DeviceProAddress, (bool)true))
- {
- DeviceProDTO? deviceProDTO2 = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == RGVStationitem && x.DeviceProParamName == "STB" && x.DeviceProParamType == "ReadDeviceCommand");
- if (conveyorLine.Communicator.Read<bool>(deviceProDTO2.DeviceProAddress))
- {
- conveyorLine.Communicator.Write(deviceProDTO.DeviceProAddress, (bool)false);
- _taskService.UpdateTaskStatusToNext2(command.TaskNo);
-
- wcsWriteLog5(RGVStationitem, "姝e父淇℃伅", $"娓呴櫎绔欏彴锛歿RGVStationitem}鐨勪氦浜掍俊鍙峰啓鍏ワ細false锛屽湴鍧�锛歿deviceProDTO.DeviceProAddress}");
- }
- else
- {
- wcsWriteLog5(RGVStationitem, "閿欒淇℃伅", $"鏈鍙栧埌绔欏彴锛歿RGVStationitem}鐨勪氦浜掍俊鍙凤細true锛屽湴鍧�锛歿deviceProDTO.DeviceProAddress}");
- }
- }
- else
- {
- conveyorLine.Communicator.Write(deviceProDTO.DeviceProAddress, (bool)false);
- wcsWriteLog5(RGVStationitem, "閿欒淇℃伅", $"{RGVStationitem}鐨勪氦浜掍俊鍙峰啓鍏ワ細true ==銆� false锛屽湴鍧�锛歿deviceProDTO.DeviceProAddress}");
- }
- }
- else
- {
- wcsWriteLog5(RGVStationitem, "閿欒淇℃伅", $"鏈鍙栧埌绔欏彴锛歿RGVStationitem}鐨勭敵璇蜂俊鍙凤紝鐩墠淇″彿鐘舵�佷负銆侽nline锛歿command.Online}锛孲TB锛歿command.STB}锛孴askNo锛歿command.TaskNo}锛�");
- }
- }
- }
+
}
/// <summary>
- /// RGV杈撻�佺嚎璇锋眰鍑虹珯
+ /// 杈撻�佺嚎鍏ュ簱瀹屾垚
/// </summary>
/// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
- public void RequestOutbound(CommonConveyorLine conveyorLine)
+ /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+ public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
{
-
- List<string> platformsList = _PlatformStationService.GetPlatform2(conveyorLine.DeviceCode);
- foreach (var RGVStationitem in platformsList)
- {
- ConveyorLineCommand command = lineCommand(conveyorLine, RGVStationitem);
- if (command != null)
- {
- if(command.Online)
- {
- if (command.STB)
- {
- if (_taskService.UpdateTaskStatusToNext(command.TaskNo).Status)
- {
- DeviceProDTO? deviceProDTO6 = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == RGVStationitem && x.DeviceProParamName == "ACK" && x.DeviceProParamType == "DeviceCommand");
- if (deviceProDTO6 != null)
- {
- conveyorLine.Communicator.Write(deviceProDTO6.DeviceProAddress, (bool)true);
- wcsWriteLog2(RGVStationitem, "姝e父鏃ュ織", $"{RGVStationitem}鍐欏叆杈撻�佺嚎淇″彿,妯″潡{deviceProDTO6.DeviceProAddress}锛歵rue");
- }
- else
- {
- wcsWriteLog2(RGVStationitem, "閿欒鏃ュ織", $"鏈壘鍒板浜庣殑璇诲彇妯″潡{RGVStationitem}");
- }
- }
- else
- {
- wcsWriteLog2(RGVStationitem, "閿欒鏃ュ織", $"浠诲姟淇℃伅鏇存敼澶辫触");
- }
- }
- else
- {
- DeviceProDTO? deviceProDTO6 = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == RGVStationitem && x.DeviceProParamName == "ACK" && x.DeviceProParamType == "DeviceCommand");
- if (deviceProDTO6 != null)
- {
-
- conveyorLine.Communicator.Write(deviceProDTO6.DeviceProAddress, (bool)false);
- wcsWriteLog2(RGVStationitem, "姝e父鏃ュ織", $"{RGVStationitem}鍐欏叆杈撻�佺嚎淇″彿,妯″潡{deviceProDTO6.DeviceProAddress}锛歠alse");
- }
- else
- {
- wcsWriteLog2(RGVStationitem, "閿欒鏃ュ織", $"鏈壘鍒板浜庣殑璇诲彇妯″潡{RGVStationitem}");
- }
- }
- }
- else
- {
- wcsWriteLog2(RGVStationitem, "閿欒鏃ュ織", $"璇ョ珯鍙皗RGVStationitem}涓嶅浜庤仈鏈虹姸鎬�");
- }
-
- }
- }
- }
-
- /// <summary>
- /// 鑾峰彇鍑哄簱绔欏彴锛屾洿鏂板嚭搴撲换鍔�
- /// </summary>
- /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
- public void RequestOutAdd(CommonConveyorLine conveyorLine)
- {
- List<PlatformStation> platformsList = _PlatformStationService.GetPlatformOutList(conveyorLine.DeviceCode);
- foreach (var RGVStationitem in platformsList)
- {
- ConveyorLineCommand command = lineCommand(conveyorLine, RGVStationitem.Station_code);
- if (command != null)
- {
- if(command.Online)
- {
- if (command.Free)
- {
- if (_taskService.OutConveyorLineTask(RGVStationitem)) //鏌ユ壘鏄惁琚崰鐢�
- {
- wcsWriteLog3(RGVStationitem.Station_code.ToString(), "鏇存柊鎴愬姛", $"浠诲姟淇℃伅鏇存柊鎴愬姛");
- }
- else
- {
- wcsWriteLog3(RGVStationitem.Station_code.ToString(), "閿欒淇℃伅", $"宸叉湁璇ョ珯鍙扮殑鍑哄簱浠诲姟鎴栦换鍔℃洿鏂板け璐�");
- }
- }
- else
- {
- wcsWriteLog3(RGVStationitem.Station_code.ToString(), "閿欒淇℃伅", $"璇ュ嚭搴撶珯鍙颁笉鍙斁璐�");
- }
- }
- else
- {
- wcsWriteLog3(RGVStationitem.Station_code.ToString(), "鏄惁鑱旀満", $"璇ョ珯鍙皗RGVStationitem.Station_code}涓嶅浜庤仈鏈虹姸鎬�");
- }
- }
- }
- }
-
-
- /// <summary>
- /// 鍫嗗灈鏈哄嚭搴撶珯鍙帮紝鏍规嵁浠诲姟杩涜涓嬪彂鑷宠緭閫佺嚎
- /// </summary>
- /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
- public void RequestOutSCLine(CommonConveyorLine conveyorLine)
- {
- List<Dt_Task> StationData = _taskService.StackerCraneOutTask();
- foreach (var LinSCStationitem in StationData)
- {
- string platformsList = _PlatformStationService.GetOutSCName(LinSCStationitem.Roadway, LinSCStationitem.Station_storey);
- DeviceProDTO? deviceProDTO6 = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == platformsList && x.DeviceProParamName == "STB" && x.DeviceProParamType == "DeviceCommand");
- DeviceProDTO? deviceProDTO7 = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == platformsList && x.DeviceProParamName == "TaskNo" && x.DeviceProParamType == "DeviceCommand");
- if (deviceProDTO6 != null && deviceProDTO7 != null)
- {
- conveyorLine.Communicator.Write(deviceProDTO7.DeviceProAddress, (int)LinSCStationitem.TaskNum);
- if (conveyorLine.Communicator.Write(deviceProDTO6.DeviceProAddress, (bool)true))
- {
- DeviceProDTO? deviceProDTO8 = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == platformsList && x.DeviceProParamName == "ACK" && x.DeviceProParamType == "ReadDeviceCommand");
- if (deviceProDTO8 != null)
- {
- if (conveyorLine.Communicator.Read<bool>(deviceProDTO8.DeviceProAddress))
- {
- _taskService.UpdateTaskStatusToNext(LinSCStationitem.TaskNum);
- conveyorLine.Communicator.Write(deviceProDTO6.DeviceProAddress, (bool)false);
- conveyorLine.Communicator.Write(deviceProDTO8.DeviceProAddress, (int)0);
- //鍐欏叆杈撻�佺嚎鍥炲簲淇″彿涓�
- }
- else
- {
- wcsWriteLog4(LinSCStationitem.TargetAddress, "鐢宠鍑哄簱鍫嗗灈鏈虹珯鍙伴敊璇俊鎭�", $"鏈鍙栧埌杈撻�佺嚎鍥炲簲淇″彿锛欰CK锛寋LinSCStationitem}");
- }
- }
- else
- {
- wcsWriteLog4(LinSCStationitem.TargetAddress, "鐢宠鍑哄簱鍫嗗灈鏈虹珯鍙伴敊璇俊鎭�", $"鏈壘鍒板浜庣殑璇诲彇妯″潡{LinSCStationitem}");
- }
- }
- else
- {
- wcsWriteLog4(LinSCStationitem.TargetAddress, "鐢宠鍑哄簱鍫嗗灈鏈虹珯鍙板け璐�", $"鍐欏叆杈撻�佺嚎淇″彿,妯″潡{deviceProDTO6.DeviceProAddress}锛氬け璐�");
- }
- }
- else
- {
- wcsWriteLog4(LinSCStationitem.TargetAddress, "鐢宠鍑哄簱鍫嗗灈鏈虹珯鍙伴敊璇俊鎭�", $"鏈壘鍒板浜庣殑鍐欏叆妯″潡{LinSCStationitem}");
- }
- }
}
-
-
/// <summary>
- /// 璇诲彇淇℃伅璁板綍
+ /// 杈撻�佺嚎璇锋眰鍑轰俊鎭�
/// </summary>
- /// <param name="SCLLinStack"></param>
- /// <param name="Logtype"></param>
- /// <param name="Magessadd"></param>
- public void wcsWriteLog(string SCLLinStack, string Logtype, string Magessadd)
+ /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+ /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+ public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
{
- WriteLog.Write_Log("鍏ュ簱鍙�", SCLLinStack + "绔欏彴", Logtype, new { 淇℃伅 = Magessadd });
+
}
- public void wcsWriteLog2(string SCLLinStack, string Logtype, string Magessadd)
+ /// <summary>
+ /// 杈撻�佺嚎璇锋眰鍑哄簱涓嬩竴鍦板潃
+ /// </summary>
+ /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+ /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+ public void RequestOutNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
{
- WriteLog.Write_Log("RGV绔欏彴", SCLLinStack + "绔欏彴", Logtype, new { 淇℃伅 = Magessadd });
+
}
- public void wcsWriteLog3(string SCLLinStack, string Logtype, string Magessadd)
+ /// <summary>
+ /// 杈撻�佺嚎鍑哄簱瀹屾垚
+ /// </summary>
+ /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+ /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+ public void ConveyorLineOutFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
{
- WriteLog.Write_Log("鍑哄簱鍙�", SCLLinStack + "绔欏彴", Logtype, new { 淇℃伅 = Magessadd });
- }
-
- public void wcsWriteLog4(string SCLLinStack, string Logtype, string Magessadd)
- {
- WriteLog.Write_Log("鍫嗗灈鏈虹珯鍙�", SCLLinStack + "绔欏彴", Logtype, new { 淇℃伅 = Magessadd });
- }
-
- public void wcsWriteLog5(string SCLLinStack, string Logtype, string Magessadd)
- {
- WriteLog.Write_Log("鍫嗗灈鏈哄叆搴撶珯鍙�", SCLLinStack + "绔欏彴", Logtype, new { 淇℃伅 = Magessadd });
- }
-
-
-
-
- public ConveyorLineCommand lineCommand(CommonConveyorLine conveyorLine,string Station_code)
- {
- ConveyorLineCommand conveyorLineCommand = new ConveyorLineCommand();
- List<DeviceProDTO> deviceProDTO6 = conveyorLine.DeviceProDTOs
- .Where(x => x.DeviceChildCode == Station_code
- && DBLine.ListDBdata.Contains(x.DeviceProParamName)
- && x.DeviceProParamType == "ReadDeviceCommand")
- .ToList();
- foreach (var item in deviceProDTO6)
- {
- var paramName = item.DeviceProParamName;
- var propertyInfo = typeof(ConveyorLineCommand).GetProperty(paramName);
-
- if (propertyInfo != null)
- {
- if (item.DeviceDataType == "bool")
- {
- var value = conveyorLine.Communicator.Read<bool>(item.DeviceProAddress);
- propertyInfo.SetValue(conveyorLineCommand, value);
- }else if(item.DeviceDataType == "int")
- {
- var value = conveyorLine.Communicator.Read<int>(item.DeviceProAddress);
- propertyInfo.SetValue(conveyorLineCommand, value);
- }else if(item.DeviceDataType == "string")
- {
- var value = conveyorLine.Communicator.Read<string>(item.DeviceProAddress);
- propertyInfo.SetValue(conveyorLineCommand, value);
- }
- }
- }
- return conveyorLineCommand;
+
}
}
}
--
Gitblit v1.9.3