change - 添加定点巡检,替换PLC地址

master
wenjy 2 months ago
parent 643a5ed023
commit 66922f3f30

@ -143,21 +143,21 @@ namespace SlnMesnac.Business
List<base_cabinet_info> cabinet_Infos = new List<base_cabinet_info>();
base.GetCabinetInfos(address, out cabinet_Infos);
if (!_plc.writeInt32ByAddress("VD1517", 1)) //下发轨道电机启动信号
if (!_plc.writeInt32ByAddress("VD1516", 1)) //下发轨道电机启动信号
{
throw new ArgumentException($"启动信号写入PLC失败VD1517写1");
throw new ArgumentException($"启动信号写入PLC失败VD1516写1");
}
_log.Info($"启动信号写入PLC成功VD1517写1");
_log.Info($"启动信号写入PLC成功VD1516写1");
foreach (var item in cabinet_Infos)
{
this.SendTrackMotorAddress(item);
if (!_plc.writeInt32ByAddress("VD1513", 1)) //母排检测完成下发检测完成信号,升降电机可以回到原位等待
if (!_plc.writeInt32ByAddress("VD1512", 1)) //母排检测完成下发检测完成信号,升降电机可以回到原位等待
{
throw new ArgumentException($"下发母排检测完成下发检测完成信号写入失败VD1513写1");
throw new ArgumentException($"下发母排检测完成下发检测完成信号写入失败VD1512写1");
}
Task.Delay(1000).Wait();
}
@ -177,19 +177,19 @@ namespace SlnMesnac.Business
/// <exception cref="ArgumentException"></exception>
private void SendTrackMotorAddress(base_cabinet_info item)
{
if (!_plc.writeInt32ByAddress("VD1521", item.cabinetCode)) //下发电柜编号,通知轨道电机前往指定电柜位置
if (!_plc.writeInt32ByAddress("VD1520", item.cabinetCode)) //下发电柜编号,通知轨道电机前往指定电柜位置
{
throw new ArgumentException($"下发轨道电机前往指定位置编号写入失败VD1521写{item.cabinetCode}");
throw new ArgumentException($"下发轨道电机前往指定位置编号写入失败VD1520写{item.cabinetCode}");
}
_log.Info($"下发轨道电机前往指定位置成功VD1521写{item.cabinetCode}");
_log.Info($"下发轨道电机前往指定位置成功VD1520写{item.cabinetCode}");
this.AwaitArriveSignal("VD1529"); //等待轨道相机到位信号
this.AwaitArriveSignal("VD1528"); //等待轨道相机到位信号
this.SendLiftMotorDict(item.cabinetCode);
//if (!_plc.writeInt32ByAddress("VD1521", 0))
//if (!_plc.writeInt32ByAddress("VD1520", 0))
//{
// throw new ArgumentException($"电柜检测完成轨道电机地址写0失败VD1521写0");
// throw new ArgumentException($"电柜检测完成轨道电机地址写0失败VD1520写0");
//}
}
@ -206,13 +206,13 @@ namespace SlnMesnac.Business
base.GetBusbarInfos(cabinetCode, out busbar_Infos);
foreach (var busbar in busbar_Infos)
{
if (!_plc.writeFloatByAddress("VD1525", ((float)busbar.busbarDist))) //下发母排距离,升降电机升降的距离
if (!_plc.writeFloatByAddress("VD1524", ((float)busbar.busbarDist))) //下发母排距离,升降电机升降的距离
{
throw new ArgumentException($"下发母排升降距离写入失败VD1525写{busbar.cabinetCode}");
throw new ArgumentException($"下发母排升降距离写入失败VD1524写{busbar.cabinetCode}");
}
_log.Info($"下发母排升降距离成功VD1525写{busbar.busbarDist}");
_log.Info($"下发母排升降距离成功VD1524写{busbar.busbarDist}");
this.AwaitArriveSignal("VD1505"); //等待升降电机到位信号
this.AwaitArriveSignal("VD1504"); //等待升降电机到位信号
//控制云台旋转
if(busbar.isRotate == 1)
@ -227,11 +227,11 @@ namespace SlnMesnac.Business
this.SaveBusbarTemp(busbar.busbarCode, busbar.cabinetCode, _realTemperatureInfo,busbar.isPictures);
Task.Delay(1000).Wait();
//if (!_plc.writeFloatByAddress("VD1525", 0))
//if (!_plc.writeFloatByAddress("VD1524", 0))
//{
// throw new ArgumentException($"母排检测完成向PLC升降距离写0失败VD1525写0");
// throw new ArgumentException($"母排检测完成向PLC升降距离写0失败VD1524写0");
//}
//_log.Info($"母排检测完成向PLC升降距离写0成功VD1525写0");
//_log.Info($"母排检测完成向PLC升降距离写0成功VD1524写0");
if(busbar.isRotate == 1)
{
@ -348,7 +348,7 @@ namespace SlnMesnac.Business
public string GetDeviceStatus()
{
int deviceStatus = _plc.readInt32ByAddress("VD1509");
int deviceStatus = _plc.readInt32ByAddress("VD1508");
string deviceStatusFlag = string.Empty;

@ -0,0 +1,170 @@
using SlnMesnac.Business.@base;
using SlnMesnac.Model.dto;
using SlnMesnac.Plc;
using SlnMesnac.Repository;
using SlnMesnac.Repository.service;
using SlnMesnac.Serilog;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* SlnMesnac.Business
* 2202e7a9-f41e-4b59-b139-05f10987e114
*
* WenJY
*
* 2024-11-29 10:58:14
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.Business
{
public class FixedPointBusiness : BaseBusiness
{
private readonly Irecord_busbar_tempServices _record_busbar_TempServices;
public FixedPointBusiness(SerilogHelper log, PlcAbsractFactory plc, Ibase_cabinet_infoServices base_Cabinet_InfoServices, Ibase_busbar_infoServices base_Busbar_InfoServices, Irecord_busbar_tempServices record_busbar_TempServices) : base(log, plc, base_Cabinet_InfoServices, base_Busbar_InfoServices)
{
_record_busbar_TempServices = record_busbar_TempServices;
}
public void StartFixedPoint(base_busbar_info busbarInfo)
{
try
{
Task.Run(() =>
{
Task.Delay(1000).Wait();
base.InitEquip(2); //判断PLC状态下发工作模式
if (!_plc.writeInt32ByAddress("VD1516", 1)) //下发轨道电机启动信号
{
throw new ArgumentException($"定点巡检模式启动信号写入PLC失败VD1516写1");
}
_log.Info($"定点巡检模式启动信号写入PLC成功VD1516写1");
SendTrackMotorAddress(busbarInfo);
});
}
catch (Exception ex)
{
throw new InvalidOperationException($"自动巡检逻辑处理异常:{ex.Message}");
}
}
public void EndFixedPoint(base_busbar_info busbarInfo)
{
if (busbarInfo.isRotate == 1)
{
GimbaRotationControlEvent?.Invoke("20", "4", "10");
}
if (!_plc.writeInt32ByAddress("VD1512", 1)) //母排检测完成下发检测完成信号,升降电机可以回到原位等待
{
throw new ArgumentException($"定点巡检模式下发检测完成信号写入失败VD1512写1");
}
_log.Info($"定点巡检模式下发检测完成信号写入PLC成功VD1512写1");
_log.Info($"定点巡检结束");
}
/// <summary>
/// 下发轨道电机位置编号
/// </summary>
/// <param name="item"></param>
/// <exception cref="ArgumentException"></exception>
private void SendTrackMotorAddress(base_busbar_info busbarInfo)
{
if (!_plc.writeInt32ByAddress("VD1520", (int)busbarInfo.cabinetCode)) //下发电柜编号,通知轨道电机前往指定电柜位置
{
throw new ArgumentException($"定点巡检模式下发轨道电机前往指定位置编号写入失败VD1520写{(int)busbarInfo.cabinetCode}");
}
_log.Info($"定点巡检模式下发轨道电机前往指定位置成功VD1520写{(int)busbarInfo.cabinetCode}");
this.AwaitArriveSignal("VD1528"); //等待轨道相机到位信号
this.SendLiftMotorDict(busbarInfo);
}
/// <summary>
/// 等待PLC到位信号
/// </summary>
/// <param name="signal"></param>
/// <exception cref="InvalidOperationException"></exception>
private void AwaitArriveSignal(string signal)
{
try
{
bool is_arrive = true;
while (is_arrive)
{
int is_arrive_flag = _plc.readInt32ByAddress(signal); //读取PLC轨道电机到位信号
if (is_arrive_flag == 1)
{
_log.Info($"PLC已到达指定位置{signal}值为{is_arrive_flag}");
if (!_plc.writeInt32ByAddress(signal, 0))
{
throw new ArgumentException($"PLC到位信号复位失败{signal}写0");
}
is_arrive = false;
continue;
}
_log.Info($"等待PLC前往指定位置{signal}值为{is_arrive_flag}");
Task.Delay(1000).Wait();
}
}
catch (Exception e)
{
throw new InvalidOperationException($"等待到位信号处理异常:{e.Message}");
}
}
public delegate void GimbaRotationControl(string wPanPos, string wTiltPos, string wZoomPos);
public event GimbaRotationControl GimbaRotationControlEvent;
private void SendLiftMotorDict(base_busbar_info busbar)
{
if (!_plc.writeFloatByAddress("VD1524", ((float)busbar.busbarDist))) //下发母排距离,升降电机升降的距离
{
throw new ArgumentException($"下发母排升降距离写入失败VD1524写{busbar.cabinetCode}");
}
_log.Info($"下发母排升降距离成功VD1524写{busbar.busbarDist}");
this.AwaitArriveSignal("VD1504"); //等待升降电机到位信号
//控制云台旋转
if (busbar.isRotate == 1)
{
GimbaRotationControlEvent?.Invoke(busbar.wPanPos, busbar.wTiltPos, busbar.wZoomPos);
}
}
}
}

@ -63,20 +63,20 @@ namespace SlnMesnac.Business.@base
int plcFlag = 0;
do
{
plcFlag = _plc.readInt32ByAddress("VD1509"); //PLC状态
plcFlag = _plc.readInt32ByAddress("VD1508"); //PLC状态
if (plcFlag != 1)
{
_log.Info($"PLC状态不具备启动条件:VD1509值为{plcFlag}");
_log.Info($"PLC状态不具备启动条件:VD1508值为{plcFlag}");
Task.Delay(1000).Wait();
continue;
}
if (!_plc.writeInt32ByAddress("VD1533", model)) //工作模式:1-自动2-巡检3-手动
if (!_plc.writeInt32ByAddress("VD1536", model)) //工作模式:1-自动2-巡检3-手动
{
throw new ArgumentException($"工作模式:自动模式写入PLC失败VD1533写{model}");
throw new ArgumentException($"工作模式:自动模式写入PLC失败VD1536写{model}");
}
_log.Info($"工作模式写入PLC成功VD1533写{model}");
_log.Info($"工作模式写入PLC成功VD1536写{model}");
} while (plcFlag != 1);

@ -0,0 +1,51 @@
<Window x:Class="SlnMesnac.WPF.Page.FixedPointWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.WPF.Page"
xmlns:local1="clr-namespace:SlnMesnac.WPF.Converter.Sys_Flag"
mc:Ignorable="d"
Title="{Binding FixedPointTitle}" Height="550" Width="850">
<Window.Resources>
<local1:IsFlagConvert x:Key="IsFlagConvert"/>
</Window.Resources>
<Grid>
<DataGrid Grid.Row="0" ItemsSource="{Binding BusbarInfoItems}" Background="Transparent"
FontSize="18" ColumnHeaderHeight="35"
RowHeight="40" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False" HorizontalAlignment="Center"
Foreground="#31446E" x:Name="dataGrid2" Margin="0,10,0,0" >
<!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns>
<!--<DataGridTextColumn Binding="{Binding cabinetCode}" Header="电柜" Width="2*" IsReadOnly="True"/>-->
<!--<DataGridTextColumn Binding="{Binding busbarCode}" Header="编号" Width="2*" IsReadOnly="True"/>-->
<DataGridTextColumn Binding="{Binding busbarAlias}" Header="别名" Width="4*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding busbarDist}" Header="距离" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding isRotate,Converter={StaticResource IsFlagConvert}}" Header="是否旋转" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding wPanPos}" Header="P" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding wTiltPos}" Header="T" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding wZoomPos}" Header="Z" Width="2*" IsReadOnly="True"/>
<!--<DataGridTextColumn Binding="{Binding isEnd,Converter={StaticResource IsFlagConvert}}" Header="是否尾排" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding isChecked,Converter={StaticResource IsFlagConvert}}" Header="是否检测" Width="2*" IsReadOnly="True"/>-->
<!--<DataGridTextColumn Binding="{Binding isPictures,Converter={StaticResource IsFlagConvert}}" Header="是否拍照" Width="2*" IsReadOnly="True"/>-->
<DataGridTemplateColumn Header="操作" Width="4*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<!--<Button Content="巡检" Command="{Binding DataContext.FixedPointCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding}" Style="{StaticResource BUTTON_AGREE}" FontSize="14" Width="80" Height="30" Background="#009999" BorderBrush="#FF36B5C1" VerticalAlignment="Center" HorizontalAlignment="Center"/>-->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="巡检" Command="{Binding DataContext.StartFixedPointCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding}" Style="{StaticResource BUTTON_AGREE}" FontSize="14" Width="80" Height="30" Background="#5095F3" BorderBrush="#5095F3" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10,0"/>
<Button Content="完成" Command="{Binding DataContext.EndFixedPointCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding}" Style="{StaticResource BUTTON_AGREE}" FontSize="14" Width="80" Height="30" Background="#FF9900" BorderBrush="#FF9900" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10,0"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>

