change - 增加PLC模式取消信号

master
wenjy 2 months ago
parent 41badef91d
commit 82e9c90f9d

@ -150,13 +150,6 @@ namespace SlnMesnac.Business
List<base_cabinet_info> cabinet_Infos = new List<base_cabinet_info>(); List<base_cabinet_info> cabinet_Infos = new List<base_cabinet_info>();
base.GetCabinetInfos(address, out cabinet_Infos); base.GetCabinetInfos(address, out cabinet_Infos);
if (!_plc.writeInt32ByAddress("VD1516", 1)) //下发轨道电机启动信号
{
throw new ArgumentException($"启动信号写入PLC失败VD1516写1");
}
_log.Info($"启动信号写入PLC成功VD1516写1");
foreach (var item in cabinet_Infos) foreach (var item in cabinet_Infos)
{ {
@ -402,5 +395,19 @@ namespace SlnMesnac.Business
return deviceStatusFlag; return deviceStatusFlag;
} }
/// <summary>
/// 取消PLC工作模式
/// </summary>
/// <exception cref="ArgumentException"></exception>
public void ClearPlcMode()
{
if (!_plc.writeInt32ByAddress("VD1536", 0)) //工作模式:1-自动2-巡检3-手动0-取消
{
throw new ArgumentException($"工作模式:取消写入PLC失败VD1536写0");
}
_log.Info($"工作模式:取消写入PLC成功VD1536写0");
}
} }
} }

@ -55,7 +55,7 @@ namespace SlnMesnac.Business
Task.Delay(1000).Wait(); Task.Delay(1000).Wait();
base.InitEquip(2); //判断PLC状态下发工作模式 base.InitEquip(3); //判断PLC状态下发工作模式
if (!isFlag) if (!isFlag)
{ {
@ -63,14 +63,6 @@ namespace SlnMesnac.Business
return; return;
} }
if (!_plc.writeInt32ByAddress("VD1516", 1)) //下发轨道电机启动信号
{
throw new ArgumentException($"定点巡检模式启动信号写入PLC失败VD1516写1");
}
_log.Info($"定点巡检模式启动信号写入PLC成功VD1516写1");
SendTrackMotorAddress(busbarInfo); SendTrackMotorAddress(busbarInfo);
isFlag = false; isFlag = false;

@ -81,7 +81,7 @@ namespace SlnMesnac.Business
isFlag = true; isFlag = true;
base.InitEquip(1); //判断PLC状态下发工作模式 base.InitEquip(2); //判断PLC状态下发工作模式
int address = _plc.readInt32ByAddress("VD1100"); //读取轨道电机当前位置,判断原点及起始位置 int address = _plc.readInt32ByAddress("VD1100"); //读取轨道电机当前位置,判断原点及起始位置
@ -95,13 +95,6 @@ namespace SlnMesnac.Business
List<base_cabinet_info> cabinet_Infos = new List<base_cabinet_info>(); List<base_cabinet_info> cabinet_Infos = new List<base_cabinet_info>();
base.GetCabinetInfos(address, out cabinet_Infos); base.GetCabinetInfos(address, out cabinet_Infos);
if (!_plc.writeInt32ByAddress("VD1516", 1)) //下发轨道电机启动信号
{
throw new ArgumentException($"启动信号写入PLC失败VD1516写1");
}
_log.Info($"启动信号写入PLC成功VD1516写1");
foreach (var item in cabinet_Infos) foreach (var item in cabinet_Infos)
{ {

@ -605,6 +605,8 @@ namespace SlnMesnac.WPF.ViewModel
public void Stop_AutoMode() public void Stop_AutoMode()
{ {
autoModeBusiness.Stop(); autoModeBusiness.Stop();
autoModeBusiness.ClearPlcMode();
} }
/// <summary> /// <summary>
@ -624,11 +626,15 @@ namespace SlnMesnac.WPF.ViewModel
public void Stop_InspMode() public void Stop_InspMode()
{ {
inspModeBusiness.Stop(); inspModeBusiness.Stop();
autoModeBusiness.ClearPlcMode();
} }
public void Stop_PointMode() public void Stop_PointMode()
{ {
fixedPointBusiness.EndFixedPoint(null,true); fixedPointBusiness.EndFixedPoint(null,true);
autoModeBusiness.ClearPlcMode();
} }
private int lastTrackMotorAddress = 0; private int lastTrackMotorAddress = 0;

Loading…
Cancel
Save