Browse Source

666

样式分支
fyf 2 years ago
parent
commit
484aa29d47
32 changed files with 2499 additions and 430 deletions
  1. +37
    -0
      BPASmartClient.Business/Plugin/ConfigMgr.cs
  2. +0
    -4
      BPASmartClient.Business/Plugin/DeviceMgr.cs
  3. +599
    -0
      BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml
  4. +5
    -6
      BPASmartClient.CustomResource/Themes/MyStyle.xaml
  5. +329
    -103
      BPASmartClient.CustomResource/UserControls/UserKeyBoard.xaml
  6. +7
    -7
      BPASmartClient.Device/BaseDevice.cs
  7. +2
    -1
      BPASmartClient.Helper/BPASmartClient.Helper.csproj
  8. +49
    -0
      BPASmartClient.Helper/Sqlite.cs
  9. +58
    -0
      BPASmartClient.Model/Alarm.cs
  10. +182
    -0
      BPASmartClient.Model/DeviceConfigModelJson.cs
  11. +0
    -1
      BPASmartClient.Model/KeepDataBase.cs
  12. +26
    -10
      BPASmartClient.MorkS/Alarm.cs
  13. +68
    -30
      BPASmartClient.MorkS/Control_Morks.cs
  14. +3
    -0
      BPASmartClient.MorkS/GVL_MORKS.cs
  15. +1
    -0
      BPASmartClient.MorkS/OrderLocInfo.cs
  16. +199
    -0
      BPASmartClient.ViewModel/AlarmViewModel.cs
  17. +181
    -191
      BPASmartClient.ViewModel/Model/DeviceConfigModel.cs
  18. +32
    -13
      BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
  19. +46
    -0
      BPASmartClient.ViewModel/SystemSetViewModel.cs
  20. +2
    -3
      BPASmartClient/App.config
  21. +1
    -0
      BPASmartClient/App.xaml
  22. +1
    -0
      BPASmartClient/BPASmartClient.csproj
  23. +34
    -26
      BPASmartClient/Control/AdminstratorsView.xaml
  24. +376
    -0
      BPASmartClient/Control/AlarmView.xaml
  25. +28
    -0
      BPASmartClient/Control/AlarmView.xaml.cs
  26. +7
    -7
      BPASmartClient/Control/OrderStatusView.xaml
  27. +1
    -1
      BPASmartClient/Control/ShopDeviceConfigView.xaml
  28. +2
    -2
      BPASmartClient/Control/ShopDeviceConfigView.xaml.cs
  29. +142
    -10
      BPASmartClient/Control/SystemSetView.xaml
  30. +11
    -9
      BPASmartClient/DeviceInfo.xml
  31. +5
    -5
      BPASmartClient/MainWindow.xaml
  32. +65
    -1
      BPASmartClient/MainWindow.xaml.cs

+ 37
- 0
BPASmartClient.Business/Plugin/ConfigMgr.cs View File

@@ -1,8 +1,11 @@
using BPA.ApolloClient;
using BPA.Message;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System.Collections.ObjectModel;
using System.Xml.Linq;
using System.Xml.XPath;

@@ -58,6 +61,40 @@ namespace BPASmartClient.Business
/// </summary>
private void InitDeviceModel()
{
//var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig");
//string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json";
//deviceConfigs = new List<DeviceConfig>();
//if (File.Exists(path))
//{
// string JsonString = File.ReadAllText(path);
// var result = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModelJson>>(JsonString);
// if (result != null)
// {
// foreach (var shop in result)
// {
// foreach (var device in shop.deviceModels)
// {

// DeviceConfig deviceConfig = new DeviceConfig();
// deviceConfig.Name = device.DeviceName;
// deviceConfig.Module = device.DeviceNamespace;
// deviceConfig.DeviceId = int.Parse(device.DeviceId);

// foreach (var comms in device.communicationDevcies)
// {
// BPASmartClient.Model.Peripheral peripheral = new BPASmartClient.Model.Peripheral();
// peripheral.Module = comms.CommunicationNamespace;
// }
// deviceConfigs.Add(deviceConfig);
// }
// }
// }
//}





deviceConfigs = new List<DeviceConfig>();
var devicePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DeviceInfo.xml");
var xdoc = XDocument.Load(devicePath);


+ 0
- 4
BPASmartClient.Business/Plugin/DeviceMgr.cs View File

@@ -74,8 +74,6 @@ namespace BPASmartClient.Business
}
}



public void StartService()
{
this.devices.ForEach(device =>
@@ -129,8 +127,6 @@ namespace BPASmartClient.Business
});
}



public void StopService()
{
this.devices.ForEach(device => device.Stop());


+ 599
- 0
BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml View File

@@ -0,0 +1,599 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=System.Runtime">


<!-- 使用该资源字典记得安装Util.Control Nutget包 -->
<!--#region Window窗体-->
<SolidColorBrush x:Key="WindowBackground" Color="#007ACB" />
<SolidColorBrush x:Key="WindowInnerBackground" Color="Transparent" />
<SolidColorBrush x:Key="WindowBorderBrush" Color="#920892" />
<DropShadowEffect
x:Key="WindowDropShadow"
BlurRadius="8"
Direction="0"
Opacity="0.7"
ShadowDepth="0"
Color="Red" />
<SolidColorBrush x:Key="CaptionForeground" Color="White" />
<LinearGradientBrush x:Key="CaptionBackground" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0" Color="#571457" />
<GradientStop Offset="1" Color="#6A196A" />
</LinearGradientBrush>
<!--#endregion-->

<!--#region MessageBoxX-->
<SolidColorBrush x:Key="InfoForeground" Color="White" />
<SolidColorBrush x:Key="QuestionForeground" Color="#74B80C" />
<SolidColorBrush x:Key="WarningForeground" Color="DarkOrange" />
<SolidColorBrush x:Key="ErrorForeground" Color="#E74E4E" />
<!--#endregion-->

<!--#region WaitingBox-->
<SolidColorBrush x:Key="WaitingBoxBackground" Color="#921692" />
<!--#endregion-->

<!--#region 边框:Menu-->
<DropShadowEffect
x:Key="DefaultDropShadow"
BlurRadius="5"
Direction="315"
Opacity="0.6"
ShadowDepth="2"
Color="Black" />
<!--#endregion-->

<!--#region 输入组件-->
<SolidColorBrush x:Key="TextForeground" Color="Black" />
<SolidColorBrush x:Key="TextBackground" Color="White" />
<SolidColorBrush x:Key="TextSelectionBrush" Color="#8F8787" />
<!--#endregion-->

<!--#region TextBox默认Label颜色-->
<SolidColorBrush x:Key="TextLabelBackground" Color="#508AB6" />
<!--#endregion-->

<!--#region 输入框-->
<SolidColorBrush x:Key="ControlBorderBrush" Color="#999C9F" />
<SolidColorBrush x:Key="MouseOverBorderBrush" Color="#F6D1D1" />
<SolidColorBrush x:Key="FocusBackground" Color="#365080" />
<SolidColorBrush x:Key="FocusBorderBrush" Color="#EBCECE" />
<!--#endregion-->

<!--#region ScrollBar-->
<SolidColorBrush x:Key="ScrollBarForeround" Color="#877F7F" />
<SolidColorBrush x:Key="ScrollBarBackground" Color="#3E3E42" />
<!--#endregion-->

<!--#region ItemsControl:DataGrid,Tree-->
<system:Double x:Key="HeaderFontSize">14</system:Double>
<SolidColorBrush x:Key="HeaderBorderBrush" Color="#A6FFA500" />
<SolidColorBrush x:Key="HeaderBackground" Color="Purple" />
<SolidColorBrush x:Key="ItemsContentBackground" Color="#1389D7" />
<SolidColorBrush x:Key="ItemsAlternationContentBackground" Color="#128EE0" />
<SolidColorBrush x:Key="GridLinesBrush" Color="#A6D0C2A7" />
<SolidColorBrush x:Key="ItemSelectedForeground" Color="red" />
<SolidColorBrush x:Key="ItemSelectedBackground" Color="#BC8BEA" />
<SolidColorBrush x:Key="ItemMouseOverBackground" Color="#BC8BEA" />
<SolidColorBrush x:Key="ItemMouseOverForeground" Color="White" />
<!--#endregion-->

<!--#region 高亮:日历Today-->
<SolidColorBrush x:Key="ItemHighlighteBackground" Color="#BC8BEA" />
<SolidColorBrush x:Key="ItemHighlighteForeground" Color="#BC8BEA" />
<!--#endregion-->

<!--#region 普通无背景按钮-->
<SolidColorBrush x:Key="CheckedForeground" Color="#F7B63E" />
<SolidColorBrush x:Key="MouseOverForeground" Color="Orange" />
<SolidColorBrush x:Key="PressedForeground" Color="#F7B63E" />
<SolidColorBrush x:Key="LinkForeground" Color="#0816BB" />
<!--#endregion-->

<!--#region Popup,ComboBox-->
<SolidColorBrush x:Key="PopupBackground" Color="red" />
<!--#endregion-->

<!--#region Button-->
<SolidColorBrush x:Key="ButtonBackground" Color="#1D4A9A" />
<SolidColorBrush x:Key="ButtonForeground" Color="White" />
<SolidColorBrush x:Key="ButtonMouseOverBackground" Color="Orange" />
<SolidColorBrush x:Key="ButtonMouseOverForeground" Color="White" />
<SolidColorBrush x:Key="ButtonPressedBackground" Color="DarkOrange" />
<SolidColorBrush x:Key="ButtonPressedForeground" Color="White" />
<!--#endregion-->

<!--#region Menu-->
<SolidColorBrush x:Key="MenuForeground" Color="#920892" />
<SolidColorBrush x:Key="MenuBackground" Color="#DDD1D1" />
<SolidColorBrush x:Key="MenuBorderBrush" Color="DarkBlue" />
<SolidColorBrush x:Key="MenuMouseOverBackground" Color="#0D3CD2" />
<SolidColorBrush x:Key="MenuMouseOverForeground" Color="White" />
<SolidColorBrush x:Key="MenuPressedBackground" Color="#082CA0" />
<SolidColorBrush x:Key="MenuPressedForeground" Color="White" />
<!--#endregion-->

<!--#region State brush-->
<SolidColorBrush x:Key="SuccessfulfaiBrush" Color="#16B32A" />
<SolidColorBrush x:Key="FailedBrush" Color="#B92222" />
<!--#endregion-->

<!--#region DatePickerCalendarStyle-->
<Style x:Key="DatePickerCalendarStyle" TargetType="{x:Type Calendar}">
<Setter Property="Background" Value="#103153" />
<Setter Property="FontSize" Value="18" />
<Setter Property="CalendarButtonStyle" Value="{DynamicResource ButtonStyle}" />
<Setter Property="CalendarDayButtonStyle" Value="{DynamicResource DayButtonStyle}" />
<Setter Property="BorderBrush" Value="Purple" />
<Setter Property="CalendarItemStyle" Value="{DynamicResource CalendarItemsStyle}" />
</Style>
<!--#endregion-->

<!--#region 年,月按钮样式-->
<Style x:Key="ButtonStyle" TargetType="CalendarButton">
<Setter Property="Background" Value="#103153" />
<Setter Property="FontSize" Value="14" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CalendarButton}">
<Grid x:Name="Grid" Margin="0">
<Border x:Name="Bg" Background="{TemplateBinding Background}" />
<ContentPresenter
x:Name="NormalText"
Margin="5,2,5,2"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
TextElement.Foreground="{TemplateBinding Foreground}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Purple" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region DayButtonStyle-->
<Style x:Key="DayButtonStyle" TargetType="CalendarDayButton">
<Setter Property="Background" Value="#103153" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CalendarDayButton}">
<Grid x:Name="Grid" Margin="0">
<Border
x:Name="Bg"
Background="#103153"
BorderBrush="Purple"
BorderThickness="0" />
<ContentPresenter
x:Name="NormalText"
Margin="5,2,5,2"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
TextElement.Foreground="{TemplateBinding Foreground}" />
</Grid>
<ControlTemplate.Triggers>
<!-- 不在当月的日期 -->
<Trigger Property="IsInactive" Value="True">
<Setter TargetName="Grid" Property="Opacity" Value="0.5" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="red" />
</Trigger>
<Trigger Property="IsToday" Value="True">
<Setter Property="Foreground" Value="yellow" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Aqua" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region FButton_Transparency-->
<Style x:Key="FButton_Transparency" TargetType="{x:Type Button}">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="white" />
<Setter Property="FontFamily" Value="../Fonts/#iconfont" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Height" Value="Auto" />
<Setter Property="Width" Value="Auto" />
<Setter Property="FontSize" Value="13" />
<Setter Property="Padding" Value="3,1,3,1" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="1">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Purple" />
</Trigger>
</Style.Triggers>
</Style>
<!--#endregion-->

