Browse Source

输送中心添加手动页面状态信息页面设备信息卡

master
sc 7 months ago
parent
commit
acd37a8245
  1. 1
      ConvertMoels/StateToColorConvert.cs
  2. 2
      ConvertMoels/StatenClassConvert.cs
  3. 64
      EX/DispenseState.xaml
  4. 69
      EX/DispenseState.xaml.cs
  5. 56
      EX/ManualDyelot.xaml
  6. 66
      EX/ManualDyelot.xaml.cs
  7. 2
      MainWindow.xaml.cs
  8. 54
      Properties/Resources.Designer.cs
  9. 18
      Properties/Resources.en-US.resx
  10. 18
      Properties/Resources.resx
  11. 18
      Properties/Resources.zh-CN.resx
  12. 18
      Properties/Resources.zh-TW.resx
  13. 21
      SunlightCentralizedControlManagement_SCCM_.csproj
  14. 40
      UserControls/DispenseMacInfo.xaml
  15. 70
      UserControls/DispenseMacInfo.xaml.cs
  16. 16
      UserControls/info.xaml.cs
  17. 18
      View/DispenseMachinesSet.xaml
  18. 11
      View/DispenseMachinesSet.xaml.cs
  19. 12
      View/DispenseView.xaml
  20. 59
      View/DispenseView.xaml.cs
  21. 8
      WindowsView/UserMessage.xaml.cs

1
ConvertMoels/StateToColorConvert.cs

@ -24,6 +24,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
if (i == "201") return "green";
else if (i == "202") return "yellow";
else if (i == "309") return "Red";
else if (i == "800") return "Red";
else return "block";
}
}

2
ConvertMoels/StatenClassConvert.cs

@ -35,7 +35,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
else if (i == "309") Staten = Properties.Resources.Abnormal;//错误
else if (i == "800") Staten = Properties.Resources.Notimplementation;//未连接
else if (i == "801") Staten = Properties.Resources.Implementation;//连接成功
else if (i == "801") Staten = Properties.Resources.Online;//在线
else if (i == "802") Staten = Properties.Resources.Online;//在线
else if (i == "899") Staten = Properties.Resources.CloseTheConnection;//关闭连接
else Staten = "null";

64
EX/DispenseState.xaml

@ -0,0 +1,64 @@
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.EX.DispenseState"
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:SunlightCentralizedControlManagement_SCCM_.EX"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
GridLinesVisibility="All" ColumnHeaderHeight="40"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" BorderBrush="#FFC9C9C9" FontSize="16" BorderThickness="5,5,5,5" >
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="25" />
<Setter Property="FontSize" Value="15" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.ID}" Binding="{Binding ID}" Width="80" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Machine}" Width="100" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Redye}" Binding="{Binding ReDye}" Width="80" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding StepNumber}" Width="80" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Time}" Binding="{Binding CreationTime}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.ProductCode}" Binding="{Binding ProductCode}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.ProductName}" Binding="{Binding ProductName}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Grams}" Binding="{Binding Weight}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.State}" Binding="{Binding State}" Width="100" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Volume}" Binding="{Binding Volume}" Width="100" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.DispenseModule}" Binding="{Binding DispenseModule}" Width="100" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.StartTime}" Binding="{Binding DispenseStartTime}" Width="200" IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

69
EX/DispenseState.xaml.cs

@ -0,0 +1,69 @@
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
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 SunlightCentralizedControlManagement_SCCM_.EX
{
/// <summary>
/// DispenseState.xaml 的交互逻辑
/// </summary>
public partial class DispenseState : UserControl
{
public DispenseState()
{
InitializeComponent();
}
public async void State(object dat,string mac)
{
string Connstr_SC;
string WaitChemical_WaitDispenseDyestuff;
string DAT = mac.Substring(0,3);
if (DAT == "252")
{
WaitChemical_WaitDispenseDyestuff = "SELECT * FROM [dbo].[WaitDispenseDyestuff] WHERE DispenseMachine = '" + dat + "'";
}
else
{
WaitChemical_WaitDispenseDyestuff = "SELECT * FROM [dbo].[WaitChemical] WHERE DispenseMachine = '" + dat + "'";
}
try
{
if (MainWindowViewModel.SQMOD == "Windows Authentication")
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
await conn_SC.OpenAsync(); //连接数据库
SqlDataAdapter WaitChemical_data = new SqlDataAdapter(WaitChemical_WaitDispenseDyestuff, Connstr_SC); //查询
conn_SC.Close();
DataTable ds = new DataTable();//载入信息
WaitChemical_data.Fill(ds);
Grid_data.ItemsSource = ds.DefaultView;
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}
}
}
}

