diff --git a/SlnMesnac.Business/FixedPointBusiness.cs b/SlnMesnac.Business/FixedPointBusiness.cs index e14cec9..719635e 100644 --- a/SlnMesnac.Business/FixedPointBusiness.cs +++ b/SlnMesnac.Business/FixedPointBusiness.cs @@ -51,10 +51,19 @@ namespace SlnMesnac.Business { Task.Run(() => { + isFlag = true; + Task.Delay(1000).Wait(); base.InitEquip(2); //判断PLC状态,下发工作模式 + if (!isFlag) + { + _log.Info($"定点巡检取消"); + return; + } + + if (!_plc.writeInt32ByAddress("VD1516", 1)) //下发轨道电机启动信号 { throw new ArgumentException($"定点巡检模式启动信号写入PLC失败;VD1516写1"); @@ -63,6 +72,10 @@ namespace SlnMesnac.Business _log.Info($"定点巡检模式启动信号写入PLC成功;VD1516写1"); SendTrackMotorAddress(busbarInfo); + + isFlag = false; + + _log.Info($"定点巡检结束"); }); } catch (Exception ex) @@ -71,8 +84,16 @@ namespace SlnMesnac.Business } } - public void EndFixedPoint(base_busbar_info busbarInfo) + public void EndFixedPoint(base_busbar_info busbarInfo,bool isClose = false) { + + if (isClose) + { + _log.Info($"定点巡检取消"); + isFlag = false; + return; + } + if (busbarInfo.isRotate == 1) { GimbaRotationControlEvent?.Invoke("20", "4", "10"); @@ -83,7 +104,7 @@ namespace SlnMesnac.Business throw new ArgumentException($"定点巡检模式下发检测完成信号写入失败;VD1512写1"); } _log.Info($"定点巡检模式下发检测完成信号写入PLC成功;VD1512写1"); - _log.Info($"定点巡检结束"); + //_log.Info($"定点巡检结束"); } @@ -103,6 +124,11 @@ namespace SlnMesnac.Business this.AwaitArriveSignal("VD1528"); //等待轨道相机到位信号 + if (!isFlag) + { + return; + } + this.SendLiftMotorDict(busbarInfo); } @@ -119,6 +145,11 @@ namespace SlnMesnac.Business bool is_arrive = true; while (is_arrive) { + if (!isFlag) + { + break; + } + int is_arrive_flag = _plc.readInt32ByAddress(signal); //读取PLC轨道电机到位信号 if (is_arrive_flag == 1) { @@ -155,7 +186,6 @@ namespace SlnMesnac.Business private void SendLiftMotorDict(base_busbar_info busbar) { - if (!_plc.writeFloatByAddress("VD1524", ((float)busbar.busbarDist))) //下发母排距离,升降电机升降的距离 { throw new ArgumentException($"下发母排升降距离写入失败;VD1524写{busbar.cabinetCode}"); @@ -164,6 +194,11 @@ namespace SlnMesnac.Business this.AwaitArriveSignal("VD1504"); //等待升降电机到位信号 + if (!isFlag) + { + return; + } + //控制云台旋转 if (busbar.isRotate == 1) { diff --git a/SlnMesnac.Config/AppConfig.cs b/SlnMesnac.Config/AppConfig.cs index 17a4228..6452eb5 100644 --- a/SlnMesnac.Config/AppConfig.cs +++ b/SlnMesnac.Config/AppConfig.cs @@ -36,6 +36,11 @@ namespace SlnMesnac.Config /// 日志文件路径 /// public string logPath { get; set; } + + /// + /// 系统标题 + /// + public string SystemTitleStr { get; set; } /// /// 可见光图像保存路径 diff --git a/SlnMesnac.WPF/MainWindow.xaml b/SlnMesnac.WPF/MainWindow.xaml index d6454cb..eda76a8 100644 --- a/SlnMesnac.WPF/MainWindow.xaml +++ b/SlnMesnac.WPF/MainWindow.xaml @@ -20,7 +20,11 @@ - + + + + + diff --git a/SlnMesnac.WPF/Page/IndexControl.xaml.cs b/SlnMesnac.WPF/Page/IndexControl.xaml.cs index ff59bd0..0f65452 100644 --- a/SlnMesnac.WPF/Page/IndexControl.xaml.cs +++ b/SlnMesnac.WPF/Page/IndexControl.xaml.cs @@ -242,8 +242,10 @@ namespace SlnMesnac.WPF.Page else { btn_fixedmode.Background = new SolidColorBrush(Colors.Transparent); + is_fixed_model = false; + indexControlViewModel.Stop_PointMode(); } } diff --git a/SlnMesnac.WPF/SlnMesnac.WPF.csproj b/SlnMesnac.WPF/SlnMesnac.WPF.csproj index 7e04033..b83cec5 100644 --- a/SlnMesnac.WPF/SlnMesnac.WPF.csproj +++ b/SlnMesnac.WPF/SlnMesnac.WPF.csproj @@ -15,6 +15,7 @@ + @@ -58,6 +59,7 @@ + diff --git a/SlnMesnac.WPF/Templates/image/logo.png b/SlnMesnac.WPF/Templates/image/logo.png new file mode 100644 index 0000000..706588a Binary files /dev/null and b/SlnMesnac.WPF/Templates/image/logo.png differ diff --git a/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs b/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs index 44cba57..4527ac9 100644 --- a/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs @@ -614,37 +614,6 @@ namespace SlnMesnac.WPF.ViewModel { string taskCode = DateTime.Now.ToString("yyyyMMddHHmmssffff"); string fileName = $"{taskCode}.mp4"; - //Task.Run(() => - //{ - // var url = $"{_appConfig.videoFilePath}\\可见光\\{fileName}"; - // CHCNetSDK.NET_DVR_MakeKeyFrame(m_lUserID, 1); - // if (!CHCNetSDK.NET_DVR_SaveRealData(Scenery_RealHandle, url)) - // { - // var str = "可见光通道开启巡检录像失败, error code= " + NET_DVR_GetLastError(); - // _log.Info(str); - // return; - // } - // else - // { - // _log.Info($"可见光通道开启巡检录像成功"); - // } - //}); - - //Task.Run(() => - //{ - // var url = $"{_appConfig.videoFilePath}\\热成像\\{fileName}"; - // CHCNetSDK.NET_DVR_MakeKeyFrame(m_lUserID, 2); - // if (!CHCNetSDK.NET_DVR_SaveRealData(Thermal_RealHandle, url)) - // { - // var str = "热成像通道开启巡检录像失败, error code= " + NET_DVR_GetLastError(); - // _log.Info(str); - // return; - // } - // else - // { - // _log.Info($"热成像通道开启巡检录像成功"); - // } - //}); inspModeBusiness.Start(taskCode, fileName); } @@ -654,37 +623,14 @@ namespace SlnMesnac.WPF.ViewModel /// public void Stop_InspMode() { - //Task.Run(() => - //{ - // if (!CHCNetSDK.NET_DVR_StopSaveRealData(Scenery_RealHandle)) - // { - // var str = "可见光通道关闭巡检录像失败, error code= " + NET_DVR_GetLastError(); - // _log.Info(str); - // return; - // } - // else - // { - // _log.Info($"可见光通道关闭巡检录像成功"); - // } - //}); - - //Task.Run(() => - //{ - // if (!CHCNetSDK.NET_DVR_StopSaveRealData(Thermal_RealHandle)) - // { - // var str = "热成像通道关闭巡检录像失败, error code= " + NET_DVR_GetLastError(); - // _log.Info(str); - // return; - // } - // else - // { - // _log.Info($"热成像通道关闭巡检录像成功"); - // } - //}); - inspModeBusiness.Stop(); } + public void Stop_PointMode() + { + fixedPointBusiness.EndFixedPoint(null,true); + } + private int lastTrackMotorAddress = 0; private void RefreshTrackMotorAddress() { diff --git a/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs b/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs index e55eb58..1a5f881 100644 --- a/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs @@ -2,6 +2,7 @@ using GalaSoft.MvvmLight.Command; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using SlnMesnac.Config; using SlnMesnac.Plc; using SlnMesnac.WPF.Page; using SlnMesnac.WPF.Page.CabinetInfo; @@ -15,6 +16,8 @@ namespace SlnMesnac.WPF.ViewModel { private readonly ILogger _logger; + private readonly AppConfig _appConfig; + //代码生成 private readonly GenerateControl generateControl = new GenerateControl(); @@ -33,13 +36,13 @@ namespace SlnMesnac.WPF.ViewModel set { _PlcStatus = value; RaisePropertyChanged(nameof(PlcStatus)); } } /// - /// 箱壳扫码器状态 + /// 系统标题 /// - private int _ShellScannerStatus = 0; - public int ShellScannerStatus + private string _SystemTitleStr = "智能巡检控制系统"; + public string SystemTitleStr { - get { return _ShellScannerStatus; } - set { _ShellScannerStatus = value; RaisePropertyChanged(nameof(ShellScannerStatus)); } + get { return _SystemTitleStr; } + set { _SystemTitleStr = value; RaisePropertyChanged(nameof(SystemTitleStr)); } } /// @@ -88,6 +91,9 @@ namespace SlnMesnac.WPF.ViewModel _logger = App.ServiceProvider.GetService>(); + _appConfig = App.ServiceProvider.GetService(); + SystemTitleStr = _appConfig.SystemTitleStr; + ControlOnClickCommand = new RelayCommand(obj => ControlOnClick(obj)); FormControlCommand = new RelayCommand(x => FormControl(x)); RefreshPlcStatus(); diff --git a/SlnMesnac.WPF/appsettings.json b/SlnMesnac.WPF/appsettings.json index b3eb2e0..6b88f47 100644 --- a/SlnMesnac.WPF/appsettings.json +++ b/SlnMesnac.WPF/appsettings.json @@ -7,33 +7,34 @@ } }, "AllowedHosts": "*", - "AppConfig": { - "logPath": "D:\\巡检机器人控制系统\\日志信息", - "visibleRangePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\可见光图像", - "infraredImagePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\红外热成像", - "videoFilePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\巡检录像", - "cameraIp": "192.168.2.64", - "cameraPort": 8000, - "cameraUserName": "admin", - "cameraPassword": "haiwei@2024", - "checkCycle": 5, - "SqlConfig": [ - { - "configId": "iot", - "dbType": 0, - "connStr": "Data Source=192.168.2.165;Port=3306;Initial Catalog=iot_smarthotspot;uid=root;pwd=haiwei@123;Charset=utf8mb4;SslMode=none" - } - ], - "PlcConfig": [ - { - "configId": 1, - "plcType": "SiemensPlc", - //"plcIp": "127.0.0.1", - "plcIp": "192.168.2.1", - "plcPort": 102, - "plcKey": "iot", - "isFlage": "true" - } - ] - } + "AppConfig": { + "SystemTitleStr": "赛轮热电智能巡检控制系统", + "logPath": "D:\\巡检机器人控制系统\\日志信息", + "visibleRangePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\可见光图像", + "infraredImagePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\红外热成像", + "videoFilePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\巡检录像", + "cameraIp": "192.168.2.64", + "cameraPort": 8000, + "cameraUserName": "admin", + "cameraPassword": "haiwei@2024", + "checkCycle": 5, + "SqlConfig": [ + { + "configId": "iot", + "dbType": 0, + "connStr": "Data Source=192.168.2.165;Port=3306;Initial Catalog=iot_smarthotspot;uid=root;pwd=haiwei@123;Charset=utf8mb4;SslMode=none" + } + ], + "PlcConfig": [ + { + "configId": 1, + "plcType": "SiemensPlc", + "plcIp": "127.0.0.1", + //"plcIp": "192.168.2.1", + "plcPort": 102, + "plcKey": "iot", + "isFlage": "true" + } + ] + } }