<!--#region CalendarItemsStyle-->
<Style x:Key="CalendarItemsStyle" TargetType="{x:Type CalendarItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CalendarItem}">
<ControlTemplate.Resources>
<!-- 头部星期样式 -->
<DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
<TextBlock
Margin="0,6,0,6"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="{StaticResource HeaderFontSize}"
FontWeight="Bold"
Foreground="{StaticResource PressedForeground}"
Opacity="0.8"
Text="{Binding}" />
</DataTemplate>
</ControlTemplate.Resources>
<Grid x:Name="PART_Root">
<Border
Margin="{TemplateBinding Margin}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Header -->
<Grid
Grid.Row="0"
HorizontalAlignment="Stretch"
Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button
x:Name="PART_PreviousButton"
Grid.Column="0"
Content="&#xe601;"
Focusable="False"
Style="{StaticResource FButton_Transparency}" />
<Button
x:Name="PART_HeaderButton"
Grid.Column="1"
Focusable="False"
Style="{StaticResource FButton_Transparency}" />

<Button
x:Name="PART_NextButton"
Grid.Column="2"
Content="&#xe600;"
Focusable="False"
Style="{StaticResource FButton_Transparency}" />
</Grid>

<!-- PART_MonthView -->
<Grid
x:Name="PART_MonthView"
Grid.Row="1"
Margin="6,1,6,6"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Visibility="Visible">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
</Grid>

<!-- PART_YearView -->
<Grid
x:Name="PART_YearView"
Grid.Row="1"
Margin="6,10,6,10"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Visibility="Hidden">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
</Grid>
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="PART_Root" Property="Opacity" Value="{StaticResource DisableOpacity}" />
</Trigger>
<DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Year">
<Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
<Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
</DataTrigger>
<!-- Decade 美 ['dɛked] n. 十年,十年期;十 -->
<DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Decade">
<Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
<Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region DropDownButtonStyle-->
<!-- 显示日历的按钮的模板 -->
<Style x:Key="DropDownButtonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<TextBlock
x:Name="DropDownText"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../Fonts/#iconfont"
FontSize="16"
Foreground="#3aa7f3"
Text="&#xe6ab;" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="DropDownText" Property="FontSize" Value="18" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="DropDownText" Property="Foreground" Value="#cd8624" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region DatePickerTextBox样式-->
<Style x:Key="DatePickerTextBoxStyle" TargetType="DatePickerTextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<TextBlock
x:Name="tb"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Text}" />
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource Mode=Self}}" Value="">
<Setter TargetName="tb" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region PickerStyle-->
<Style x:Key="PickerStyle" TargetType="{x:Type DatePicker}">
<Setter Property="Foreground" Value="#00c2f4" />
<Setter Property="IsTodayHighlighted" Value="True" />
<Setter Property="SelectedDateFormat" Value="Short" />
<Setter Property="Padding" Value="2" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<!-- Set CalendarStyle to DatePickerCalendarStyle. -->
<Setter Property="CalendarStyle" Value="{DynamicResource DatePickerCalendarStyle}" />
<Setter Property="Width" Value="200" />
<Setter Property="FontSize" Value="12" />
<!--<Setter Property="Height" Value="30" />-->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DatePicker}">
<Border
x:Name="br"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid
x:Name="PART_Root"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
x:Name="PART_Button"
Grid.Column="1"
Height="20"
Margin="3,0,3,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Transparent"
Focusable="False"
Foreground="{TemplateBinding Foreground}"
Style="{StaticResource DropDownButtonStyle}" />
<DatePickerTextBox
x:Name="PART_TextBox"
Grid.Column="0"
Margin="5,0,0,0"
VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}"
Style="{StaticResource DatePickerTextBoxStyle}"
Text="{TemplateBinding Text}" />
<Grid
x:Name="PART_DisabledVisual"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
IsHitTestVisible="False"
Opacity="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle
Grid.Row="0"
Grid.Column="0"
Fill="#A5FFFFFF"
RadiusX="1"
RadiusY="1" />
<Rectangle
Grid.Row="0"
Grid.Column="1"
Width="19"
Height="18"
Margin="3,0,3,0"
Fill="#A5FFFFFF"
RadiusX="1"
RadiusY="1" />
<Popup
x:Name="PART_Popup"
AllowsTransparency="True"
Placement="Bottom"
PlacementTarget="{Binding ElementName=br}"
PopupAnimation="Slide"
StaysOpen="False" />
</Grid>
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="PART_DisabledVisual"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="BorderBrush" Value="#3aa7f3" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region Control colors.-->
<Color x:Key="WindowColor">#FFE8EDF9</Color>
<Color x:Key="ContentAreaColorLight">#FFC5CBF9</Color>
<Color x:Key="ContentAreaColorDark">#FF7381F9</Color>

<Color x:Key="DisabledControlLightColor">#FFE8EDF9</Color>
<Color x:Key="DisabledControlDarkColor">#FFC5CBF9</Color>
<Color x:Key="DisabledForegroundColor">#FF888888</Color>

<Color x:Key="SelectedBackgroundColor">#FFC5CBF9</Color>
<Color x:Key="SelectedUnfocusedColor">#FFDDDDDD</Color>

<Color x:Key="ControlLightColor">White</Color>
<Color x:Key="ControlMediumColor">#FF7381F9</Color>
<Color x:Key="ControlDarkColor">#FF211AA9</Color>

<Color x:Key="ControlMouseOverColor">#FF3843C4</Color>
<Color x:Key="ControlPressedColor">#FF211AA9</Color>


<Color x:Key="GlyphColor">#FF444444</Color>
<Color x:Key="GlyphMouseOver">sc#1, 0.004391443, 0.002428215, 0.242281124</Color>
<!--#endregion-->

<!--#region Border colors-->
<Color x:Key="BorderLightColor">#FFCCCCCC</Color>
<Color x:Key="BorderMediumColor">#FF888888</Color>
<Color x:Key="BorderDarkColor">#FF444444</Color>

<Color x:Key="PressedBorderLightColor">#FF888888</Color>
<Color x:Key="PressedBorderDarkColor">#FF444444</Color>

<Color x:Key="DisabledBorderLightColor">#FFAAAAAA</Color>
<Color x:Key="DisabledBorderDarkColor">#FF888888</Color>

<Color x:Key="DefaultBorderBrushDarkColor">Black</Color>
<!--#endregion-->

<!--#region 特定于控制的资源-->
<Color x:Key="HeaderTopColor">#FFC5CBF9</Color>
<Color x:Key="DatagridCurrentCellBorderColor">Black</Color>
<Color x:Key="SliderTrackDarkColor">#FFC5CBF9</Color>

<Color x:Key="NavButtonFrameColor">#FF3843C4</Color>

<LinearGradientBrush x:Key="MenuPopupBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0" Color="{DynamicResource ControlLightColor}" />
<GradientStop Offset="0.5" Color="{DynamicResource ControlMediumColor}" />
<GradientStop Offset="1" Color="{DynamicResource ControlLightColor}" />
</LinearGradientBrush>

<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill" StartPoint="0,0" EndPoint="1,0">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="0" Color="#000000FF" />
<GradientStop Offset="0.4" Color="#600000FF" />
<GradientStop Offset="0.6" Color="#600000FF" />
<GradientStop Offset="1" Color="#000000FF" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>

<!--#endregion-->

</ResourceDictionary>

+ 5
- 6
BPASmartClient.CustomResource/Themes/MyStyle.xaml View File