56
EX/ManualDyelot.xaml

@ -0,0 +1,56 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.EX.ManualDyelot"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.EX"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
mc:Ignorable="d" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen"
Title="ManualDyelot" Height="960" Width="1280">
<Grid Background="#FFC9C9C9">
<Grid Margin="5,5,5,5" Background="White">
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
GridLinesVisibility="All" ColumnHeaderHeight="50"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" FontSize="20" Margin="0,0,400,0">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="55" />
<Setter Property="FontSize" Value="35" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.ProductCode}" Binding="{Binding ProductCode}" Width="300" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.ProductName}" Binding="{Binding ProductName}" Width="300" IsReadOnly="True" />
<DataGridTextColumn Header="KG" Binding="{Binding Weight}" Width="*" />
</DataGrid.Columns>
</DataGrid>
<Button x:Name="State" Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Right" Height="55" Margin="0,0,15,10" VerticalAlignment="Bottom" Width="200" Click="State_Click" Padding="0,4,0,4" FontSize="20"/>
</Grid>
</Grid>
</Window>

66
EX/ManualDyelot.xaml.cs

@ -0,0 +1,66 @@
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace SunlightCentralizedControlManagement_SCCM_.EX
{
/// <summary>
/// ManualDyelot.xaml 的交互逻辑
/// </summary>
public partial class ManualDyelot : Window
{
public ManualDyelot()
{
InitializeComponent();
}
public async void MAC(object Machines)
{
string Connstr_SC;
string sql = "SELECT * FROM [dbo].[Pipes] WHERE Dispenser = '" + Machines + "'";
try
{
if (MainWindowViewModel.SQMOD == "Windows Authentication")
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
await conn_SC.OpenAsync(); //连接数据库
SqlDataAdapter _data = new SqlDataAdapter(sql, Connstr_SC); //查询
conn_SC.Close();
DataTable ds = new DataTable();//载入信息
_data.Fill(ds);
Grid_data.ItemsSource = ds.DefaultView;
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}
}
private void State_Click(object sender, RoutedEventArgs e)
{
}
}
}

2
MainWindow.xaml.cs

@ -116,7 +116,7 @@ namespace SunlightCentralizedControlManagement_SCCM_
}
private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
{
Picture.Content = new View.DispenseView();
}
private void Buttonhelp_Click(object sender, RoutedEventArgs e)

54
Properties/Resources.Designer.cs

@ -699,6 +699,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 DispenseModule 的本地化字符串。
/// </summary>
public static string DispenseModule {
get {
return ResourceManager.GetString("DispenseModule", resourceCulture);
}
}
/// <summary>
/// 查找类似 Details were not sent 的本地化字符串。
/// </summary>
@ -1113,6 +1122,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Information 的本地化字符串。
/// </summary>
public static string Information {
get {
return ResourceManager.GetString("Information", resourceCulture);
}
}
/// <summary>
/// 查找类似 I/O 的本地化字符串。
/// </summary>
@ -1248,6 +1266,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Manual 的本地化字符串。
/// </summary>
public static string Manual {
get {
return ResourceManager.GetString("Manual", resourceCulture);
}
}
/// <summary>
/// 查找类似 MasterCylinder 的本地化字符串。
/// </summary>
@ -1464,6 +1491,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 NOT AVAILABLE 的本地化字符串。
/// </summary>
public static string Not_a {
get {
return ResourceManager.GetString("Not_a", resourceCulture);
}
}
/// <summary>
/// 查找类似 Notimplementation 的本地化字符串。
/// </summary>
@ -2220,6 +2256,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 screen 的本地化字符串。
/// </summary>
public static string Screen {
get {
return ResourceManager.GetString("Screen", resourceCulture);
}
}
/// <summary>
/// 查找类似 Search 的本地化字符串。
/// </summary>
@ -2616,6 +2661,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Volume 的本地化字符串。
/// </summary>
public static string Volume {
get {
return ResourceManager.GetString("Volume", resourceCulture);
}
}
/// <summary>
/// 查找类似 Washing 的本地化字符串。
/// </summary>

