change - 修改定点巡检取消逻辑,添加系统标题配置

master
wenjy 2 months ago
parent 8a13bcf707
commit 08adc9d5e0

@ -51,10 +51,19 @@ namespace SlnMesnac.Business
{ {
Task.Run(() => Task.Run(() =>
{ {
isFlag = true;
Task.Delay(1000).Wait(); Task.Delay(1000).Wait();
base.InitEquip(2); //判断PLC状态下发工作模式 base.InitEquip(2); //判断PLC状态下发工作模式
if (!isFlag)
{
_log.Info($"定点巡检取消");
return;
}
if (!_plc.writeInt32ByAddress("VD1516", 1)) //下发轨道电机启动信号 if (!_plc.writeInt32ByAddress("VD1516", 1)) //下发轨道电机启动信号
{ {
throw new ArgumentException($"定点巡检模式启动信号写入PLC失败VD1516写1"); throw new ArgumentException($"定点巡检模式启动信号写入PLC失败VD1516写1");
@ -63,6 +72,10 @@ namespace SlnMesnac.Business
_log.Info($"定点巡检模式启动信号写入PLC成功VD1516写1"); _log.Info($"定点巡检模式启动信号写入PLC成功VD1516写1");
SendTrackMotorAddress(busbarInfo); SendTrackMotorAddress(busbarInfo);
isFlag = false;
_log.Info($"定点巡检结束");
}); });
} }
catch (Exception ex) 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) if (busbarInfo.isRotate == 1)
{ {
GimbaRotationControlEvent?.Invoke("20", "4", "10"); GimbaRotationControlEvent?.Invoke("20", "4", "10");
@ -83,7 +104,7 @@ namespace SlnMesnac.Business
throw new ArgumentException($"定点巡检模式下发检测完成信号写入失败VD1512写1"); throw new ArgumentException($"定点巡检模式下发检测完成信号写入失败VD1512写1");
} }
_log.Info($"定点巡检模式下发检测完成信号写入PLC成功VD1512写1"); _log.Info($"定点巡检模式下发检测完成信号写入PLC成功VD1512写1");
_log.Info($"定点巡检结束"); //_log.Info($"定点巡检结束");
} }
@ -103,6 +124,11 @@ namespace SlnMesnac.Business
this.AwaitArriveSignal("VD1528"); //等待轨道相机到位信号 this.AwaitArriveSignal("VD1528"); //等待轨道相机到位信号
if (!isFlag)
{
return;
}
this.SendLiftMotorDict(busbarInfo); this.SendLiftMotorDict(busbarInfo);
} }
@ -119,6 +145,11 @@ namespace SlnMesnac.Business
bool is_arrive = true; bool is_arrive = true;
while (is_arrive) while (is_arrive)
{ {
if (!isFlag)
{
break;
}
int is_arrive_flag = _plc.readInt32ByAddress(signal); //读取PLC轨道电机到位信号 int is_arrive_flag = _plc.readInt32ByAddress(signal); //读取PLC轨道电机到位信号
if (is_arrive_flag == 1) if (is_arrive_flag == 1)
{ {
@ -155,7 +186,6 @@ namespace SlnMesnac.Business
private void SendLiftMotorDict(base_busbar_info busbar) private void SendLiftMotorDict(base_busbar_info busbar)
{ {
if (!_plc.writeFloatByAddress("VD1524", ((float)busbar.busbarDist))) //下发母排距离,升降电机升降的距离 if (!_plc.writeFloatByAddress("VD1524", ((float)busbar.busbarDist))) //下发母排距离,升降电机升降的距离
{ {
throw new ArgumentException($"下发母排升降距离写入失败VD1524写{busbar.cabinetCode}"); throw new ArgumentException($"下发母排升降距离写入失败VD1524写{busbar.cabinetCode}");
@ -164,6 +194,11 @@ namespace SlnMesnac.Business
this.AwaitArriveSignal("VD1504"); //等待升降电机到位信号 this.AwaitArriveSignal("VD1504"); //等待升降电机到位信号
if (!isFlag)
{
return;
}
//控制云台旋转 //控制云台旋转
if (busbar.isRotate == 1) if (busbar.isRotate == 1)
{ {

@ -36,6 +36,11 @@ namespace SlnMesnac.Config
/// 日志文件路径 /// 日志文件路径
/// </summary> /// </summary>
public string logPath { get; set; } public string logPath { get; set; }
/// <summary>
/// 系统标题
/// </summary>
public string SystemTitleStr { get; set; }
/// <summary> /// <summary>
/// 可见光图像保存路径 /// 可见光图像保存路径

@ -20,7 +20,11 @@
<RowDefinition Height="0.7*"/> <RowDefinition Height="0.7*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="Red" BorderThickness="0" CornerRadius="0" Background="#0050BF"> <Border Grid.Row="0" BorderBrush="Red" BorderThickness="0" CornerRadius="0" Background="#0050BF">
<TextBlock Text="智能巡检控制系统" FontSize="30" Foreground="White" FontWeight="Bold" Margin="50,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"/> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Source="/Templates/image/logo.png" Margin="20,10,0,10" />
<TextBlock Text="{Binding SystemTitleStr}" FontSize="30" Foreground="White" FontWeight="Bold" Margin="30,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</StackPanel>
</Border> </Border>
<Border Grid.Row="1" BorderBrush="Red" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="0,20"> <Border Grid.Row="1" BorderBrush="Red" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="0,20">
<ContentControl Content="{Binding UserContent}"/> <ContentControl Content="{Binding UserContent}"/>

@ -242,8 +242,10 @@ namespace SlnMesnac.WPF.Page
else else
{ {
btn_fixedmode.Background = new SolidColorBrush(Colors.Transparent); btn_fixedmode.Background = new SolidColorBrush(Colors.Transparent);
is_fixed_model = false; is_fixed_model = false;
indexControlViewModel.Stop_PointMode();
} }
} }

@ -15,6 +15,7 @@
<None Remove="Templates\image\avg_t.png" /> <None Remove="Templates\image\avg_t.png" />
<None Remove="Templates\image\background.jpg" /> <None Remove="Templates\image\background.jpg" />
<None Remove="Templates\image\device.png" /> <None Remove="Templates\image\device.png" />
<None Remove="Templates\image\logo.png" />
<None Remove="Templates\image\machine.png" /> <None Remove="Templates\image\machine.png" />
<None Remove="Templates\image\max_t.png" /> <None Remove="Templates\image\max_t.png" />
<None Remove="Templates\image\min_t.png" /> <None Remove="Templates\image\min_t.png" />
@ -58,6 +59,7 @@
<Resource Include="Templates\image\avg_t.png" /> <Resource Include="Templates\image\avg_t.png" />
<Resource Include="Templates\image\background.jpg" /> <Resource Include="Templates\image\background.jpg" />
<Resource Include="Templates\image\device.png" /> <Resource Include="Templates\image\device.png" />
<Resource Include="Templates\image\logo.png" />
<Resource Include="Templates\image\machine.png" /> <Resource Include="Templates\image\machine.png" />
<Resource Include="Templates\image\max_t.png" /> <Resource Include="Templates\image\max_t.png" />
<Resource Include="Templates\image\min_t.png" /> <Resource Include="Templates\image\min_t.png" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@ -614,37 +614,6 @@ namespace SlnMesnac.WPF.ViewModel
{ {
string taskCode = DateTime.Now.ToString("yyyyMMddHHmmssffff"); string taskCode = DateTime.Now.ToString("yyyyMMddHHmmssffff");
string fileName = $"{taskCode}.mp4"; 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); inspModeBusiness.Start(taskCode, fileName);
} }
@ -654,37 +623,14 @@ namespace SlnMesnac.WPF.ViewModel
/// </summary> /// </summary>
public void Stop_InspMode() 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(); inspModeBusiness.Stop();
} }
public void Stop_PointMode()
{
fixedPointBusiness.EndFixedPoint(null,true);
}
private int lastTrackMotorAddress = 0; private int lastTrackMotorAddress = 0;
private void RefreshTrackMotorAddress() private void RefreshTrackMotorAddress()
{ {

@ -2,6 +2,7 @@
using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Command;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using SlnMesnac.Config;
using SlnMesnac.Plc; using SlnMesnac.Plc;
using SlnMesnac.WPF.Page; using SlnMesnac.WPF.Page;
using SlnMesnac.WPF.Page.CabinetInfo; using SlnMesnac.WPF.Page.CabinetInfo;
@ -15,6 +16,8 @@ namespace SlnMesnac.WPF.ViewModel
{ {
private readonly ILogger<MainWindowViewModel> _logger; private readonly ILogger<MainWindowViewModel> _logger;
private readonly AppConfig _appConfig;
//代码生成 //代码生成
private readonly GenerateControl generateControl = new GenerateControl(); private readonly GenerateControl generateControl = new GenerateControl();
@ -33,13 +36,13 @@ namespace SlnMesnac.WPF.ViewModel
set { _PlcStatus = value; RaisePropertyChanged(nameof(PlcStatus)); } set { _PlcStatus = value; RaisePropertyChanged(nameof(PlcStatus)); }
} }
/// <summary> /// <summary>
/// 箱壳扫码器状态 /// 系统标题
/// </summary> /// </summary>
private int _ShellScannerStatus = 0; private string _SystemTitleStr = "智能巡检控制系统";
public int ShellScannerStatus public string SystemTitleStr
{ {
get { return _ShellScannerStatus; } get { return _SystemTitleStr; }
set { _ShellScannerStatus = value; RaisePropertyChanged(nameof(ShellScannerStatus)); } set { _SystemTitleStr = value; RaisePropertyChanged(nameof(SystemTitleStr)); }
} }
/// <summary> /// <summary>
@ -88,6 +91,9 @@ namespace SlnMesnac.WPF.ViewModel
_logger = App.ServiceProvider.GetService<ILogger<MainWindowViewModel>>(); _logger = App.ServiceProvider.GetService<ILogger<MainWindowViewModel>>();
_appConfig = App.ServiceProvider.GetService<AppConfig>();
SystemTitleStr = _appConfig.SystemTitleStr;
ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj)); ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj));
FormControlCommand = new RelayCommand<object>(x => FormControl(x)); FormControlCommand = new RelayCommand<object>(x => FormControl(x));
RefreshPlcStatus(); RefreshPlcStatus();

@ -7,33 +7,34 @@
} }
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"AppConfig": { "AppConfig": {
"logPath": "D:\\巡检机器人控制系统\\日志信息", "SystemTitleStr": "赛轮热电智能巡检控制系统",
"visibleRangePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\可见光图像", "logPath": "D:\\巡检机器人控制系统\\日志信息",
"infraredImagePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\红外热成像", "visibleRangePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\可见光图像",
"videoFilePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\巡检录像", "infraredImagePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\红外热成像",
"cameraIp": "192.168.2.64", "videoFilePath": "D:\\智慧热电监控平台\\uploadPath\\日志信息\\巡检录像",
"cameraPort": 8000, "cameraIp": "192.168.2.64",
"cameraUserName": "admin", "cameraPort": 8000,
"cameraPassword": "haiwei@2024", "cameraUserName": "admin",
"checkCycle": 5, "cameraPassword": "haiwei@2024",
"SqlConfig": [ "checkCycle": 5,
{ "SqlConfig": [
"configId": "iot", {
"dbType": 0, "configId": "iot",
"connStr": "Data Source=192.168.2.165;Port=3306;Initial Catalog=iot_smarthotspot;uid=root;pwd=haiwei@123;Charset=utf8mb4;SslMode=none" "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": [ ],
{ "PlcConfig": [
"configId": 1, {
"plcType": "SiemensPlc", "configId": 1,
//"plcIp": "127.0.0.1", "plcType": "SiemensPlc",
"plcIp": "192.168.2.1", "plcIp": "127.0.0.1",
"plcPort": 102, //"plcIp": "192.168.2.1",
"plcKey": "iot", "plcPort": 102,
"isFlage": "true" "plcKey": "iot",
} "isFlage": "true"
] }
} ]
}
} }

Loading…
Cancel
Save