diff --git a/LOGO/242w.png b/LOGO/242w.png
new file mode 100644
index 0000000..766e0ce
Binary files /dev/null and b/LOGO/242w.png differ
diff --git a/LOGO/252-2t.png b/LOGO/252-2t.png
new file mode 100644
index 0000000..bc35305
Binary files /dev/null and b/LOGO/252-2t.png differ
diff --git a/LOGO/252RB.png b/LOGO/252RB.png
new file mode 100644
index 0000000..bb09d79
Binary files /dev/null and b/LOGO/252RB.png differ
diff --git a/LOGO/252RMRD.png b/LOGO/252RMRD.png
new file mode 100644
index 0000000..08830cb
Binary files /dev/null and b/LOGO/252RMRD.png differ
diff --git a/LOGO/302.png b/LOGO/302.png
new file mode 100644
index 0000000..4742d3d
Binary files /dev/null and b/LOGO/302.png differ
diff --git a/LOGO/303.png b/LOGO/303.png
new file mode 100644
index 0000000..e2cb8a6
Binary files /dev/null and b/LOGO/303.png differ
diff --git a/LOGO/303pdw.png b/LOGO/303pdw.png
new file mode 100644
index 0000000..e25ffd9
Binary files /dev/null and b/LOGO/303pdw.png differ
diff --git a/SunlightCentralizedControlManagement_SCCM_.csproj b/SunlightCentralizedControlManagement_SCCM_.csproj
index dad28ee..d1e4194 100644
--- a/SunlightCentralizedControlManagement_SCCM_.csproj
+++ b/SunlightCentralizedControlManagement_SCCM_.csproj
@@ -137,6 +137,12 @@
LogView.xaml
+
+ DispenseView.xaml
+
+
+ DispenseMachinesSet.xaml
+
MachinesView.xaml
@@ -240,6 +246,14 @@
Designer
MSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
@@ -449,6 +463,14 @@
+
+
+
+
+
+
+
+
diff --git a/View/DispenseMachinesSet.xaml b/View/DispenseMachinesSet.xaml
new file mode 100644
index 0000000..b26041c
--- /dev/null
+++ b/View/DispenseMachinesSet.xaml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/View/DispenseMachinesSet.xaml.cs b/View/DispenseMachinesSet.xaml.cs
new file mode 100644
index 0000000..104d5e5
--- /dev/null
+++ b/View/DispenseMachinesSet.xaml.cs
@@ -0,0 +1,218 @@
+using SkiaSharp;
+using SunlightCentralizedControlManagement_SCCM_.UserClass;
+using SunlightCentralizedControlManagement_SCCM_.ViewModel;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net;
+using System.Net.NetworkInformation;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
+
+namespace SunlightCentralizedControlManagement_SCCM_.View
+{
+ ///
+ /// MachinesSet.xaml 的交互逻辑
+ ///
+ public partial class DispenseMachinesSet : UserControl
+ {
+ public DispenseMachinesSet()
+ {
+ InitializeComponent();
+
+ //
+ string[] Machine_ = { "252", "252RB", "252-2T", "252RDRM", "242W", "302", "303", "303PDW" };
+ TextMachineGroup.ItemsSource = Machine_;
+
+ }
+
+ 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");
+ //private string SYS_machines = null;
+ private void UserControl_Loaded(object sender, RoutedEventArgs e)
+ {
+ Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
+ }
+
+ private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
+ if (rownum != -1)//判断鼠标定位是否有效
+ {
+ comboBoxMachine.Text = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
+ 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;//定位第列,
+
+ }
+ }
+
+ private void Save_Click(object sender, RoutedEventArgs e)
+ {
+ if (!string.IsNullOrEmpty(comboBoxMachine.Text))
+ {
+ Dictionary dr_new = new Dictionary();//缓存函数
+ dr_new.Add("Name", comboBoxMachine.Text);
+ dr_new.Add("Groups", TextMachineGroup.Text);
+ dr_new.Add("IP", IP.Text);
+ dr_new.Add("PORT", PORT.Text);
+
+ SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
+ SQLiteHelpers.Open(); //打开数据库
+
+ if (SQLiteHelpers.ExecuteDataSet("select * from Machines where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
+ {
+ SQLiteHelpers.InsertData("Machines", dr_new);
+ }
+ else
+ {
+ SQLiteHelpers.Update("Machines", dr_new, "name='" + comboBoxMachine.Text + "'", null);
+ }
+ MainWindowViewModel.Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存
+ SQLiteHelpers.Close();
+ Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
+ comboBoxMachine.Text = null;
+ TextMachineGroup.Text = null;
+ IP.Text = null;
+ PORT.Text = "7789";
+ }
+ else
+ {
+ }
+ }
+ private void Delete_Click(object sender, RoutedEventArgs e)
+ {
+ if (!string.IsNullOrEmpty(comboBoxMachine.Text))
+ {
+ MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question);
+ if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码
+ {
+ SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
+ SQLiteHelpers.Open(); //打开数据库
+ SQLiteHelpers.Delete("Machines", "Name='" + comboBoxMachine.Text + "'", null);
+ MainWindowViewModel.Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存
+ SQLiteHelpers.Close();
+ Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
+ comboBoxMachine.Text = null;
+ }
+ }
+ else
+ {
+ textlog.Text = "Invalid";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
+ }
+ }
+ private void Test_Click(object sender, RoutedEventArgs e)//测试按钮
+ {
+ if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text))
+ {
+ textlog.Text = "TEST";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
+ //------------使用ping类------
+ string host = IP.Text;
+ Ping p1 = new Ping();
+ PingReply reply = p1.Send(host); //发送主机名或Ip地址
+ //StringBuilder sbuilder;
+ if (reply.Status == IPStatus.Success)
+ {
+ Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ //连接服务器,绑定IP 与 端口
+ IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Parse(IP.Text), int.Parse(PORT.Text));
+ try
+ {
+ socket.Connect(iPEndPoint);
+ socket.Close();//离线
+ textlog.Text = "Link succeed";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
+ }
+ catch (Exception)
+ {
+ textlog.Text = "Link failed";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
+ }
+ }
+ else if (reply.Status == IPStatus.TimedOut)
+ {
+ textlog.Text = "Link timeout";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
+ }
+ else
+ {
+ textlog.Text = "No links";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
+ }
+ }
+ else
+ {
+ textlog.Text = "Invalid";
+ textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
+ }
+
+ }
+
+ private void TextMachineGroup_DropDownClosed(object sender, EventArgs e)
+ {
+ Uri uri;
+ BitmapImage bitmapImage;
+ switch (TextMachineGroup.Text)//步骤用时计算
+ {
+ case "252":
+ uri = new Uri("pack://application:,,,/ReferencedAssembly;component/LOGO/252-2t.png");
+ bitmapImage = new BitmapImage(uri);
+ IMAGE.Source = bitmapImage;
+ break;
+ case "252-2T":
+ uri = new Uri("pack://application:,,,/ReferencedAssembly;component/SunlightCentralizedControlManagement(SCCM)/LOGO/252-2t.png");
+ bitmapImage = new BitmapImage(uri);
+ IMAGE.Source = bitmapImage;
+ break;
+ case "252RB":
+ uri = new Uri("pack://application:,,,/ReferencedAssembly;component/SunlightCentralizedControlManagement(SCCM)/LOGO/252RB.png");
+ bitmapImage = new BitmapImage(uri);
+ IMAGE.Source = bitmapImage;
+ break;
+ case "252RDRM":
+ uri = new Uri("pack://application:,,,/ReferencedAssembly;component/SunlightCentralizedControlManagement(SCCM)/LOGO/252RDRM.png");
+ bitmapImage = new BitmapImage(uri);
+ IMAGE.Source = bitmapImage;
+ break;
+ case "242W":
+ uri = new Uri("pack://application:,,,/SunlightCentralizedControlManagement_SCCM_;component/242w.png");
+ bitmapImage = new BitmapImage(uri);
+ IMAGE.Source = bitmapImage;
+ break;
+ case "302":
+ uri = new Uri("pack://application:,,,/ReferencedAssembly;component/SunlightCentralizedControlManagement(SCCM)/LOGO/302.png");
+ bitmapImage = new BitmapImage(uri);
+ IMAGE.Source = bitmapImage;
+ break;
+ case "303":
+ uri = new Uri("pack://application:,,,/ReferencedAssembly;component/SunlightCentralizedControlManagement(SCCM)/LOGO/303.png");
+ bitmapImage = new BitmapImage(uri);
+ IMAGE.Source = bitmapImage;
+ break;
+ case "303PDW":
+ uri = new Uri("pack://application:,,,/ReferencedAssembly;component/SunlightCentralizedControlManagement(SCCM)/LOGO/303pdw.png");
+ bitmapImage = new BitmapImage(uri);
+ IMAGE.Source = bitmapImage;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
diff --git a/View/DispenseView.xaml b/View/DispenseView.xaml
new file mode 100644
index 0000000..5c82b4b
--- /dev/null
+++ b/View/DispenseView.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/View/DispenseView.xaml.cs b/View/DispenseView.xaml.cs
new file mode 100644
index 0000000..41dc95c
--- /dev/null
+++ b/View/DispenseView.xaml.cs
@@ -0,0 +1,49 @@
+using SkiaSharp;
+using SunlightCentralizedControlManagement_SCCM_.UserClass;
+using SunlightCentralizedControlManagement_SCCM_.ViewModel;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net;
+using System.Net.NetworkInformation;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
+
+namespace SunlightCentralizedControlManagement_SCCM_.View
+{
+ ///
+ /// MachinesSet.xaml 的交互逻辑
+ ///
+ public partial class DispenseView : UserControl
+ {
+ public DispenseView()
+ {
+ InitializeComponent();
+ }
+
+ 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");
+ //private string SYS_machines = null;
+ private void UserControl_Loaded(object sender, RoutedEventArgs e)
+ {
+
+ }
+
+
+
+ }
+}
diff --git a/View/SYSSetView.xaml b/View/SYSSetView.xaml
index fc1cd93..10cf162 100644
--- a/View/SYSSetView.xaml
+++ b/View/SYSSetView.xaml
@@ -22,6 +22,14 @@
+
+
+
+
+
+
+
+
@@ -29,7 +37,7 @@
-
+
diff --git a/View/SYSSetView.xaml.cs b/View/SYSSetView.xaml.cs
index 8715a4b..bb3ee2e 100644
--- a/View/SYSSetView.xaml.cs
+++ b/View/SYSSetView.xaml.cs
@@ -51,5 +51,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{
Picture.Content = new View.LogView();
}
+
+ private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
+ {
+ Picture.Content = new View.DispenseMachinesSet();
+ }
}
}