18
Properties/Resources.en-US.resx

@ -1014,4 +1014,22 @@
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Manual" xml:space="preserve">
<value>Manual</value>
</data>
<data name="Not_a" xml:space="preserve">
<value>NOT AVAILABLE</value>
</data>
<data name="Screen" xml:space="preserve">
<value>Screen</value>
</data>
<data name="Volume" xml:space="preserve">
<value>Volume</value>
</data>
<data name="DispenseModule" xml:space="preserve">
<value>DispenseModule</value>
</data>
<data name="Information" xml:space="preserve">
<value>Information</value>
</data>
</root>

18
Properties/Resources.resx

@ -1014,4 +1014,22 @@
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Manual" xml:space="preserve">
<value>Manual</value>
</data>
<data name="Not_a" xml:space="preserve">
<value>NOT AVAILABLE</value>
</data>
<data name="Screen" xml:space="preserve">
<value>screen</value>
</data>
<data name="Volume" xml:space="preserve">
<value>Volume</value>
</data>
<data name="DispenseModule" xml:space="preserve">
<value>DispenseModule</value>
</data>
<data name="Information" xml:space="preserve">
<value>Information</value>
</data>
</root>

18
Properties/Resources.zh-CN.resx

@ -1014,4 +1014,22 @@
<data name="Cancel" xml:space="preserve">
<value>取消</value>
</data>
<data name="Manual" xml:space="preserve">
<value>手动</value>
</data>
<data name="Not_a" xml:space="preserve">
<value>当前功能不可用</value>
</data>
<data name="Screen" xml:space="preserve">
<value>远程画面</value>
</data>
<data name="Volume" xml:space="preserve">
<value>容量</value>
</data>
<data name="DispenseModule" xml:space="preserve">
<value>运行模组</value>
</data>
<data name="Information" xml:space="preserve">
<value>信息</value>
</data>
</root>

18
Properties/Resources.zh-TW.resx

@ -1014,4 +1014,22 @@
<data name="Cancel" xml:space="preserve">
<value>取消</value>
</data>
<data name="Manual" xml:space="preserve">
<value>手動</value>
</data>
<data name="Not_a" xml:space="preserve">
<value>目前功能不可用</value>
</data>
<data name="Screen" xml:space="preserve">
<value>遠端畫面</value>
</data>
<data name="Volume" xml:space="preserve">
<value>容量</value>
</data>
<data name="DispenseModule" xml:space="preserve">
<value>運行模組</value>
</data>
<data name="Information" xml:space="preserve">
<value />
</data>
</root>

21
SunlightCentralizedControlManagement_SCCM_.csproj

@ -101,6 +101,12 @@
</ApplicationDefinition>
<Compile Include="ConvertMoels\BoolRBConvert.cs" />
<Compile Include="ConvertMoels\StatenClassConvert.cs" />
<Compile Include="EX\DispenseState.xaml.cs">
<DependentUpon>DispenseState.xaml</DependentUpon>
</Compile>
<Compile Include="EX\ManualDyelot.xaml.cs">
<DependentUpon>ManualDyelot.xaml</DependentUpon>
</Compile>
<Compile Include="Login.xaml.cs">
<DependentUpon>Login.xaml</DependentUpon>
</Compile>
@ -124,6 +130,9 @@
<Compile Include="UserClass\StrToInt.cs" />
<Compile Include="UserClass\SubItem.cs" />
<Compile Include="UserClass\UserControlMenuItem.cs" />
<Compile Include="UserControls\DispenseMacInfo.xaml.cs">
<DependentUpon>DispenseMacInfo.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModel\CurveTempModel.cs" />
<Compile Include="ViewModel\CurveDiagramViewModel.cs" />
<Compile Include="ViewModel\MainWindowViewModel.cs" />
@ -212,6 +221,14 @@
<Compile Include="WindowsView\ViewStep.xaml.cs">
<DependentUpon>ViewStep.xaml</DependentUpon>
</Compile>
<Page Include="EX\DispenseState.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EX\ManualDyelot.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Login.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -234,6 +251,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="UserControls\DispenseMacInfo.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\CurveTemp.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

