Commit 56bdd823 authored by 潘栩锋's avatar 潘栩锋 🚴

完成 收卷升级到V7

parent bb89f0e3
......@@ -40,22 +40,23 @@ namespace FLY.Winder.UI.Client
//注册属性更新计划
for (int i = 0; i < 2; i++)
{
string objname = $"{nameof(IWinderSystemService.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[] {
"CenterFrictionalComp",
"CenterTensionFactor",
"CenterTransmissionRatio",
"CenterVelocityComp",
"CenterPressureFactor",
"CenterOutputRatio",
"CenterDia",
"CenterVelocity",
"CenterPressure",
"TongUpDownTime",
"TongInOutTime",
"EPRollerTime"
nameof(Common.WinderInsideOutside.CenterFrictionalComp),
nameof(Common.WinderInsideOutside.CenterTensionFactor),
nameof(Common.WinderInsideOutside.CenterTransmissionRatio),
nameof(Common.WinderInsideOutside.CenterVelocityComp),
nameof(Common.WinderInsideOutside.CenterPressureFactor),
nameof(Common.WinderInsideOutside.CenterOutputRatio),
nameof(Common.WinderInsideOutside.CenterDia),
nameof(Common.WinderInsideOutside.CenterVelocity),
nameof(Common.WinderInsideOutside.CenterPressure),
nameof(Common.WinderInsideOutside.TongUpDownTime),
nameof(Common.WinderInsideOutside.TongInOutTime),
nameof(Common.WinderInsideOutside.EPRollerTime)
});
}
}
......
......@@ -38,34 +38,36 @@ namespace FLY.Winder.UI.Client
this.DataContext = winderSystem;
//注册属性更新计划
string objname = nameof(IWinderSystemService.Accessory);
setPlan_accessory = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Accessory,
objname,
new string[] {
"WindMaxDia",
nameof(Common.WinderAccessory.WindMaxDia),
});
for (int i = 0; i < 2; i++)
{
objname = $"{nameof(IWinderSystemService.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[] {
"EleRulerValue",
"InterstitialValue",
"CenterDia",
"DiaFactor",
"MaxDiaSet",
"MinDiaSet",
"MaxValueSet",
"MinValueSet",
"InterstitialWidth",
"InterstitialPressureComp",
"Tension2",
"TensionComp",
"SpliceCompLen",
"SpliceCompBeginPos",
"SpliceCompEndPos"
nameof(Common.WinderInsideOutside.EleRulerValue),
nameof(Common.WinderInsideOutside.InterstitialValue),
nameof(Common.WinderInsideOutside.CenterDia),
nameof(Common.WinderInsideOutside.DiaFactor),
nameof(Common.WinderInsideOutside.MaxDiaSet),
nameof(Common.WinderInsideOutside.MinDiaSet),
nameof(Common.WinderInsideOutside.MaxValueSet),
nameof(Common.WinderInsideOutside.MinValueSet),
nameof(Common.WinderInsideOutside.InterstitialWidth),
nameof(Common.WinderInsideOutside.InterstitialPressureComp),
nameof(Common.WinderInsideOutside.Tension2),
nameof(Common.WinderInsideOutside.TensionComp),
nameof(Common.WinderInsideOutside.SpliceCompLen),
nameof(Common.WinderInsideOutside.SpliceCompBeginPos),
nameof(Common.WinderInsideOutside.SpliceCompEndPos)
});
}
}
......
......@@ -39,9 +39,8 @@ namespace FLY.Winder.UI.Client
private void button_error_Click(object sender, RoutedEventArgs e)
{
PgErrorTable2 p = new PgErrorTable2();
var warningReasonWindow = container.Resolve<WarningReasonWindow>("winderWarningReasonWindow");
var warningService = container.Resolve<IWarningService>("winderWarningService");
p.Init(container, warningService, warningReasonWindow);
var warningService = container.Resolve<IWarningSystem2Service>("winderWarningService");
p.Init(container, warningService);
NavigationService.Navigate(p);
}
......
......@@ -39,50 +39,52 @@ namespace FLY.Winder.UI.Client
grid_winder.DataContext = winderSystem;
//注册属性更新计划
string objname = nameof(IWinderSystemService.Accessory);
setPlan_accessory = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Accessory,
objname,
new string[] {
"TensionDetection",
"Velocity",
"VelocityFactor",
"IsTraction1Debug",
nameof(Common.WinderAccessory.TensionDetection),
nameof(Common.WinderAccessory.Velocity),
nameof(Common.WinderAccessory.VelocityFactor),
nameof(Common.WinderAccessory.IsTraction1Debug),
"Traction1RollerD",
"Traction1GearRatio",
"Traction1Velocity",
nameof(Common.WinderAccessory.Traction1RollerD),
nameof(Common.WinderAccessory.Traction1GearRatio),
nameof(Common.WinderAccessory.Traction1Velocity),
"Traction2Tension",
"Traction2TensionSet",
"Traction2ITime",
"Traction2Factor",
"Traction2RollerD",
"Traction2GearRatio",
"Traction2PIDResult",
"Traction2PIDAdjust",
"Traction2SyncV",
"Traction2Velocity",
"Traction2LiftGain"
nameof(Common.WinderAccessory.Traction2Tension),
nameof(Common.WinderAccessory.Traction2TensionSet),
nameof(Common.WinderAccessory.Traction2ITime),
nameof(Common.WinderAccessory.Traction2Factor),
nameof(Common.WinderAccessory.Traction2RollerD),
nameof(Common.WinderAccessory.Traction2GearRatio),
nameof(Common.WinderAccessory.Traction2PIDResult),
nameof(Common.WinderAccessory.Traction2PIDAdjust),
nameof(Common.WinderAccessory.Traction2SyncV),
nameof(Common.WinderAccessory.Traction2Velocity),
nameof(Common.WinderAccessory.Traction2LiftGain)
});
for (int i = 0; i < 2; i++)
{
objname = $"{nameof(IWinderSystemService.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[] {
"Tension",
"TensionSet",
"ITime",
"Factor",
"RollerD",
"GearRatio",
"PIDResult",
"PIDAdjust",
"SyncV",
"Velocity",
"LiftGain",
"VelocityComp"
nameof(Common.WinderInsideOutside.Tension),
nameof(Common.WinderInsideOutside.TensionSet),
nameof(Common.WinderInsideOutside.ITime),
nameof(Common.WinderInsideOutside.Factor),
nameof(Common.WinderInsideOutside.RollerD),
nameof(Common.WinderInsideOutside.GearRatio),
nameof(Common.WinderInsideOutside.PIDResult),
nameof(Common.WinderInsideOutside.PIDAdjust),
nameof(Common.WinderInsideOutside.SyncV),
nameof(Common.WinderInsideOutside.Velocity),
nameof(Common.WinderInsideOutside.LiftGain),
nameof(Common.WinderInsideOutside.VelocityComp)
});
}
}
......
......@@ -38,30 +38,32 @@ namespace FLY.Winder.UI.Client
grid_winder.DataContext = winderSystem;
//注册属性更新计划
string objname = nameof(IWinderSystemService.Accessory);
setPlan_accessory = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Accessory,
objname,
new string[] {
"WinderMeasurePerimeter",
"TensionDetectionRange"
nameof(Common.WinderAccessory.WinderMeasurePerimeter),
nameof(Common.WinderAccessory.TensionDetectionRange)
});
for (int i = 0; i < 2; i++)
{
objname = $"{nameof(IWinderSystemService.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[] {
"TurnoverUpperWait",
"TurnoverOrgDelay",
"TurnoverBackDelay",
"CuttingFilmDelay",
"CuttingFilmElapsed",
"PressureArmBackElapsed",
"AirRollerCheck",
"OffsetElapsed",
"ElapsedWait",
"TapeLimit"
nameof(Common.WinderInsideOutside.TurnoverUpperWait),
nameof(Common.WinderInsideOutside.TurnoverOrgDelay),
nameof(Common.WinderInsideOutside.TurnoverBackDelay),
nameof(Common.WinderInsideOutside.CuttingFilmDelay),
nameof(Common.WinderInsideOutside.CuttingFilmElapsed),
nameof(Common.WinderInsideOutside.PressureArmBackElapsed),
nameof(Common.WinderInsideOutside.AirRollerCheck),
nameof(Common.WinderInsideOutside.OffsetElapsed),
nameof(Common.WinderInsideOutside.ElapsedWait),
nameof(Common.WinderInsideOutside.TapeLimit)
});
}
......
......@@ -41,14 +41,15 @@ namespace FLY.Winder.UI.Client.UiModule
//注册属性更新计划
for (int i = 0; i < 2; i++)
{
string objname = $"{nameof(IWinderSystemService.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[] {
"TurnoverInching",
"CuttingFilm",
"TurnoverOrg",
"PressureArmOffset"});
nameof(Common.WinderInsideOutside.TurnoverInching),
nameof(Common.WinderInsideOutside.CuttingFilm),
nameof(Common.WinderInsideOutside.TurnoverOrg),
nameof(Common.WinderInsideOutside.PressureArmOffset)});
}
}
......
......@@ -41,23 +41,24 @@ namespace FLY.Winder.UI.Client.UiModule
//注册属性更新计划
for (int i = 0; i < 2; i++)
{
string objname = $"{nameof(IWinderSystemService.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[] {
"CenterTensionSet",
"CenterInitDia",
"IsCenterInitDiaNotify",
"CenterTaperSet",
"CenterTensionKg",
"CenterDia",
"EPInitPressure",
"EPTaperSet",
"EPAirPressure",
"IsEPRollerClosed",
"IsSurfaceWindGet",
"IsCenterWindGet",
"IsCsWindGet"
nameof(Common.WinderInsideOutside.CenterTensionSet),
nameof(Common.WinderInsideOutside.CenterInitDia),
nameof(Common.WinderInsideOutside.IsCenterInitDiaNotify),
nameof(Common.WinderInsideOutside.CenterTaperSet),
nameof(Common.WinderInsideOutside.CenterTensionKg),
nameof(Common.WinderInsideOutside.CenterDia),
nameof(Common.WinderInsideOutside.EPInitPressure),
nameof(Common.WinderInsideOutside.EPTaperSet),
nameof(Common.WinderInsideOutside.EPAirPressure),
nameof(Common.WinderInsideOutside.IsEPRollerClosed),
nameof(Common.WinderInsideOutside.IsSurfaceWindGet),
nameof(Common.WinderInsideOutside.IsCenterWindGet),
nameof(Common.WinderInsideOutside.IsCsWindGet)
});
}
winderSystem.Items[0].PropertyChanged += Items0_PropertyChanged;
......@@ -67,7 +68,7 @@ namespace FLY.Winder.UI.Client.UiModule
private async void Items0_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "CenterInitDia")
if (e.PropertyName == nameof(Common.WinderInsideOutside.CenterInitDia))
{
if (winderSystem is WinderSystemServiceClient)
{
......@@ -81,7 +82,7 @@ namespace FLY.Winder.UI.Client.UiModule
}
private async void Items1_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "CenterInitDia")
if (e.PropertyName == nameof(Common.WinderInsideOutside.CenterInitDia))
{
if (winderSystem is WinderSystemServiceClient)
{
......
......@@ -30,20 +30,19 @@
<Setter Property="SnapsToDevicePixels" Value="True"/>
</Style>
<local:DynAreaViewModelParams x:Key="unitests_props" IsError="False" Error="报警MSG"/>
<conv:IsGTMultiValueConverter x:Key="isgtconv"/>
<conv:RatioConverter x:Key="ratioconv" />
</ResourceDictionary>
</UserControl.Resources>
<Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="Button_Click">
<Button Style="{StaticResource Styles.Button.Empty}">
<Grid Height="120">
<Grid x:Name="grid_winder" d:DataContext="{StaticResource unittests_windersystem}"/>
<Grid x:Name="grid_error" d:DataContext="{StaticResource unitests_props}"/>
<Border Style="{StaticResource BorderStyle_module}"
<Border Style="{StaticResource Styles.Module.Border}"
DataContext="{Binding DataContext,ElementName=grid_winder}">
<StackPanel Orientation="Vertical" >
<StackPanel >
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
......@@ -78,15 +77,20 @@
</MultiBinding>
</Rectangle.Width>
</Rectangle>
<StackPanel Orientation="Horizontal" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="内收卷" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" Foreground="LightGray" Margin="2" />
<Viewbox Margin="5,0" MaxWidth="80" MaxHeight="26">
<Viewbox Grid.Column="1" Margin="5,0" MaxWidth="80" MaxHeight="26">
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding MeasureLen, StringFormat={}{0:F0}}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="White" />
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="m" FontSize="12" Foreground="LightGray"/>
</StackPanel>
</Viewbox>
</StackPanel>
</Grid>
</Grid>
<Grid Margin="2" Grid.Column="1" DataContext="{Binding Items[1]}" Background="{StaticResource Color_theme_static}">
......@@ -99,50 +103,25 @@
</MultiBinding>
</Rectangle.Width>
</Rectangle>
<StackPanel Orientation="Horizontal" >
<TextBlock Text=" 外收卷" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" Foreground="LightGray" Margin="2" />
<Viewbox Margin="5,0" MaxWidth="80" MaxHeight="26">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="外收卷" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" Foreground="LightGray" Margin="2" />
<Viewbox Grid.Column="1" Margin="5,0" MaxWidth="80" MaxHeight="26">
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding MeasureLen, StringFormat={}{0:F0}}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="White" />
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="m" FontSize="12" Foreground="LightGray"/>
</StackPanel>
</Viewbox>
</StackPanel>
</Grid>
</Grid>
</Grid>
</StackPanel>
</Border>
<Border Style="{StaticResource BorderStyle_module}" 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>
......
......@@ -27,11 +27,7 @@ namespace FLY.Winder.UI.Client.UiModule
IUnityContainer container;
IWinderSystemService winderSystem;
WarningReasonWindow warningReasonWindow;
IWarningService warningService;
DispatcherTimer timer_error;
DynAreaViewModelParams props = new DynAreaViewModelParams();
SetPLCUpdatePlan setPlan_accessory;
SetPLCUpdatePlan[] setPlan_winders = new SetPLCUpdatePlan[2];
......@@ -43,138 +39,36 @@ namespace FLY.Winder.UI.Client.UiModule
[InjectionMethod]
public void Init(
IUnityContainer container,
[Dependency("winderWarningReasonWindow")] WarningReasonWindow warningReasonWindow,
[Dependency("winderWarningService")]IWarningService warningService,
IWinderSystemService winderSystemService)
{
this.container = container;
winderSystem = winderSystemService;
//创建窗口观察 报警原因列表
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 = winderSystem;
grid_error.DataContext = props;
//注册属性更新计划
string objname = nameof(winderSystem.Accessory);
setPlan_accessory = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Accessory,
objname,
new string[]
{
"Velocity"
nameof(winderSystem.Accessory.Velocity)
});
for (int i = 0; i < 2; i++)
{
objname = $"{nameof(winderSystem.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[]
{
"MeasureLen",
"MeasurePreWarning"
nameof(Common.WinderInsideOutside.MeasureLen),
nameof(Common.WinderInsideOutside.MeasurePreWarning)
});
}
winderSystem.PropertyChanged += (s, e) =>
{
if (e.PropertyName == "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 (winderSystem is FObjServiceClient)
{
if (!(winderSystem as FObjServiceClient).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
{
/// <summary>
/// 有异常
/// </summary>
public bool IsError { get; set; }
/// <summary>
/// 异常消息
/// </summary>
public string Error { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
public class UiModule2_DynAreaWinder : IUiModule2
{
/// <summary>
......
......@@ -43,11 +43,12 @@ namespace FLY.Winder.UI.Client.UiModule
grid_winder.DataContext = winderSystem;
//注册属性更新计划
string objname = nameof(IWinderSystemService.Accessory);
setPlan_accessory = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Accessory,
objname,
new string[] {
nameof(WinderAccessory.VelocitySet),
nameof(WinderAccessory.IsVelocityChanged),
......@@ -80,9 +81,10 @@ namespace FLY.Winder.UI.Client.UiModule
for (int i = 0; i < 2; i++)
{
objname = $"{nameof(IWinderSystemService.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[] {
nameof(WinderInsideOutside.MeasureLenSet),
nameof(WinderInsideOutside.MeasurePreWarning),
......
......@@ -43,11 +43,12 @@ namespace FLY.Winder.UI.Client.UiModule
grid_winder.DataContext = winderSystem;
//注册属性更新计划
string objname = nameof(IWinderSystemService.Accessory);
setPlan_accessory = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Accessory,
objname,
new string[] {
nameof(WinderAccessory.VelocitySet),
nameof(WinderAccessory.IsVelocityChanged),
......@@ -80,9 +81,10 @@ namespace FLY.Winder.UI.Client.UiModule
for (int i = 0; i < 2; i++)
{
objname = $"{nameof(IWinderSystemService.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[] {
nameof(WinderInsideOutside.MeasureLenSet),
nameof(WinderInsideOutside.MeasurePreWarning),
......
......@@ -41,21 +41,22 @@ namespace FLY.Winder.UI.Client.UiModule
//注册属性更新计划
for (int i = 0; i < 2; i++)
{
string objname = $"{nameof(IWinderSystemService.Items)}[{i}]";
setPlan_winders[i] = new SetPLCUpdatePlan(
winderSystem.PLCos,
winderSystem.Items[i],
objname,
new string[] {
"IsTongAuto",
"TurnoverInching",
"CuttingFilm",
"TurnoverOrg",
"PressureArmOffset",
"PushRod",
"TongLoosen",
"TongUp",
"TongDown",
"TongIn",
"TongOut" });
nameof(Common.WinderInsideOutside.IsTongAuto),
nameof(Common.WinderInsideOutside.TurnoverInching),
nameof(Common.WinderInsideOutside.CuttingFilm),
nameof(Common.WinderInsideOutside.TurnoverOrg),
nameof(Common.WinderInsideOutside.PressureArmOffset),
nameof(Common.WinderInsideOutside.PushRod),
nameof(Common.WinderInsideOutside.TongLoosen),
nameof(Common.WinderInsideOutside.TongUp),
nameof(Common.WinderInsideOutside.TongDown),
nameof(Common.WinderInsideOutside.TongIn),
nameof(Common.WinderInsideOutside.TongOut) });
}
}
......
......@@ -61,6 +61,15 @@
<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="WdDRList.xaml.cs">
<DependentUpon>WdDRList.xaml</DependentUpon>
</Compile>
<Compile Include="WdSetup.xaml.cs">
<DependentUpon>WdSetup.xaml</DependentUpon>
</Compile>
......@@ -76,6 +85,18 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="PgLoading.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PgMain.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdDRList.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdSetup.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
<Window x:Class="FLY.Winder.UI.Server.MainWindow"

<NavigationWindow x:Class="FLY.Winder.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"
xmlns:local="clr-namespace:FLY.Winder.UI.Server"
mc:Ignorable="d"
Title="MainWindow" SizeToContent="WidthAndHeight" >
<Grid>
<Grid x:Name="grid_plc"/>
<Grid x:Name="grid_plcos"/>
<StackPanel >
<StackPanel Orientation="Horizontal" >
<StackPanel Orientation="Vertical" Margin="4" DataContext="{Binding DataContext,ElementName=grid_plc}">
<TextBlock Text="更新速度" />
<TextBlock Text="{Binding ActUpdateInterval}" FontSize="20"/>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="4" DataContext="{Binding DataContext,ElementName=grid_plcos}">
<TextBlock Text="PLC连接状态" />
<TextBlock Text="{Binding IsConnectedWithPLC}" FontSize="20"/>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="4" DataContext="{Binding DataContext,ElementName=grid_plc}">
<TextBlock Text="寄存器更新数" />
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding DRNeedUpdateCnt}" FontSize="20"/>
<TextBlock Text="/"/>
<TextBlock Text="{Binding DRCnt}" FontSize="20"/>
</StackPanel>
</StackPanel>
</StackPanel>
<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>
using System;
using FLY.Winder.Server;
using FLY.Winder.Server.OBJProxy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -17,37 +19,39 @@ namespace FLY.Winder.UI.Server
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : NavigationWindow
{
FLY.AppHelper.WindowNotifyIconHelper notifyiconhelper;
FLY.Winder.Server.TDGage gage;
FLY.Winder.Server.OBJProxy.OBJProxy oBJProxy;
TDGage gage;
OBJProxy oBJProxy;
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();
private async void NavigationWindow_Loaded(object sender, RoutedEventArgs _e)
{
gage = new TDGage("Gage1");
await gage.Init();
oBJProxy = new OBJProxy(0, gage);
FObjBase.PollModule.Current.Start();
gage = new FLY.Winder.Server.TDGage("Gage1");
oBJProxy = new Winder.Server.OBJProxy.OBJProxy(0, gage);
FLY.OBJComponents.Server.PLCProxySystem plsos =
gage.mData.PLCos as FLY.OBJComponents.Server.PLCProxySystem;
grid_plcos.DataContext = plsos;
grid_plc.DataContext = plsos.PLCs[0];
}
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();
w.Owner = this;
w.ShowDialog();
}
}
}
<Page x:Class="FLY.Winder.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"
xmlns:local="clr-namespace:FLY.Winder.UI.Server"
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>
using System;
using System.Windows.Controls;
using System.Windows.Threading;
namespace FLY.Winder.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.Winder.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.Winder.UI.Server"
mc:Ignorable="d"
Title="PgMain" Height="210" Width="405">
<Page.Resources>
<local:PgMainVmUt x:Key="viewModel"/>
</Page.Resources>
<Grid d:DataContext="{StaticResource viewModel}">
<StackPanel Margin="5">
<ItemsControl x:Name="itemcontrol" ItemsSource="{Binding PLCs}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" >
<TextBlock Text="更新速度" />
<TextBlock FontSize="20">
<Run Text="{Binding ActUpdateInterval,StringFormat=\{0:sfff\}, Mode=OneWay}" />
<Run Text="ms" FontSize="15"/>
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="{Binding Client.RemoteAddr,Mode=OneWay}" />
<TextBlock >
连接状态[<Run Text="{Binding Client.IsConnected,Mode=OneWay}" FontSize="20"/>]
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="异常次数" />
<TextBlock Text="{Binding ErrorCnt}" FontSize="20"/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="寄存器更新数" />
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="20">
<Run Text="{Binding DRNeedUpdateCnt,Mode=OneWay}"/>/<Run Text="{Binding DRCnt,Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</StackPanel>
<Button Margin="4" Padding="5,2" Content="..." Tag="{Binding .}" Click="btnMoreClick"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnSetupClick"></Button>
</StackPanel>
</Grid>
</Page>

using FLY.Winder.Server;
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.Winder.UI.Server
{
/// <summary>
/// PgMain.xaml 的交互逻辑
/// </summary>
public partial class PgMain : Page
{
public PgMain()
{
InitializeComponent();
}
public void Init(TDGage gage)
{
var plsos = gage.mData.PLCos as FLY.OBJComponents.Server.PLCProxySystem;
this.itemcontrol.ItemsSource = plsos.PLCs;
}
private void btnSetupClick(object sender, RoutedEventArgs e)
{
WdSetup w = new WdSetup();
w.Owner = App.Current.MainWindow;
w.ShowDialog();
}
private void btnMoreClick(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
var plc = button.Tag as Modbus.WithThread.ModbusMapper_Client;
WdDRList w = new WdDRList();
w.Init(plc);
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; }
}
}
......@@ -7,12 +7,12 @@ using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("收卷服务器")]
[assembly: AssemblyTitle("FLY.Winder.UI.Server")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("佛山市枫莱尔自动化技术有限公司")]
[assembly: AssemblyProduct("收卷服务器")]
[assembly: AssemblyCopyright("Copyright © 2021 flyautomation")]
[assembly: AssemblyCopyright("Copyright © 2021 FlyAutomation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......@@ -51,6 +51,6 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.36.0.0")]
[assembly: AssemblyFileVersion("6.36.0.0")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
[assembly: Guid("0CE35EA7-927A-41C0-9DC6-80511329760B")]
<Window x:Class="FLY.Winder.UI.Server.WdDRList"
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:FLY.Winder.UI.Server"
mc:Ignorable="d"
Title="DRList" Height="450" Width="800">
<Grid>
<DataGrid x:Name="dataGrid" AutoGenerateColumns="True" IsReadOnly="True"/>
</Grid>
</Window>
using FLY.Modbus;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Shapes;
namespace FLY.Winder.UI.Server
{
/// <summary>
/// DRList.xaml 的交互逻辑
/// </summary>
public partial class WdDRList : Window
{
ObservableCollection<DataToRegsView> dataToRegsViews = new ObservableCollection<DataToRegsView>();
Modbus.WithThread.ModbusMapper_Client plc;
public WdDRList()
{
InitializeComponent();
}
public void Init(Modbus.WithThread.ModbusMapper_Client plc)
{
this.plc = plc;
for (int i = 0; i < plc.DRmap.Count(); i++)
{
var dr = plc.DRmap[i];
//获取描述
var type = dr.owner.GetType();
var propertyInfo = type.GetProperty(dr.propertyName);
var attributes = propertyInfo.GetCustomAttributes(typeof(DescriptionAttribute), false);
string description = "";
if (attributes.Length > 0)
{
description = (attributes.First() as DescriptionAttribute).Description;
}
dataToRegsViews.Add(new DataToRegsView()
{
dr = dr,
Addr = dr.addr,
DataArea = dr.dataArea,
IsNeedUpdate = dr.isNeedUpdate,
PropertyName = dr.propertyName,
Description = description,
Value = dr.value
});
}
plc.PropertyChanged += Plc_PropertyChanged;
plc.NameDataChanged += Plc_NameDataChanged;
dataGrid.ItemsSource = dataToRegsViews;
}
private void Plc_NameDataChanged(object sender, DataToRegs dr)
{
var drViews = from _drView in dataToRegsViews
where _drView.dr == dr
select _drView;
if (drViews.Count() == 0)
return;
var drView = drViews.First();
drView.Value = dr.value;
}
private void Plc_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(plc.PlanUpdateTime))
{
for (int i = 0; i < plc.DRmap.Count(); i++)
{
var dr = plc.DRmap[i];
dataToRegsViews[i].IsNeedUpdate = dr.isNeedUpdate;
}
}
}
}
/// <summary>
/// 数据映射的类;
/// Data: PC 属性
/// Regs: PLC 对象(寄存器、线圈)
/// </summary>
public class DataToRegsView : INotifyPropertyChanged
{
public DataToRegs dr;
/// <summary>
/// 对应 PLC寄存器区 coil or register
/// </summary>
public PLCAddressArea DataArea { get; set; }
/// <summary>
/// PLC 首地址
/// </summary>
public int Addr { get; set; }
/// <summary>
/// object 的 property 名称, 只能是 数字类型都是double, 剩下就是 bool
/// </summary>
public string PropertyName { get; set; }
/// <summary>
/// property 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// property 的值, 没有缩小. 只有 double 与 bool
/// </summary>
public object Value { get; set; }
/// <summary>
/// 需要从PLC读取数据更新
/// </summary>
public bool IsNeedUpdate { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
///
/// </summary>
/// <returns></returns>
public override string ToString()
{
return PropertyName + " [" + ((int)DataArea).ToString() + "](" + Addr + ")";
}
}
}
......@@ -58,25 +58,19 @@ namespace FLY.Winder.Client
}
Accessory = new WinderAccessory();
syncPropServiceClient = new SyncPropServiceClient(
mServerID + 1,
new Dictionary<string, INotifyPropertyChanged>
var objnames = new Dictionary<string, INotifyPropertyChanged>
{
{"Accessory", Accessory },
{"Items[0]", Items[0] },
{"Items[1]", Items[1] }
});
{nameof(Accessory), Accessory },
{$"{nameof(Items)}[0]", Items[0] },
{$"{nameof(Items)}[1]", Items[1] }
};
syncPropServiceClient = new SyncPropServiceClient(
mServerID + 1, objnames);
PLCos = new PLCProxySystemServiceClient(
mServerID + 2,
new Dictionary<string, INotifyPropertyChanged>
{
{"Accessory", Accessory },
{"Items[0]", Items[0] },
{"Items[1]", Items[1] }
});
mServerID + 2);
}
public override UInt32[] GetIDs()
......