@ -0,0 +1,32 @@
using SlnMesnac.WPF.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace SlnMesnac.WPF.Page
{
/// <summary>
/// FixedPointWindow.xaml 的交互逻辑
/// </summary>
public partial class FixedPointWindow : Window
{
public FixedPointWindow(int cabinetCode)
{
InitializeComponent();
FixedPointViewModel fixedPointViewModel = new FixedPointViewModel(cabinetCode);
this.DataContext = fixedPointViewModel;
fixedPointViewModel.QueryBusbarInfo(cabinetCode);
}
}
}

@ -1,11 +1,15 @@
using SlnMesnac.WPF.ViewModel;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using Brushes = System.Windows.Media.Brushes;
using Rectangle = System.Windows.Shapes.Rectangle;
namespace SlnMesnac.WPF.Page
{
@ -242,7 +246,7 @@ namespace SlnMesnac.WPF.Page
{
var stationNumber = GetStationNumber(i, true);
if(stationNumber == 0)
if (stationNumber == 0)
{
continue;
}
@ -259,23 +263,54 @@ namespace SlnMesnac.WPF.Page
Name = $"station{stationNumber}",
};
// 设置位置
Canvas.SetLeft(station, 20 + i * 50); // 50 是两个矩形之间的间距
Canvas.SetTop(station, 25);
// 设置 ToolTip
ToolTip toolTip = new ToolTip();
TextBlock textBlock = new TextBlock { Text = stationNumber.ToString() };
toolTip.Content = textBlock;
TextBlock toolTipTextBlock = new TextBlock { Text = stationNumber.ToString().Replace("station", string.Empty) };
toolTip.Content = toolTipTextBlock;
station.ToolTip = toolTip;
station.Name = $"station{stationNumber}";
// 将矩形添加到 Canvas 中
canvasTrack.Children.Add(station);
// 添加点击事件
station.MouseLeftButtonDown += (sender, e) =>
{
// 获取被点击的 Rectangle 对象
Rectangle clickedStation = sender as Rectangle;
// 检查是否成功转换
if (clickedStation != null)
{
// 获取并输出当前点击的 Name 属性
string stationName = clickedStation.Name;
FixedPointInspection(Convert.ToInt32(clickedStation.Name.Replace("station", string.Empty)));
}
};
// 创建一个新的 Grid 来包含 Rectangle 和 TextBlock
Grid grid = new Grid();
grid.Children.Add(station);
// 创建 TextBlock 来显示 Name
TextBlock textBlock = new TextBlock
{
Text = station.Name.Replace("station", string.Empty),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Foreground = Brushes.White, // 设置文本颜色
FontSize = 12 // 设置字体大小
};
grid.Children.Add(textBlock);
// 设置位置
Canvas.SetLeft(grid, 20 + i * 50); // 50 是两个矩形之间的间距
Canvas.SetTop(grid, 25);
// 将 Grid 添加到 Canvas 中
canvasTrack.Children.Add(grid);
}
for (int i = 0; i < 15; i++)
{
var stationNumber = GetStationNumber(i,false);
var stationNumber = GetStationNumber(i, false);
Rectangle station = new Rectangle
{
Width = 35,
@ -285,22 +320,49 @@ namespace SlnMesnac.WPF.Page
RadiusY = 5,
Stroke = Brushes.Transparent,
StrokeThickness = 1,
Name = $"station{stationNumber}"
Name = $"station{stationNumber}",
ToolTip = new ToolTip
{
Content = new TextBlock { Text = stationNumber.ToString().Replace("station",string.Empty) }
}
};
// 创建一个新的 Grid 来包含 Rectangle 和 TextBlock
Grid grid = new Grid();
grid.Children.Add(station);
// 创建 TextBlock 来显示 Name
TextBlock textBlock = new TextBlock
{
Text = station.Name.Replace("station", string.Empty),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Foreground = Brushes.White, // 设置文本颜色
FontSize = 12 // 设置字体大小
};
grid.Children.Add(textBlock);
// 设置位置
Canvas.SetLeft(station, 120 + i * 50); // 50 是两个矩形之间的间距
Canvas.SetTop(station, 155);
Canvas.SetLeft(grid, 120 + i * 50); // 50 是两个矩形之间的间距
Canvas.SetTop(grid, 155);
// 设置 ToolTip
ToolTip toolTip = new ToolTip();
TextBlock textBlock = new TextBlock { Text = stationNumber.ToString() };
toolTip.Content = textBlock;
station.ToolTip = toolTip;
station.Name = $"station{stationNumber}";
// 添加点击事件
station.MouseLeftButtonDown += (sender, e) =>
{
// 获取被点击的 Rectangle 对象
Rectangle clickedStation = sender as Rectangle;
// 将矩形添加到 Canvas 中
canvasTrack.Children.Add(station);
// 检查是否成功转换
if (clickedStation != null)
{
// 获取并输出当前点击的 Name 属性
string stationName = clickedStation.Name;
FixedPointInspection(Convert.ToInt32(clickedStation.Name.Replace("station", string.Empty)));
}
};
// 将 Grid 添加到 Canvas 中
canvasTrack.Children.Add(grid);
}
}
@ -313,18 +375,22 @@ namespace SlnMesnac.WPF.Page
// 根据输入的站点编号高亮对应的站点
if(canvasTrack!= null)
{
foreach(Rectangle station in canvasTrack.Children)
foreach (var item in canvasTrack.Children)
{
if(station.Name == $"station{stationNumber}")
if (item is Grid gridItem)
{
station.Fill = Brushes.GreenYellow;
foreach (var station in gridItem.Children)
{
if (station is Rectangle rectangle)
{
if (rectangle.Name == $"station{stationNumber}")
{
rectangle.Fill = Brushes.GreenYellow;
}
}
}
}
}
//Rectangle station = (Rectangle)canvasTrack.FindName($"station{stationNumber}");
//if (station != null)
//{
// station.Fill = Brushes.GreenYellow;
//}
}
});
@ -333,13 +399,26 @@ namespace SlnMesnac.WPF.Page
private void ResetStationColors()
{
foreach (Rectangle station in canvasTrack.Children)
var gridList = canvasTrack.Children;
foreach(var item in canvasTrack.Children)
{
if (station.Name.Contains("station"))
if(item is Grid gridItem)
{
station.Fill = Brushes.Gray;
foreach (var station in gridItem.Children)
{
if(station is Rectangle rectangle)
{
if (rectangle.Name.Contains("station"))
{
rectangle.Fill = Brushes.Gray;
}
}
}
}
}
}
private int GetStationNumber(int i,bool isFlag)
@ -365,9 +444,15 @@ namespace SlnMesnac.WPF.Page
}
return number;
}
private void FixedPointInspection(int cabinetCode)
{
FixedPointWindow fixedPointWindow = new FixedPointWindow(cabinetCode);
// 设置窗口属性使其居中顶层显示
fixedPointWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
fixedPointWindow.Topmost = true;
fixedPointWindow.ShowDialog();
}
}