40
UserControls/DispenseMacInfo.xaml

@ -0,0 +1,40 @@
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.UserControls.DispenseMacInfo"
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:SunlightCentralizedControlManagement_SCCM_.UserControls"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="400" Background="#FF828282">
<Grid Margin="5,5,5,5" Background="White" >
<Image x:Name="IMAGE" VerticalAlignment="Top" Height="400" Margin="0,5,0,0" />
<Grid Margin="0,400,0,0">
<TextBlock TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" Height="30" VerticalAlignment="Top" FontSize="16"
HorizontalAlignment="Left" Width="150" Background="#FFE0E0E0"/>
<TextBlock TextWrapping="Wrap" Text="{x:Static lang:Resources.State}" Height="30" VerticalAlignment="Top" FontSize="16"
Margin="0,30,0,0" HorizontalAlignment="Left" Width="150" Background="#FFE0E0E0"/>
<TextBlock TextWrapping="Wrap" Text="{x:Static lang:Resources.WorkingStatus}" Height="30" VerticalAlignment="Top" FontSize="16"
Margin="0,60,0,0" HorizontalAlignment="Left" Width="150" Background="#FFE0E0E0"/>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,0,80,0">
<TextBlock x:Name="mac" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,0,0,0" HorizontalAlignment="Right" Width="80">
<TextBlock x:Name="macg" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,30,0,0">
<TextBlock x:Name="state" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,60,0,0">
<TextBlock x:Name="WorkingStatus" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Button x:Name="State" Content="{x:Static lang:Resources.Information}" HorizontalAlignment="Right" Height="35" Margin="0,0,15,10" VerticalAlignment="Bottom" Width="80" Click="State_Click" Padding="0,4,0,4"/>
<Button x:Name="Manual" Content="{x:Static lang:Resources.Manual}" HorizontalAlignment="Right" Height="35" Margin="0,0,115,10" VerticalAlignment="Bottom" Width="80" Click="Manual_Click" Padding="0,4,0,4"/>
<Button x:Name="Screen" Content="{x:Static lang:Resources.Screen}" HorizontalAlignment="Right" Height="35" Margin="0,0,215,10" VerticalAlignment="Bottom" Width="80" Click="Screen_Click" Padding="0,4,0,4"/>
<materialDesign:PackIcon x:Name="mlock" Kind="Lock" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="50" Height="50" Foreground="#FFA98C00" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
</Grid>
</Grid>
</UserControl>

70
UserControls/DispenseMacInfo.xaml.cs

@ -0,0 +1,70 @@
using ScottPlot.Plottables;
using SunlightCentralizedControlManagement_SCCM_.EX;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace SunlightCentralizedControlManagement_SCCM_.UserControls
{
/// <summary>
/// info.xaml 的交互逻辑
/// </summary>
public partial class DispenseMacInfo : UserControl
{
public DispenseMacInfo()
{
InitializeComponent();
}
private void State_Click(object sender, RoutedEventArgs e)
{
if (mlock.Visibility == Visibility.Visible)
{
MessageBox.Show(Properties.Resources.Not_a,"Dispense",MessageBoxButton.OK);
return;
}
UserMessage userMessage = new UserMessage();
userMessage.DispenseMacInfo(mac.Text, macg.Text);
userMessage.Show();
}
private void Manual_Click(object sender, RoutedEventArgs e)
{
if (mlock.Visibility == Visibility.Visible)
{
MessageBox.Show(Properties.Resources.Not_a, "Dispense", MessageBoxButton.OK);
return;
}
ManualDyelot manualDyelot = new ManualDyelot();
manualDyelot.MAC(mac.Text);
manualDyelot.Show();
}
private void Screen_Click(object sender, RoutedEventArgs e)
{
if (mlock.Visibility == Visibility.Visible)
{
MessageBox.Show(Properties.Resources.Not_a, "Dispense", MessageBoxButton.OK);
return;
}
}
}
}

