diff --git a/SlnMesnac.Business/AutoModeBusiness.cs b/SlnMesnac.Business/AutoModeBusiness.cs index 4c3df07..0220ff2 100644 --- a/SlnMesnac.Business/AutoModeBusiness.cs +++ b/SlnMesnac.Business/AutoModeBusiness.cs @@ -150,13 +150,6 @@ namespace SlnMesnac.Business List cabinet_Infos = new List(); 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) { @@ -402,5 +395,19 @@ namespace SlnMesnac.Business return deviceStatusFlag; } + + /// + /// 取消PLC工作模式 + /// + /// + public void ClearPlcMode() + { + if (!_plc.writeInt32ByAddress("VD1536", 0)) //工作模式:1-自动;2-巡检;3-手动;0-取消 + { + throw new ArgumentException($"工作模式:取消;写入PLC失败;VD1536写0"); + } + + _log.Info($"工作模式:取消;写入PLC成功;VD1536写0"); + } } } diff --git a/SlnMesnac.Business/FixedPointBusiness.cs b/SlnMesnac.Business/FixedPointBusiness.cs index 719635e..4d12b35 100644 --- a/SlnMesnac.Business/FixedPointBusiness.cs +++ b/SlnMesnac.Business/FixedPointBusiness.cs @@ -55,7 +55,7 @@ namespace SlnMesnac.Business Task.Delay(1000).Wait(); - base.InitEquip(2); //判断PLC状态,下发工作模式 + base.InitEquip(3); //判断PLC状态,下发工作模式 if (!isFlag) { @@ -63,14 +63,6 @@ namespace SlnMesnac.Business return; } - - if (!_plc.writeInt32ByAddress("VD1516", 1)) //下发轨道电机启动信号 - { - throw new ArgumentException($"定点巡检模式启动信号写入PLC失败;VD1516写1"); - } - - _log.Info($"定点巡检模式启动信号写入PLC成功;VD1516写1"); - SendTrackMotorAddress(busbarInfo); isFlag = false; diff --git a/SlnMesnac.Business/InspModeBusiness.cs b/SlnMesnac.Business/InspModeBusiness.cs index f5e9dc6..d30bd9b 100644 --- a/SlnMesnac.Business/InspModeBusiness.cs +++ b/SlnMesnac.Business/InspModeBusiness.cs @@ -81,7 +81,7 @@ namespace SlnMesnac.Business isFlag = true; - base.InitEquip(1); //判断PLC状态,下发工作模式 + base.InitEquip(2); //判断PLC状态,下发工作模式 int address = _plc.readInt32ByAddress("VD1100"); //读取轨道电机当前位置,判断原点及起始位置 @@ -95,13 +95,6 @@ namespace SlnMesnac.Business List cabinet_Infos = new List(); 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) { diff --git a/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs b/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs index 4527ac9..226b5da 100644 --- a/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs @@ -605,6 +605,8 @@ namespace SlnMesnac.WPF.ViewModel public void Stop_AutoMode() { autoModeBusiness.Stop(); + + autoModeBusiness.ClearPlcMode(); } /// @@ -624,11 +626,15 @@ namespace SlnMesnac.WPF.ViewModel public void Stop_InspMode() { inspModeBusiness.Stop(); + + autoModeBusiness.ClearPlcMode(); } public void Stop_PointMode() { fixedPointBusiness.EndFixedPoint(null,true); + + autoModeBusiness.ClearPlcMode(); } private int lastTrackMotorAddress = 0;