@@ -957,7 +957,7 @@
</Setter>
</Style.Setters>
</Style>
<Style TargetType="Button">
<Style.Setters>
<Setter Property="VerticalContentAlignment" Value="Center" />
@@ -968,16 +968,15 @@
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="BD" Cursor="Hand">
<StackPanel
HorizontalAlignment="Center"
Orientation="Horizontal">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<!--<Border Width="16" Margin="5">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/顶部切图/返回按钮图标.png" />
</Border.Background>
</Border>-->
<TextBlock Margin="10,0,10,0"
<TextBlock
x:Name="textBlock"
Margin="10,0,10,0"
VerticalAlignment="Center"
FontSize="14"
Foreground="#4fade8"
@@ -1016,7 +1015,7 @@
</Setter>
</Style.Setters>
</Style>
<Style x:Key="CommonBtn_返回" TargetType="Button">
<Style.Setters>
<Setter Property="VerticalContentAlignment" Value="Center" />


+ 329
- 103
BPASmartClient.CustomResource/UserControls/UserKeyBoard.xaml View File

@@ -1,81 +1,100 @@
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.UserKeyBoard"
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:BPASmartClient.CustomResource.UserControls"
mc:Ignorable="d"
d:DesignHeight="180" d:DesignWidth="500"
x:Name="Keyboard" Background="Transparent" >
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.UserKeyBoard"
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:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="Keyboard"
d:DesignHeight="180"
d:DesignWidth="500"
Background="Transparent"
mc:Ignorable="d">
<UserControl.Resources>
<Style x:Key="btnNum" TargetType="{x:Type Button}">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" BorderBrush="#FF474747" BorderThickness="1" CornerRadius="6">
<Border
x:Name="border"
BorderBrush="#FF474747"
BorderThickness="1"
CornerRadius="6">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#002A5F"/>
<GradientStop Color="#6495ED" Offset="1"/>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#002A5F" />
<GradientStop Offset="1" Color="#6495ED" />
</LinearGradientBrush>
</Border.Background>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" TextElement.Foreground="#4fade8" TextElement.FontSize="16" />
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
TextElement.FontSize="16"
TextElement.Foreground="#4fade8" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="border" >
<Setter TargetName="border" Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFF7500"/>
<GradientStop Color="#FFFFC547" Offset="1"/>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFFF7500" />
<GradientStop Offset="1" Color="#FFFFC547" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="False">
<Setter Property="Background" TargetName="border" >
<Setter TargetName="border" Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#002A5F"/>
<GradientStop Color="#6495ED" Offset="1"/>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#002A5F" />
<GradientStop Offset="1" Color="#6495ED" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="btnFunc" TargetType="{x:Type Button}">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<!--<Setter Property="Padding" Value="1"/>-->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" BorderBrush="#FF565656" BorderThickness="1" CornerRadius="6">
<Border
x:Name="border"
BorderBrush="#FF565656"
BorderThickness="1"
CornerRadius="6">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#002A5F"/>
<GradientStop Color="#6495ED" Offset="1"/>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#002A5F" />
<GradientStop Offset="1" Color="#6495ED" />
</LinearGradientBrush>
</Border.Background>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" TextElement.Foreground="White" TextElement.FontSize="18"/>
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
TextElement.FontSize="18"
TextElement.Foreground="White" />

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="border">
<Setter TargetName="border" Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Gray" Offset="1"/>
<GradientStop Color="#FF2D2D2D" Offset="0"/>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="1" Color="Gray" />
<GradientStop Offset="0" Color="#FF2D2D2D" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
@@ -87,88 +106,295 @@
</Style>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger SourceName="Keyboard" RoutedEvent="UserControl.Loaded">
<EventTrigger RoutedEvent="UserControl.Loaded" SourceName="Keyboard">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Keyboard" Storyboard.TargetProperty="Opacity"
From="0" To="1" Duration="0:0:0.2">
</DoubleAnimation>
<DoubleAnimation
Storyboard.TargetName="Keyboard"
Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</UserControl.Triggers>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>
<Grid x:Name="ButtonGrid" Grid.Row="1" Grid.Column="1" ButtonBase.Click="ButtonGrid_Click">
<Grid
x:Name="ButtonGrid"
Grid.Row="1"
Grid.Column="1"
ButtonBase.Click="ButtonGrid_Click">
<Grid.RowDefinitions>
<RowDefinition Height="80*"/>
<RowDefinition Height="80*"/>
<RowDefinition Height="80*"/>
<RowDefinition Height="80*"/>
<RowDefinition Height="80*" />
<RowDefinition Height="80*" />
<RowDefinition Height="80*" />
<RowDefinition Height="80*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="120*" />
</Grid.ColumnDefinitions>
<Button Margin="2" Grid.Column="0" Grid.Row="0" Content="1" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="1" Grid.Row="0" Content="2" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="2" Grid.Row="0" Content="3" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="3" Grid.Row="0" Content="4" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="4" Grid.Row="0" Content="5" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="5" Grid.Row="0" Content="6" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="6" Grid.Row="0" Content="7" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="7" Grid.Row="0" Content="8" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="8" Grid.Row="0" Content="9" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="9" Grid.Row="0" Content="0" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="0" Grid.Row="1" Content="Q" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="1" Grid.Row="1" Content="W" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="2" Grid.Row="1" Content="E" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="3" Grid.Row="1" Content="R" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="4" Grid.Row="1" Content="T" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="5" Grid.Row="1" Content="Y" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="6" Grid.Row="1" Content="U" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="7" Grid.Row="1" Content="I" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="8" Grid.Row="1" Content="O" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="9" Grid.Row="1" Content="P" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="0" Grid.Row="2" Content="A" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="1" Grid.Row="2" Content="S" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="2" Grid.Row="2" Content="D" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="3" Grid.Row="2" Content="F" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="4" Grid.Row="2" Content="G" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="5" Grid.Row="2" Content="H" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="6" Grid.Row="2" Content="J" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="7" Grid.Row="2" Content="K" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="8" Grid.Row="2" Content="L" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="0" Grid.Row="3" Content="Z" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="1" Grid.Row="3" Content="X" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="2" Grid.Row="3" Content="C" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="3" Grid.Row="3" Content="V" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="4" Grid.Row="3" Content="B" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="5" Grid.Row="3" Content="N" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="6" Grid.Row="3" Content="M" Style="{StaticResource btnNum}"/>
<Button Margin="2" Grid.Column="9" Grid.Row="2" Content="A/a" Style="{StaticResource btnFunc}"/>
<Button Margin="2" Grid.Column="7" Grid.Row="3" Content="DEL" Style="{StaticResource btnFunc}"/>
<Button Margin="2" Grid.Column="8" Grid.Row="3" Content="AC" Style="{StaticResource btnFunc}"/>
<Button Margin="2" Grid.Column="9" Grid.Row="3" Content="确认" Style="{StaticResource btnFunc}"/>
<Button
Grid.Row="0"
Grid.Column="0"
Margin="2"
Content="1"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="0"
Grid.Column="1"
Margin="2"
Content="2"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="0"
Grid.Column="2"
Margin="2"
Content="3"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="0"
Grid.Column="3"
Margin="2"
Content="4"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="0"
Grid.Column="4"
Margin="2"
Content="5"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="0"
Grid.Column="5"
Margin="2"
Content="6"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="0"
Grid.Column="6"
Margin="2"
Content="7"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="0"
Grid.Column="7"
Margin="2"
Content="8"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="0"
Grid.Column="8"
Margin="2"
Content="9"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="0"
Grid.Column="9"
Margin="2"
Content="0"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="0"
Margin="2"
Content="Q"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="1"
Margin="2"
Content="W"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="2"
Margin="2"
Content="E"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="3"
Margin="2"
Content="R"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="4"
Margin="2"
Content="T"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="5"
Margin="2"
Content="Y"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="6"
Margin="2"
Content="U"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="7"
Margin="2"
Content="I"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="8"
Margin="2"
Content="O"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="1"
Grid.Column="9"
Margin="2"
Content="P"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="0"
Margin="2"
Content="A"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="1"
Margin="2"
Content="S"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="2"
Margin="2"
Content="D"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="3"
Margin="2"
Content="F"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="4"
Margin="2"
Content="G"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="5"
Margin="2"
Content="H"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="6"
Margin="2"
Content="J"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="7"
Margin="2"
Content="K"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="8"
Margin="2"
Content="L"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="3"
Grid.Column="0"
Margin="2"
Content="Z"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="3"
Grid.Column="1"
Margin="2"
Content="X"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="3"
Grid.Column="2"
Margin="2"
Content="C"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="3"
Grid.Column="3"
Margin="2"
Content="V"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="3"
Grid.Column="4"
Margin="2"
Content="B"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="3"
Grid.Column="5"
Margin="2"
Content="N"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="3"
Grid.Column="6"
Margin="2"
Content="M"
Style="{StaticResource btnNum}" />
<Button
Grid.Row="2"
Grid.Column="9"
Margin="2"
Content="A/a"
Style="{StaticResource btnFunc}" />
<Button
Grid.Row="3"
Grid.Column="7"
Margin="2"
Content="DEL"
Style="{StaticResource btnFunc}" />
<Button
Grid.Row="3"
Grid.Column="8"
Margin="2"
Content="AC"
Style="{StaticResource btnFunc}" />
<Button
Grid.Row="3"
Grid.Column="9"
Margin="2"
Content="确认"
Style="{StaticResource btnFunc}" />

</Grid>
</Grid>


+ 7
- 7
BPASmartClient.Device/BaseDevice.cs View File

@@ -99,7 +99,7 @@ namespace BPASmartClient.Device
/// </summary>
private List<IPeripheral> peripherals;

public Action<int,object> AddErrorAction { get; set; }
public Action<int, object> AddErrorAction { get; set; }
public Action<int, object> DeleteErrorAction { get; set; }

#endregion
@@ -110,9 +110,9 @@ namespace BPASmartClient.Device
/// <param name="info"></param>
public void DeviceProcessLogShow(string info)
{
Log.Insert(0,new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "流程", Text = info });
Log.Insert(0, new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "流程", Text = info });
MessageLog.GetInstance.DeviceProcessLogShow(DeviceId.ToString(), info);
if (Log.Count > 100) { Log.RemoveAt(Log.Count - 1);}
if (Log.Count > 100) { Log.RemoveAt(Log.Count - 1); }
}

