Commit 391b4130 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 IBC添加吸料

parent ed4e7d10
......@@ -113,11 +113,35 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UiModule\FeederPanel\FeederPanel2.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\FeederPanel\FeederPanelStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\FeederPanel\FeederStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\FeederPanel\UcFeeder.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\FeederPanel\UcFeeder2.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\TempAreaPanel\TempAreaPanel2.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\TempAreaPanel\UcTcSet.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\MainPanel\MainPanelStyle.xaml">
<Page Include="UiModule\IbcPanel\MainPanelStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
......@@ -125,7 +149,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UiModule\MainPanel\MainPanel2.xaml">
<Page Include="UiModule\IbcPanel\MainPanel2.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
......@@ -141,7 +165,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UiModule\MainPanel\MainPanel.xaml">
<Page Include="UiModule\IbcPanel\MainPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
......@@ -165,7 +189,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\MainPanel\WdK123.xaml">
<Page Include="UiModule\IbcPanel\WdK123.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
......@@ -198,6 +222,18 @@
<Compile Include="PgTempAreaParam.xaml.cs">
<DependentUpon>PgTempAreaParam.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\FeederPanel\FeederPanel2.xaml.cs">
<DependentUpon>FeederPanel2.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\FeederPanel\UcFeeder.xaml.cs">
<DependentUpon>UcFeeder.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\FeederPanel\UcFeeder2.xaml.cs">
<DependentUpon>UcFeeder2.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\TempAreaPanel\TempAreaPanel2.xaml.cs">
<DependentUpon>TempAreaPanel2.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\TempAreaPanel\UcTcSet.xaml.cs">
<DependentUpon>UcTcSet.xaml</DependentUpon>
</Compile>
......@@ -207,7 +243,7 @@
<Compile Include="UiModule\IbcCtrlGraph\IbcCtrlGraphParams.cs" />
<Compile Include="UiModule\IbcCtrlGraph\IbcCtrlGraphVm.cs" />
<Compile Include="UiModule\IbcCtrlGraph\IbcCtrlGraphVmUt.cs" />
<Compile Include="UiModule\MainPanel\MainPanel2.xaml.cs">
<Compile Include="UiModule\IbcPanel\MainPanel2.xaml.cs">
<DependentUpon>MainPanel2.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\MenuSetting2.xaml.cs">
......@@ -219,7 +255,7 @@
<Compile Include="UiModule\DynAreaIbc.xaml.cs">
<DependentUpon>DynAreaIbc.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\MainPanel\MainPanel.xaml.cs">
<Compile Include="UiModule\IbcPanel\MainPanel.xaml.cs">
<DependentUpon>MainPanel.xaml</DependentUpon>
</Compile>
<Compile Include="PgMenu.xaml.cs">
......@@ -247,7 +283,7 @@
<Compile Include="UiModule\IbcCtrlGraph\WdGraphSet.xaml.cs">
<DependentUpon>WdGraphSet.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\MainPanel\WdK123.xaml.cs">
<Compile Include="UiModule\IbcPanel\WdK123.xaml.cs">
<DependentUpon>WdK123.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\TempAreaPanel\WdTempAreaSet.xaml.cs">
......
......@@ -17,7 +17,7 @@
<!--颜色 文字.输入框.背景 -->
<SolidColorBrush x:Key="Color_text_activity_background" Color="#50587c"/>
<!--颜色 标题.输入框.警告 -->
<SolidColorBrush x:Key="Color_title_activity_warning" Color="#f92649"/>
......@@ -42,11 +42,11 @@
<!--颜色 警告-->
<SolidColorBrush x:Key="Color_warning" Color="#e44c65"/>
<!--颜色 表格边框-->
<SolidColorBrush x:Key="Color_table_border" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="Color_table_alter_row" Color="#80587c"/>
<!--颜色 存放很多块 的容器背景色-->
<SolidColorBrush x:Key="Color_bottom" Color="#1c233d"/>
<!--颜色 块的底色-->
......@@ -54,11 +54,32 @@
<!--颜色 比块的底色白一点,用于弱强调 -->
<SolidColorBrush x:Key="Color_background2" Color="#50587c"/>
<!--颜色 灯的颜色 -->
<SolidColorBrush x:Key="Color_bright" Color="Yellow"/>
<SolidColorBrush x:Key="Color_extinguish" Color="#FF636363"/>
<!--颜色 仪表板.数码管绿色 -->
<SolidColorBrush x:Key="SegGreenBrush" Color="#78b649"/>
<!--颜色 仪表板.数码管红色 -->
<SolidColorBrush x:Key="SegOrangeBrush" Color="#d67234"/>
<!--颜色 仪表板.数码管底色 -->
<SolidColorBrush x:Key="SegBgBrush" Color="#222222"/>
<!--颜色 仪表板.绿灯 -->
<SolidColorBrush x:Key="LedGreenBrush" Color="#78b649"/>
<!--颜色 仪表板.红灯 -->
<SolidColorBrush x:Key="LedRedBrush" Color="#2e3554"/>
<!--颜色 仪表板.印刷字 -->
<SolidColorBrush x:Key="PrintBrush" Color="White"/>
<!--颜色 仪表板.最下放品牌栏 -->
<SolidColorBrush x:Key="BrandBrush" Color="#FF4cc5f4"/>
<!--颜色 仪表板.底色 -->
<SolidColorBrush x:Key="DashBoardBrush" Color="#384064"/>
<!--颜色 仪表板.边框 -->
<SolidColorBrush x:Key="DashBoardBorderBrush" Color="Black"/>
</ResourceDictionary>
\ No newline at end of file
......@@ -3,10 +3,10 @@
<!--颜色 标题-->
<SolidColorBrush x:Key="Color_title" Color="#FF464646"/>
<!--颜色 单位-->
<SolidColorBrush x:Key="Color_unit" Color="#FF464646"/>
<!--颜色 文字-->
<SolidColorBrush x:Key="Color_text" Color="#FF0b0b0b"/>
......@@ -18,7 +18,7 @@
<!--颜色 文字.输入框.背景 -->
<SolidColorBrush x:Key="Color_text_activity_background" Color="#8880C3EE"/>
<!--颜色 标题.输入框.警告 -->
<SolidColorBrush x:Key="Color_title_activity_warning" Color="#f92649"/>
......@@ -27,7 +27,7 @@
<!--颜色 文字.输入框.背景.警告 -->
<SolidColorBrush x:Key="Color_text_activity_background_warning" Color="#88f07085"/>
<!--加减按钮颜色-->
<SolidColorBrush x:Key="Color_theme_minus" Color="#FFEE5610"/>
<SolidColorBrush x:Key="Color_theme_plus" Color="#FF008BE5"/>
......@@ -46,7 +46,7 @@
<!--颜色 警告-->
<SolidColorBrush x:Key="Color_warning" Color="DarkRed"/>
<!--颜色 表格边框-->
<SolidColorBrush x:Key="Color_table_border" Color="#FF0b0b0b"/>
<SolidColorBrush x:Key="Color_table_alter_row" Color="LightGray"/>
......@@ -56,12 +56,34 @@
<!--颜色 块的底色-->
<SolidColorBrush x:Key="Color_background" Color="White"/>
<!--颜色 比块的底色白一点,用于弱强调 -->
<SolidColorBrush x:Key="Color_background2" Color="WhiteSmoke"/>
<SolidColorBrush x:Key="Color_background2" Color="#e9e9e9"/>
<!--颜色 灯的颜色 -->
<SolidColorBrush x:Key="Color_bright" Color="#FF008BE5"/>
<SolidColorBrush x:Key="Color_extinguish" Color="#FF888888"/>
<!--颜色 仪表板.数码管绿色 -->
<!--<SolidColorBrush x:Key="SegGreenBrush" Color="#4f7333"/>-->
<SolidColorBrush x:Key="SegGreenBrush" Color="#00561f"/>
<!--颜色 仪表板.数码管红色 -->
<SolidColorBrush x:Key="SegOrangeBrush" Color="#005083"/>
<!--颜色 仪表板.数码管底色 -->
<SolidColorBrush x:Key="SegBgBrush" Color="#e9e9e9"/>
<!--颜色 仪表板.绿灯 -->
<SolidColorBrush x:Key="LedGreenBrush" Color="#78b649"/>
<!--颜色 仪表板.红灯 -->
<SolidColorBrush x:Key="LedRedBrush" Color="#676767"/>
<!--颜色 仪表板.印刷字 -->
<SolidColorBrush x:Key="PrintBrush" Color="#FF464646"/>
<!--颜色 仪表板.最下放品牌栏 -->
<SolidColorBrush x:Key="BrandBrush" Color="#69c4ff"/>
<!--颜色 仪表板.底色 -->
<SolidColorBrush x:Key="DashBoardBrush" Color="White"/>
<!--颜色 仪表板.边框 -->
<SolidColorBrush x:Key="DashBoardBorderBrush" Color="Black"/>
</ResourceDictionary>
\ No newline at end of file
<UserControl x:Class="FLY.IBC.UI.Client.UiModule.FeederPanel2"
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.IBC.UI.Client.UiModule"
mc:Ignorable="d" d:DesignWidth="1600" d:DesignHeight="954">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="FeederPanelStyle.xaml"/>
<ResourceDictionary Source="FeederStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid d:DataContext="{StaticResource ibcServiceUt}">
<ItemsControl x:Name="ic" ItemsSource="{Binding FeederDatas}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="{Binding ElementName=ic,Path=Items.Count}"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl ContentTemplate="{StaticResource Feeder2Template}" Content="{Binding .}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</UserControl>
using FLY.IBC.Client;
using FLY.IBC.IService;
using FLY.OBJComponents.Client;
using MultiLayout.UiModule;
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.Navigation;
using System.Windows.Shapes;
using Unity;
namespace FLY.IBC.UI.Client.UiModule
{
/// <summary>
/// FeederPanel.xaml 的交互逻辑
/// </summary>
public partial class FeederPanel2 : UserControl
{
IIbcSystemService ibcSystemService;
IUnityContainer container;
List<SetPLCUpdatePlan> setPlan_feederDatas = new List<SetPLCUpdatePlan>();
public FeederPanel2()
{
InitializeComponent();
}
[InjectionMethod]
public void Init(
IUnityContainer container,
IIbcSystemService downBlowingSystemService)
{
this.ibcSystemService = downBlowingSystemService;
this.DataContext = this.ibcSystemService;
for (int i = 0; i < this.ibcSystemService.FeederDatas.Count(); i++)
{
string objname = $"{nameof(IIbcSystemService.FeederDatas)}[{i}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.ibcSystemService.PLCos,
objname,
UcFeeder.update_propertynames);
setPlan_feederDatas.Add(plan);
}
if (this.ibcSystemService is IbcSystemServiceClient)
{
(this.ibcSystemService as IbcSystemServiceClient).ResetItemsEvent += ResetItemsEvent;
}
}
private void ResetItemsEvent()
{
//把多出来的删除
int remove_cnt = setPlan_feederDatas.Count() - this.ibcSystemService.FeederDatas.Count();
if (remove_cnt > 0)
{
for (int i = 0; i < remove_cnt; i++)
{
SetPLCUpdatePlan plan = setPlan_feederDatas[setPlan_feederDatas.Count() - 1 - i];
plan.Dispose();
}
setPlan_feederDatas.RemoveRange(setPlan_feederDatas.Count() - remove_cnt, remove_cnt);
}
else
{
int start_idx = setPlan_feederDatas.Count();
int add_cnt = -remove_cnt;
for (int i = 0; i < add_cnt; i++)
{
string objname = $"{nameof(IIbcSystemService.FeederDatas)}[{start_idx + i}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.ibcSystemService.PLCos,
objname,
UcFeeder.update_propertynames);
setPlan_feederDatas.Add(plan);
}
}
}
}
public class UiModule2_FeederPanel2 : IUiModule2
{
/// <summary>
/// 控件标题
/// 它的值取决于culture
/// </summary>
public string Title => "IBC.吸料2";
public ComponentType Type => ComponentType.Graph;
public bool IsUnique => true;
/// <summary>
/// 控件
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetComponent(int id, IUnityContainer container)
{
FeederPanel2 graph = new FeederPanel2();
container.BuildUp(graph);
return graph;
}
/// <summary>
/// 控件缩略图,用于编辑界面时,大致看看
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetThumbnail()
{
return new System.Windows.Controls.Grid();
}
/// <summary>
/// 给出全部控件ID, 控件自行删除没有的参数
/// </summary>
/// <param name="IDs"></param>
public void MatchParam(int[] IDs)
{
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:flyctrl="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.IBC.UI.Client;component/Themes/Styles2.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:flyctrl="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" >
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="FeederPanelStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!--单层吸料界面模板 横向-->
<DataTemplate x:Key="FeederTemplate">
<Grid >
<Border Style="{StaticResource Styles.Module.Border}" Background="{StaticResource Color_background}">
<Viewbox Margin="{StaticResource ControlMargin}" Stretch="Uniform" StretchDirection="DownOnly" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid >
<StackPanel>
<Border Width="100" Background="{StaticResource Color_badgeBg}" Margin="3" HorizontalAlignment="Left">
<TextBlock Text="{Binding Number}" Width="100" Height="100" FontSize="100" FontWeight="Bold" FontFamily="Arial Black" Foreground="{StaticResource Color_badgeText}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</Border>
<ItemsControl ItemsSource="{Binding Feeders}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
<Grid>
<flyctrl:ToggleButtonOnOff Style="{StaticResource ToggleButtonOnOffStyle}" Width="140"
Margin="{StaticResource ControlMargin}"
OnLabel="吸料开" OnBrush="{StaticResource Color_on}"
OffLabel="吸料关" OffBrush="{StaticResource Color_off}"
IsChecked="{Binding IsFeederOn}"/>
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Padding="6,2" Margin="0,-5,-5,0"
Background="{StaticResource Color_badgeBg}" Foreground="{StaticResource Color_badgeText}"
FontSize="30"
Text="{Binding Number}" />
</Grid>
<Grid Width="20"/>
<Button Style="{StaticResource MahApps.Styles.Button.Square.Accent}"
Padding="20,5" Margin="{StaticResource ControlMargin}"
FontSize="{StaticResource FontSize_title}"
Content="复位"
Visibility="{Binding IsFeederResetValid,Converter={StaticResource visbilityconv}}">
<i:Interaction.Behaviors>
<flyctrl:Set1Behavior Binding="{Binding FeederReset}"/>
</i:Interaction.Behaviors>
</Button>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</Viewbox>
</Border>
</Grid>
</DataTemplate>
<!--单层吸料界面模板 纵向-->
<DataTemplate x:Key="Feeder2Template">
<Grid >
<Border Style="{StaticResource Styles.Module.Border}" Background="{StaticResource Color_background}">
<Viewbox Margin="{StaticResource ControlMargin}" Stretch="Uniform" StretchDirection="DownOnly" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid >
<StackPanel>
<Border Width="100" Background="{StaticResource Color_badgeBg}" Margin="3" HorizontalAlignment="Left">
<TextBlock Text="{Binding Number}" Width="100" Height="100" FontSize="100" FontWeight="Bold" FontFamily="Arial Black" Foreground="{StaticResource Color_badgeText}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</Border>
<ItemsControl ItemsSource="{Binding Feeders}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Margin="{StaticResource ControlMargin}">
<Grid HorizontalAlignment="Left">
<flyctrl:ToggleButtonOnOff Style="{StaticResource ToggleButtonOnOffStyle}" Width="140"
Margin="{StaticResource ControlMargin}"
OnLabel="吸料开" OnBrush="{StaticResource Color_on}"
OffLabel="吸料关" OffBrush="{StaticResource Color_off}"
IsChecked="{Binding IsFeederOn}"/>
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Padding="6,2" Margin="0,-5,-5,0"
Background="{StaticResource Color_badgeBg}" Foreground="{StaticResource Color_badgeText}"
FontSize="30"
Text="{Binding Number}" />
</Grid>
<Grid Width="20"/>
<Button Style="{StaticResource MahApps.Styles.Button.Square.Accent}"
Padding="20,5" Margin="{StaticResource ControlMargin}"
FontSize="{StaticResource FontSize_title}"
Content="复位"
Visibility="{Binding IsFeederResetValid,Converter={StaticResource visbilityconv}}">
<i:Interaction.Behaviors>
<flyctrl:Set1Behavior Binding="{Binding FeederReset}"/>
</i:Interaction.Behaviors>
</Button>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</Viewbox>
</Border>
</Grid>
</DataTemplate>
</ResourceDictionary>
\ No newline at end of file
<UserControl x:Class="FLY.IBC.UI.Client.UiModule.UcFeeder"
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.Client.UiModule"
xmlns:flyctrl="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:ut="clr-namespace:FLY.IBC.UI.Client.UnitTests"
mc:Ignorable="d" >
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="FeederPanelStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid d:DataContext="{Binding Source={StaticResource ibcServiceUt},Path=FeederDatas[0]}">
<Border Style="{StaticResource Styles.Module.Border}" Background="{StaticResource Color_background}">
<Viewbox Margin="{StaticResource ControlMargin}" Stretch="Uniform" StretchDirection="DownOnly" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid >
<StackPanel>
<Border Width="100" Background="{StaticResource Color_badgeBg}" Margin="3" HorizontalAlignment="Left">
<TextBlock Text="{Binding Number}" Width="100" Height="100" FontSize="100" FontWeight="Bold" FontFamily="Arial Black" Foreground="{StaticResource Color_badgeText}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</Border>
<ItemsControl ItemsSource="{Binding Feeders}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
<Grid>
<flyctrl:ToggleButtonOnOff Style="{StaticResource ToggleButtonOnOffStyle}" Width="140"
Margin="{StaticResource ControlMargin}"
OnLabel="吸料开" OnBrush="{StaticResource Color_on}"
OffLabel="吸料关" OffBrush="{StaticResource Color_off}"
IsChecked="{Binding IsFeederOn}"/>
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Padding="6,2" Margin="0,-5,-5,0"
Background="{StaticResource Color_badgeBg}" Foreground="{StaticResource Color_badgeText}"
FontSize="30"
Text="{Binding Number}" />
</Grid>
<Grid Width="20"/>
<Button Style="{StaticResource MahApps.Styles.Button.Square.Accent}"
Padding="20,5" Margin="{StaticResource ControlMargin}"
FontSize="{StaticResource FontSize_title}"
Content="复位"
Visibility="{Binding IsFeederResetValid,Converter={StaticResource visbilityconv}}">
<i:Interaction.Behaviors>
<flyctrl:Set1Behavior Binding="{Binding FeederReset}"/>
</i:Interaction.Behaviors>
</Button>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</Viewbox>
</Border>
</Grid>
</UserControl>
using FLY.IBC.Common;
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.Navigation;
using System.Windows.Shapes;
namespace FLY.IBC.UI.Client.UiModule
{
/// <summary>
/// UcFeeder.xaml 的交互逻辑
/// </summary>
public partial class UcFeeder : UserControl
{
public static string[] update_propertynames;
static UcFeeder() {
string[] propertynames = new string[] {
nameof(FeederData.IsFeederOn1),
nameof(FeederData.IsFeederResetValid1),
nameof(FeederData.FeederReset1)
};
List<string> update_propertynames = new List<string>();
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < propertynames.Count(); j++)
{
update_propertynames.Add(propertynames[j].Replace("1", (i + 1).ToString()));
}
}
UcFeeder.update_propertynames = update_propertynames.ToArray();
}
public UcFeeder()
{
InitializeComponent();
}
}
}
<UserControl x:Class="FLY.DownBlowing.UI.Client.UiModule.UcFeeder2"
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.Client.UiModule"
xmlns:flyctrl="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d" >
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="FeederPanelStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid d:DataContext="{Binding Source={StaticResource ibcServiceUt},Path=FeederDatas[0]}">
<Border Style="{StaticResource Styles.Module.Border}" Background="{StaticResource Color_background}">
<Viewbox Margin="{StaticResource ControlMargin}" Stretch="Uniform" StretchDirection="DownOnly" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid >
<StackPanel>
<Border Width="100" Background="{StaticResource Color_badgeBg}" Margin="3" HorizontalAlignment="Left">
<TextBlock Text="{Binding Number}" Width="100" Height="100" FontSize="100" FontWeight="Bold" FontFamily="Arial Black" Foreground="{StaticResource Color_badgeText}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</Border>
<ItemsControl ItemsSource="{Binding Feeders}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Margin="{StaticResource ControlMargin}">
<Grid HorizontalAlignment="Left">
<flyctrl:ToggleButtonOnOff Style="{StaticResource ToggleButtonOnOffStyle}" Width="140"
Margin="{StaticResource ControlMargin}"
OnLabel="吸料开" OnBrush="{StaticResource Color_on}"
OffLabel="吸料关" OffBrush="{StaticResource Color_off}"
IsChecked="{Binding IsFeederOn}"/>
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Padding="6,2" Margin="0,-5,-5,0"
Background="{StaticResource Color_badgeBg}" Foreground="{StaticResource Color_badgeText}"
FontSize="30"
Text="{Binding Number}" />
</Grid>
<Grid Width="20"/>
<Button Style="{StaticResource MahApps.Styles.Button.Square.Accent}"
Padding="20,5" Margin="{StaticResource ControlMargin}"
FontSize="{StaticResource FontSize_title}"
Content="复位"
Visibility="{Binding IsFeederResetValid,Converter={StaticResource visbilityconv}}">
<i:Interaction.Behaviors>
<flyctrl:Set1Behavior Binding="{Binding FeederReset}"/>
</i:Interaction.Behaviors>
</Button>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</Viewbox>
</Border>
</Grid>
</UserControl>
using System.Windows.Controls;
namespace FLY.DownBlowing.UI.Client.UiModule
{
/// <summary>
/// UcFeeder.xaml 的交互逻辑
/// </summary>
public partial class UcFeeder2 : UserControl
{
public UcFeeder2()
{
InitializeComponent();
}
}
}
......@@ -3,7 +3,7 @@
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:DesignWidth="1060" d:DesignHeight="634" Unloaded="UserControl_Unloaded" >
mc:Ignorable="d" d:DesignWidth="960" d:DesignHeight="890" Unloaded="UserControl_Unloaded" >
<!--1920*1080 下图表区 1600 * 954
1280*1024 下图表区 960 * 890
1388*768 下图表区 1060 * 634-->
......
......@@ -121,7 +121,7 @@ namespace FLY.IBC.UI.Client.UiModule
/// 控件标题
/// 它的值取决于culture
/// </summary>
public string Title => "IBC.温区主界面";
public string Title => "IBC.温";
public ComponentType Type => ComponentType.Graph;
public bool IsUnique => true;
......
<UserControl x:Class="FLY.IBC.UI.Client.UiModule.TempAreaPanel2"
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:DesignWidth="960" d:DesignHeight="890" Unloaded="UserControl_Unloaded" >
<!--1920*1080 下图表区 1600 * 954
1280*1024 下图表区 960 * 890
1388*768 下图表区 1060 * 634-->
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="TempAreaPanelStyle.xaml"/>
<ResourceDictionary Source="UcTcStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid d:DataContext="{StaticResource ibcServiceUt}">
<ItemsControl x:Name="ic" ItemsSource="{Binding TAreas}" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="{Binding ElementName=ic,Path=Items.Count}"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Style="{StaticResource Styles.Button.Empty}" Tag="{Binding .}" Click="btnTAreaClick">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Style="{StaticResource Styles.Module.Border}" Background="{StaticResource Color_background}" CornerRadius="5,5,0,0" Margin="{StaticResource ControlMargin}">
<TextBlock Text="{Binding Number}" Foreground="{StaticResource Color_title}"
FontSize="50" FontWeight="Bold" FontFamily="Arial Black" TextAlignment="Center" />
</Border>
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[0]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[1]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="3" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[2]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="4" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[3]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="5" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[4]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="6" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[5]}" Margin="{StaticResource ControlMargin}"/>
</Grid>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</UserControl>
\ No newline at end of file
using FLY.IBC.Client;
using FLY.IBC.Common;
using FLY.IBC.IService;
using FLY.OBJComponents.Client;
using MultiLayout.UiModule;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Unity;
namespace FLY.IBC.UI.Client.UiModule
{
/// <summary>
/// TempAreaPanel.xaml 的交互逻辑
/// </summary>
public partial class TempAreaPanel2 : UserControl
{
IIbcSystemService ibcSystemService;
IUnityContainer container;
List<SetPLCUpdatePlan> setPlan_items = new List<SetPLCUpdatePlan>();
static string[] update_propertynames;
static TempAreaPanel2() {
string[] propertynames = new string[] {
nameof(Common.TempArea.TempPV1),
nameof(Common.TempArea.TempSV1),
nameof(Common.TempArea.IsHeating1),
nameof(Common.TempArea.IsHeatingSet1),
nameof(Common.TempArea.IsCooling1),
nameof(Common.TempArea.IsSelfAdjusting1)
};
List<string> update_propertynames = new List<string>();
for (int i = 0; i < 6; i++) {
for (int j = 0; j < propertynames.Count(); j++)
{
update_propertynames.Add(propertynames[j].Replace("1", (i + 1).ToString()));
}
}
TempAreaPanel2.update_propertynames = update_propertynames.ToArray();
}
public TempAreaPanel2()
{
InitializeComponent();
}
[InjectionMethod]
public void Init(
IUnityContainer container,
IIbcSystemService ibcSystemService)
{
this.ibcSystemService = ibcSystemService;
this.DataContext = this.ibcSystemService;
for (int i = 0; i < this.ibcSystemService.TAreas.Count(); i++)
{
string objname = $"{nameof(IIbcSystemService.TAreas)}[{i}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.ibcSystemService.PLCos,
objname,
update_propertynames);
setPlan_items.Add(plan);
}
if (ibcSystemService is IbcSystemServiceClient)
{
(ibcSystemService as IbcSystemServiceClient).ResetItemsEvent += MWeighterCsService_ResetItemsEvent;
}
}
private void MWeighterCsService_ResetItemsEvent()
{
//把多出来的删除
int remove_cnt = setPlan_items.Count() - this.ibcSystemService.TAreas.Count();
if (remove_cnt > 0)
{
for (int i = 0; i < remove_cnt; i++)
{
SetPLCUpdatePlan plan = setPlan_items[setPlan_items.Count() - 1 - i];
plan.Dispose();
}
setPlan_items.RemoveRange(setPlan_items.Count() - remove_cnt, remove_cnt);
}
else
{
int start_idx = setPlan_items.Count();
int add_cnt = -remove_cnt;
for (int i = 0; i < add_cnt; i++)
{
string objname = $"{nameof(IIbcSystemService.TAreas)}[{i+ start_idx}]";
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.ibcSystemService.PLCos,
objname,
update_propertynames);
setPlan_items.Add(plan);
}
}
}
private void btnTAreaClick(object sender, RoutedEventArgs e)
{
var button = sender as Button;
var tempArea = button.Tag as TempArea;
WdTempAreaSet w = new WdTempAreaSet();
w.Init(this.ibcSystemService, tempArea);
w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this);
w.ShowDialog();
}
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
{
}
}
public class UiModule2_TempAreaPanel2 : IUiModule2
{
/// <summary>
/// 控件标题
/// 它的值取决于culture
/// </summary>
public string Title => "IBC.温控2";
public ComponentType Type => ComponentType.Graph;
public bool IsUnique => true;
/// <summary>
/// 控件
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetComponent(int id, IUnityContainer container)
{
TempAreaPanel2 graph = new TempAreaPanel2();
container.BuildUp(graph);
return graph;
}
/// <summary>
/// 控件缩略图,用于编辑界面时,大致看看
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetThumbnail()
{
return new System.Windows.Controls.Grid();
}
/// <summary>
/// 给出全部控件ID, 控件自行删除没有的参数
/// </summary>
/// <param name="IDs"></param>
public void MatchParam(int[] IDs)
{
}
}
}
......@@ -3,7 +3,7 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.IBC.UI.Client;component/Themes/Styles2.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.IBC.UI.Client;component/Themes/Color.Dark.xaml"/>
<!--<ResourceDictionary Source="pack://application:,,,/FLY.IBC.UI.Client;component/Themes/Color.Dark.xaml"/>-->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
\ No newline at end of file
using FLY.IBC.Common;
using FLY.IBC.IService;
using FLY.OBJComponents.IService;
using FLY.OBJComponents.Server;
using MathNet.Numerics;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.IBC.UI.Client.UnitTests
{
public class IbcServiceUt
public class IbcServiceUt : IIbcSystemService
{
/// <summary>
/// 数据
......@@ -17,16 +21,33 @@ namespace FLY.IBC.UI.Client.UnitTests
public IBCData Item { get; } = new IBCData();
/// <summary>
/// 各层称重
/// 挤出温控
/// </summary>
public ObservableCollection<TempArea> TAreas { get; } = new ObservableCollection<TempArea>();
/// <summary>
/// 吸料
/// </summary>
public ObservableCollection<FeederData> FeederDatas { get; } = new ObservableCollection<FeederData>();
public FeederWarningData FeederWarningData { get; } = new FeederWarningData();
/// <summary>
/// 层数
/// </summary>
public int TAreasCnt { get; private set; }
public int FeederCnt { get; private set; }
private PLCProxySystem plcos = new PLCProxySystem();
/// <summary>
/// PLC代理系统
/// </summary>
public IPLCProxySystemService PLCos { get { return plcos; } }
public bool HasIbc { get; private set; }
public IbcServiceUt() {
HasIbc = true;
Item.IsIBCAuto = true;
Item.IsOutletAirOn = true;
Item.FilmWidth = 1001.23f;
......@@ -42,74 +63,77 @@ namespace FLY.IBC.UI.Client.UnitTests
Item.L = 3002;
Item.BubbleCorrA = 23;
TAreas.Add(new TempArea("M")
{
TempPV1 = 100,
TempPV2 = 101,
TempPV3 = 101.1f,
TempPV4 = 99.2f,
TempPV5 = 30,
TempPV6 = 29,
IsHeating1 =1,
});
TAreas.Add(new TempArea("A")
{
TempPV1 = 100,
TempPV2 = 101,
TempPV3 = 101.1f,
TempPV4 = 99.2f,
TempPV5 = 30,
TempPV6 = 29,
IsCooling2 = 1,
});
TAreas.Add(new TempArea("B")
{
TempPV1 = 100,
TempPV2 = 101,
TempPV3 = 101.1f,
TempPV4 = 99.2f,
TempPV5 = 30,
TempPV6 = 29,
IsSelfAdjusting1 = 1,
});
TAreas.Add(new TempArea("C")
TAreasCnt = 1 + 5;
for (int i = 0; i < TAreasCnt; i++)
{
TempPV1 = 100,
TempPV2 = 101,
TempPV3 = 101.1f,
TempPV4 = 99.2f,
TempPV5 = 30,
TempPV6 = 29
});
TAreas.Add(new TempArea("D")
string number = Index2Number(i);
TempArea ta = new TempArea();
ta.Init(number);
TAreas.Add(ta);
}
FeederCnt = TAreasCnt - 1;
for (int i = 0; i < FeederCnt; i++)
{
TempPV1 = 100,
TempPV2 = 101,
TempPV3 = 101.1f,
TempPV4 = 99.2f,
TempPV5 = 30,
TempPV6 = 29
});
TAreas.Add(new TempArea("E")
string number = Index2Number(i + 1);
FeederData fd = new FeederData();
fd.Init(number);
FeederDatas.Add(fd);
}
TAreas[0].TempPV1 = 100;
TAreas[0].TempPV2 = 101;
TAreas[0].TempPV3 = 101.1f;
TAreas[0].TempPV4 = 99.2f;
TAreas[0].TempPV5 = 30;
TAreas[0].TempPV6 = 29;
TAreas[0].IsHeating1 = 1;
TAreas[1].TempPV1 = 100;
TAreas[1].TempPV2 = 101;
TAreas[1].TempPV3 = 101.1f;
TAreas[1].TempPV4 = 99.2f;
TAreas[1].TempPV5 = 30;
TAreas[1].TempPV6 = 29;
TAreas[1].IsCooling2 = 1;
TAreas[2].TempPV1 = 100;
TAreas[2].TempPV2 = 101;
TAreas[2].TempPV3 = 101.1f;
TAreas[2].TempPV4 = 99.2f;
TAreas[2].TempPV5 = 30;
TAreas[2].TempPV6 = 29;
TAreas[2].IsSelfAdjusting1 = 1;
Random r = new Random();
for (int i = 3; i < TAreas.Count(); i++)
{
TempPV1 = 100,
TempPV2 = 101,
TempPV3 = 101.1f,
TempPV4 = 99.2f,
TempPV5 = 30,
TempPV6 = 29
});
TAreas[i].TempPV1 = (float)(100 + r.NextDouble() * 2);
TAreas[i].TempPV2 = 101;
TAreas[i].TempPV3 = 101.1f;
TAreas[i].TempPV4 = 99.2f;
TAreas[i].TempPV5 = 30;
TAreas[i].TempPV6 = 29;
}
TAreasCnt = TAreas.Count();
}
public event PropertyChangedEventHandler PropertyChanged;
string Index2Number(int index)
{
string number;
if (index == 0)
{
number = "M";
}
else
{
number = ((char)('A' + (index - 1))).ToString();
}
return number;
}
}
}
......@@ -20,18 +20,46 @@ namespace FLY.IBC.Client
public class IbcSystemServiceClient : FObjServiceClient, IIbcSystemService, IPropertyOpt
{
#region IIBCSystemService
#region IBC
public bool HasIbc { get; set; } = true;
/// <summary>
/// 数据
/// </summary>
public IBCData Item { get; } = new IBCData();
#endregion
#region 温控
public int TAreasCnt { get; set; } = 0;
public ObservableCollection<TempArea> TAreas { get; } = new ObservableCollection<TempArea>();
#endregion
#region 吸料
/// <summary>
/// 吸料机层数
/// </summary>
public int FeederCnt { get; set; } = 0;
/// <summary>
/// 吸料
/// </summary>
public ObservableCollection<FeederData> FeederDatas { get; } = new ObservableCollection<FeederData>();
/// <summary>
/// 吸料报警
/// </summary>
public FeederWarningData FeederWarningData { get; } = new FeederWarningData();
#endregion
/// <summary>
/// PLC代理系统
/// </summary>
public IPLCProxySystemService PLCos { get; private set; }
public int TAreasCnt { get; set; } = 0;
#endregion
SyncPropServiceClient syncPropServiceClient;
......@@ -62,19 +90,47 @@ namespace FLY.IBC.Client
FObjServiceClientManager.Instance.Connect_to_Another_OBJSys(connName, this);
}
void TAreasAdd(int i) {
string number = Index2Number_tArea(i);
//少了,需要添加
TempArea ta = new TempArea();
ta.Init(number);
TAreas.Add(ta);
}
string Index2Number_tArea(int index)
{
string number;
if (i == 0)
if (index == 0)
{
number = "M";
}
else
{
number = ((char)('A' + i - 1)).ToString();
number = ((char)('A' + (index - 1))).ToString();
}
return number;
}
void FeederDatasAdd(int i)
{
string number = Index2Number_feeder(i);
//少了,需要添加
TempArea ta = new TempArea(number);
TAreas.Add(ta);
FeederData fd = new FeederData();
fd.Init(number);
FeederDatas.Add(fd);
}
string Index2Number_feeder(int index)
{
string number;
number = ((char)('A' + (index))).ToString();
return number;
}
void Init()
{
......@@ -83,15 +139,26 @@ namespace FLY.IBC.Client
{
TAreasAdd(i);
}
for (int i = 0; i < FeederCnt; i++)
{
FeederDatasAdd(i);
}
//--------------------------------------------------------------
//属性同步
Dictionary<string, INotifyPropertyChanged> objnames = new Dictionary<string, INotifyPropertyChanged>();
objnames.Add(".", this);
objnames.Add(nameof(Item), Item);
for (int i = 0; i < TAreas.Count(); i++)
objnames.Add($"{nameof(TAreas)}[{i}]", TAreas[i]);
for (int i = 0; i < FeederDatas.Count(); i++)
objnames.Add($"{nameof(FeederDatas)}[{i}]", FeederDatas[i]);
objnames.Add(nameof(FeederWarningData), FeederWarningData);
syncPropServiceClient = new SyncPropServiceClient(mServerID + 1, objnames);
//--------------------------------------------------------------
......@@ -140,6 +207,17 @@ namespace FLY.IBC.Client
Save();
}
}
else if (e.PropertyName == nameof(FeederCnt))
{
if (IsFeederCntChanged())
{
ResetFeederDatas();
Save();
}
}
else if (e.PropertyName == nameof(HasIbc)) {
Save();
}
}
bool IsTAreasCntChanged()
{
......@@ -149,7 +227,7 @@ namespace FLY.IBC.Client
return false;
}
/// <summary>
/// 重新创建 Items
/// 重新创建 TAreas
/// </summary>
void ResetTAreas()
{
......@@ -208,6 +286,75 @@ namespace FLY.IBC.Client
ResetItemsEvent?.Invoke();
return;
}
bool IsFeederCntChanged()
{
if (FeederDatas.Count() != FeederCnt)
return true;
else
return false;
}
/// <summary>
/// 重新创建 FeederDatas
/// </summary>
void ResetFeederDatas()
{
int last_feederCnt = FeederDatas.Count();
for (int i = 0; i < FeederDatas.Count(); i++)
{
if (i < FeederCnt)
{
}
else
{
//多出来的Item 都要删除
int remove_cnt = FeederDatas.Count() - FeederCnt;
for (i = 0; i < remove_cnt; i++)
FeederDatas.RemoveAt(FeederDatas.Count() - 1);
goto _step1;
}
}
for (int i = FeederDatas.Count(); i < FeederCnt; i++)
{
//少了,需要添加
FeederDatasAdd(i);
}
_step1:
//处理属性同步
if (last_feederCnt == FeederDatas.Count())//数量相同,不需要处理
goto _step2;
if (last_feederCnt < FeederDatas.Count())
{
//少了需要添加
for (int i = last_feederCnt; i < FeederDatas.Count(); i++)
{
string objname = $"{nameof(FeederDatas)}[{i}]";
syncPropServiceClient.Add(objname, FeederDatas[i]);
}
}
else
{
//多了需要删除
for (int i = TAreas.Count(); i < last_feederCnt; i++)
{
string objname = $"{nameof(FeederDatas)}[{i}]";
syncPropServiceClient.Remove(objname);
}
}
_step2:
ResetItemsEvent?.Invoke();
return;
}
/// <summary>
///
/// </summary>
......@@ -234,7 +381,9 @@ namespace FLY.IBC.Client
public string[] GetSyncPropNames()
{
return new string[]{
nameof(TAreasCnt)
nameof(HasIbc),
nameof(TAreasCnt),
nameof(FeederCnt)
};
}
......@@ -247,5 +396,7 @@ namespace FLY.IBC.Client
public class IbcSystemClientJsonDb
{
public int TAreasCnt;
public int FeederCnt;
public bool HasIbc;
}
}
using FLY.OBJComponents.IService;
using Misc;
using System.Collections.Generic;
using System.ComponentModel;
namespace FLY.IBC.Common
{
public class FeederData : INotifyPropertyChanged, IPropertyOpt
{
public FeederData()
{
}
public void Init(string number)
{
Number = number;
FeedersBinding();
}
/// <summary>
/// 名称:A,B,C,D,E
/// </summary>
public string Number { get; set; }
#region 辅助代码生成
/// <summary>
/// 吸料开1
/// </summary>
[Description("吸料开1")]
public bool IsFeederOn1{ get; set; }
/// <summary>
/// 吸料开2
/// </summary>
[Description("吸料开2")]
public bool IsFeederOn2{ get; set; }
/// <summary>
/// 吸料开3
/// </summary>
[Description("吸料开3")]
public bool IsFeederOn3{ get; set; }
/// <summary>
/// 吸料开4
/// </summary>
[Description("吸料开4")]
public bool IsFeederOn4{ get; set; }
/// <summary>
/// 吸料开5
/// </summary>
[Description("吸料开5")]
public bool IsFeederOn5{ get; set; }
/// <summary>
/// 吸料开6
/// </summary>
[Description("吸料开6")]
public bool IsFeederOn6{ get; set; }
/// <summary>
/// 吸料复位1(按1)
/// </summary>
[Description("吸料复位1(按1)")]
public bool FeederReset1{ get; set; }
/// <summary>
/// 吸料复位2(按1)
/// </summary>
[Description("吸料复位2(按1)")]
public bool FeederReset2{ get; set; }
/// <summary>
/// 吸料复位3(按1)
/// </summary>
[Description("吸料复位3(按1)")]
public bool FeederReset3{ get; set; }
/// <summary>
/// 吸料复位4(按1)
/// </summary>
[Description("吸料复位4(按1)")]
public bool FeederReset4{ get; set; }
/// <summary>
/// 吸料复位5(按1)
/// </summary>
[Description("吸料复位5(按1)")]
public bool FeederReset5{ get; set; }
/// <summary>
/// 吸料复位6(按1)
/// </summary>
[Description("吸料复位6(按1)")]
public bool FeederReset6{ get; set; }
/// <summary>
/// 吸料复位有效1
/// </summary>
[Description("吸料复位有效1")]
public bool IsFeederResetValid1{ get; set; }
/// <summary>
/// 吸料复位有效2
/// </summary>
[Description("吸料复位有效2")]
public bool IsFeederResetValid2{ get; set; }
/// <summary>
/// 吸料复位有效3
/// </summary>
[Description("吸料复位有效3")]
public bool IsFeederResetValid3{ get; set; }
/// <summary>
/// 吸料复位有效4
/// </summary>
[Description("吸料复位有效4")]
public bool IsFeederResetValid4{ get; set; }
/// <summary>
/// 吸料复位有效5
/// </summary>
[Description("吸料复位有效5")]
public bool IsFeederResetValid5{ get; set; }
/// <summary>
/// 吸料复位有效6
/// </summary>
[Description("吸料复位有效6")]
public bool IsFeederResetValid6{ get; set; }
/// <summary>
/// NO.1未吸到料
/// </summary>
[Description("NO.1未吸到料")]
[IsError()]
public bool IsErrorOfFeeder1 { get; set; }
/// <summary>
/// NO.2未吸到料
/// </summary>
[Description("NO.2未吸到料")]
[IsError()]
public bool IsErrorOfFeeder2 { get; set; }
/// <summary>
/// NO.3未吸到料
/// </summary>
[Description("NO.3未吸到料")]
public bool IsErrorOfFeeder3 { get; set; }
/// <summary>
/// NO.4未吸到料
/// </summary>
[Description("NO.4未吸到料")]
[IsError()]
public bool IsErrorOfFeeder4 { get; set; }
/// <summary>
/// NO.5未吸到料
/// </summary>
[Description("NO.5未吸到料")]
[IsError()]
public bool IsErrorOfFeeder5 { get; set; }
/// <summary>
/// NO.6未吸到料
/// </summary>
[Description("NO.6未吸到料")]
[IsError()]
public bool IsErrorOfFeeder6 { get; set; }
#endregion
public string[] GetSyncPropNames()
{
return null;
}
public string[] GetNoSyncPropNames()
{
return new string[] {
nameof(Number),
nameof(Feeders)
};
}
public List<FeederCell> Feeders { get; } = new List<FeederCell>();
/// <summary>
/// 每个料仓 绑定到 对应的队列
/// </summary>
void FeedersBinding()
{
Feeders.Clear();
for (int i = 0; i < 6; i++)
{
int no = i + 1;
FeederCell feeder = new FeederCell();
feeder.Number = no.ToString();
Misc.BindingOperations.SetBinding(this, $"{nameof(feeder.IsFeederOn)}{no}", feeder, nameof(feeder.IsFeederOn), Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"{nameof(feeder.FeederReset)}{no}", feeder, nameof(feeder.FeederReset), Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"{nameof(feeder.IsFeederResetValid)}{no}", feeder, nameof(feeder.IsFeederResetValid));
Feeders.Add(feeder);
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
public class FeederCell : INotifyPropertyChanged
{
/// <summary>
/// 序号
/// </summary>
public string Number { get; set; }
/// <summary>
/// 吸料开1
/// </summary>
[Description("吸料开")]
public bool IsFeederOn { get; set; }
/// <summary>
/// 吸料复位(按1)
/// </summary>
[Description("吸料复位(按1)")]
public bool FeederReset { get; set; }
/// <summary>
/// 吸料复位有效
/// </summary>
[Description("吸料复位有效")]
public bool IsFeederResetValid { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
}
using Misc;
using System.ComponentModel;
namespace FLY.IBC.Common
{
public class FeederWarningData : INotifyPropertyChanged
{
public FeederWarningData()
{
}
#region 辅助代码生成
/// <summary>
/// 吸料急停开启报警
/// </summary>
[Description("吸料急停开启报警")]
[IsError()]
public bool Warning111 { get; set; }
/// <summary>
/// 吸料1号电机过载报警
/// </summary>
[Description("吸料1号电机过载报警")]
[IsError()]
public bool Warning112 { get; set; }
/// <summary>
/// 吸料2号电机过载报警
/// </summary>
[Description("吸料2号电机过载报警")]
[IsError()]
public bool Warning113 { get; set; }
#endregion
public event PropertyChangedEventHandler PropertyChanged;
}
}
......@@ -14,12 +14,15 @@ namespace FLY.IBC.Common
{
public class TempArea : INotifyPropertyChanged, IPropertyOpt
{
public TempArea(string number)
public TempArea()
{
}
public void Init(string number)
{
Number = number;
TemperaturesBinding();
}
/// <summary>
/// 名称:M,A,B,C,D,E
/// </summary>
......
......@@ -49,8 +49,10 @@
<ItemGroup>
<Compile Include="Client\BulkDbWidthServiceClient.cs" />
<Compile Include="Client\IbcSystemServiceClient.cs" />
<Compile Include="Common\FeederData.cs" />
<Compile Include="Common\IBCData.cs" />
<Compile Include="Common\TempArea.cs" />
<Compile Include="Common\FeederWarningData.cs" />
<Compile Include="IService\IBulkDbWidthService.cs" />
<Compile Include="IService\IIBCSystemService.cs" />
<Compile Include="OBJ_INTERFACE\IBC_OBJ_INTERFACE.cs" />
......
......@@ -13,23 +13,50 @@ namespace FLY.IBC.IService
{
public interface IIbcSystemService:INotifyPropertyChanged
{
/// <summary>
/// PLC代理系统
/// </summary>
IPLCProxySystemService PLCos { get; }
#region IBC
/// <summary>
/// 有IBC数据
/// </summary>
bool HasIbc { get; }
/// <summary>
/// 数据
/// </summary>
IBCData Item { get; }
#endregion
#region 温控
/// <summary>
/// 各层称重
/// 温控层数
/// </summary>
int TAreasCnt { get; }
/// <summary>
/// 温控
/// </summary>
ObservableCollection<TempArea> TAreas { get; }
#endregion
#region 吸料
/// <summary>
/// PLC代理系统
/// 吸料层数
/// </summary>
IPLCProxySystemService PLCos { get; }
int FeederCnt { get; }
/// <summary>
/// 层数
/// 吸料
/// </summary>
int TAreasCnt { get; }
ObservableCollection<FeederData> FeederDatas { get; }
/// <summary>
/// 吸料报警
/// </summary>
FeederWarningData FeederWarningData { get; }
#endregion
}
}
This diff is collapsed.
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