From 28110912ca4803e5793f181517d7bf2d7a5ea2ad Mon Sep 17 00:00:00 2001
From: HuBingJie <3146306518@qq.com>
Date: 星期五, 05 十二月 2025 00:32:49 +0800
Subject: [PATCH] 1
---
代码管理/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 311 +++++++++++++++++++++++++++++----------------------
1 files changed, 174 insertions(+), 137 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
index c1a5208..dc2793c 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
@@ -1,24 +1,17 @@
-锘縰sing Autofac.Core;
-using AutoMapper;
+锘縰sing AutoMapper;
using Quartz;
-using System.Diagnostics.CodeAnalysis;
-using System.Reflection;
-using System.Threading.Tasks;
using WIDESEA_Common.Log;
-using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
-using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.Enum;
using WIDESEAWCS_ISystemServices;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
-using WIDESEAWCS_Model.Models.System;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Service;
+using WIDESEAWCS_TaskInfoService;
using WIDESEAWCS_Tasks.ConveyorLineJob;
using WIDESEAWCS_Tasks.StackerCraneJob;
-using static System.Collections.Specialized.BitVector32;
namespace WIDESEAWCS_Tasks
{
@@ -32,6 +25,7 @@
private readonly IMapper _mapper;
private readonly IRgvOperationService _gvOperationService;
private readonly IEquipmentStatusService _equipmentStatusService;
+ //private readonly TaskService _task;
public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IAgvStationService agvStation, IMapper mapper, IRgvOperationService gvOperationService, IEquipmentStatusService equipmentStatusService)
{
@@ -42,6 +36,7 @@
_mapper = mapper;
_gvOperationService = gvOperationService;
_equipmentStatusService=equipmentStatusService;
+ //_task = task;
}
public async Task Execute(IJobExecutionContext context)
@@ -51,105 +46,25 @@
CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
if (conveyorLine != null)
{
+
+
//鏍规嵁璁惧鏌ユ壘鍑哄搴旂殑绔欏彴淇℃伅
List<AGVStation> aGVStations = _agvStationService.GetYljSide(conveyorLine.DeviceCode);
foreach (var Stations in aGVStations)
{
- /*if (Stations.Station_material == (int)RGVEquipment.AQMexit)
+ if (Stations.Station_material == (int)RGVEquipment.AQMexit)
{
- //鑾峰彇鍒板畨鍏ㄩ棬淇℃伅
- AQMReturnnormal aQMConveyor = AQMStoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
- if(Stations.Station_tasktype== (int)RGVTasktype.Outbound)
- {
- //璇诲彇鍫嗗灈鏈轰笌RGV鏄惁鍦ㄦ姤璀︼紝濡傛灉鍦ㄦ姤璀︼紝鍒欏啓鍏ュ畨鍏ㄩ棬鎶ヨ
- if (_gvOperationService.AQMReadAlarminform(2) && _equipmentStatusService.GetSCstatus())
- {
- //鍐欏叆鎶ヨ
- GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "AlarmSummary", 1);
- }
+ bool Security = SecurityDoorEquipment(conveyorLine, Stations); //瀹夊叏闂�
+ if (Security) continue;
- //瀹夊叏闂ㄦ�ュ仠鐘舵��
- if (aQMConveyor.EmergencyStopStatus == 0)
- {
- //绔嬮┈鍋滄鍏ㄩ儴RGV(寰楀垽鏂璕GV鐘舵��,娌″仠姝㈢殑鍒欏仠姝�)
- _gvOperationService.WriteOutbuttonpause(null);
-
- }
-
- //瀹夊叏闂ㄨ繘琛岃姹�
- if (aQMConveyor.DoorRequest == 1 && aQMConveyor.IndicatorStatus== (int)SafetyDoorStatus.YellowBlink2Hz)
- {
- //璇诲彇鍒拌姹傚悗锛屾牴鎹姸鎬佹寚绀虹伅杩涜鎿嶄綔
- if (aQMConveyor.EmergencyStopStatus == 1 && aQMConveyor.EmergencyStopStatus == 0) //鏈�ュ仠锛岄渶瑕佺敵璇疯繘鍏ヨ澶�
- {
- //鐩存帴鍋滄RGV鍔ㄤ綔
- _gvOperationService.WriteOutbuttonpause(null);
-
- //璇诲彇瀛愭瘝杞︽槸鍚﹂兘鍦ㄧ┖闂茬姸鎬�
- if (GetDeviceAddress.OutRGVStatice()) //璇诲彇瀛愭瘝杞︾姸鎬�
- {
- //鍐欏叆寮�闂ㄤ俊鍙�
- GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "OpenDoor", 1);
- }
- }
- }
- }
- else
- {
- if (_gvOperationService.AQMReadAlarminform(1) && _equipmentStatusService.GetSCstatus())
- {
- //鍐欏叆鎶ヨ
- GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "AlarmSummary", 1);
- }
-
-
- //瀹夊叏闂ㄦ�ュ仠鐘舵��
- if (aQMConveyor.EmergencyStopStatus == 0)
- {
- //绔嬮┈鍋滄鍏ㄩ儴RGV(寰楀垽鏂璕GV鐘舵��,娌″仠姝㈢殑鍒欏仠姝�)
- _gvOperationService.InWriteOutbuttonpause(null);
-
- }
-
- //瀹夊叏闂ㄨ繘琛岃姹�
- if (aQMConveyor.DoorRequest == 1 && aQMConveyor.IndicatorStatus == (int)SafetyDoorStatus.YellowBlink2Hz)
- {
- //璇诲彇鍒拌姹傚悗锛屾牴鎹姸鎬佹寚绀虹伅杩涜鎿嶄綔
- if (aQMConveyor.EmergencyStopStatus == 1 && aQMConveyor.EmergencyStopStatus == 0) //鏈�ュ仠锛岄渶瑕佺敵璇疯繘鍏ヨ澶�
- {
- //鐩存帴鍋滄RGV鍔ㄤ綔
- _gvOperationService.InWriteOutbuttonpause(null);
-
- //璇诲彇瀛愭瘝杞︽槸鍚﹂兘鍦ㄧ┖闂茬姸鎬�
- if (GetDeviceAddress.OutRGVStatice()) //璇诲彇瀛愭瘝杞︾姸鎬�
- {
- //鍐欏叆寮�闂ㄤ俊鍙�
- GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "OpenDoor", 1);
- }
- }
- }
- }
- }*/
- /*else
+ }
+ else
{
- PlatformStatus aQMConveyor = StoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
- if (aQMConveyor.HCJ_GoodsStatus == 0) //鍙繘琛屾斁璐�
- {
- WebResponseContent webResponseContent = new WebResponseContent();
- //鏍规嵁绫诲瀷鏌ユ壘浠诲姟
- if (Stations.Station_material == (int)RGVEquipment.AbnormalOutbound)
- {
- //鏌ユ壘鏄惁鏈夊紓甯告惉杩愪换鍔�
- webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 1); //杩橀渶瑕佷紶鍏ュ湴鍧�
- }
- else
- {
- //鍑哄簱绔欏彴鐨勪换鍔�
- webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 2);
- }
- }
- }*/
+ bool HCJPlat=PlatformEquipmentInformation(conveyorLine, Stations); //寮傚父绔欏彴锛屽嚭搴撶珯鍙�
+ if (HCJPlat) continue;
+ }
+
}
}
}
@@ -160,30 +75,120 @@
return;
}
-
- public AQMConveyorRgvommand AQMCommand(CommonConveyorLine conveyorLine, string kladder)
+
+ //澶勭悊瀹夊叏闂ㄧ殑閫昏緫
+ private void HandleDoorRequest(AQMReturnnormal aQMConveyor, AGVStation aGVStation,int tasktype) //1锛氬叆搴� 2锛氬嚭搴�
{
- AQMConveyorRgvommand conveyorRgvCommand = new AQMConveyorRgvommand();
- List<DeviceProDTO> deviceProDTO6 = conveyorLine.DeviceProDTOs
- .Where(x => x.DeviceChildCode == kladder
- && DBLine.ConveyorAQMCommand.Contains(x.DeviceProParamName)
- && x.DeviceProParamType == "ReadDeviceCommand")
- .ToList();
- foreach (var item in deviceProDTO6)
+ /*bool RGValarm = _gvOperationService.AQMReadAlarminform(tasktype);
+ bool SCstatus = _equipmentStatusService.GetSCstatus();
+ if (RGValarm || SCstatus)
{
- var paramName = item.DeviceProParamName;
- var propertyInfo = typeof(AQMConveyorRgvommand).GetProperty(paramName);
+ //鍐欏叆鎶ヨ
+ GetDeviceAddress.WriteSecurityDoorpolice(aGVStation.ChildPosiDeviceCode, "AlarmSummary", 1);
- if (propertyInfo != null)
+ bool RGVRGV_DWorkingmode = tasktype == 1 ? _gvOperationService.InWriteOutbuttonpause(null).Status : _gvOperationService.WriteOutbuttonpause(null).Status;
+ }*/
+
+ if (aQMConveyor.DoorRequest == 1 && aQMConveyor.IndicatorStatus == (int)SafetyDoorStatus.YellowBlink2Hz)
+ {
+ if (aQMConveyor.EmergencyStopStatus == 1) //璇锋眰寮�闂ㄧ瓑寰呬换鍔″畬鎴�
{
- if (item.DeviceDataType == "int")
+ bool AQMzckm = tasktype == 1 ? GetDeviceAddress.InRGVRGVStepprocess() : GetDeviceAddress.OutRGVRGVStepprocess(); //鍒ゆ柇鏄惁鏈夎繘绋嬩换鍔�
+ if (AQMzckm)
{
- var value = conveyorLine.Communicator.Read<short>(item.DeviceProAddress);
- propertyInfo.SetValue(conveyorRgvCommand, value);
+ //鍐欏叆鍋滄鐨勪俊鎭�
+ bool RGVRGV_DWorkingmode = tasktype == 1 ? _gvOperationService.InWriteOutbuttonpause(null).Status : _gvOperationService.WriteOutbuttonpause(null).Status;
+
+ bool RGVstate = tasktype == 1 ? GetDeviceAddress.InRGVStatice() : GetDeviceAddress.OutRGVStatice(); //鍒ゆ柇鏄惁鍏ㄤ负鎵嬪姩
+ WebResponseContent webResponse = _taskService.StkRunStatus();
+ if (RGVstate && webResponse.Status == true)
+ {
+ //鍐欏叆寮�闂ㄤ俊鍙�
+ GetDeviceAddress.WriteSecurityDoorpolice(aGVStation.ChildPosiDeviceCode, "OpenDoor", 1);
+ }
}
+
+ }
+ else //鎬ュ仠绔嬮┈鏆傚仠璁惧
+ {
+ bool AQMkm = tasktype == 1 ? GetDeviceAddress.InRGVStatice() : GetDeviceAddress.OutRGVStatice();
+ WebResponseContent webResponse = _taskService.StkRunStatus();
+
+ if (AQMkm && webResponse.Status == true)
+ {
+ GetDeviceAddress.WriteSecurityDoorpolice(aGVStation.ChildPosiDeviceCode, "OpenDoor", 1);
+ }
+
}
}
- return conveyorRgvCommand;
+ }
+
+ //瀹夊叏闂ㄨ澶囦俊鎭鐞�
+ private bool SecurityDoorEquipment(CommonConveyorLine conveyorLine, AGVStation Stations)
+ {
+ try
+ {
+ // 鑾峰彇瀹夊叏闂ㄤ俊鎭�
+ AQMReturnnormal aQMConveyor = AQMStoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
+ if(aQMConveyor != null)
+ {
+ if (aQMConveyor.SafetyLockStatus == 1)
+ {
+ //鍐欏叆鎶ヨ
+ GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "AlarmSummary", 0);
+ //鍐欏叆寮�闂ㄤ俊鍙�
+ GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "OpenDoor", 0);
+ }
+
+ // 鏍规嵁浠诲姟绫诲瀷閫夋嫨澶勭悊绛栫暐
+ if (Stations.Station_tasktype == (int)RGVTasktype.Outbound)
+ {
+ if (aQMConveyor.EmergencyStopStatus == 0 || aQMConveyor.SafetyLockStatus==0) _gvOperationService.WriteOutbuttonpause(null);
+ HandleDoorRequest(aQMConveyor, Stations, 2);
+ }
+ else
+ {
+ if (aQMConveyor.EmergencyStopStatus == 0 || aQMConveyor.SafetyLockStatus == 0) _gvOperationService.InWriteOutbuttonpause(null);
+ HandleDoorRequest(aQMConveyor, Stations, 1);
+ }
+ }
+
+ return false;
+ }
+ catch (Exception ex)
+ {
+ return true;
+ throw;
+ }
+ }
+
+ private bool PlatformEquipmentInformation(CommonConveyorLine conveyorLine, AGVStation Stations)
+ {
+ try
+ {
+ if (StoticCommand(conveyorLine, Stations.HCJStorageaddress.ToString())) //鍙繘琛屾斁璐�
+ {
+ WebResponseContent webResponseContent = new WebResponseContent();
+ //鏍规嵁绫诲瀷鏌ユ壘浠诲姟
+ if (Stations.Station_material == (int)RGVEquipment.AbnormalOutbound)
+ {
+ //鏌ユ壘鏄惁鏈夊紓甯告惉杩愪换鍔�
+ webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 1); //杩橀渶瑕佷紶鍏ュ湴鍧�
+ }
+ else
+ {
+ //鍑哄簱绔欏彴鐨勪换鍔�
+ webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 2);
+ }
+ }
+
+ return false;
+ }
+ catch (Exception ex)
+ {
+ return true;
+ throw;
+ }
}
/// <summary>
@@ -227,30 +232,62 @@
return conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == PLCmanipula && x.DeviceProParamName == DeviceProParamName && x.DeviceProParamType == DeviceProParamType);
}
- public PlatformStatus StoticCommand(CommonConveyorLine conveyorLine, string kladder)
+ //绔欏彴淇″彿
+ /* public bool StoticCommand(CommonConveyorLine conveyorLine, string kladder)
{
- PlatformStatus conveyorRgvCommand = new PlatformStatus();
- List<DeviceProDTO> deviceProDTO6 = conveyorLine.DeviceProDTOs
- .Where(x => x.DeviceChildCode == kladder
- && x.DeviceProParamType == "ReadDeviceCommand")
- .ToList();
- foreach (var item in deviceProDTO6)
+ DeviceProDTO? deviceProDTO6 = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == kladder
+ && x.DeviceProParamName == "HCJ_GoodsStatus"
+ && x.DeviceProParamType == "ReadDeviceCommand");
+ if(deviceProDTO6 == null) { return false; }
+
+ if (deviceProDTO6.DeviceChildCode == "2016"||deviceProDTO6.DeviceChildCode == "2017"|| deviceProDTO6.DeviceChildCode == "2018"|| deviceProDTO6.DeviceChildCode == "2019"
+ || deviceProDTO6.DeviceChildCode == "1001"|| deviceProDTO6.DeviceChildCode == "1002")
{
- var paramName = item.DeviceProParamName;
- var propertyInfo = typeof(PlatformStatus).GetProperty(paramName);
-
- if (propertyInfo != null)
- {
- if (item.DeviceDataType == "int")
- {
- var value = conveyorLine.Communicator.Read<short>(item.DeviceProAddress);
- propertyInfo.SetValue(conveyorRgvCommand, value);
- }
- }
+ var value1 = conveyorLine.Communicator.Read<short>(deviceProDTO6.DeviceProAddress);
+ //寤舵椂5绉�
+ System.Threading.Thread.Sleep(5000);
+ var value2 = conveyorLine.Communicator.Read<short>(deviceProDTO6.DeviceProAddress);
+ if (value1 != value2 && (value1 !=0 && value2 !=0)) { return false; };
+ return true;
}
- return conveyorRgvCommand;
+ var value = conveyorLine.Communicator.Read<short>(deviceProDTO6.DeviceProAddress);
+
+ if (value == 0) { return true; }
+ return false;
+ }*/
+
+
+
+ //绔欏彴淇″彿
+ public bool StoticCommand(CommonConveyorLine conveyorLine, string kladder)
+ {
+ DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == kladder
+ && x.DeviceProParamName == "HCJ_GoodsStatus"
+ && x.DeviceProParamType == "ReadDeviceCommand");
+ // 杩欎簺绔欏彴闇�瑕佲�滃欢鏃�5绉掑苟姣旇緝绗竴娆′笌鏈�鍚庝竴娆$粨鏋溾��
+ bool isPlatformCode =
+ kladder == "2016" || kladder == "2017" || kladder == "2018" || kladder == "2019" ||
+ kladder == "1001" || kladder == "1002";
+
+ if (isPlatformCode)
+ {
+ // 绗竴娆¤鍙�
+ short first = conveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
+
+ // 寤舵椂5绉�
+ System.Threading.Thread.Sleep(5000);
+
+ // 鏈�鍚庝竴娆¤鍙�
+ short last = conveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
+
+ // 鍗忚锛�0=鏃犱俊鍙�=鏃犺揣=绌轰綅
+ return first == 0 && last == 0;
+ }
+ else
+ {
+ short value = conveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
+ return value == 0; // 0=绌轰綅鍙斁锛�1=鏈夎揣涓嶅彲鏀�
+ }
}
-
-
}
}
--
Gitblit v1.9.3