public void Initliaze()
@@ -170,7 +170,7 @@ namespace BPASmartClient.Device
Text = item.Ms
};
Error.Add(obj);
AddErrorAction?.Invoke(DeviceId,obj);
AddErrorAction?.Invoke(DeviceId, obj);
}
}
else
@@ -179,7 +179,7 @@ namespace BPASmartClient.Device
if (res != null)
{
Error.Remove(res);
DeleteErrorAction?.Invoke(DeviceId,res);
DeleteErrorAction?.Invoke(DeviceId, res);
}
}
}
@@ -230,7 +230,7 @@ namespace BPASmartClient.Device
Type = res.Grade,
Text = res.Info
};
Error.Insert(0,obj);
Error.Insert(0, obj);
AddErrorAction?.Invoke(DeviceId, obj);
}
});
@@ -320,7 +320,7 @@ namespace BPASmartClient.Device
}

/// <summary>
/// 获取流程信息
/// 获取监控信息
/// </summary>
private void GetMonitorData(IStatus status)
{


+ 2
- 1
BPASmartClient.Helper/BPASmartClient.Helper.csproj View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@@ -18,6 +18,7 @@

<ItemGroup>
<PackageReference Include="log4net" Version="2.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.5" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>


+ 49
- 0
BPASmartClient.Helper/Sqlite.cs View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Sqlite;

namespace BPASmartClient.Helper
{
public class Sqlite<T> : DbContext where T : class, new()
{

private volatile static Sqlite<T> _Instance;
public static Sqlite<T> GetInstance => _Instance ?? (_Instance = new Sqlite<T>());
private Sqlite() { }

public DbSet<T> Base { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite($"FileName={path}");
}

static string path
{
get
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DB"));
return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DB\\{typeof(T).Name}.db";
}
}


public void Save()
{
Database.EnsureCreated();
SaveChanges();
}

public object GetData()
{
Database.EnsureCreated();
return Base.ToList();
}

}
}

+ 58
- 0
BPASmartClient.Model/Alarm.cs View File

@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.Model
{
public class Alarm : ObservableObject
{
/// <summary>
/// ID
/// </summary>
[Key]
public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
private int _mId;

/// <summary>
/// 编号ID
/// </summary>
public int NumId { get { return _mNumId; } set { _mNumId = value; OnPropertyChanged(); } }
private int _mNumId;


/// <summary>
/// 日期
/// </summary>
public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } }
private string _mDate;

/// <summary>
/// 时间
/// </summary>
public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } }
private string _mTime;

/// <summary>
/// 报警信息
/// </summary>
public string Info { get { return _mInfo; } set { _mInfo = value; OnPropertyChanged(); } }
private string _mInfo;

/// <summary>
/// 报警值
/// </summary>
public string Value { get { return _mValue; } set { _mValue = value; OnPropertyChanged(); } }
private string _mValue;

/// <summary>
/// 报警等级
/// </summary>
public string Grade { get { return _mGrade; } set { _mGrade = value; OnPropertyChanged(); } }
private string _mGrade;

}
}

+ 182
- 0
BPASmartClient.Model/DeviceConfigModelJson.cs View File

@@ -0,0 +1,182 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Model
{

/// <summary>
/// 店铺设备
/// </summary>
public class DeviceConfigModelJson : ObservableObject
{
/// <summary>
/// 店铺名称
/// </summary>
public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } }
private string _mShopName = string.Empty;

/// <summary>
/// 店铺ID
/// </summary>
public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } }
private string _mShopId = string.Empty;

/// <summary>
/// 设备集合
/// </summary>
public ObservableCollection<DeviceModel> deviceModels { get; set; } = new ObservableCollection<DeviceModel>();
}

/// <summary>
/// 启动模块
/// </summary>
public class DeviceModel : ObservableObject
{
/// <summary>
/// 设备名称
/// </summary>
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
private string _mDeviceName = string.Empty;

/// <summary>
/// 启动设备模块
/// </summary>
public string DeviceModule { get { return _mDeviceModule; } set { _mDeviceModule = value; OnPropertyChanged(); } }
private string _mDeviceModule = string.Empty;

public string DeviceNamespace { get; set; }


public string Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
private string _mId = string.Empty;


/// <summary>
/// 设备ID
/// </summary>
public string DeviceId { get { return _mDeviceId; } set { _mDeviceId = value; OnPropertyChanged(); } }
private string _mDeviceId = string.Empty;

/// <summary>
/// 通讯模块
/// </summary>
public ObservableCollection<CommunicationModel> communicationDevcies { get; set; } = new ObservableCollection<CommunicationModel>();

}

/// <summary>
/// 通讯模块
/// </summary>
public class CommunicationModel : ObservableObject
{
/// <summary>
/// 通讯启动模块
/// </summary>
public string CommunicationModule { get { return _mCommunicationModule; } set { _mCommunicationModule = value; OnPropertyChanged(); } }
private string _mCommunicationModule = string.Empty;

public string CommunicationNamespace { get; set; }

public string CommunicationName { get { return _mCommunicationName; } set { _mCommunicationName = value; OnPropertyChanged(); } }
private string _mCommunicationName = string.Empty;

public string DeviceModelId { get { return _mDeviceModelId; } set { _mDeviceModelId = value; OnPropertyChanged(); } }
private string _mDeviceModelId = string.Empty;

public CommunicationPar communicationPar { get { return _mcommunicationPar; } set { _mcommunicationPar = value; OnPropertyChanged(); } }
private CommunicationPar _mcommunicationPar = new CommunicationPar();

}

/// <summary>
/// 通讯参数
/// </summary>
public class CommunicationPar : ObservableObject
{
/// <summary>
/// 选择网口通讯
/// </summary>
public bool IsNetworkPort { get { return _mIsNetworkPort; } set { _mIsNetworkPort = value; OnPropertyChanged(); } }
private bool _mIsNetworkPort = false;

/// <summary>
/// 选择串口通讯
/// </summary>
public bool IsSerialPort { get { return _mIsSerialPort; } set { _mIsSerialPort = value; OnPropertyChanged(); } }
private bool _mIsSerialPort = true;

/// <summary>
/// IP地址
/// </summary>
public string IPAddress { get { return _mIPAddress; } set { _mIPAddress = value; OnPropertyChanged(); } }
private string _mIPAddress;

/// <summary>
/// IP 端口号
/// </summary>
public int IPPort { get { return _mIPPort; } set { _mIPPort = value; OnPropertyChanged(); } }
private int _mIPPort;

/// <summary>
/// ip 串口 站号
/// </summary>
public int StationNo { get { return _mStationNo; } set { _mStationNo = value; OnPropertyChanged(); } }
private int _mStationNo;


/// <summary>
/// 串口单口号
/// </summary>
public string SerialPort { get { return _mSerialPort; } set { _mSerialPort = value; OnPropertyChanged(); } }
private string _mSerialPort;

/// <summary>
/// 波特率
/// </summary>
public int BaudRate { get { return _mBaudRate; } set { _mBaudRate = value; OnPropertyChanged(); } }
private int _mBaudRate;

/// <summary>
/// 数据位
/// </summary>
public int DataBits { get { return _mDataBits; } set { _mDataBits = value; OnPropertyChanged(); } }
private int _mDataBits = 8;

/// <summary>
/// 停止位
/// </summary>
public string StopBits { get { return _mStopBits; } set { _mStopBits = value; OnPropertyChanged(); } }
private string _mStopBits = "1";

/// <summary>
/// 校验位
/// </summary>
public string Parity { get { return _mParity; } set { _mParity = value; OnPropertyChanged(); } }
private string _mParity;

public ObservableCollection<Variable> variables { get; set; } = new ObservableCollection<Variable>();
}

public class Variable : ObservableObject
{
public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
private int _mId;


public string Address { get { return _mAddress; } set { _mAddress = value; OnPropertyChanged(); } }
private string _mAddress;


public int ReadLeng { get { return _mReadLeng; } set { _mReadLeng = value; OnPropertyChanged(); } }
private int _mReadLeng;


}
}



+ 0
- 1
BPASmartClient.Model/KeepDataBase.cs View File

@@ -23,7 +23,6 @@ namespace BPASmartClient.Model
public ObservableCollection<OrderData> orderLists { get; set; } = new ObservableCollection<OrderData>();



/// <summary>
/// 参数设置
/// </summary>


+ 26
- 10
BPASmartClient.MorkS/Alarm.cs View File

@@ -11,7 +11,7 @@ namespace BPASmartClient.MorkS
{
/// <summary>
/// 煮面机左侧低温报警
/// PLC ---> M550.0
/// PLC ---> M230.0
/// ModbusTcp --> 1570
/// </summary>
[Alarm("煮面机左侧低温报警")]
@@ -19,7 +19,7 @@ namespace BPASmartClient.MorkS

/// <summary>
/// 煮面机左侧低温报警
/// PLC ---> M550.1
/// PLC ---> M230.1
/// ModbusTcp --> 1571
/// </summary>
[Alarm("煮面机右侧低温报警")]
@@ -27,7 +27,7 @@ namespace BPASmartClient.MorkS

/// <summary>
/// 供碗1缺碗
/// PLC ---> M550.2
/// PLC ---> 230.2
/// ModbusTcp --> 1572
/// </summary>
[Alarm("供碗1缺碗")]
@@ -35,7 +35,7 @@ namespace BPASmartClient.MorkS

/// <summary>
/// 供碗2缺碗
/// PLC ---> M550.3
/// PLC ---> M230.3
/// ModbusTcp --> 1573
/// </summary>
[Alarm("供碗2缺碗")]
@@ -43,7 +43,7 @@ namespace BPASmartClient.MorkS

/// <summary>
/// 供碗1出碗检测异常
/// PLC ---> M550.4
/// PLC ---> M230.4
/// ModbusTcp --> 1574
/// </summary>
[Alarm("供碗1出碗检测异常")]
@@ -51,7 +51,7 @@ namespace BPASmartClient.MorkS

/// <summary>
/// 供碗2出碗检测异常
/// PLC ---> M550.5
/// PLC ---> M230.5
/// ModbusTcp --> 1575
/// </summary>
[Alarm("供碗2出碗检测异常")]
@@ -59,7 +59,7 @@ namespace BPASmartClient.MorkS

/// <summary>
/// 推碗气缸故障
/// PLC ---> M550.6
/// PLC ---> M230.6
/// ModbusTcp --> 1576
/// </summary>
[Alarm("推碗气缸故障")]
@@ -67,7 +67,7 @@ namespace BPASmartClient.MorkS

/// <summary>
/// 煮面机通讯异常
/// PLC ---> M550.7
/// PLC ---> M230.7
/// ModbusTcp --> 1577
/// </summary>
[Alarm("煮面机通讯异常")]
@@ -75,7 +75,7 @@ namespace BPASmartClient.MorkS

/// <summary>
/// 配料机通讯异常
/// PLC ---> M551.0
/// PLC ---> M231.0
/// ModbusTcp --> 1580
/// </summary>
[Alarm("配料机通讯异常")]
@@ -83,7 +83,7 @@ namespace BPASmartClient.MorkS

/// <summary>
/// 机器人通讯异常
/// PLC ---> M551.1
/// PLC ---> M231.1
/// ModbusTcp --> 1581
/// </summary>
[Alarm("机器人通讯异常")]
@@ -128,5 +128,21 @@ namespace BPASmartClient.MorkS
/// </summary>
[Alarm("机器人本体异常")]
public bool RobotSelfInException { get; set; }

/// <summary>
/// 煮面机左侧缺水
/// PLC ---> M232.0
/// ModbusTcp --> 1570
/// </summary>
[Alarm("煮面机左侧缺水报警")]
public bool LeftLackWater { get; set; }

/// <summary>
/// 煮面机右侧缺水
/// PLC ---> M232.1
/// ModbusTcp --> 1571
/// </summary>
[Alarm("煮面机右侧缺水报警")]
public bool RightLackWater { get; set; }
}
}