using FLY.OBJComponents.IService;
using FLY.OBJComponents.Server.OBJProxy;
using FLY.Winder.IService;
using FLY.Winder.Server.Model;
......@@ -24,9 +25,10 @@ namespace FLY.Winder.Server.OBJProxy
typeof(IBulkDbService),
gage.mHistoryDb.WinderInfoBuffer);
var mWarnSystemOBJProxy = new WarningSystem_OBJProxy(
var mWarnSystemOBJProxy = new FObjBase.Reflect.Reflect_Proxy(
objsys_idx,
OBJ_INTERFACE.OBJ_INTERFACE.WARNING_OBJ_ID,
typeof(IWarningSystem2Service),
gage.mWarning);
winderSystemOBJProxy.CurrObjSys.Start_Conn_Server(
......
......@@ -24,7 +24,7 @@ namespace FLY.Winder.Server
/// <summary>
/// 报警系统
/// </summary>
public WarningSystem mWarning;
public WarningSystem2 mWarning;
public HistoryDb mHistoryDb;
......@@ -43,27 +43,40 @@ namespace FLY.Winder.Server
}
System.Environment.CurrentDirectory = mParamDirectory;
Init1();
mSysParam = new SysParam();
mData = new WinderSystem();
mDbModel = new DbModel();
mHistoryDb = new HistoryDb();
mWarning = new WarningSystem2();
}
#region Init登陆服务器初始化----------------------------------------------------
/// <summary>
/// 第1步, 加载本地数据
/// </summary>
public void Init1()
public async Task Init()
{
mSysParam = new SysParam();
mData = new WinderSystem();
//---------------------------------------------------------------------------------------------------------------
//数据库
mDbModel = new DbModel();
mDbModel.Init();
mDbModel.KeepDBSize(mSysParam.DBKeepMonth);
mHistoryDb = new 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);
......
......@@ -37,7 +37,7 @@ namespace FLY.Winder.Server
/// <summary>
/// 报警系统
/// </summary>
WarningSystem warning;
WarningSystem2 warning;
/// <summary>
/// 记录到数据库
/// </summary>
......@@ -59,7 +59,7 @@ namespace FLY.Winder.Server
}
public void Init(HistoryDb historyDb, WarningSystem warning)
public void Init(HistoryDb historyDb, WarningSystem2 warning)
{
this.historyDb = historyDb;
this.warning = warning;
......
Subproject commit 21c5a6f2918cee129c3743cf9492a0db5d238a4d
Subproject commit 85d39bdfc3d7b84fee2e239de1139e63ac5ee0ef
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