16
UserControls/info.xaml.cs

@ -28,22 +28,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
public info()
{
InitializeComponent();
CountDown();
}
private void CountDown()
{
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
{
Interval = TimeSpan.FromSeconds(10)//秒
};
timer1s.Tick += Tick_Event_1S;
timer1s.Start();
}//时间周期初始化
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{
}
}
}

18
View/DispenseMachinesSet.xaml

@ -62,12 +62,20 @@
<DataGridTextColumn Header="{x:Static lang:Resources.Group}" Binding="{Binding Groups}" Width="210" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding IP}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding PORT}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding User}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Passsword}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding LOCK}" Width="0" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
<Image HorizontalAlignment="Left" x:Name="IMAGE" VerticalAlignment="Top" Width="400" Height="400" Margin="10,200,0,0" />
<Image HorizontalAlignment="Left" x:Name="IMAGE" VerticalAlignment="Bottom" Width="400" Height="400" Margin="10,200,0,100" />
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" FontSize="20" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,150,0,0" x:Name="User" VerticalAlignment="Top" Width="270" FontSize="20" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,150,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,200,0,0" x:Name="Password" VerticalAlignment="Top" Width="270" FontSize="20" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,200,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Password}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<CheckBox x:Name="dLICK" Content="{x:Static lang:Resources._lock}" HorizontalAlignment="Left" Height="35 " Margin="10,250,0,0" VerticalAlignment="Top" Width="200" FontSize="20"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="TextMachineGroup" VerticalAlignment="Top" Width="270" FontSize="20"
DropDownClosed="TextMachineGroup_DropDownClosed" TextBoxBase.TextChanged="TextMachineGroup_DropDownClosed"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,50,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.MachineGroup}" VerticalAlignment="Top" Width="120" FontSize="25"/>
@ -75,10 +83,10 @@
<TextBlock HorizontalAlignment="Left" Height="40" Margin="350,100,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" Width="20" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="360,100,0,0" x:Name="PORT" VerticalAlignment="Top" Width="60" FontSize="20" MaxLines="1" Text="7789"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,100,0,0" TextWrapping="Wrap" Text="IP/PORT" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,600,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/>
<Button Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Left" Height="35" Margin="250,600,0,5" VerticalAlignment="Top" Width="80" Click="Save_Click"/>
<Button Content="{x:Static lang:Resources.Delete}" HorizontalAlignment="Left" Height="35" Margin="340,600,0,5" VerticalAlignment="Top" Width="80" Click="Delete_Click"/>
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="160,600,50,5" VerticalAlignment="Top" Width="80" Click="Test_Click"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,600,0,15" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Bottom" Width="140" FontSize="20"/>
<Button Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Left" Height="35" Margin="250,600,0,15" VerticalAlignment="Bottom" Width="80" Click="Save_Click"/>
<Button Content="{x:Static lang:Resources.Delete}" HorizontalAlignment="Left" Height="35" Margin="340,600,0,15" VerticalAlignment="Bottom" Width="80" Click="Delete_Click"/>
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="160,600,50,15" VerticalAlignment="Bottom" Width="80" Click="Test_Click"/>

11
View/DispenseMachinesSet.xaml.cs