+ 68
- 30
BPASmartClient.MorkS/Control_Morks.cs View File

@@ -67,7 +67,10 @@ namespace BPASmartClient.MorkS

private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
if (res != null) goodName = res.MorkOrder.GoodsName;
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
}

private void ReadData(string address, ushort len = 1, Action<bool[]> action = null)
@@ -91,7 +94,7 @@ namespace BPASmartClient.MorkS

public override void ReadData()
{
GetStatus("M550.0", new Action<bool[]>((bools) =>
GetStatus("M230.0", new Action<bool[]>((bools) =>
{
alarm.MachineLeftLowTemperature = bools[0];
alarm.MachineRightLowTemperature = bools[1];
@@ -108,6 +111,8 @@ namespace BPASmartClient.MorkS
alarm.RobotNotInRemoteMode = bools[13];
alarm.RobotNotInReady = bools[14];
alarm.RobotSelfInException = bools[15];
alarm.LeftLackWater = bools[16];
alarm.RightLackWater = bools[17];
}));

GetStatus("M0.3", new Action<bool[]>((bools) =>
@@ -179,6 +184,7 @@ namespace BPASmartClient.MorkS
if (@event == null) return;
if (@event is DoOrderEvent order)
{
mORKS.doOrderEvents.Add(order);
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
DeviceProcessLogShow($"接收到{OrderCount}次订单");
@@ -192,7 +198,7 @@ namespace BPASmartClient.MorkS
if (loc >= 1 && loc <= 5)
{
if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId });
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { GoodName = order.MorkOrder.GoodsName, Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId });
}
else if (loc >= 10 && loc <= 11)
{
@@ -205,6 +211,8 @@ namespace BPASmartClient.MorkS
if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
{
BatchingId = res.BatchingId,
GoodName = order.MorkOrder.GoodsName,
Loc = ushort.Parse(res.BatchingLoc),
SuborderId = order.MorkOrder.SuborderId,
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
@@ -238,6 +246,18 @@ namespace BPASmartClient.MorkS
}
}

private void BowlControl(OrderLocInfo orderLocInfo)
{
if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11)
{
mORKS.TakeBowlId = orderLocInfo.SuborderId;
TakeBowlControl(orderLocInfo.Loc);
SetRecipeNumber(orderLocInfo.RecipeNumber);
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
mORKS.TakeBowlInterlock = true;
}
}

/// <summary>
/// 取碗控制
@@ -246,43 +266,60 @@ namespace BPASmartClient.MorkS
{
if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.TakeBowlIdle && !mORKS.TakeBowlInterlock)
{
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
//if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
//{
ushort BowLoc = 0;
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
if (res == null || res?.Count == 0)
{
ushort BowLoc = 0;
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == orderLocInfo.BatchingId).ToList();
if (res != null)
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) BowlControl(orderLocInfo);
}
else
{
foreach (var item in res)
{
foreach (var item in res)
if (ushort.TryParse(item.BatchingLoc, out ushort loc))
{
if (ushort.TryParse(item.BatchingLoc, out ushort loc))
DeviceProcessLogShow($"位置:={loc},检测开关1:{alarm.Supply1_LossBowl},检测开关1:{alarm.Supply2_LossBowl}");
if (loc == 10 && !alarm.Supply1_LossBowl)
{
if (loc == 10 && alarm.Supply1_LossBowl)
{
BowLoc = loc;
break;
}
else if (loc == 11 && alarm.Supply2_LossBowl)
{
BowLoc = loc;
break;
}
BowLoc = loc;
break;
}
else if (loc == 11 && !alarm.Supply2_LossBowl)
{
BowLoc = loc;
break;
}

}
}

if (BowLoc >= 10 && BowLoc <= 11)
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
{
mORKS.TakeBowlId = orderLocInfo.SuborderId;
//TakeBowlControl(orderLocInfo.Loc);
TakeBowlControl(BowLoc);
SetRecipeNumber(orderLocInfo.RecipeNumber);
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
orderLocInfo.Loc = BowLoc;
BowlControl(orderLocInfo);
}

}
mORKS.TakeBowlInterlock = true;

//if (BowLoc >= 10 && BowLoc <= 11)
//{
// mORKS.TakeBowlInterlock = true;
// mORKS.TakeBowlId = orderLocInfo.SuborderId;
// TakeBowlControl(BowLoc);
// SetRecipeNumber(orderLocInfo.RecipeNumber);
// OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
// DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
//}


//之前版本
//mORKS.TakeBowlId = orderLocInfo.SuborderId;
//TakeBowlControl(orderLocInfo.Loc);
//SetRecipeNumber(orderLocInfo.RecipeNumber);
//OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
//DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
//mORKS.TakeBowlInterlock = true;
//}

}
}

@@ -496,6 +533,7 @@ namespace BPASmartClient.MorkS
{
//配方数据地址范围:VW2000 - VW2278
WriteData("VW2000", recipeBoms.ToArray());
DeviceProcessLogShow("写配方成功");
}
else { DeviceProcessLogShow("配方数据为空"); }
}


+ 3
- 0
BPASmartClient.MorkS/GVL_MORKS.cs View File

@@ -1,4 +1,5 @@
using BPASmartClient.Device;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -303,6 +304,8 @@ namespace BPASmartClient.MorkS
//[Circuit("取碗控制", "有取碗队列数量")]
public ConcurrentQueue<OrderLocInfo> TakeBowlTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();

public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();

/// <summary>
/// 是否有面条
/// </summary>


+ 1
- 0
BPASmartClient.MorkS/OrderLocInfo.cs View File

@@ -12,5 +12,6 @@ namespace BPASmartClient.MorkS
public ushort Loc { get; set; }
public ushort RecipeNumber { get; set; }
public int BatchingId { get; set; }
public string GoodName { get; set; }
}
}

+ 199
- 0
BPASmartClient.ViewModel/AlarmViewModel.cs View File

@@ -0,0 +1,199 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.Input;
using System.Collections.ObjectModel;
using System.Windows;
using System.Threading;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPASmartClient.Device;
using BPASmartClient.Helper;
using BPASmartClient.Business;

namespace BPASmartClient.ViewModel
{
public class AlarmViewModel : ObservableObject
{
public AlarmViewModel()
{
ControlCommand = new RelayCommand(() =>
{
if (ControlButText == "报警复位")
{
return;
}
if (ControlButText == "开始查询")
{
var lists = Sqlite<Alarm>.GetInstance.Base.ToList();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
if (res != null)
{
HistoryAlarm.Clear();
foreach (var item in res)
{
HistoryAlarm.Add(item);
}
}
}

});

SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史报警")
{
GetHistoryAlarm();
CurrentDataVis = Visibility.Hidden;
HistoryDataVis = Visibility.Visible;
IsVisibility = Visibility.Visible;
ControlButText = "开始查询";
ButContent = "实时报警";
return;
}

if (ButContent == "实时报警")
{
HistoryDataVis = Visibility.Hidden;
CurrentDataVis = Visibility.Visible;
IsVisibility = Visibility.Hidden;
ControlButText = "报警复位";
ButContent = "历史报警";
return;
}
});

}


public static void AlarmMonitoring()
{
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device =>
{
device.AddErrorAction = new Action<int, object>((id, o) =>
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
AlarmInfos.Add(new Alarm()
{
NumId = AlarmInfos.Count,
Date = DateTime.Now.ToString("yyyy/MM/dd"),
Grade = o?.GetType()?.GetProperty("Type")?.GetValue(o)?.ToString(),
Info = o?.GetType()?.GetProperty("Text")?.GetValue(o)?.ToString(),
Time = DateTime.Now.ToString("HH:mm:ss"),
});
}));
});

device.DeleteErrorAction = new Action<int, object>((id, o) =>
{
var info = o?.GetType()?.GetProperty("Text")?.GetValue(o)?.ToString();
var res = AlarmInfos.FirstOrDefault(p => p.Info == info);
if (res != null) AlarmInfos.Remove(res);
});
});



//ThreadManage.GetInstance.StartLong(new Action(() =>
//{
// if (SimpleFactory.GetInstance.Alarm != null)
// {
// foreach (var item in SimpleFactory.GetInstance.Alarm.GetType().GetProperties())
// {
// var res = item.GetValue(SimpleFactory.GetInstance.Alarm);
// if (res != null)
// {
// if (res is bool blen)
// {
// if (item.CustomAttributes.Count() > 0)
// {
// if (item.CustomAttributes.ElementAt(0)?.ConstructorArguments.Count() > 0)
// {
// var info = item.CustomAttributes.ElementAt(0)?.ConstructorArguments.ElementAt(0).Value;
// if (info != null)
// {
// App.Current.Dispatcher.Invoke(new Action(() =>
// {
// AlarmHelper.GetInstance.EdgeAlarm(blen, info.ToString());
// }));
// }
// }
// }
// }
// }
// }
// }
// Thread.Sleep(500);
//}), "报警检测监控");
}

private void GetHistoryAlarm()
{
//var data = Sqlite<Alarm>.GetInstance.Base.ToList();
//if (data != null)
//{
// AlarmHelper.GetInstance.HistoryAlarms.Clear();
// foreach (var item in data)
// {
// int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
// if (day == 0)
// {
// AlarmHelper.GetInstance.HistoryAlarms.Add(item);
// }
// }
//}
}

public RelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }


public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;


public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
private Visibility _mHistoryDataVis = Visibility.Hidden;


/// <summary>
/// 是否显示
/// </summary>
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
private Visibility _mIsVisibility = Visibility.Hidden;

/// <summary>
/// 文字显示
/// </summary>
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
private string _mButContent = "历史报警";

/// <summary>
/// 控制按钮文本显示
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";


/// <summary>
/// 开始时间
/// </summary>
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
private DateTime _mStartDateTime = DateTime.Now;

/// <summary>
/// 结束时间
/// </summary>
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
private DateTime _mEndDateTime = DateTime.Now;


public static ObservableCollection<Alarm> AlarmInfos { get; set; } = new ObservableCollection<Alarm>();

public static ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>();

}
}

+ 181
- 191
BPASmartClient.ViewModel/Model/DeviceConfigModel.cs View File

@@ -1,191 +1,181 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
using System.Windows;

namespace BPASmartClient.ViewModel.Model
{
/// <summary>
/// 店铺设备
/// </summary>
public class DeviceConfigModel : ObservableObject
{

/// <summary>
/// 店铺名称
/// </summary>
public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } }
private string _mShopName = string.Empty;

/// <summary>
/// 店铺ID
/// </summary>
public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } }
private string _mShopId = string.Empty;

/// <summary>
/// 设备集合
/// </summary>
public ObservableCollection<DeviceModel> deviceModels { get; set; } = new ObservableCollection<DeviceModel>();
}

/// <summary>
/// 启动模块
/// </summary>
public class DeviceModel : ObservableObject
{
/// <summary>
/// 设备名称
/// </summary>
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
private string _mDeviceName = string.Empty;

/// <summary>
/// 启动设备模块
/// </summary>
public string DeviceModule { get { return _mDeviceModule; } set { _mDeviceModule = value; OnPropertyChanged(); } }
private string _mDeviceModule = string.Empty;


public string Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
private string _mId = string.Empty;


/// <summary>
/// 设备ID
/// </summary>
public string DeviceId { get { return _mDeviceId; } set { _mDeviceId = value; OnPropertyChanged(); } }
private string _mDeviceId = string.Empty;

/// <summary>
/// 通讯模块
/// </summary>
public ObservableCollection<CommunicationModel> communicationDevcies { get; set; } = new ObservableCollection<CommunicationModel>();

}

/// <summary>
/// 通讯模块
/// </summary>
public class CommunicationModel : ObservableObject
{
/// <summary>
/// 通讯启动模块
/// </summary>
public string CommunicationModule { get { return _mCommunicationModule; } set { _mCommunicationModule = value; OnPropertyChanged(); } }
private string _mCommunicationModule = string.Empty;

public string CommunicationName { get { return _mCommunicationName; } set { _mCommunicationName = value; OnPropertyChanged(); } }
private string _mCommunicationName = string.Empty;

public string DeviceModelId { get { return _mDeviceModelId; } set { _mDeviceModelId = value; OnPropertyChanged(); } }
private string _mDeviceModelId = string.Empty;

public CommunicationPar communicationPar { get { return _mcommunicationPar; } set { _mcommunicationPar = value; OnPropertyChanged(); } }
private CommunicationPar _mcommunicationPar = new CommunicationPar();


}

/// <summary>
/// 通讯参数
/// </summary>
public class CommunicationPar : ObservableObject
{
///// <summary>
///// 通讯类型,false:串口,true:网口
///// </summary>
//public bool CommunicationType { get { return _mCommunicationType; } set { _mCommunicationType = value; OnPropertyChanged(); } }
//private bool _mCommunicationType;

/// <summary>
/// 选择网口通讯
/// </summary>
public bool IsNetworkPort { get { return _mIsNetworkPort; } set { _mIsNetworkPort = value; OnPropertyChanged(); } }
private bool _mIsNetworkPort = false;

/// <summary>
/// 选择串口通讯
/// </summary>
public bool IsSerialPort { get { return _mIsSerialPort; } set { _mIsSerialPort = value; OnPropertyChanged(); } }
private bool _mIsSerialPort = true;

//public Visibility NetworkVisibility { get { return _mNetworkVisibility; } set { _mNetworkVisibility = value; OnPropertyChanged(); } }
//private Visibility _mNetworkVisibility = Visibility.Collapsed;

//public Visibility SerialVisibility { get { return _mSerialVisibility; } set { _mSerialVisibility = value; OnPropertyChanged(); } }
//private Visibility _mSerialVisibility = Visibility.Visible;

/// <summary>
/// IP地址
/// </summary>
public string IPAddress { get { return _mIPAddress; } set { _mIPAddress = value; OnPropertyChanged(); } }
private string _mIPAddress;

/// <summary>
/// IP 端口号
/// </summary>
public int IPPort { get { return _mIPPort; } set { _mIPPort = value; OnPropertyChanged(); } }
private int _mIPPort;

/// <summary>
/// ip 串口 站号
/// </summary>
public int StationNo { get { return _mStationNo; } set { _mStationNo = value; OnPropertyChanged(); } }
private int _mStationNo;


/// <summary>
/// 串口单口号
/// </summary>
public string SerialPort { get { return _mSerialPort; } set { _mSerialPort = value; OnPropertyChanged(); } }
private string _mSerialPort;

/// <summary>
/// 波特率
/// </summary>
public int BaudRate { get { return _mBaudRate; } set { _mBaudRate = value; OnPropertyChanged(); } }
private int _mBaudRate;

/// <summary>
/// 数据位
/// </summary>
public int DataBits { get { return _mDataBits; } set { _mDataBits = value; OnPropertyChanged(); } }
private int _mDataBits = 8;

/// <summary>
/// 停止位
/// </summary>
public string StopBits { get { return _mStopBits; } set { _mStopBits = value; OnPropertyChanged(); } }
private string _mStopBits = "1";

/// <summary>
/// 校验位
/// </summary>
public string Parity { get { return _mParity; } set { _mParity = value; OnPropertyChanged(); } }
private string _mParity;

public ObservableCollection<Variable> variables { get; set; } = new ObservableCollection<Variable>();
}

public class Variable : ObservableObject
{
public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
private int _mId;


public string Address { get { return _mAddress; } set { _mAddress = value; OnPropertyChanged(); } }
private string _mAddress;


public int ReadLeng { get { return _mReadLeng; } set { _mReadLeng = value; OnPropertyChanged(); } }
private int _mReadLeng;


}
}
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using Microsoft.Toolkit.Mvvm.ComponentModel;
//using System.Collections.ObjectModel;
//using Microsoft.Toolkit.Mvvm.Input;
//using System.Windows;

//namespace BPASmartClient.ViewModel.Model
//{
// /// <summary>
// /// 店铺设备
// /// </summary>
// public class DeviceConfigModel : ObservableObject
// {
// /// <summary>
// /// 店铺名称
// /// </summary>
// public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } }
// private string _mShopName = string.Empty;

// /// <summary>
// /// 店铺ID
// /// </summary>
// public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } }
// private string _mShopId = string.Empty;

// /// <summary>
// /// 设备集合
// /// </summary>
// public ObservableCollection<DeviceModel> deviceModels { get; set; } = new ObservableCollection<DeviceModel>();
// }

// /// <summary>
// /// 启动模块
// /// </summary>
// public class DeviceModel : ObservableObject
// {
// /// <summary>
// /// 设备名称
// /// </summary>
// public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
// private string _mDeviceName = string.Empty;

// /// <summary>
// /// 启动设备模块
// /// </summary>
// public string DeviceModule { get { return _mDeviceModule; } set { _mDeviceModule = value; OnPropertyChanged(); } }
// private string _mDeviceModule = string.Empty;

// public string DeviceNamespace { get; set; }


// public string Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
// private string _mId = string.Empty;


// /// <summary>
// /// 设备ID
// /// </summary>
// public string DeviceId { get { return _mDeviceId; } set { _mDeviceId = value; OnPropertyChanged(); } }
// private string _mDeviceId = string.Empty;

// /// <summary>
// /// 通讯模块
// /// </summary>
// public ObservableCollection<CommunicationModel> communicationDevcies { get; set; } = new ObservableCollection<CommunicationModel>();

// }

// /// <summary>
// /// 通讯模块
// /// </summary>
// public class CommunicationModel : ObservableObject
// {
// /// <summary>
// /// 通讯启动模块
// /// </summary>
// public string CommunicationModule { get { return _mCommunicationModule; } set { _mCommunicationModule = value; OnPropertyChanged(); } }
// private string _mCommunicationModule = string.Empty;

// public string CommunicationNamespace { get; set; }

// public string CommunicationName { get { return _mCommunicationName; } set { _mCommunicationName = value; OnPropertyChanged(); } }
// private string _mCommunicationName = string.Empty;

// public string DeviceModelId { get { return _mDeviceModelId; } set { _mDeviceModelId = value; OnPropertyChanged(); } }
// private string _mDeviceModelId = string.Empty;

// public CommunicationPar communicationPar { get { return _mcommunicationPar; } set { _mcommunicationPar = value; OnPropertyChanged(); } }
// private CommunicationPar _mcommunicationPar = new CommunicationPar();

// }

// /// <summary>
// /// 通讯参数
// /// </summary>
// public class CommunicationPar : ObservableObject
// {
// /// <summary>
// /// 选择网口通讯
// /// </summary>
// public bool IsNetworkPort { get { return _mIsNetworkPort; } set { _mIsNetworkPort = value; OnPropertyChanged(); } }
// private bool _mIsNetworkPort = false;

// /// <summary>
// /// 选择串口通讯
// /// </summary>
// public bool IsSerialPort { get { return _mIsSerialPort; } set { _mIsSerialPort = value; OnPropertyChanged(); } }
// private bool _mIsSerialPort = true;

// /// <summary>
// /// IP地址
// /// </summary>
// public string IPAddress { get { return _mIPAddress; } set { _mIPAddress = value; OnPropertyChanged(); } }
// private string _mIPAddress;