@ -0,0 +1,87 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Business;
using SlnMesnac.Repository;
using SlnMesnac.Repository.service;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* SlnMesnac.WPF.ViewModel
* 82a9c020-20a4-4f1a-8a87-2081004da0c9
*
* WenJY
*
* 2024-11-29 9:36:57
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.WPF.ViewModel
{
public partial class FixedPointViewModel : ObservableObject
{
private readonly BusbarInfoBusiness busbarInfoBusiness;
private readonly FixedPointBusiness fixedPointBusiness;
public FixedPointViewModel(int fixedPointTitle)
{
busbarInfoBusiness = App.ServiceProvider.GetService<BusbarInfoBusiness>();
fixedPointBusiness = App.ServiceProvider.GetService<FixedPointBusiness>();
FixedPointTitle = $"{fixedPointTitle}#电柜定点巡检";
}
public string _fixedPointTitle = "定点巡检";
public string FixedPointTitle
{
get => _fixedPointTitle;
set => SetProperty(ref _fixedPointTitle, value);
}
private ObservableCollection<base_busbar_info> _busbarInfoItems = new ObservableCollection<base_busbar_info>();
public ObservableCollection<base_busbar_info> BusbarInfoItems
{
get => _busbarInfoItems;
set => SetProperty(ref _busbarInfoItems, value);
}
public void QueryBusbarInfo(int cabinetCode)
{
busbarInfoBusiness.QueryBusbarInfo(cabinetCode, out List<base_busbar_info> info);
BusbarInfoItems = new ObservableCollection<base_busbar_info>(info);
}
private bool isFlag = false;
[RelayCommand]
public void StartFixedPoint(base_busbar_info busbar_Info)
{
var code = busbar_Info.busbarCode;
fixedPointBusiness.StartFixedPoint(busbar_Info);
}
[RelayCommand]
public void EndFixedPoint(base_busbar_info busbar_Info)
{
var code = busbar_Info.busbarCode;
fixedPointBusiness.EndFixedPoint(busbar_Info);
}
}
}

