Commit d733246a authored by 潘栩锋's avatar 潘栩锋 🚴

下吹 升级为 V7

parent 8dd15fcf
......@@ -43,9 +43,8 @@ namespace FLY.DownBlowing.UI.Client
private void button_error_Click(object sender, RoutedEventArgs e)
{
PgErrorTable2 p = new PgErrorTable2();
var warningReasonWindow = container.Resolve<WarningReasonWindow>("downBlowingWarningReasonWindow");
var warningService = container.Resolve<IWarningService>("downBlowingWarningService");
p.Init(container, warningService, warningReasonWindow);
var warningService = container.Resolve<IWarningSystem2Service>("downBlowingWarningService");
p.Init(container, warningService);
NavigationService.Navigate(p);
}
......
......@@ -66,9 +66,13 @@ namespace FLY.DownBlowing.UI.Client
this.downBlowingSystemService = downBlowingSystemService;
//注册属性更新计划
int index = this.downBlowingSystemService.TAreas.IndexOf(tempArea);
string objname = $"{nameof(IDownBlowingSystemService.TAreas)}[{index}]";
setPlan = new FLY.OBJComponents.Client.SetPLCUpdatePlan(
downBlowingSystemService.PLCos,
tempArea,
objname,
update_propertynames);
this.tempArea = tempArea;
this.DataContext = tempArea;
......
......@@ -7,12 +7,12 @@ using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("FLY.DownBlowing.UI.Client")]
[assembly: AssemblyTitle("下吹 客户端 UI库")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("下吹 客户端")]
[assembly: AssemblyCopyright("Copyright © 2021 flyautomation")]
[assembly: AssemblyProduct("下吹 客户端 UI库")]
[assembly: AssemblyCopyright("Copyright © 2022 flyautomation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......@@ -51,5 +51,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.0.0.0")]
[assembly: AssemblyFileVersion("6.0.0.0")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
......@@ -29,16 +29,15 @@
<Setter Property="SnapsToDevicePixels" Value="True"/>
</Style>-->
<local:DynAreaViewModelParams x:Key="unitests_props" IsError="False" Error="吸料 PLC 连接断开,请检测网络连接状态,打电话联系"/>
<conv:IsGTMultiValueConverter x:Key="isgtconv"/>
<conv:RatioConverter x:Key="ratioconv" />
</ResourceDictionary>
</UserControl.Resources>
<Button Style="{StaticResource Styles.Button.Empty}" Click="Button_Click">
<Button Style="{StaticResource Styles.Button.Empty}" >
<Grid Height="120" >
<Grid x:Name="grid_winder" d:DataContext="{Binding Source={StaticResource downBlowingSystemUt},Path=WinderData}"/>
<Grid x:Name="grid_error" d:DataContext="{StaticResource unitests_props}"/>
<Border Style="{StaticResource Styles.Module.Border}"
DataContext="{Binding DataContext,ElementName=grid_winder}">
......@@ -86,36 +85,6 @@
</Grid>
</Border>
<Border Style="{StaticResource Styles.Module.Border}" Background="{StaticResource Brushes.Validation}"
DataContext="{Binding DataContext,ElementName=grid_error}"
Visibility="{Binding IsError,Converter={StaticResource visbilityconv}}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Path Margin="5" Fill="White" Stretch="Uniform" Width="60" Height="60" SnapsToDevicePixels="True" Data="{StaticResource Geometry_alert-circle-outline}" >
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding IsError}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever" >
<DoubleAnimation BeginTime="0:0:0" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="00:00:01" />
<DoubleAnimation BeginTime="0:0:1" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:01" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
<TextBlock Grid.Column="1" Margin="5" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="22" Foreground="White" Text="{Binding Error}"/>
</Grid>
</Border>
</Grid>
</Button>
......
......@@ -22,18 +22,9 @@ namespace FLY.DownBlowing.UI.Client.UiModule
/// </summary>
public partial class DynAreaWinder : UserControl
{
#region 延时推送 MARKNO
const int MARKNO_UPDATEERROR = 1;
#endregion
IUnityContainer container;
IDownBlowingSystemService downBlowingSystem;
WarningReasonWindow warningReasonWindow;
IWarningService warningService;
DispatcherTimer timer_error;
DynAreaViewModelParams props = new DynAreaViewModelParams();
SetPLCUpdatePlan setPlan_winder;
public DynAreaWinder()
......@@ -44,38 +35,19 @@ namespace FLY.DownBlowing.UI.Client.UiModule
[InjectionMethod]
public void Init(
IUnityContainer container,
[Dependency("downBlowingWarningReasonWindow")] WarningReasonWindow warningReasonWindow,
[Dependency("downBlowingWarningService")]IWarningService warningService,
IDownBlowingSystemService downBlowingSystemService)
{
this.container = container;
this.downBlowingSystem = downBlowingSystemService;
//创建窗口观察 报警原因列表
this.warningReasonWindow = warningReasonWindow;
this.warningService = warningService;
//报警原因轮流显示
timer_error = new DispatcherTimer();
timer_error.Interval = TimeSpan.FromSeconds(3);
timer_error.Tick += (s, e) =>
{
reason_list_index--;
if (reason_list_index < 0)
reason_list_index = warningReasonWindow.Record.Count();
updateError();
};
warningReasonWindow.Record.CollectionChanged += Record_CollectionChanged;
grid_winder.DataContext = this.downBlowingSystem.WinderData;
grid_error.DataContext = props;
string objname = nameof(IDownBlowingSystemService.WinderData);
//注册属性更新计划
setPlan_winder = new SetPLCUpdatePlan(
this.downBlowingSystem.PLCos,
this.downBlowingSystem.WinderData,
objname,
new string[]
{
nameof(WinderData.T1Velocity),
......@@ -84,77 +56,6 @@ namespace FLY.DownBlowing.UI.Client.UiModule
nameof(WinderData.OwMeasurePreWarning),
});
downBlowingSystem.PropertyChanged += (s, e) =>
{
if (downBlowingSystem is FObjServiceClient) {
if (e.PropertyName == nameof(FObjServiceClient.IsConnected)) {
updateError();
}
}
};
updateError();
}
private void Record_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
FObjBase.PollModule.Current.Poll_JustOnce(
new FObjBase.PollModule.PollHandler(delegate ()
{
reason_list_index = warningReasonWindow.Record.Count() - 1;
updateError();
}), this, MARKNO_UPDATEERROR);
}
void updateError()
{
if (downBlowingSystem is FObjServiceClient)
{
var client = downBlowingSystem as FObjServiceClient;
if (!client.IsConnected)
{
props.Error = "下吹服务器连接断开";
props.IsError = true;
reason_list_index = -1;
timer_error.Stop();
return;
}
}
if (warningReasonWindow.Record.Count == 0)
{
props.IsError = false;
props.Error = "";
reason_list_index = -1;
timer_error.Stop();
return;
}
if (reason_list_index >= warningReasonWindow.Record.Count)
reason_list_index = warningReasonWindow.Record.Count - 1;
else if (reason_list_index < 0)
reason_list_index = 0;
props.Error = warningReasonWindow.Record[reason_list_index].Description;
props.IsError = true;
timer_error.Start();
}
private int reason_list_index = -1;
private void Button_Click(object sender, RoutedEventArgs e)
{
PgErrorTable2 p = new PgErrorTable2();
p.Init(container, warningService, warningReasonWindow);
FlyLayoutManager.NavigationService.Navigate(p);
}
}
public class DynAreaViewModelParams : INotifyPropertyChanged
......
......@@ -43,9 +43,10 @@ namespace FLY.DownBlowing.UI.Client.UiModule
for (int i = 0; i < this.downBlowingSystemService.FeederDatas.Count(); i++)
{
string objname = $"{nameof(IDownBlowingSystemService.FeederDatas)}[{i}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.FeederDatas[i],
objname,
UcFeeder.update_propertynames);
setPlan_feederDatas.Add(plan);
}
......@@ -80,9 +81,10 @@ namespace FLY.DownBlowing.UI.Client.UiModule
int add_cnt = -remove_cnt;
for (int i = 0; i < add_cnt; i++)
{
string objname = $"{nameof(IDownBlowingSystemService.FeederDatas)}[{start_idx+i}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.FeederDatas[start_idx + i],
objname,
UcFeeder.update_propertynames);
setPlan_feederDatas.Add(plan);
}
......
......@@ -44,9 +44,11 @@ namespace FLY.DownBlowing.UI.Client.UiModule
for (int i = 0; i < this.downBlowingSystemService.FeederDatas.Count(); i++)
{
string objname = $"{nameof(IDownBlowingSystemService.FeederDatas)}[{i}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.FeederDatas[i],
objname,
UcFeeder.update_propertynames);
setPlan_feederDatas.Add(plan);
}
......@@ -76,9 +78,10 @@ namespace FLY.DownBlowing.UI.Client.UiModule
int add_cnt = -remove_cnt;
for (int i = 0; i < add_cnt; i++)
{
string objname = $"{nameof(IDownBlowingSystemService.FeederDatas)}[{start_idx + i}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.FeederDatas[start_idx + i],
objname,
UcFeeder.update_propertynames);
setPlan_feederDatas.Add(plan);
}
......
......@@ -60,10 +60,11 @@ namespace FLY.DownBlowing.UI.Client.UiModule
for (int i = 0; i < this.downBlowingSystemService.TAreas.Count(); i++)
{
string objname = $"{nameof(IDownBlowingSystemService.TAreas)}[{i}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.TAreas[i],
update_propertynames);
objname,
update_propertynames); ;
setPlan_items.Add(plan);
}
......@@ -93,10 +94,12 @@ namespace FLY.DownBlowing.UI.Client.UiModule
int add_cnt = -remove_cnt;
for (int i = 0; i < add_cnt; i++)
{
string objname = $"{nameof(IDownBlowingSystemService.TAreas)}[{start_idx + i}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.TAreas[start_idx + i],
update_propertynames);
this.downBlowingSystemService.PLCos,
objname,
update_propertynames);
setPlan_items.Add(plan);
}
}
......
......@@ -53,9 +53,12 @@ namespace FLY.DownBlowing.UI.Client.UiModule
this.tempArea = tempArea;
this.DataContext = tempArea;
int index = this.downBlowingSystemService.TAreas.IndexOf(tempArea);
string objname = $"{nameof(IDownBlowingSystemService.TAreas)}[{index}]";
setPlan_item = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.tempArea,
objname,
update_propertynames);
tempArea.PropertyChanged += TempArea_PropertyChanged;
......
......@@ -26,10 +26,10 @@ namespace FLY.DownBlowing.UI.Client.UiModule
//IsTongAuto
//注册属性更新计划
string objname = nameof(IDownBlowingSystemService.WinderData);
setPlan_winder = new SetPLCUpdatePlan(
this.downBlowingSystem.PLCos,
this.downBlowingSystem.WinderData,
objname,
new string[] {
nameof(this.downBlowingSystem.WinderData.IsOwTongAuto),
nameof(this.downBlowingSystem.WinderData.OwCalenderRollerAct),
......
......@@ -61,9 +61,12 @@ namespace FLY.DownBlowing.UI.Client.UiModule
{
this.downBlowingSystemService = downBlowingSystemService;
this.DataContext = this.downBlowingSystemService;
string objname = nameof(IDownBlowingSystemService.WinderData);
this.setPlan_winder = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.WinderData,
objname,
update_propertynames
);
}
......
......@@ -48,9 +48,12 @@ namespace FLY.DownBlowing.UI.Client.UiModule
{
this.downBlowingSystemService = downBlowingSystemService;
this.DataContext = this.downBlowingSystemService;
string objname = nameof(IDownBlowingSystemService.IbcData);
this.setPlan_ibc = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.IbcData,
objname,
update_propertynames
);
}
......
......@@ -48,9 +48,12 @@ namespace FLY.DownBlowing.UI.Client.UiModule
{
this.downBlowingSystemService = downBlowingSystemService;
this.DataContext = this.downBlowingSystemService;
string objname = nameof(IDownBlowingSystemService.IbcData);
this.setPlan = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.IbcData,
objname,
update_propertynames
);
}
......
......@@ -50,9 +50,11 @@ namespace FLY.DownBlowing.UI.Client.UiModule
{
this.downBlowingSystemService = downBlowingSystemService;
this.DataContext = this.downBlowingSystemService;
string objname = nameof(IDownBlowingSystemService.WinderData);
this.setPlan = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.WinderData,
objname,
update_propertynames
);
}
......
......@@ -55,14 +55,18 @@ namespace FLY.DownBlowing.UI.Client.UiModule
{
this.downBlowingSystemService = downBlowingSystemService;
this.DataContext = this.downBlowingSystemService;
string objname = nameof(IDownBlowingSystemService.WinderData);
this.setPlan_winder = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.WinderData,
objname,
update_propertynames_winder
);
objname = nameof(IDownBlowingSystemService.IbcData);
this.setPlan_ibc = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.IbcData,
objname,
update_propertynames_ibc
);
}
......
......@@ -66,9 +66,10 @@ namespace FLY.DownBlowing.UI.Client.UiModule
this.container = container;
this.downBlowingSystemService = downBlowingSystemService;
this.DataContext = this.downBlowingSystemService;
string objname = nameof(IDownBlowingSystemService.WinderData);
this.setPlan_winder = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.WinderData,
objname,
update_propertynames_winder
);
}
......
......@@ -49,9 +49,12 @@ namespace FLY.DownBlowing.UI.Client.UiModule
{
this.downBlowingSystemService = downBlowingSystemService;
this.DataContext = this.downBlowingSystemService;
string objname = nameof(IDownBlowingSystemService.WinderData);
this.setPlan = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.WinderData,
objname,
update_propertynames
);
......
......@@ -72,9 +72,10 @@ namespace FLY.DownBlowing.UI.Client.UiModule
{
this.downBlowingSystemService = downBlowingSystemService;
this.DataContext = this.downBlowingSystemService;
string objname = nameof(IDownBlowingSystemService.WinderData);
this.setPlan_winder = new SetPLCUpdatePlan(
this.downBlowingSystemService.PLCos,
this.downBlowingSystemService.WinderData,
objname,
update_propertynames
);
}
......
......@@ -62,6 +62,12 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="PgLoading.xaml.cs">
<DependentUpon>PgLoading.xaml</DependentUpon>
</Compile>
<Compile Include="PgMain.xaml.cs">
<DependentUpon>PgMain.xaml</DependentUpon>
</Compile>
<Compile Include="WdSetup.xaml.cs">
<DependentUpon>WdSetup.xaml</DependentUpon>
</Compile>
......@@ -77,6 +83,14 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="PgLoading.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PgMain.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WdSetup.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
<Window x:Class="FLY.DownBlowing.UI.Server.MainWindow"
<NavigationWindow x:Class="FLY.DownBlowing.UI.Server.MainWindow"
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"
mc:Ignorable="d"
xmlns:local="clr-namespace:FLY.DownBlowing.UI.Server"
Title="MainWindow" SizeToContent="WidthAndHeight">
<Window.Resources>
<local:TimeSpan2msConverter x:Key="timespan2msConv"/>
</Window.Resources>
<Grid>
<StackPanel>
<ListView x:Name="listView" Margin="5">
<ListView.View>
<GridView >
<GridViewColumn Header="更新速度(ms)" DisplayMemberBinding="{Binding ActUpdateInterval,Converter={StaticResource timespan2msConv}}"></GridViewColumn>
<GridViewColumn Header="地址" DisplayMemberBinding="{Binding Client.RemoteEP}"></GridViewColumn>
<GridViewColumn Header="寄存器更新数" DisplayMemberBinding="{Binding DRNeedUpdateCnt}"></GridViewColumn>
<GridViewColumn Header="寄存器总数" DisplayMemberBinding="{Binding DRCnt}"></GridViewColumn>
<GridViewColumn Header="连接状态" DisplayMemberBinding="{Binding Client.IsConnected}"></GridViewColumn>
<GridViewColumn Header="异常次数" DisplayMemberBinding="{Binding ErrorCnt}"></GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnSetupClick"></Button>
</StackPanel>
</Grid>
</Window>
Title="MainWindow" ResizeMode="NoResize" SizeToContent="WidthAndHeight" MinWidth="400" MinHeight="200"
ShowsNavigationUI="False"
Loaded="NavigationWindow_Loaded">
</NavigationWindow>
\ No newline at end of file
using System;
using FLY.DownBlowing.Server;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
......@@ -21,7 +22,7 @@ namespace FLY.DownBlowing.UI.Server
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : NavigationWindow
{
FLY.AppHelper.WindowNotifyIconHelper notifyiconhelper;
FLY.DownBlowing.Server.TDGage gage;
......@@ -29,28 +30,32 @@ namespace FLY.DownBlowing.UI.Server
public MainWindow()
{
InitializeComponent();
PgLoading p = new PgLoading();
this.Navigate(p);
this.Title = (new Misc.Ver() { SrcType = typeof(MainWindow) }).ToString();
notifyiconhelper = new AppHelper.WindowNotifyIconHelper(this, this.Title);
this.Hide();
//DebugInit();
}
FObjBase.PollModule.Current.Start();
gage = new FLY.DownBlowing.Server.TDGage("Gage1");
objProxy = new FLY.DownBlowing.Server.OBJProxy.OBJProxy(0, gage);
private async void NavigationWindow_Loaded(object sender, RoutedEventArgs _e)
{
gage = new TDGage("Gage1");
await gage.Init();
FLY.OBJComponents.Server.PLCProxySystem plsos =
gage.mData.PLCos as FLY.OBJComponents.Server.PLCProxySystem;
objProxy = new DownBlowing.Server.OBJProxy.OBJProxy(0, gage);
//this.itemcontrol.ItemsSource = plsos.PLCs;
this.listView.ItemsSource = plsos.PLCs;
//plsos.PLCs[0].UpdateInterval = 1000;
FObjBase.PollModule.Current.Start();
//DebugInit();
this.Hide();
PgMain p = new PgMain();
p.Init(gage);
this.Navigate(p);
this.NavigationService.RemoveBackEntry();
}
private void btnSetupClick(object sender, RoutedEventArgs e)
{
WdSetup w = new WdSetup();
......
<Page x:Class="FLY.DownBlowing.UI.Server.PgLoading"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="PgLoading" >
<Grid>
<TextBlock x:Name="message" VerticalAlignment="Center" HorizontalAlignment="Center" Text="初始化中......" FontSize="24"/>
</Grid>
</Page>
\ No newline at end of file
using System;
using System.Windows.Controls;
using System.Windows.Threading;
namespace FLY.DownBlowing.UI.Server
{
/// <summary>
/// PgLoading.xaml 的交互逻辑
/// </summary>
public partial class PgLoading : Page
{
DispatcherTimer timer;
public PgLoading()
{
InitializeComponent();
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
Timer_Tick(null, null);
}
int cnt = 0;
private void Timer_Tick(object sender, EventArgs e)
{
string str = "";
for (int i = 0; i < cnt; i++)
{
str += ".";
}
message.Text = "初始化中" + str;
cnt++;
if (cnt > 6)
cnt = 0;
}
}
}
<Page x:Class="FLY.DownBlowing.UI.Server.PgMain"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FLY.DownBlowing.UI.Server"
mc:Ignorable="d"
Title="PgMain">
<Page.Resources>
<local:TimeSpan2msConverter x:Key="timespan2msConv"/>
<local:PgMainVmUt x:Key="viewModel"/>
</Page.Resources>
<Grid d:DataContext="{StaticResource viewModel}">
<StackPanel>
<ListView x:Name="listView" ItemsSource="{Binding PLCs}" Margin="5">
<ListView.View>
<GridView >
<GridViewColumn Header="更新速度(ms)" DisplayMemberBinding="{Binding ActUpdateInterval,Converter={StaticResource timespan2msConv}}"></GridViewColumn>
<GridViewColumn Header="地址" DisplayMemberBinding="{Binding Client.RemoteAddr}"></GridViewColumn>
<GridViewColumn Header="寄存器更新数" DisplayMemberBinding="{Binding DRNeedUpdateCnt}"></GridViewColumn>
<GridViewColumn Header="寄存器总数" DisplayMemberBinding="{Binding DRCnt}"></GridViewColumn>
<GridViewColumn Header="连接状态" DisplayMemberBinding="{Binding Client.IsConnected}"></GridViewColumn>
<GridViewColumn Header="异常次数" DisplayMemberBinding="{Binding ErrorCnt}"></GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnSetupClick"></Button>
</StackPanel>
</Grid>
</Page>
using System;
using System.Collections.Generic;
using System.ComponentModel;
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.Navigation;
using System.Windows.Shapes;
namespace FLY.DownBlowing.UI.Server
{
/// <summary>
/// PgMain.xaml 的交互逻辑
/// </summary>
public partial class PgMain : Page
{
public PgMain()
{
InitializeComponent();
}
public void Init(FLY.DownBlowing.Server.TDGage gage)
{
FLY.OBJComponents.Server.PLCProxySystem plsos =
gage.mData.PLCos as FLY.OBJComponents.Server.PLCProxySystem;
this.listView.ItemsSource = plsos.PLCs;
}
private void btnSetupClick(object sender, RoutedEventArgs e)
{
WdSetup w = new WdSetup();
w.Owner = App.Current.MainWindow;
w.ShowDialog();
}
}
public class PgMainVmUt : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public List<ModbusMapperClientView> PLCs { get; set; }
public PgMainVmUt()
{
PLCs = new List<ModbusMapperClientView>() {
new ModbusMapperClientView(){
ActUpdateInterval = TimeSpan.FromMilliseconds( 623),
Client = new TcpClientView(){
IsConnected = true,
RemoteAddr = "127.168.50.1:502"
},
DRCnt = 130,
DRNeedUpdateCnt = 30,
ErrorCnt = 2
},
new ModbusMapperClientView(){
ActUpdateInterval = TimeSpan.FromMilliseconds(2623),
Client = new TcpClientView(){
IsConnected = false,
RemoteAddr = "127.168.50.2:502"
},
DRCnt = 45,
DRNeedUpdateCnt = 40,
ErrorCnt = 2
},
new ModbusMapperClientView(){
ActUpdateInterval = TimeSpan.FromMilliseconds(123),
Client = new TcpClientView(){
IsConnected = true,
RemoteAddr = "127.168.50.3:502"
},
DRCnt = 10,
DRNeedUpdateCnt = 3,
ErrorCnt = 0
}
};
}
}
public class ModbusMapperClientView : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// 实际更新间隔
/// </summary>
public TimeSpan ActUpdateInterval { get; set; }
public int ErrorCnt { get; set; }
public int DRNeedUpdateCnt { get; set; }
public int DRCnt { get; set; }
public TcpClientView Client { get; set; }
}
public class TcpClientView : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public string RemoteAddr { get; set; }
public bool IsConnected { get; set; }
}
}
......@@ -12,7 +12,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("佛山市枫莱尔自动化技术有限公司")]
[assembly: AssemblyProduct("枫莱尔--下吹服务器")]
[assembly: AssemblyCopyright("Copyright © 2021 FLYAutomation")]
[assembly: AssemblyCopyright("Copyright © 2022 FLYAutomation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......@@ -51,7 +51,7 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.36.1.0")]
[assembly: AssemblyFileVersion("6.36.1.0")]
[assembly: AssemblyVersion("7.0.0")]
[assembly: AssemblyFileVersion("7.0.0")]
[assembly: Guid("A4B71A37-7B77-47AA-9F59-ACC3EF84C4E0")]
......@@ -131,7 +131,7 @@ namespace FLY.DownBlowing.Client
//PLC代理,用于添加更新任务
objnames = GetObjNames();
plcos = new PLCProxySystemServiceClient(mServerID + 2, objnames);
plcos = new PLCProxySystemServiceClient(mServerID + 2);
this.PropertyChanged += DownBlowingSystemServiceClient_PropertyChanged;
......@@ -204,7 +204,6 @@ namespace FLY.DownBlowing.Client
TAreas.RemoveAt(index);
string objname = $"{nameof(TAreas)}[{index}]";
syncPropServiceClient.Remove(objname);
PLCos.ObjNames.Remove(objname);
}
for (int i = 0; i < remove_cnt; i++)
......@@ -213,7 +212,6 @@ namespace FLY.DownBlowing.Client
FeederDatas.RemoveAt(index);
string objname = $"{nameof(FeederDatas)}[{index}]";
syncPropServiceClient.Remove(objname);
PLCos.ObjNames.Remove(objname);
}
}
else if (remove_cnt < 0)
......@@ -226,7 +224,6 @@ namespace FLY.DownBlowing.Client
string objname = $"{nameof(TAreas)}[{index}]";
syncPropServiceClient.Add(objname, TAreas[index]);
PLCos.ObjNames.Add(objname, TAreas[index]);
}
......@@ -237,7 +234,6 @@ namespace FLY.DownBlowing.Client
string objname = $"{nameof(FeederDatas)}[{index}]";
syncPropServiceClient.Add(objname, FeederDatas[index]);
PLCos.ObjNames.Add(objname, FeederDatas[index]);
}
}
......
......@@ -9,8 +9,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FLY.DownBlowing.UI.Server")]
[assembly: AssemblyCopyright("Copyright © flyautomation at 2021")]
[assembly: AssemblyProduct("FLY.DownBlowing")]
[assembly: AssemblyCopyright("Copyright © 2022 flyautomation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.0.0.0")]
[assembly: AssemblyFileVersion("6.0.0.0")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
......@@ -13,7 +13,9 @@ namespace FLY.DownBlowing.Server.OBJProxy
TDGage mGage = gage;
var downBlowingSystemOBJProxy = new DownBlowingSystem_OBJProxy( objsys_idx, mGage.mData);
var mWarnSystemOBJProxy = new FLY.OBJComponents.Server.OBJProxy.WarningSystem_OBJProxy(objsys_idx, OBJ_INTERFACE_ID.WARNING_OBJ_ID, mGage.mWarning);
var warnSystemOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.WARNING_OBJ_ID,
typeof(OBJComponents.IService.IWarningSystem2Service), mGage.mWarning);
downBlowingSystemOBJProxy.CurrObjSys.Start_Conn_Server(
new IPEndPoint(IPAddress.Any, gage.mSysParam.OBJ_Port));
......
......@@ -69,7 +69,7 @@ namespace FLY.DownBlowing.Server
/// <summary>
/// 报警系统
/// </summary>
WarningSystem warning;
WarningSystem2 warning;
/// <summary>
/// 记录到数据库
/// </summary>
......@@ -84,7 +84,7 @@ namespace FLY.DownBlowing.Server
{
}
public void Init(HistoryDb historyDb ,WarningSystem warning)
public void Init(HistoryDb historyDb ,WarningSystem2 warning)
{
this.historyDb = historyDb;
......
......@@ -20,7 +20,7 @@ namespace FLY.DownBlowing.Server
Model.DbModel mDbModel;
public Model.HistoryDb mHistoryDb;
public WarningSystem mWarning;
public WarningSystem2 mWarning;
public TDGage(string nam)
{
......@@ -33,27 +33,39 @@ namespace FLY.DownBlowing.Server
}
System.Environment.CurrentDirectory = mParamDirectory;
Init1();
mSysParam = new SysParam();
mData = new DownBlowingSystem();
mDbModel = new Model.DbModel();
mHistoryDb = new Model.HistoryDb();
mWarning = new WarningSystem2();
}
#region Init登陆服务器初始化----------------------------------------------------
/// <summary>
/// 第1步, 加载本地数据
/// </summary>
public void Init1()
public async Task Init()
{
mSysParam = new SysParam();
mData = new DownBlowingSystem();
//---------------------------------------------------------------------------------------------------------------
//数据库
mDbModel = new Model.DbModel();
mDbModel.Init();
mDbModel.KeepDBSize(mSysParam.DBKeepMonth);
mHistoryDb = new Model.HistoryDb();
await Task.Factory.StartNew(() =>
{
//初始数据库(加载 MaxId)
mDbModel.Init();
//删除不需要的备份数据
mDbModel.KeepBackupSize(12);
//备份上一个月之前的数据到 yyyy-MM 文件夹
mDbModel.BackupBbInSize(12);
//当前的数据库只保存上个月与这个月的数据
mDbModel.KeepDBSize(1);
});
mHistoryDb.Init(mDbModel);
mWarning = new WarningSystem();
mWarning.Init(mHistoryDb.ErrorBuffer);
mData.Init(mHistoryDb, mWarning);
......
Subproject commit 3273888d39675c3efafca9858e45a498e9eb3aab
Subproject commit 9fa1a097d3219d0e1c342adb0bf16ebf49e09c98
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment