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

This commit is contained in:
sc committed 2025-03-25 23:26:47 +08:00
commit acd37a8245
21 files changed
+610 -31

No files matched your search

+13 -5
View File
@@ -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"/>
+10 -1
View File
@@ -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); //数据库连接路径
+6 -6
View File
@@ -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>
+57 -2
View File
@@ -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]);
}
}