// /// <summary>
// /// IP 端口号
// /// </summary>
// public int IPPort { get { return _mIPPort; } set { _mIPPort = value; OnPropertyChanged(); } }
// private int _mIPPort;

// /// <summary>
// /// ip 串口 站号
// /// </summary>
// public int StationNo { get { return _mStationNo; } set { _mStationNo = value; OnPropertyChanged(); } }
// private int _mStationNo;


// /// <summary>
// /// 串口单口号
// /// </summary>
// public string SerialPort { get { return _mSerialPort; } set { _mSerialPort = value; OnPropertyChanged(); } }
// private string _mSerialPort;

// /// <summary>
// /// 波特率
// /// </summary>
// public int BaudRate { get { return _mBaudRate; } set { _mBaudRate = value; OnPropertyChanged(); } }
// private int _mBaudRate;

// /// <summary>
// /// 数据位
// /// </summary>
// public int DataBits { get { return _mDataBits; } set { _mDataBits = value; OnPropertyChanged(); } }
// private int _mDataBits = 8;

// /// <summary>
// /// 停止位
// /// </summary>
// public string StopBits { get { return _mStopBits; } set { _mStopBits = value; OnPropertyChanged(); } }
// private string _mStopBits = "1";

// /// <summary>
// /// 校验位
// /// </summary>
// public string Parity { get { return _mParity; } set { _mParity = value; OnPropertyChanged(); } }
// private string _mParity;

// public ObservableCollection<Variable> variables { get; set; } = new ObservableCollection<Variable>();
// }

// public class Variable : ObservableObject
// {
// public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
// private int _mId;


// public string Address { get { return _mAddress; } set { _mAddress = value; OnPropertyChanged(); } }
// private string _mAddress;


// public int ReadLeng { get { return _mReadLeng; } set { _mReadLeng = value; OnPropertyChanged(); } }
// private int _mReadLeng;


// }
//}

+ 32
- 13
BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs View File

@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.ViewModel.Model;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
@@ -14,14 +13,16 @@ using System.Windows;
using System.IO.Ports;
using System.IO;
using Newtonsoft.Json;
using BPASmartClient.Model;

namespace BPASmartClient.ViewModel
{
public class ShopDeviceConfigViewModel : ObservableObject
{
private DeviceConfigModel configModel = new DeviceConfigModel();
private DeviceConfigModelJson configModel = new DeviceConfigModelJson();
string FileName => deviceConfig.Count > 0 ? deviceConfig[0].ShopName : string.Empty;

public static List<string> IDevices = new List<string>();
public static List<string> IPeripherals = new List<string>();
public ShopDeviceConfigViewModel()
{
ActionManage.GetInstance.Register(new Action<object[]>((o) =>
@@ -49,6 +50,17 @@ namespace BPASmartClient.ViewModel
{
if (deviceConfig.Count > 0)
{
for (int i = 0; i < deviceConfig.ElementAt(0).deviceModels.Count; i++)
{
string name = deviceConfig.ElementAt(0).deviceModels.ElementAt(i).DeviceModule;
deviceConfig.ElementAt(0).deviceModels.ElementAt(i).DeviceNamespace = IDevices.FirstOrDefault(p => p.Contains(name));

for (int m = 0; m < deviceConfig.ElementAt(0).deviceModels.ElementAt(i).communicationDevcies.Count; m++)
{
string comName = deviceConfig.ElementAt(0).deviceModels.ElementAt(i).communicationDevcies.ElementAt(m).CommunicationModule;
deviceConfig.ElementAt(0).deviceModels.ElementAt(i).communicationDevcies.ElementAt(m).CommunicationNamespace = IPeripherals.FirstOrDefault(p => p.Contains(comName));
}
}
File.WriteAllText($"{LocaPath.GetInstance().GetDeviceConfigPath}{FileName}.json", JsonConvert.SerializeObject(deviceConfig));
}
});
@@ -166,7 +178,7 @@ namespace BPASmartClient.ViewModel
/// <summary>
/// 设备信息列表
/// </summary>
public static ObservableCollection<DeviceConfigModel> deviceConfig { get; set; } = new ObservableCollection<DeviceConfigModel>();
public static ObservableCollection<DeviceConfigModelJson> deviceConfig { get; set; } = new ObservableCollection<DeviceConfigModelJson>();

/// <summary>
/// 端口号列表
@@ -211,17 +223,24 @@ namespace BPASmartClient.ViewModel
Enum.GetNames(typeof(Parity)).ToList().ForEach((item) => { Paritys.Add(item); });

DeviceModels.Clear();
DeviceModels.Add("Morks");
DeviceModels.Add("Morkt");
DeviceModels.Add("Morkic");
DeviceModels.Add("Morkjc");
IDevices.ForEach((item) =>
{
var strs = item.Split(".");
if (strs != null && strs.Length == 3)
{
DeviceModels.Add(strs[1]);
}
});

CommunicationModel.Clear();
CommunicationModel.Add("乐百");
CommunicationModel.Add("节卡");
CommunicationModel.Add("单片机");
CommunicationModel.Add("咖啡机");
CommunicationModel.Add("冰淇淋机");
IPeripherals.ForEach((item) =>
{
var strs = item.Split(".");
if (strs != null && strs.Length == 3)
{
CommunicationModel.Add(strs[1]);
}
});

Shops.Clear();
DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetInstance().GetDeviceConfigPath);


+ 46
- 0
BPASmartClient.ViewModel/SystemSetViewModel.cs View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.ViewModel
{
public class SystemSetViewModel : ObservableObject
{
public SystemSetViewModel()
{
if (SaveInfoCommand == null)
{
SaveInfoCommand = new Action(() =>
{
List<ushort> values = new List<ushort>();
values.Clear();

List<bool> bools = new List<bool>();
bools.Clear();

for (int i = 0; i < Json<KeepDataBase>.Data.parSets.Count; i++)
{
values.Clear();
values.Add(Json<KeepDataBase>.Data.parSets[i].Minute);
values.Add(Json<KeepDataBase>.Data.parSets[i].Second);
bools.Add(Json<KeepDataBase>.Data.parSets[i].IsShield);
//ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetWordAddress($"VW{116 + (i * 6)}"), WriteType.HoldingRegisters, values.ToArray());
}
//ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M260.0"), WriteType.Coils, bools.ToArray());

});
}
}

public ObservableCollection<ParSet> parSets { get; set; } = Json<KeepDataBase>.Data.parSets;
public Action SaveInfoCommand { get; set; }

}
}

+ 2
- 3
BPASmartClient/App.config View File

@@ -3,7 +3,7 @@
<appSettings>
<!--通用配置-->
<!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺-->
<add key="ClientId" value="250"/>
<add key="ClientId" value="51"/>
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/>
<add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/>
<add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>-->
@@ -37,7 +37,6 @@
<add key ="Namespaces" value="DEV.test1.Config"/>-->

<!--正式环境-->
<add key="ApolloUri" value="http://47.108.65.220:28080"/>
<add key="OrderServiceUri" value="https://witt.black-pa.com/order/"/>
<add key="StockServiceUri" value="https://witt.black-pa.com/stock/"/>
@@ -46,7 +45,7 @@
<add key="BroadcastPubTopic" value="/broadcast/grgpECHSL7q/Transit_SetDevice"/>
<add key="AppId" value="order"/>
<add key ="Namespaces" value="TEST1.Config"/>
<add key="IsEnableTest" value="False"/>
<add key="IsEnableTest" value="false"/>

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->


+ 1
- 0
BPASmartClient/App.xaml View File

@@ -15,6 +15,7 @@
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" />
<!--<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>-->



+ 1
- 0
BPASmartClient/BPASmartClient.csproj View File

@@ -30,6 +30,7 @@
<ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />
<ProjectReference Include="..\HBLConsole.MORKIC\BPASmartClient.MORKIC.csproj" />
</ItemGroup>

<ItemGroup>


+ 34
- 26
BPASmartClient/Control/AdminstratorsView.xaml View File

@@ -1,36 +1,39 @@
<UserControl x:Class="BPASmartClient.Control.AdminstratorsView"
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:BPASmartClient.Control"
xmlns:uc="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:helper ="clr-namespace:BPASmartClient.Control.Helper"
xmlns:vm ="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800" Loaded="UserControl_Loaded">
<UserControl
x:Class="BPASmartClient.Control.AdminstratorsView"
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:helper="clr-namespace:BPASmartClient.Control.Helper"
xmlns:local="clr-namespace:BPASmartClient.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:uc="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
d:DesignHeight="600"
d:DesignWidth="800"
Loaded="UserControl_Loaded"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:AdminstratorsViewModel/>
<vm:AdminstratorsViewModel />
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="TxLogin" TargetType="TextBlock" >
<Setter Property="FontSize" Value="20"/>
<Setter Property="Foreground" Value="#ddd"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style x:Key="TxLogin" TargetType="TextBlock">
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="#ddd" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="7*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="7*" />
<ColumnDefinition Width="10*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="4*"/>
<RowDefinition Height="8*"/>
<RowDefinition Height="20*"/>
<RowDefinition Height="10*" />
<RowDefinition Height="5*" />
<RowDefinition Height="4*" />
<RowDefinition Height="8*" />
<RowDefinition Height="20*" />
</Grid.RowDefinitions>
<TextBlock Text="账号:"
VerticalAlignment="Bottom" HorizontalAlignment="Right"
@@ -78,7 +81,12 @@
Content="登 录"
Command="{Binding AdminLoginCommand}" IsDefault="True"/>

<uc:UserKeyBoard x:Name="myKeyboard" Grid.Row="4" Grid.ColumnSpan="2" Margin="100,10,100,50" Focusable="False"/>
<uc:UserKeyBoard
x:Name="myKeyboard"
Grid.Row="4"
Grid.ColumnSpan="2"
Margin="100,10,100,50"
Focusable="False" />
</Grid>
</UserControl>

+ 376
- 0
BPASmartClient/Control/AlarmView.xaml View File

@@ -0,0 +1,376 @@
<UserControl
x:Class="BPASmartClient.Control.AlarmView"
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:local="clr-namespace:BPASmartClient.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:AlarmViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="DataTextBlockStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,8"
HorizontalAlignment="Right"
Orientation="Horizontal">

<DatePicker
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibility}" />

<DatePicker
Margin="20,0,20,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibility}" />

<Button
Width="140"
Background="#FF19B7EC"
Command="{Binding ControlCommand}"
Content="{Binding ControlButText}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Margin="20,0,0,0"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="ID" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警日期" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警时间" />

<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警信息" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警值" />

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警等级" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding AlarmInfos}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding NumId}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Time}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryAlarm}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Id}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Time}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<!--#endregion-->


</Grid>
</UserControl>

+ 28
- 0
BPASmartClient/Control/AlarmView.xaml.cs View File

@@ -0,0 +1,28 @@
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 BPASmartClient.Control
{
/// <summary>
/// AlarmView.xaml 的交互逻辑
/// </summary>
public partial class AlarmView : UserControl
{
public AlarmView()
{
InitializeComponent();
}
}
}

+ 7
- 7
BPASmartClient/Control/OrderStatusView.xaml View File

@@ -36,7 +36,7 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<!--<RowDefinition />-->
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 制作中的订单列表-->
@@ -118,8 +118,8 @@
<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible">
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding orderStatusLists}">
<ItemsControl.ItemTemplate>
<DataTemplate>
@@ -206,7 +206,7 @@

<!--#region 表格标题栏设置-->

<!--<Grid Background="#dd2AB2E7">
<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
@@ -271,13 +271,13 @@
Foreground="{StaticResource TitleFontColor}"
Text="完成时间" />

</Grid>-->
</Grid>

<!--#endregion-->

<!--#region 表格数据显示-->

<!--<ScrollViewer
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
@@ -352,7 +352,7 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>-->
</ScrollViewer>

<!--#endregion-->



+ 1
- 1
BPASmartClient/Control/ShopDeviceConfigView.xaml View File

@@ -7,7 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
xmlns:vmm="clr-namespace:BPASmartClient.ViewModel.Model;assembly=BPASmartClient.ViewModel"
xmlns:vmm="clr-namespace:BPASmartClient.Model;assembly=BPASmartClient.Model"
d:DesignHeight="900"
d:DesignWidth="1200"
mc:Ignorable="d">


+ 2
- 2
BPASmartClient/Control/ShopDeviceConfigView.xaml.cs View File

@@ -16,8 +16,8 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using BPASmartClient.DialogWindow;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.ViewModel;
using BPASmartClient.ViewModel.Model;
using Newtonsoft.Json;

namespace BPASmartClient.Control
@@ -140,7 +140,7 @@ namespace BPASmartClient.Control
if (file != null && File.Exists(file.FullName))
{
string JsonString = File.ReadAllText(file.FullName);
var result = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModel>>(JsonString);
var result = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModelJson>>(JsonString);
if (result != null)
{
ShopDeviceConfigViewModel.deviceConfig.Clear();


+ 142
- 10
BPASmartClient/Control/SystemSetView.xaml View File

@@ -1,12 +1,144 @@
<UserControl x:Class="BPASmartClient.Control.SystemSetView"
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:BPASmartClient.Control"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Label FontSize="100" >系统参数设置界面</Label>
<UserControl
x:Class="BPASmartClient.Control.SystemSetView"
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:local="clr-namespace:BPASmartClient.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:SystemSetViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="35" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<CheckBox
Grid.Row="0"
Grid.Column="2"
Height="20"
Margin="10"
VerticalAlignment="Top"
Background="#FF2AB2E7"
Content="开机启动"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding IsSelected}"
Template="{StaticResource CbTemplate}" />

<StackPanel
Grid.Row="1"
HorizontalAlignment="Right"
Orientation="Horizontal">

<TextBlock Style="{StaticResource TextBlockStyle}" Text="请点击按钮保存参数:" />

<pry:IcoButton
Grid.Column="5"
Width="140"
HorizontalAlignment="Left"
Command="{Binding SaveInfoCommand}"
Content="保存配置"
FontSize="16"
IcoText="&#xe936;"
Style="{StaticResource NewButtonStyle}">
<pry:IcoButton.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</pry:IcoButton.Foreground>
</pry:IcoButton>


</StackPanel>

<!-- 参数放置面板 -->
<Grid Grid.Row="2">
<ItemsControl ItemsSource="{Binding parSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding TextBlockContext}" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(分)" />
<TextBox
Width="100"
Margin="0,10"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Second}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(秒)" />

<CheckBox
Height="20"
Margin="10"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="{Binding CheckBoxContext}"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding IsShield}"
Template="{StaticResource CbTemplate}" />