@ -45,6 +45,7 @@ namespace SlnMesnac.WPF.ViewModel
private SerilogHelper _log;
private AutoModeBusiness autoModeBusiness;
private InspModeBusiness inspModeBusiness;
private FixedPointBusiness fixedPointBusiness;
private AppConfig _appConfig;
private CHCNetSDK.RemoteConfigCallback _callback;
@ -69,9 +70,11 @@ namespace SlnMesnac.WPF.ViewModel
_appConfig = App.ServiceProvider.GetService<AppConfig>();
autoModeBusiness = App.ServiceProvider.GetService<AutoModeBusiness>();
inspModeBusiness = App.ServiceProvider.GetService<InspModeBusiness>();
fixedPointBusiness = App.ServiceProvider.GetService<FixedPointBusiness>();
autoModeBusiness.CaptureAlarmPictureEvent += CapturePicture;
autoModeBusiness.GimbaRotationControlEvent += GimbaRotationControl;
fixedPointBusiness.GimbaRotationControlEvent += GimbaRotationControl;
RefreshTrackMotorAddress();
}catch (Exception ex)

@ -21,7 +21,7 @@
{
"configId": "iot",
"dbType": 0,
"connStr": "Data Source=127.0.0.1;Port=3306;Initial Catalog=iot_smarthotspot;uid=root;pwd=haiwei@123;Charset=utf8mb4;SslMode=none"
"connStr": "Data Source=192.168.2.165;Port=3306;Initial Catalog=iot_smarthotspot;uid=root;pwd=haiwei@123;Charset=utf8mb4;SslMode=none"
}
],
"PlcConfig": [

Loading…
Cancel
Save