@ -48,8 +48,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
Griddata.ItemsSource = SQLiteHelpers.ExecuteDataSet("select Name,Groups,IP,PORT,DATA from MachinesDispense Order by id", null).Tables[0].DefaultView;
DataTable dataTable = SQLiteHelpers.ExecuteDataSet("select * from MachinesDispense Order by id", null).Tables[0];
SQLiteHelpers.Close();
Griddata.ItemsSource = dataTable.DefaultView;
}
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
@ -61,6 +62,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
TextMachineGroup.Text = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
IP.Text = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
PORT.Text = (Griddata.Columns[4].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
User.Text = (Griddata.Columns[5].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
Password.Text = (Griddata.Columns[6].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
string TYR= (Griddata.Columns[7].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;
dLICK.IsChecked = Convert.ToBoolean((Griddata.Columns[7].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text);//定位第列,
}
}
@ -77,6 +82,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dr_new.Add("Groups", TextMachineGroup.Text);
dr_new.Add("IP", IP.Text);
dr_new.Add("PORT", PORT.Text);
dr_new.Add("State", "899");
dr_new.Add("User", User.Text);
dr_new.Add("Passsword", Password.Text);
dr_new.Add("LOCK", dLICK.IsChecked.ToString());
dr_new.Add("DATA",imageData);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径

12
View/DispenseView.xaml

@ -16,14 +16,14 @@
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<ScrollViewer Margin="0" VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Horizontal" x:Name="DispenseMacView" Background="White">
</WrapPanel>
</ScrollViewer>
</Grid>
<StackPanel Grid.Row="1" Height="60" Background="#FF00204E" Orientation="Horizontal">
<StackPanel Grid.Row="1" Height="60" Background="#FF00204E" Orientation="Horizontal">
</StackPanel>
</Grid>
</UserControl>

59
View/DispenseView.xaml.cs

@ -1,14 +1,19 @@
using SkiaSharp;
using LiveChartsCore.Geo;
using SkiaSharp;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.UserControls;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using SunlightCentralizedControlManagement_SCCM_.ConvertMoels;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@ -37,10 +42,60 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
DataTable DispenseMac = new DataTable();
UserControls.DispenseMacInfo[] dispenseMacInfo = new UserControls.DispenseMacInfo[99]; //定义总览信息卡
//private string SYS_machines = null;
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
SQLiteHelpers = new SQLiteHelper(DBAddress);
SQLiteHelpers.Open(); //打开数据库
DispenseMac = SQLiteHelpers.ExecuteDataSet("select * from MachinesDispense ", null).Tables[0];//缓存
SQLiteHelpers.Close();
/// <summary>
/// 生成总览信息卡
/// </summary>
for (int i = 0; i < DispenseMac.Rows.Count; i++)
{
string x = DispenseMac.AsEnumerable().Select(row => row.Field<string>("State")).ElementAt(i);
bool y = DispenseMac.AsEnumerable().Select(row => row.Field<bool>("LOCK")).ElementAt(i);
dispenseMacInfo[i] = new UserControls.DispenseMacInfo();
dispenseMacInfo[i].Margin = new Thickness(5, 5, 0, 5);
dispenseMacInfo[i].Width = 400;
dispenseMacInfo[i].Height = 600;
dispenseMacInfo[i].mac.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("name")).ElementAt(i);
dispenseMacInfo[i].macg.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("Groups")).ElementAt(i);
dispenseMacInfo[i].state.Text = StatenClassConvert.Convert(x);
if (x == "899")
{
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
else
{
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
}
dispenseMacInfo[i].WorkingStatus.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("WorkingStatus")).ElementAt(i);
if (y)
{
dispenseMacInfo[i].mlock.Visibility = Visibility.Visible;
}
else
{
dispenseMacInfo[i].mlock.Visibility = Visibility.Collapsed;
}
//dispenseMacInfo[i].name.Text = Selet_Machines(MainWindowViewModel.Machines, "name", i).ToString();
// dispenseMacInfo[i].IMAGE = ;
MemoryStream memoryStream = new MemoryStream(DispenseMac.AsEnumerable().Select(row => row.Field<byte[]>("DATA")).ElementAt(i));
//数据流生成图片显示
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.StreamSource = memoryStream;
bitmapImage.EndInit();
dispenseMacInfo[i].IMAGE.Source = bitmapImage;
DispenseMacView.Children.Add(dispenseMacInfo[i]);
}
}

8
WindowsView/UserMessage.xaml.cs

@ -1,4 +1,5 @@
using SunlightCentralizedControlManagement_SCCM_.View;
using SunlightCentralizedControlManagement_SCCM_.EX;
using System;
using System.Collections.Generic;
using System.Linq;
@ -24,7 +25,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
{
InitializeComponent();
}
public void DispenseMacInfo(object dat, string mac)
{
DispenseState dispenseState = new DispenseState();
dispenseState.State(dat,mac);
Picture.Content = dispenseState;
}
public void Dyelots(object dat)
{
DyelotView dyelotView = new DyelotView();

Loading…
Cancel
Save