</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</Grid>

</Grid>
</UserControl>

+ 11
- 9
BPASmartClient/DeviceInfo.xml View File

@@ -26,19 +26,21 @@
</Peripherals>
</Device>-->

<Device Name="MorkT" Module="BPASmartClient.MorkF.Control_MorkF" DeviceId="29">
<!--<Device Name="MorkT" Module="BPASmartClient.MorkF.Control_MorkF" DeviceId="33">
<Peripherals>
<Peripheral Module="BPASmartClient.DRCoffee.CoffeeMachine">
<Parameters>
<PortName>COM5</PortName>
<BaudRate>9600</BaudRate>
<!--<IpAddress>192.168.6.1</IpAddress>
-->
<!--<IpAddress>192.168.6.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>-->
<!--
</Parameters>
</Peripheral>
</Peripherals>
</Device>
</Device>-->


<!--<Device Name="MorkF" Module="BPASmartClient.MorkF.Control_MorkF" DeviceId="2">
@@ -51,18 +53,18 @@
</Parameters>
</Peripheral>
</Peripherals>
</Device>
</Device>-->

<Device Name="Morks" Module="BPASmartClient.MorkS.Control_Morks" DeviceId="28">
<Device Name="Morks" Module="BPASmartClient.MorkS.Control_Morks" DeviceId="33">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>192.168.1.11</IpAddress>
<Port>508</Port>
<PLCReadAddress>M,M550.0,16;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>
<IpAddress>127.0.0.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->
</Device>

</BPADevices>

+ 5
- 5
BPASmartClient/MainWindow.xaml View File

@@ -50,7 +50,7 @@
Margin="20,0,0,0"
VerticalAlignment="Center"
Style="{DynamicResource imagetop_Title}" />
<Grid Grid.Column="1" Visibility="{Binding VsMenuItem}" >
<Grid Grid.Column="1" Visibility="{Binding VsMenuItem}">
<Menu>
<MenuItem Header="功能列表">
<MenuItem
@@ -243,7 +243,7 @@
VerticalAlignment="Top"
Click="Button_Click_1"
Content="测试消息弹窗"
Cursor="Hand"/>
Cursor="Hand" />

<!--<Button
Name="save"
@@ -266,7 +266,7 @@
VerticalAlignment="Top"
Click="init_Click"
Content="初始化设备"
Cursor="Hand"/>
Cursor="Hand" />

<CheckBox
Margin="350,0,0,0"
@@ -299,10 +299,10 @@
HorizontalAlignment="Right"
VerticalAlignment="Top"
Click="Button_LogOut"
Command="{Binding LogoutCommand}"
Content="注销"
Cursor="Hand"
Style="{DynamicResource CommonBtn_返回}"
Command="{Binding LogoutCommand}"/>
Style="{DynamicResource CommonBtn_返回}" />
</Grid>
<!--#region 底部窗体栏-->



+ 65
- 1
BPASmartClient/MainWindow.xaml.cs View File

@@ -11,9 +11,11 @@ using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.Peripheral;
using BPASmartClient.ViewModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -66,6 +68,7 @@ namespace BPASmartClient
ThreadManage.GetInstance().Start(new Action(() =>
{
new MainConsole().Start();
GetDevices();
}), "启动主控制台", false);

ThreadManage.GetInstance().Start(new Action(() =>
@@ -86,6 +89,67 @@ namespace BPASmartClient
}
#endregion

private void GetDevices()
{
//List<string> IDevices = new List<string>();
//List<string> IPeripherals = new List<string>();

DirectoryInfo directoryInfo = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
var files = directoryInfo.GetFiles().Where(p => p.FullName.Contains("BPASmartClient.") && p.FullName.Contains("dll")).ToList();
List<string> fileList = new List<string>();

var assemblies = AppDomain.CurrentDomain.GetAssemblies();
var dlls = assemblies?.Where(p => p.FullName.Contains("BPASmartClient.")).ToList();
List<string> dllList = new List<string>();

if (files != null)
{
foreach (var item in files)
{
var res = System.IO.Path.GetFileNameWithoutExtension(item.FullName);
if (res != null && res.Length > 0 && res.Contains(".") && !res.Contains("dll")) fileList.Add(res);
}
}

if (dlls != null)
{
dlls.ForEach((item) =>
{
item.GetTypes().ToList().ForEach((type) =>
{
if (type.GetInterfaces().Contains(typeof(IDevice)))
{
if (!type.FullName.Contains("BaseDevice")) ShopDeviceConfigViewModel.IDevices.Add(type.FullName);
}
else if (type.GetInterfaces().Contains(typeof(IPeripheral)))
{
if (!type.FullName.Contains("BasePeripheral")) ShopDeviceConfigViewModel.IPeripherals.Add(type.FullName);
}
});

dllList.Add(System.IO.Path.GetFileNameWithoutExtension(item.EscapedCodeBase));
});
}

dllList.ForEach((item) => { if (fileList.Contains(item)) fileList.Remove(item); });

fileList.ForEach((item) =>
{
Assembly.Load(item).GetTypes().ToList().ForEach((type) =>
{
if (type.GetInterfaces().Contains(typeof(IDevice)))
{
if (!type.FullName.Contains("BaseDevice")) ShopDeviceConfigViewModel.IDevices.Add(type.FullName);
}
else if (type.GetInterfaces().Contains(typeof(IPeripheral)))
{
if (!type.FullName.Contains("BasePeripheral")) ShopDeviceConfigViewModel.IPeripherals.Add(type.FullName);
}
});
});

}

#region Click
/// <summary>
/// 菜单切换栏
@@ -215,7 +279,7 @@ namespace BPASmartClient

MessageLog.GetInstance.ShowEx($"BPASmartClient 中引发错误,MainWindow.xaml.cs 类MenuItem_Click(),描述:[{ex.Message}]");
}
}

private void Button_LogOut(object sender, RoutedEventArgs e)


Loading…
Cancel
Save