diff --git a/App.xaml.cs b/App.xaml.cs index 07fc766..e02095d 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -1,11 +1,5 @@ -using Svg; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; +using System; using System.IO; -using System.Linq; -using System.Threading.Tasks; using System.Windows; namespace formula_manage @@ -44,7 +38,7 @@ namespace formula_manage this.DispatcherUnhandledException += App_DispatcherUnhandledException; } - string Log_time = DateTime.Now.ToString("yyyy-MM-dd"); + string Log_time = DateTime.Now.ToString("yyyy-MM-dd"); string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录 //string logPathtxt = "" + System.Environment.CurrentDirectory + "\\Log\\"+ Log_time + "Log.txt";//日志文件 @@ -53,17 +47,17 @@ namespace formula_manage e.Handled = true; if (e.Exception.InnerException == null) { - MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" + MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" + "(1)错误" + Environment.NewLine - + "(2)错误源:" + e.Exception.Source + Environment.NewLine - // + (3)详细信息:" + e.Exception.Message + Environment.NewLine - // + "(4)报错区域:" + e.Exception.StackTrace + + "(2)错误源:" + e.Exception.Source + Environment.NewLine + // + (3)详细信息:" + e.Exception.Message + Environment.NewLine + // + "(4)报错区域:" + e.Exception.StackTrace ); } else { - MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" - + "(1)错误" + Environment.NewLine + MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" + + "(1)错误" + Environment.NewLine // + "(2)错误源:" + e.Exception.InnerException.Source + Environment.NewLine + "(3)错误信息:" + e.Exception.Message + Environment.NewLine // + "(4)详细信息:" + e.Exception.InnerException.Message + Environment.NewLine @@ -72,7 +66,7 @@ namespace formula_manage } System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录 - string log_path = logpath +"\\ERR" +Log_time + ".txt"; + string log_path = logpath + "\\ERR" + Log_time + ".txt"; string Log_timehms = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (!File.Exists(log_path))//检查文件并写入 { @@ -90,7 +84,7 @@ namespace formula_manage StreamWriter wr = new StreamWriter(fs);//创建文件 wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString()); wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString()); - wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString()); + wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString()); wr.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString()); wr.Close(); } diff --git a/ConvertMoels/CategoriesSQLConvert.cs b/ConvertMoels/CategoriesSQLConvert.cs index c944a22..da84870 100644 --- a/ConvertMoels/CategoriesSQLConvert.cs +++ b/ConvertMoels/CategoriesSQLConvert.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; namespace formula_manage.ConvertMoels diff --git a/ConvertMoels/ColorSQLConvert.cs b/ConvertMoels/ColorSQLConvert.cs index c420311..27211ae 100644 --- a/ConvertMoels/ColorSQLConvert.cs +++ b/ConvertMoels/ColorSQLConvert.cs @@ -1,14 +1,10 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; namespace formula_manage.ConvertMoels { - /// + /// /// RGB色彩数值转换器 /// 将色彩数值转换为ARGB代码返回 /// @@ -19,7 +15,7 @@ namespace formula_manage.ConvertMoels public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) - { + { string colorValue = string.Format("{0:X6}", value);//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0” /*string StuffColor = "#FF" + colorValue;//RGB数值拼接为ARGB数值(正向)*/ string StuffColor_B = colorValue.Substring(0, 2);//获取蓝色参数 @@ -33,8 +29,8 @@ namespace formula_manage.ConvertMoels return null;//返回空 } } - /// - /// + /// + /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; diff --git a/ConvertMoels/DeviationConvert.cs b/ConvertMoels/DeviationConvert.cs index 934f487..1c8a4a2 100644 --- a/ConvertMoels/DeviationConvert.cs +++ b/ConvertMoels/DeviationConvert.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; namespace Audit.ConvertMoels diff --git a/ConvertMoels/GramsSQLConvert.cs b/ConvertMoels/GramsSQLConvert.cs index 937b437..a147c3c 100644 --- a/ConvertMoels/GramsSQLConvert.cs +++ b/ConvertMoels/GramsSQLConvert.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; namespace Audit.ConvertMoels diff --git a/ConvertMoels/IndustrySQLConvert.cs b/ConvertMoels/IndustrySQLConvert.cs index 80b0694..4d887c9 100644 --- a/ConvertMoels/IndustrySQLConvert.cs +++ b/ConvertMoels/IndustrySQLConvert.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; namespace formula_manage.ConvertMoels @@ -40,8 +36,8 @@ namespace formula_manage.ConvertMoels } } } - /// - /// + /// + /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; diff --git a/ConvertMoels/IonSQLConvert.cs b/ConvertMoels/IonSQLConvert.cs index 7bd30b4..f6c8f80 100644 --- a/ConvertMoels/IonSQLConvert.cs +++ b/ConvertMoels/IonSQLConvert.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; namespace formula_manage.ConvertMoels diff --git a/ConvertMoels/ProductTypeSQLConvert.cs b/ConvertMoels/ProductTypeSQLConvert.cs index ab33eb5..0906f93 100644 --- a/ConvertMoels/ProductTypeSQLConvert.cs +++ b/ConvertMoels/ProductTypeSQLConvert.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; namespace formula_manage.ConvertMoels diff --git a/ConvertMoels/StatenConvert.cs b/ConvertMoels/StatenConvert.cs index c24c943..c255dcd 100644 --- a/ConvertMoels/StatenConvert.cs +++ b/ConvertMoels/StatenConvert.cs @@ -1,12 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Controls; /// /// 运行状态变换器 @@ -40,7 +33,7 @@ namespace Audit.ConvertMoels } } - + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); diff --git a/ConvertMoels/StatenERRConvert.cs b/ConvertMoels/StatenERRConvert.cs index 48e0420..1ddf73e 100644 --- a/ConvertMoels/StatenERRConvert.cs +++ b/ConvertMoels/StatenERRConvert.cs @@ -1,12 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Controls; namespace Audit.ConvertMoels { diff --git a/ConvertMoels/UserSQLConvert.cs b/ConvertMoels/UserSQLConvert.cs index 8872d2e..4cc842b 100644 --- a/ConvertMoels/UserSQLConvert.cs +++ b/ConvertMoels/UserSQLConvert.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; namespace formula_manage.ConvertMoels @@ -37,7 +33,7 @@ namespace formula_manage.ConvertMoels } } } - + /// /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/EX/ExProgram.xaml.cs b/EX/ExProgram.xaml.cs index 5ad566b..451c497 100644 --- a/EX/ExProgram.xaml.cs +++ b/EX/ExProgram.xaml.cs @@ -1,17 +1,5 @@ using formula_manage.UserClass; -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.Shapes; namespace formula_manage.EX { diff --git a/EX/Exchange.xaml.cs b/EX/Exchange.xaml.cs index 6155bac..0131b25 100644 --- a/EX/Exchange.xaml.cs +++ b/EX/Exchange.xaml.cs @@ -1,20 +1,10 @@ using System; -using System.Collections.Generic; using System.Data; using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -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; -using System.Windows.Threading; namespace formula_manage.EX { @@ -31,7 +21,7 @@ namespace formula_manage.EX { WindowStartupLocation = WindowStartupLocation.CenterScreen; InitializeComponent(); - + logdataTable.Columns.Add("Name", typeof(string)); logdataTable.Columns.Add("Length", typeof(int)); logdataTable.Columns.Add("CreationTimeUtc", typeof(string)); @@ -48,7 +38,7 @@ namespace formula_manage.EX DataRow FileRow = logdataTable.NewRow(); FileRow["Name"] = item.Name; - FileRow["Length"] = item.Length/1024; + FileRow["Length"] = item.Length / 1024; FileRow["CreationTimeUtc"] = item.CreationTimeUtc; FileRow["LastWriteTimeUtc"] = item.LastWriteTimeUtc; logdataTable.Rows.Add(FileRow); @@ -67,18 +57,18 @@ namespace formula_manage.EX /*定位选中行及指定列单元格文本信息*/ LOGDATA_file((gridLog.Columns[0].GetCellContent(gridLog.Items[rownum]) as TextBlock).Text.TrimEnd());// } - - logR.Visibility = Visibility.Hidden; + + logR.Visibility = Visibility.Hidden; } private void LOGDATA_file(string dat) //读取文件显示到前端 - { + { Logtext.Document = new FlowDocument(); string filePath = System.Environment.CurrentDirectory + "\\Exchange\\"; try { - // 使用StreamReader读取文件 - using (StreamReader reader = new StreamReader(filePath + dat)) + // 使用StreamReader读取文件 + using (StreamReader reader = new StreamReader(filePath + dat)) { // 读取文件直到文件的末尾 while (!reader.EndOfStream) @@ -92,7 +82,7 @@ namespace formula_manage.EX { // 处理可能发生的任何异常 MessageBox.Show("Error reading file: " + ex.Message); - } + } } } } diff --git a/Help.xaml.cs b/Help.xaml.cs index 6dbf732..37d7b5c 100644 --- a/Help.xaml.cs +++ b/Help.xaml.cs @@ -1,16 +1,4 @@ -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.Shapes; +using System.Windows; namespace formula_manage { diff --git a/IProvider.cs b/IProvider.cs index 4fd89b5..96ba9af 100644 --- a/IProvider.cs +++ b/IProvider.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace formula_manage +namespace formula_manage { /// /// 查询接口 @@ -12,6 +6,6 @@ namespace formula_manage /// public interface IProvider where T : class { - + } } diff --git a/Login.xaml.cs b/Login.xaml.cs index 762bbb1..6dc8132 100644 --- a/Login.xaml.cs +++ b/Login.xaml.cs @@ -1,24 +1,11 @@ using System; -using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; -using System.Runtime.InteropServices; -using System.Data.SqlClient; -using System.Data; -using System.Security.Policy; -using System.IO; -using formula_manage.Windows; namespace formula_manage { @@ -31,7 +18,7 @@ namespace formula_manage DataTable logindataTable = new DataTable(); //建立login缓存 - public Login() + public Login() { WindowStartupLocation = WindowStartupLocation.CenterScreen; InitializeComponent(); @@ -68,12 +55,12 @@ namespace formula_manage UserClass.LogGing.LogGingDATA("LOGon = ENGINEER"); Main.ShowDialog();//实例化并置顶打开窗口 - } + } else { - string var_sql; + string var_sql; - if (pasword =="") var_sql = "[UserCode]='" + user + "' and [PassWord] is null"; //查询字符 + if (pasword == "") var_sql = "[UserCode]='" + user + "' and [PassWord] is null"; //查询字符 else var_sql = "[UserCode]='" + user + "' and [PassWord]='" + pasword + "'"; var loginOK = this.logindataTable.Select(var_sql).FirstOrDefault(); //查询账号信息是否正确,不正确返回null @@ -91,7 +78,7 @@ namespace formula_manage Main.ShowDialog();//实例化并置顶打开窗口 } else - System.Windows.MessageBox.Show("账号或密码错误"); + System.Windows.MessageBox.Show("账号或密码错误"); } } @@ -126,15 +113,16 @@ namespace formula_manage DBCLINK.Visibility = Visibility.Hidden; EXLINK.Visibility = Visibility.Hidden; USERLINK.Visibility = Visibility.Hidden; - DISPENLINK.Background = Brushes.Red; + DISPENLINK.Background = Brushes.Red; } if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6"))) { try { - EXLINK.Background = Brushes.Green; - }catch(Exception) + EXLINK.Background = Brushes.Green; + } + catch (Exception) { EXLINK.Background = Brushes.Red; System.Windows.MessageBox.Show("扩展程序未启动"); @@ -149,16 +137,17 @@ namespace formula_manage TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4"); TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5"); SQL2 = Boolean.Parse(Configini.IniReadvalue("SQL_SERVER", "SQL6")); //数据库对象2是否生效 - }catch(Exception) - { - System.Windows.MessageBox.Show("配置信息丢失"); + } + catch (Exception) + { + System.Windows.MessageBox.Show("配置信息丢失"); } if (TEXT_SQMOD == "0") //判断连接方式 { Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI"; } - else + else { Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR; } @@ -167,8 +156,9 @@ namespace formula_manage try { - await conn_SC.OpenAsync(); - }catch (Exception) + await conn_SC.OpenAsync(); + } + catch (Exception) { DISPENLINK.Background = Brushes.Red; //连接失败红色 DBCLINK.Background = Brushes.Red; @@ -179,7 +169,7 @@ namespace formula_manage UserClass.LogGing.LogGingDATA("DISPENLINK = ConnectFailed"); return; - } + } conn_SC.Close(); //关闭连接 DISPENLINK.Background = Brushes.Green; //连接成功绿色 @@ -200,10 +190,11 @@ namespace formula_manage } SqlConnection conn_DBC = new SqlConnection(Connstr_DBC); - try + try { await conn_DBC.OpenAsync(); - }catch (Exception) + } + catch (Exception) { DBCLINK.Background = Brushes.Red; //连接失败红色 System.Windows.MessageBox.Show("连接数据库失败"); diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 3ec2ee7..ee01017 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -1,41 +1,18 @@ -using formula_manage.Windows; +using formula_manage.UserClass; +using formula_manage.View; +using formula_manage.ViewModel; +using formula_manage.Windows; using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; using System.Data; using System.Data.SqlClient; -using System.Globalization; +using System.Drawing; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; using System.Text.RegularExpressions; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Threading; -using formula_manage.ViewModel; -using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; -using static System.Net.Mime.MediaTypeNames; -using formula_manage.UserClass; -using System.Drawing; -using System.Diagnostics; -using System.Printing; -using System.Drawing.Printing; -using static System.Drawing.Printing.PrinterSettings; -using formula_manage.View; -using formula_manage.EX; namespace formula_manage { @@ -44,18 +21,18 @@ namespace formula_manage /// public partial class MainWindow : Window { - Font font = new Font("Microsoft YaHei", 20); + Font font = new Font("Microsoft YaHei", 20); bool quit = false; - // DataTable DissolvedataTable = new DataTable(); //建立Dissolve缓存 - // DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存 - // DataTable MACHINEdataTable = new DataTable(); //建立Machine缓存 + // DataTable DissolvedataTable = new DataTable(); //建立Dissolve缓存 + // DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存 + // DataTable MACHINEdataTable = new DataTable(); //建立Machine缓存 DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存 // DataTable RecipedataTable = new DataTable(); //建立Recipe缓存 private readonly string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径 //调用配置文件 - private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"); + private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"); string TEXT_SQLIP; string TEXT_SQLNAME; @@ -129,7 +106,7 @@ namespace formula_manage private void PrintForms()//传入可用打印模板 { - int dirID=0; + int dirID = 0; DataTable Report = new DataTable(); Report.Columns.Add("NAME", typeof(string)); @@ -156,7 +133,7 @@ namespace formula_manage Forms_.DisplayMemberPath = "NAME"; // 显示文件名 Forms_.Text = Temp_m; } - + private void sql_() { TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件 @@ -194,7 +171,7 @@ namespace formula_manage Stuff_data.Fill(logindataTable); //查询结果存入缓存 conn_SC.Close(); //关闭连接 } - catch (Exception) + catch (Exception) { System.Windows.MessageBox.Show("请求信息失败,检查连接"); UserClass.LogGing.LogGingDATA("DatabaseConnectionFailed"); @@ -260,7 +237,7 @@ namespace formula_manage } // UserClass.LogGing.LogGingDATA(Log_time + "HttpSERVER_STOP"); - if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6"))) + if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6"))) { UserClass.TCPServer.Btn_SendAll("SERVER_STOP"); } @@ -307,7 +284,7 @@ namespace formula_manage UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); string PreposeT4 = Configini.IniReadvalue("SOFTWARE_SET", "T6"); // - string time = System.DateTime.Now.ToString(PreposeT); //获取系统时 + string time = System.DateTime.Now.ToString(PreposeT); //获取系统时 if (PreposeT4 != time) PreposeSl = 0; PreposeSl = PreposeSl + 1; str_Prepose = String.Format("{0:D" + preposeL + "}", PreposeSl); @@ -447,7 +424,7 @@ namespace formula_manage if (dialog.ShowDialog() == true) { // dialog.PrintVisual(printArea, "Print Test"); - // dialog.PrintVisual(richText, "测试"); + // dialog.PrintVisual(richText, "测试"); } Print.IsEnabled = true; @@ -575,7 +552,7 @@ namespace formula_manage Procedures_N.Text = "1"; Procedures_P.Text = "1"; - System.Windows.MessageBox.Show(Number.Text+"-"+ ReDye.Text + "已保存"); + System.Windows.MessageBox.Show(Number.Text + "-" + ReDye.Text + "已保存"); Number_Event(); UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); //记录当前单序号 @@ -636,7 +613,7 @@ namespace formula_manage public void Recevie_order(string[] value)//订单选择信息传递 { order.Text = value[0]; - Technology.Text = value[1]+"@" + value[2]; + Technology.Text = value[1] + "@" + value[2]; } private void Button_Order(object sender, RoutedEventArgs e) @@ -654,7 +631,7 @@ namespace formula_manage private void Button_Technology(object sender, RoutedEventArgs e) { ViewProcess viewProcess = new ViewProcess(); - viewProcess.sendMessage = Recevie_Technology; + viewProcess.sendMessage = Recevie_Technology; Deputy.Content = viewProcess; //打开工艺选择 } @@ -682,7 +659,7 @@ namespace formula_manage if (!r.Any()) return; //检查信息 if (double.Parse(r[0].ItemArray[1].ToString()) < a) { - System.Windows.MessageBox.Show("超载,确定重量","错误",MessageBoxButton.OK,MessageBoxImage.Error); + System.Windows.MessageBox.Show("超载,确定重量", "错误", MessageBoxButton.OK, MessageBoxImage.Error); list_Weight.Text = "0"; list_Total.Text = "0"; return; @@ -690,7 +667,7 @@ namespace formula_manage } private void Proportion(object sender, TextChangedEventArgs e) //浴比输入 { - float a, b, c=0; + float a, b, c = 0; b = float.Parse(list_Proportion.Text); if (list_Weight.Text != "") //判断比例是否有效 { @@ -714,10 +691,10 @@ namespace formula_manage string Name_; string Type_; string Conc_; - double Weight_=0; + double Weight_ = 0; private void CP_PRODUCT_CODE_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//原料代码输入事件 - { + { double ang; if (e.Key == Key.Enter) { @@ -765,7 +742,7 @@ namespace formula_manage Name_ = r[0].ItemArray[1].ToString(); Type_ = r[0].ItemArray[2].ToString(); Conc_ = r[0].ItemArray[3].ToString(); - Conc_ = (double.Parse(Conc_)/100).ToString(); + Conc_ = (double.Parse(Conc_) / 100).ToString(); if ((Type_ == "0") || (Type_ == "3")) { @@ -794,7 +771,7 @@ namespace formula_manage return; } } - + DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列 row.BeginEdit(); row["PRODUCT_CODE"] = Code_; @@ -828,7 +805,7 @@ namespace formula_manage private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件 { double ang; - double conc=0; + double conc = 0; System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox; int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行 @@ -939,7 +916,7 @@ namespace formula_manage Name_ = r[0].ItemArray[1].ToString(); Type_ = r[0].ItemArray[2].ToString(); Conc_ = r[0].ItemArray[3].ToString(); - Conc_ = (double.Parse(Conc_)/100).ToString(); + Conc_ = (double.Parse(Conc_) / 100).ToString(); if (double.TryParse(list_Weight.Text, out ang)) { @@ -980,7 +957,7 @@ namespace formula_manage row["PRODUCT_CODE"] = Code_; row["PRODUCT_NAME"] = Name_; row["SHIFT"] = Type_; - row.EndEdit(); + row.EndEdit(); DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid Save.IsEnabled = false; Confirm.IsEnabled = false; diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index f583fc0..be39f55 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -1,6 +1,4 @@ using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; diff --git a/SQLModels/STUFF_Product.cs b/SQLModels/STUFF_Product.cs index 859ef26..c02e24f 100644 --- a/SQLModels/STUFF_Product.cs +++ b/SQLModels/STUFF_Product.cs @@ -1,14 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace formula_manage.SQLModels { - // internal class STUFF_Product + // internal class STUFF_Product //{ - // } + // } public partial class Product { diff --git a/UserClass/CRCcheck16.cs b/UserClass/CRCcheck16.cs index 14381a9..f511e8d 100644 --- a/UserClass/CRCcheck16.cs +++ b/UserClass/CRCcheck16.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Text; -using System.Threading.Tasks; namespace formula_manage.UserClass { diff --git a/UserClass/Code128.cs b/UserClass/Code128.cs index 2f7b0b1..46bfad6 100644 --- a/UserClass/Code128.cs +++ b/UserClass/Code128.cs @@ -2,9 +2,6 @@ using System.Collections.Generic; using System.Data; using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace formula_manage.UserClass { diff --git a/UserClass/DataGridHelper.cs b/UserClass/DataGridHelper.cs index 8a33454..18adf48 100644 --- a/UserClass/DataGridHelper.cs +++ b/UserClass/DataGridHelper.cs @@ -1,10 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; using System.Windows; +using System.Windows.Controls; namespace formula_manage.UserClass { diff --git a/UserClass/DataTableForToObservableCollection.cs b/UserClass/DataTableForToObservableCollection.cs index af30c45..8576c1b 100644 --- a/UserClass/DataTableForToObservableCollection.cs +++ b/UserClass/DataTableForToObservableCollection.cs @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Data; -using System.Linq; using System.Reflection; -using System.Text; -using System.Threading.Tasks; namespace formula_manage.UserClass { diff --git a/UserClass/HardwareSN.cs b/UserClass/HardwareSN.cs index 65aaefa..45de8a4 100644 --- a/UserClass/HardwareSN.cs +++ b/UserClass/HardwareSN.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Management; -using System.Text; -using System.Threading.Tasks; +using System.Management; namespace formula_manage.UserClass { diff --git a/UserClass/IniFile.cs b/UserClass/IniFile.cs index 08ccb63..c43b367 100644 --- a/UserClass/IniFile.cs +++ b/UserClass/IniFile.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using System.Text; -using System.Threading.Tasks; namespace formula_manage.UserClass { diff --git a/UserClass/LogDataRead.cs b/UserClass/LogDataRead.cs index ad62fb6..b43eb81 100644 --- a/UserClass/LogDataRead.cs +++ b/UserClass/LogDataRead.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Documents; +using System.Text; using System.Windows.Controls; +using System.Windows.Documents; using System.Windows.Media; namespace formula_manage.UserClass diff --git a/UserClass/LogGing.cs b/UserClass/LogGing.cs index 47d9e25..b49b6df 100644 --- a/UserClass/LogGing.cs +++ b/UserClass/LogGing.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace formula_manage.UserClass { @@ -12,7 +8,7 @@ namespace formula_manage.UserClass public static void LogGingDATA(string dat) { string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录 - string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\"+ DateTime.Now.ToString("yyyy-MM-dd") + ".txt";//日志文件 + string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";//日志文件 string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:"; System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录 diff --git a/UserClass/MD5check.cs b/UserClass/MD5check.cs index 6b917d2..b3c2f4d 100644 --- a/UserClass/MD5check.cs +++ b/UserClass/MD5check.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Security.Cryptography; using System.Text; -using System.Threading.Tasks; namespace formula_manage.UserClass { diff --git a/UserClass/PressKey.cs b/UserClass/PressKey.cs index ef2b126..e0da05c 100644 --- a/UserClass/PressKey.cs +++ b/UserClass/PressKey.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace formula_manage.UserClass diff --git a/UserClass/PrintHelper.cs b/UserClass/PrintHelper.cs index e5c62ea..7ed66e8 100644 --- a/UserClass/PrintHelper.cs +++ b/UserClass/PrintHelper.cs @@ -3,9 +3,6 @@ using FastReport.Data; using System; using System.Collections.Generic; using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace formula_manage.UserClass { @@ -83,9 +80,9 @@ namespace formula_manage.UserClass { string chineseSimpleFrl = AppDomain.CurrentDomain.BaseDirectory + @"FastReport\Localization\language.frl"; FastReport.Utils.Res.LoadLocale(chineseSimpleFrl); - } + } catch (Exception ex) - { + { } try diff --git a/UserClass/StrToInt.cs b/UserClass/StrToInt.cs index 212c2c1..3c74600 100644 --- a/UserClass/StrToInt.cs +++ b/UserClass/StrToInt.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace formula_manage.UserClass { @@ -30,7 +26,7 @@ namespace formula_manage.UserClass //方法3 //int r3 = Convert.ToInt32(str, 16); //Console.WriteLine(r3); - } + } catch (Exception e) { res = 0; diff --git a/UserClass/TCPServer.cs b/UserClass/TCPServer.cs index 85e8a82..8de80b8 100644 --- a/UserClass/TCPServer.cs +++ b/UserClass/TCPServer.cs @@ -1,17 +1,11 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; -using System.IO; using System.Net; using System.Net.Sockets; -using System.Windows.Forms; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Net.NetworkInformation; +using System.Text; +using System.Threading.Tasks; namespace formula_manage.UserClass { @@ -25,53 +19,53 @@ namespace formula_manage.UserClass public static Dictionary OnLineList = new Dictionary(); DataTable IPdataTable = new DataTable(); //建立缓存 - //当前时间 + //当前时间 private string CurrentTime - { + { get { return DateTime.Now.ToString("HH:mm:ss") + Environment.NewLine; } } //编码格式 public static Encoding econding = Encoding.Default; - - public static void Start() + + public static void Start() { - //第一步:调用socket()函数创建一个用于通信的套接字 + //第一步:调用socket()函数创建一个用于通信的套接字 listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - //第二步:给已经创建的套接字绑定一个端口号,这一般通过设置网络套接口地址和调用Bind()函数来实现 + //第二步:给已经创建的套接字绑定一个端口号,这一般通过设置网络套接口地址和调用Bind()函数来实现 IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(UserClass.get_local_ip_address.IP_Address()), int.Parse("11080")); - UserClass.LogGing.LogGingDATA("NativeIP = "+ UserClass.get_local_ip_address.IP_Address()); + UserClass.LogGing.LogGingDATA("NativeIP = " + UserClass.get_local_ip_address.IP_Address()); UserClass.LogGing.LogGingDATA("NativePORT = 11080"); try { - listenSocket.Bind(endPoint); - } - catch (Exception ex) + listenSocket.Bind(endPoint); + } + catch (Exception ex) { UserClass.LogGing.LogGingDATA("TCP_NotStart"); UserClass.LogGing.LogGingDATA(ex.Message); - return; + return; } - //第三步:调用listen()函数使套接字成为一个监听套接字 + //第三步:调用listen()函数使套接字成为一个监听套接字 listenSocket.Listen(10); //ShowMessage("服务器开启成功"); - //开启一个线程监听 - Task.Run(new Action(() =>{ListenConnection();} )); + //开启一个线程监听 + Task.Run(new Action(() => { ListenConnection(); })); } public static void ListenConnection() - { + { while (true) - { - Socket clientSocket = listenSocket.Accept(); + { + Socket clientSocket = listenSocket.Accept(); string ip = clientSocket.RemoteEndPoint.ToString(); - //更新在线列表 - // AddOnLine(ip, true); - //更新在线列表集合 - OnLineList.Add(ip, clientSocket); - UserClass.LogGing.LogGingDATA("IP_Online = "+ ip); + //更新在线列表 + // AddOnLine(ip, true); + //更新在线列表集合 + OnLineList.Add(ip, clientSocket); + UserClass.LogGing.LogGingDATA("IP_Online = " + ip); // ShowMessage(ip + "上线了"); Task.Run(() => ReceiveMsg(clientSocket)); } @@ -82,106 +76,106 @@ namespace formula_manage.UserClass /// /// public static void ReceiveMsg(Socket clientSocket) - { + { while (true) { - //定义一个2M的缓冲区 + //定义一个2M的缓冲区 byte[] buffer = new byte[1024 * 1024 * 2]; - - int length = -1; + + int length = -1; try { - length = clientSocket.Receive(buffer); + length = clientSocket.Receive(buffer); } - catch (Exception) + catch (Exception) { - //客户端下线了 - //更新在线列表 - string ip = clientSocket.RemoteEndPoint.ToString(); + //客户端下线了 + //更新在线列表 + string ip = clientSocket.RemoteEndPoint.ToString(); UserClass.LogGing.LogGingDATA("IP_Line = " + ip); // AddOnLine(ip, false); OnLineList.Remove(ip); - - break; + + break; } - + if (length == 0) { - //客户端下线了 - //更新在线列表 - string ip = clientSocket.RemoteEndPoint.ToString(); + //客户端下线了 + //更新在线列表 + string ip = clientSocket.RemoteEndPoint.ToString(); UserClass.LogGing.LogGingDATA("IP_Line = " + ip); // AddOnLine(ip, false); OnLineList.Remove(ip); - + break; } - if (length > 0) + if (length > 0) { - infoR = econding.GetString(buffer, 0, length); + infoR = econding.GetString(buffer, 0, length); //ShowMessage(info); string ip = clientSocket.RemoteEndPoint.ToString(); - } + } } - + } -/* - /// - /// 在线列表更新 - /// - /// - /// - private void AddOnLine(string clientIp, bool value) - { - Invoke(new Action(() => - { - if (value) - { - this.lst_Online.Items.Add(clientIp); - } - else + /* + /// + /// 在线列表更新 + /// + /// + /// + private void AddOnLine(string clientIp, bool value) { - this.lst_Online.Items.Remove(clientIp); + Invoke(new Action(() => + { + if (value) + { + this.lst_Online.Items.Add(clientIp); + } + else + { + this.lst_Online.Items.Remove(clientIp); + } + + })); + } - })); - } + /// + /// 更新接收区 + /// + /// + private void ShowMessage(string info) + { + Invoke(new Action(() => + { + this.txt_Rcv.AppendText(CurrentTime + info + Environment.NewLine); + })); + } - /// - /// 更新接收区 - /// - /// - private void ShowMessage(string info) + */ + /// + /// 消息发送 + /// + public static void Bn_Send(string IP, string DAT) + { + if (OnLineList.ContainsKey(IP)) { - Invoke(new Action(() => - { - this.txt_Rcv.AppendText(CurrentTime + info + Environment.NewLine); - })); - - } - -*/ - /// - /// 消息发送 - /// - public static void Bn_Send(string IP ,string DAT) - { - if (OnLineList.ContainsKey(IP)) - { OnLineList[IP].Send(econding.GetBytes(DAT)); - } + } } /// /// 群发功能 /// public static void Btn_SendAll(string DAT) - { - foreach (string item in OnLineList.Keys.ToArray()) + { + foreach (string item in OnLineList.Keys.ToArray()) { if (OnLineList.ContainsKey(item)) { @@ -189,7 +183,7 @@ namespace formula_manage.UserClass } } } - + } } diff --git a/UserClass/UserPrint.cs b/UserClass/UserPrint.cs index fd40258..a2be773 100644 --- a/UserClass/UserPrint.cs +++ b/UserClass/UserPrint.cs @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; using System.Drawing.Printing; -using System.Linq; using System.Management; using System.Printing; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace formula_manage.UserClass @@ -192,11 +188,11 @@ namespace formula_manage.UserClass MessageBox.Show("网络打印机不可用", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error); - // WriteLog.SetString(ex.Message); + // WriteLog.SetString(ex.Message); } else { - // WriteLog.SetException(ex); + // WriteLog.SetException(ex); } } } diff --git a/UserClass/get_local_ip_address.cs b/UserClass/get_local_ip_address.cs index 85f8a1c..2754a2c 100644 --- a/UserClass/get_local_ip_address.cs +++ b/UserClass/get_local_ip_address.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Net.NetworkInformation; using System.Net.Sockets; -using System.Net; -using System.Text; -using System.Threading.Tasks; -using System.Net.NetworkInformation; namespace formula_manage.UserClass { @@ -35,7 +29,7 @@ namespace formula_manage.UserClass string ip; ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Ethernet); - if(ip=="")ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wireless80211); + if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wireless80211); if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Ppp); if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wwanpp); if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.TokenRing); diff --git a/View/Formula.xaml.cs b/View/Formula.xaml.cs index 9752c65..cebf49e 100644 --- a/View/Formula.xaml.cs +++ b/View/Formula.xaml.cs @@ -1,17 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +using System.Windows.Controls; namespace formula_manage.View { diff --git a/View/ViewOrder.xaml.cs b/View/ViewOrder.xaml.cs index d9b6e1b..10537c6 100644 --- a/View/ViewOrder.xaml.cs +++ b/View/ViewOrder.xaml.cs @@ -1,28 +1,16 @@ 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.Data.SqlClient; 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 FastReport.Editor; -using FastReport.DevComponents.DotNetBar; namespace formula_manage.View { /// /// ViewProcess.xaml 的交互逻辑 /// - public partial class ViewOrder: UserControl + public partial class ViewOrder : UserControl { public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径 @@ -89,11 +77,11 @@ namespace formula_manage.View { int a; string order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] order by OrdeTime desc";//查询语句 - + a = condition.SelectedIndex; //获取选择条件 - if(a==1) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where ProcessNAME = '"+ search.Text + "' order by OrdeTime desc";//查询语句 - else if(a==2) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where customer = '" + search.Text + "' order by OrdeTime desc";//查询语句 + if (a == 1) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where ProcessNAME = '" + search.Text + "' order by OrdeTime desc";//查询语句 + else if (a == 2) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where customer = '" + search.Text + "' order by OrdeTime desc";//查询语句 else if (a == 3) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where colour = '" + search.Text + "' order by OrdeTime desc";//查询语句 else if (a == 0) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] order by OrdeTime desc";//查询语句 @@ -135,7 +123,7 @@ namespace formula_manage.View OrderData[4] = (Order.Columns[4].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列 OrderData[5] = (Order.Columns[5].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列 OrderData[6] = (Order.Columns[6].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列 - + sendMessage(OrderData); //传入数组 } } diff --git a/View/ViewProcess.xaml.cs b/View/ViewProcess.xaml.cs index 916f736..ffe9ec5 100644 --- a/View/ViewProcess.xaml.cs +++ b/View/ViewProcess.xaml.cs @@ -1,19 +1,8 @@ using System; -using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -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 formula_manage.View { diff --git a/ViewModel/ExchangeViewModel.cs b/ViewModel/ExchangeViewModel.cs index 371ed57..89ea474 100644 --- a/ViewModel/ExchangeViewModel.cs +++ b/ViewModel/ExchangeViewModel.cs @@ -1,15 +1,11 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Threading; namespace formula_manage.ViewModel { public class ExchangeViewModel : ViewModelBase { - public ExchangeViewModel() + public ExchangeViewModel() { CountDown(); } @@ -30,7 +26,7 @@ namespace formula_manage.ViewModel } void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件 { - + } } diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index 3ec0e57..f9cc6c9 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -1,24 +1,11 @@ -using formula_manage.SQLModels; -using formula_manage.UserClass; -using formula_manage.ViewModel; -using formula_manage.Windows; -using GalaSoft.MvvmLight; +using formula_manage.UserClass; using System; -using System.Collections; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Data; using System.Data.SqlClient; -using System.Linq; using System.Reflection; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Forms; using System.Windows.Threading; -using System.Xml.Linq; namespace formula_manage.ViewModel { @@ -43,8 +30,8 @@ namespace formula_manage.ViewModel DataTable DissolvedataTable = new DataTable(); //建立Dissolve DataTable STUFFdataTable = new DataTable(); //建立STUFF DataTable MACHINEdataTable = new DataTable(); //建立Machine - // DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT - // DataTable RecipedataTable = new DataTable(); //建立Recipe + // DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT + // DataTable RecipedataTable = new DataTable(); //建立Recipe public static DataTable STUFFdatatemp = new DataTable(); //建立STUFF缓存 public static DataTable MACHINEdatatemp = new DataTable(); //建立Machine缓存 @@ -54,7 +41,7 @@ namespace formula_manage.ViewModel public string cdk_time; //注册到期时间 public string cdk_page = "Hidden"; //注册到期页面状态 public string cdk_pageT; //注册到期页面关闭时间 - int cdk_pageT_T=-1;////注册到期页面关闭时间计算 + int cdk_pageT_T = -1;////注册到期页面关闭时间计算 public string Sys_Time //通知UI控件参数改变 { @@ -89,50 +76,51 @@ namespace formula_manage.ViewModel private void CDkey_() { - try - { - string id_1 = SN_ID.Substring(5, 1) + SN_ID.Substring(0, 1) + SN_ID.Substring(4, 1) + SN_ID.Substring(1, 1) + SN_ID.Substring(3, 1) + SN_ID.Substring(2, 1); - if ((id_1 == SN_KEY.Substring(0, 6)) && (SN_KEY.Length == 16)) - { + try + { + string id_1 = SN_ID.Substring(5, 1) + SN_ID.Substring(0, 1) + SN_ID.Substring(4, 1) + SN_ID.Substring(1, 1) + SN_ID.Substring(3, 1) + SN_ID.Substring(2, 1); + if ((id_1 == SN_KEY.Substring(0, 6)) && (SN_KEY.Length == 16)) + { if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(SN_KEY.Substring(0, 12)), true) == SN_KEY.Substring(12, 4)) //校验key的crc校验值 - { - string Y = (2255 - StrToInt.To16Convert10(SN_KEY.Substring(6, 2))).ToString(); - string M = (255 - StrToInt.To16Convert10(SN_KEY.Substring(8, 2))).ToString(); + { + string Y = (2255 - StrToInt.To16Convert10(SN_KEY.Substring(6, 2))).ToString(); + string M = (255 - StrToInt.To16Convert10(SN_KEY.Substring(8, 2))).ToString(); string D = (255 - StrToInt.To16Convert10(SN_KEY.Substring(10, 2))).ToString(); - - string YY = DateTime.Now.ToString("yyyy"); - string MM = DateTime.Now.ToString("MM"); + + string YY = DateTime.Now.ToString("yyyy"); + string MM = DateTime.Now.ToString("MM"); string DD = DateTime.Now.ToString("dd"); - + Cdk_time = "注册到期时间: " + Y + "/" + M + "/" + D; - - if (string.Compare(Y, YY) < 0) + + if (string.Compare(Y, YY) < 0) { - if (string.Compare(M, MM) < 0) - { - if (string.Compare(D, DD) < 0) - { - Cdk_page = "Visible"; + if (string.Compare(M, MM) < 0) + { + if (string.Compare(D, DD) < 0) + { + Cdk_page = "Visible"; //cdk_pageT_T = -1; //防止触发倒计时 - } + } else if ((int.Parse(D) - int.Parse(DD)) <= 10)//提前三天提醒 - { - Cdk_page = "Visible"; + { + Cdk_page = "Visible"; cdk_pageT_T = 180; //页面关闭倒计时30秒 } - } - } - } - else - { - Cdk_page = "Visible"; - Cdk_time = "许可证安全校验错误请重新激活"; - } } + } + } + } + else + { + Cdk_page = "Visible"; + Cdk_time = "许可证安全校验错误请重新激活"; + } + } else - - { - Cdk_page = "Visible"; - Cdk_time = "计算机信息变更当前许可证失效"; + + { + Cdk_page = "Visible"; + Cdk_time = "计算机信息变更当前许可证失效"; } } catch (Exception) @@ -151,7 +139,7 @@ namespace formula_manage.ViewModel TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4"); TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5"); SN_ID = Configini.IniReadvalue("SN", "SN2"); - SN_KEY = Configini.IniReadvalue("SN", "SN1"); + SN_KEY = Configini.IniReadvalue("SN", "SN1"); if (TEXT_SQMOD == "0") //判断连接方式 { @@ -286,7 +274,7 @@ namespace formula_manage.ViewModel { cdk_pageT_T--; Cdk_pageT = cdk_pageT_T.ToString(); - if(cdk_pageT_T == 1) Cdk_page = "Hidden"; + if (cdk_pageT_T == 1) Cdk_page = "Hidden"; } } diff --git a/ViewModel/RECIPEViewModel.cs b/ViewModel/RECIPEViewModel.cs index e819bec..4c983c8 100644 --- a/ViewModel/RECIPEViewModel.cs +++ b/ViewModel/RECIPEViewModel.cs @@ -1,36 +1,23 @@ -using formula_manage.SQLModels; -using formula_manage.ViewModel; -using formula_manage.Windows; -using GalaSoft.MvvmLight; -using System; -using System.Collections; -using System.Collections.Generic; +using System; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Data; using System.Data.SqlClient; -using System.Linq; using System.Reflection; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; using System.Windows.Threading; -using System.Xml.Linq; namespace formula_manage.ViewModel { - /* public class ViewModelBase : INotifyPropertyChanged - { - public event PropertyChangedEventHandler PropertyChanged; + /* public class ViewModelBase : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged(string propertyName) - { - if (this.PropertyChanged != null) - this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } - }*/ + protected virtual void OnPropertyChanged(string propertyName) + { + if (this.PropertyChanged != null) + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + }*/ /// /// /// @@ -191,40 +178,40 @@ namespace formula_manage.ViewModel } } - /* public class Product //stuff_Product - { - public string ProductCode { get; set; } - public string ProductName { get; set; } - public int ProductType { get; set; } - public int Concentration { get; set; } - - public override string ToString() - { - return ProductCode; - } - } - public class Machine //mac - { - public string Name { get; set; } - public float Volume { get; set; } - public float Capacity { get; set; } - - public override string ToString() - { - return Name; - } - } - public class Workflow //Dissolve - { - public string DissolveName { get; set; } - public int MaterialType { get; set; } - public int WeightMIN { get; set; } - public int WeightMAX { get; set; } - - public override string ToString() - { - return DissolveName; - } - }*/ + /* public class Product //stuff_Product + { + public string ProductCode { get; set; } + public string ProductName { get; set; } + public int ProductType { get; set; } + public int Concentration { get; set; } + + public override string ToString() + { + return ProductCode; + } + } + public class Machine //mac + { + public string Name { get; set; } + public float Volume { get; set; } + public float Capacity { get; set; } + + public override string ToString() + { + return Name; + } + } + public class Workflow //Dissolve + { + public string DissolveName { get; set; } + public int MaterialType { get; set; } + public int WeightMIN { get; set; } + public int WeightMAX { get; set; } + + public override string ToString() + { + return DissolveName; + } + }*/ } diff --git a/ViewModel/ViewModelLocator.cs b/ViewModel/ViewModelLocator.cs index e0a9506..2075e23 100644 --- a/ViewModel/ViewModelLocator.cs +++ b/ViewModel/ViewModelLocator.cs @@ -1,10 +1,4 @@ using CommonServiceLocator; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Ioc; namespace formula_manage.ViewModel @@ -30,7 +24,7 @@ namespace formula_manage.ViewModel SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); } - + public MainWindowViewModel Main { get diff --git a/Windows/APP_set.xaml.cs b/Windows/APP_set.xaml.cs index 8cc7c45..91227c3 100644 --- a/Windows/APP_set.xaml.cs +++ b/Windows/APP_set.xaml.cs @@ -1,17 +1,6 @@ using System; -using System.Collections.Generic; using System.IO; -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.Shapes; namespace formula_manage.Windows { @@ -33,7 +22,7 @@ namespace formula_manage.Windows string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:"; private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件 { - MessageBoxResult result = System.Windows.MessageBox.Show("设置完成后请重启程序","提示", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel); + MessageBoxResult result = System.Windows.MessageBox.Show("设置完成后请重启程序", "提示", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel); UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); Configini.IniWritevalue("SOFTWARE_SET", " L1", Loginlink.ToString()); @@ -53,7 +42,7 @@ namespace formula_manage.Windows FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write); StreamWriter wr = new StreamWriter(fs);//创建文件 wr.WriteLine(Log_time + "FORMULA_SET:INIFile_Write"); - wr.Close(); + wr.Close(); } bool Loginlink; diff --git a/Windows/CDKEY.xaml.cs b/Windows/CDKEY.xaml.cs index ae078a8..635cc31 100644 --- a/Windows/CDKEY.xaml.cs +++ b/Windows/CDKEY.xaml.cs @@ -1,23 +1,6 @@ using formula_manage.UserClass; using System; -using System.Collections.Generic; -using System.Data.SqlClient; -using System.Globalization; -using System.Linq; -using System.Management; -using System.Runtime.InteropServices; -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.Forms; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; namespace formula_manage.Windows @@ -59,13 +42,13 @@ namespace formula_manage.Windows sn_time.Text = "注册有效时间: --------"; } } - else - { - sn_time.Text = "注册有效时间: --------"; + else + { + sn_time.Text = "注册有效时间: --------"; } } - else - { + else + { sn_time.Text = "注册有效时间: --------"; } @@ -77,16 +60,16 @@ namespace formula_manage.Windows //string hardDiskSerialNumber = HardwareSN.GetHardDiskSerialNumber(); // 获取网卡地址 //string netCardMACAddress = HardwareSN.GetNetCardMACAddress(); - sn_id.Text = MD5check.MD5Encrypt16(cpuSerialNumber+ biosSerialNumber);//生成id基于硬件值的md5校验 + sn_id.Text = MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber);//生成id基于硬件值的md5校验 + + } - } - private void Button_Click_2(object sender, RoutedEventArgs e) //cdk确认按钮 { string id_1; id_1 = sn_id.Text.Substring(5, 1) + sn_id.Text.Substring(0, 1) + sn_id.Text.Substring(4, 1) + sn_id.Text.Substring(1, 1) + sn_id.Text.Substring(3, 1) + sn_id.Text.Substring(2, 1); - if(cdk.Text.Length != 16) + if (cdk.Text.Length != 16) { System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error); return; @@ -110,7 +93,7 @@ namespace formula_manage.Windows { if (string.Compare(D, DD) >= 0) { - System.Windows.MessageBox.Show("CDKEY: 注册成功,请重启软件", "KEY",MessageBoxButton.OK,MessageBoxImage.Asterisk); + System.Windows.MessageBox.Show("CDKEY: 注册成功,请重启软件", "KEY", MessageBoxButton.OK, MessageBoxImage.Asterisk); sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D; UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); @@ -147,7 +130,7 @@ namespace formula_manage.Windows } else { - System.Windows.MessageBox.Show("CDKEY: 注册码过期","WARNING",MessageBoxButton.OK,MessageBoxImage.Warning); + System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning); } } else @@ -155,9 +138,9 @@ namespace formula_manage.Windows System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error); } } - else + else { - System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR" , MessageBoxButton.OK,MessageBoxImage.Error); + System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error); } } diff --git a/Windows/Dissolve.xaml.cs b/Windows/Dissolve.xaml.cs index c460a43..d6e05d1 100644 --- a/Windows/Dissolve.xaml.cs +++ b/Windows/Dissolve.xaml.cs @@ -1,24 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Data; +using System.Data.SqlClient; using System.Text.RegularExpressions; -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; -using GalaSoft.MvvmLight; -using formula_manage.SQLModels; -using System.Data.SqlClient; -using System.Data; -using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; -using Xceed.Wpf.AvalonDock.Themes; namespace formula_manage.Windows { @@ -127,7 +113,7 @@ namespace formula_manage.Windows string Dissolve_sql; int int_ion = 0; - if ((name.Text == "") ||(Code.Text == "")) + if ((name.Text == "") || (Code.Text == "")) { System.Windows.MessageBox.Show("请输入代码或名称"); return; @@ -171,33 +157,33 @@ namespace formula_manage.Windows conn_SC.Close(); //关闭连接 if (count == 0) - { + { Dissolve_sql = string.Format("INSERT INTO[dbo].[Dissolve](DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX) " + - "VALUES ('" + Code.Text + "','" + name.Text + "','" + Remark.Text + "','" + int_ion + "','"+ min.Text + "','" + max.Text + "')"); + "VALUES ('" + Code.Text + "','" + name.Text + "','" + Remark.Text + "','" + int_ion + "','" + min.Text + "','" + max.Text + "')"); await conn_SC.OpenAsync(); //打开数据连接 SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 if (sql_in == 0) - { + { System.Windows.MessageBox.Show("添加失败"); - } - else + } + else { GridSql(); System.Windows.MessageBox.Show("添加完成");// } - } - else - { - Dissolve_sql = string.Format("UPDATE [dbo].[Dissolve] SET DissolveName ='" + name.Text + "',REMARK='" + Remark.Text + "',MaterialType='" + int_ion + "',WeightMIN='" + min.Text + "',WeightMAX='" + max.Text + "' Where DissolveCode ='" + Code.Text + "'"); + } + else + { + Dissolve_sql = string.Format("UPDATE [dbo].[Dissolve] SET DissolveName ='" + name.Text + "',REMARK='" + Remark.Text + "',MaterialType='" + int_ion + "',WeightMIN='" + min.Text + "',WeightMAX='" + max.Text + "' Where DissolveCode ='" + Code.Text + "'"); await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 - - if (sql_in == 0) - { + + if (sql_in == 0) + { System.Windows.MessageBox.Show("修改失败"); } else @@ -213,7 +199,7 @@ namespace formula_manage.Windows return; } } - } + } private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 { diff --git a/Windows/Machine.xaml.cs b/Windows/Machine.xaml.cs index e686315..141202c 100644 --- a/Windows/Machine.xaml.cs +++ b/Windows/Machine.xaml.cs @@ -1,24 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Data; +using System.Data.SqlClient; using System.Text.RegularExpressions; -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; -using GalaSoft.MvvmLight; -using formula_manage.SQLModels; -using System.Data.SqlClient; -using System.Data; -using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; -using Xceed.Wpf.AvalonDock.Themes; namespace formula_manage.Windows { @@ -132,7 +118,7 @@ namespace formula_manage.Windows /*定位选中行及指定列单元格文本信息*/ mac_Name.Text = (DataGridMac.Columns[1].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第列 mac_MacGroup.Text = (DataGridMac.Columns[2].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();// - mac_Capacity.Text = (DataGridMac.Columns[3].GetCellContent(DataGridMac .Items[rownum]) as TextBlock).Text.TrimEnd();// + mac_Capacity.Text = (DataGridMac.Columns[3].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();// mac_Volume.Text = (DataGridMac.Columns[4].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();// mac_Industry.Text = (DataGridMac.Columns[5].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();// mac_Categories.Text = (DataGridMac.Columns[6].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();// @@ -182,7 +168,7 @@ namespace formula_manage.Windows conn_SC.Close(); //关闭连接 if (count == 0) - { + { MAC_sql = string.Format("INSERT INTO [dbo].[MACHINE](Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note ) " + "VALUES ('" + Mac_name + "','" + Mac_group + "'," + Mac_capacity + "," + Mac_volume + "," + Mac_industry + "," + Mac_categories + ",'" + Mac_note + "')"); await conn_SC.OpenAsync(); //打开数据连接 @@ -190,25 +176,25 @@ namespace formula_manage.Windows int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 if (sql_in == 0) - { + { System.Windows.MessageBox.Show("添加失败"); - } - else + } + else { GridSql(); System.Windows.MessageBox.Show("添加完成");// } - } - else - { - MAC_sql = string.Format("UPDATE [dbo].[MACHINE] SET MacGroup ='" + Mac_group + "',Capacity=" + Mac_capacity + " ,Volume=" + Mac_volume + " ,Industry=" + Mac_industry + " ,Categories=" + Mac_categories + " ,Note='" + Mac_note + "' Where Name ='" + Mac_name + "'"); + } + else + { + MAC_sql = string.Format("UPDATE [dbo].[MACHINE] SET MacGroup ='" + Mac_group + "',Capacity=" + Mac_capacity + " ,Volume=" + Mac_volume + " ,Industry=" + Mac_industry + " ,Categories=" + Mac_categories + " ,Note='" + Mac_note + "' Where Name ='" + Mac_name + "'"); await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(MAC_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(MAC_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 - - if (sql_in == 0) - { + + if (sql_in == 0) + { System.Windows.MessageBox.Show("修改失败"); } else @@ -224,7 +210,7 @@ namespace formula_manage.Windows return; } } - } + } private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 { diff --git a/Windows/Print.xaml.cs b/Windows/Print.xaml.cs index 738574e..10e41df 100644 --- a/Windows/Print.xaml.cs +++ b/Windows/Print.xaml.cs @@ -1,30 +1,12 @@ -using System; +using FastReport; +using formula_manage.UserClass; +using System; using System.Collections.Generic; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Drawing.Printing; +using System.IO; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Forms; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; -using ThoughtWorks.QRCode.Codec; -using System.Drawing; -using System.Drawing.Imaging; -using System.Drawing.Printing; -using formula_manage.UserClass; using System.Xml.Linq; -using FastReport.Format; -using Svg; -using System.IO; -using System.Windows.Media.Media3D; -using System.Reflection; -using FastReport; namespace formula_manage.Windows { @@ -57,7 +39,7 @@ namespace formula_manage.Windows string Temp_M, Temp_S; private void Window_Print(object sender, RoutedEventArgs e) { - + UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); Printer = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P1")); @@ -152,13 +134,13 @@ namespace formula_manage.Windows private void Button_Click_1(object sender, RoutedEventArgs e) //编辑模板 { - if (string.IsNullOrEmpty(Template_M.Text)) + if (string.IsNullOrEmpty(Template_M.Text)) { System.Windows.MessageBox.Show("模板不能为空"); return; } - var tuple = PrintHelper.Design(Print_path.Text+"/" + Template_M.Text); + var tuple = PrintHelper.Design(Print_path.Text + "/" + Template_M.Text); if (!tuple.Item1) { System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}"); @@ -172,7 +154,7 @@ namespace formula_manage.Windows return; } - var tuple = PrintHelper.Design(Print_path2.Text +"/" + Template_S.Text); + var tuple = PrintHelper.Design(Print_path2.Text + "/" + Template_S.Text); if (!tuple.Item1) { System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}"); @@ -255,7 +237,7 @@ namespace formula_manage.Windows return; } - File.WriteAllText(Template_path + ".frx", Template_DATA); + File.WriteAllText(Template_path + ".frx", Template_DATA); var tuple = PrintHelper.Design(Template_path + ".frx"); if (!tuple.Item1) { @@ -272,11 +254,11 @@ namespace formula_manage.Windows private void Button_Click_4(object sender, RoutedEventArgs e)//删除指定模板 { - try + try { string Template_path = Print_path.Text + "/" + Template.Text; File.Delete(Template_path); - } + } catch { System.Windows.MessageBox.Show("删除失败"); diff --git a/Windows/RECIPE.xaml.cs b/Windows/RECIPE.xaml.cs index 775139f..6cefb48 100644 --- a/Windows/RECIPE.xaml.cs +++ b/Windows/RECIPE.xaml.cs @@ -1,41 +1,14 @@ -using formula_manage.Windows; +using formula_manage.UserClass; +using formula_manage.ViewModel; using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; using System.Data; using System.Data.SqlClient; -using System.Globalization; -using System.IO; using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; using System.Text.RegularExpressions; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Threading; -using formula_manage.ViewModel; -using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; -using static System.Net.Mime.MediaTypeNames; -using formula_manage.UserClass; -using System.Drawing; -using System.Diagnostics; -using System.Printing; -using System.Drawing.Printing; -using static System.Drawing.Printing.PrinterSettings; -using formula_manage.View; -using FastReport.DevComponents.AdvTree; namespace formula_manage.Windows { @@ -164,10 +137,10 @@ namespace formula_manage.Windows { Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数 Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串 - // string Dissolve_sql; - // int int_ion = 0; - - } + // string Dissolve_sql; + // int int_ion = 0; + + } private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 { diff --git a/Windows/SQL_BAK.xaml.cs b/Windows/SQL_BAK.xaml.cs index 84572c5..7d24e60 100644 --- a/Windows/SQL_BAK.xaml.cs +++ b/Windows/SQL_BAK.xaml.cs @@ -1,18 +1,7 @@ using System; -using System.Collections.Generic; using System.Data.SqlClient; -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.Forms; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; @@ -50,7 +39,7 @@ namespace formula_manage.Windows SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2"); int.TryParse(Configini.IniReadvalue("SQL_SERVER", "SQL3"), out i); //读数据库状态配置文件 if (i == 0) SQLMOD = false; - else SQLMOD = true; + else SQLMOD = true; SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4"); SQLPASS = Configini.IniReadvalue("SQL_SERVER", "SQL5"); @@ -59,7 +48,7 @@ namespace formula_manage.Windows SQLTIME = Boolean.Parse(Configini.IniReadvalue("SQL_BAK", "S3")); int.TryParse(Configini.IniReadvalue("SQL_BAK", "S4"), out Time); if (Time == 0) SQL_TIME.Text = "日"; - else if(Time == 1) SQL_TIME.Text = "周"; + else if (Time == 1) SQL_TIME.Text = "周"; else if (Time == 2) SQL_TIME.Text = "月"; else if (Time == 3) SQL_TIME.Text = "季"; else if (Time == 4) SQL_TIME.Text = "年"; @@ -77,7 +66,7 @@ namespace formula_manage.Windows SQL_DISPEN_bak.IsEnabled = SQLBAK; SQL_DISPEN_BUT.IsEnabled = SQLBAK; } - + private void SQL_bak_time_Checked(object sender, RoutedEventArgs e) //自动保存 { SQLTIME = SQL_bak_time.IsChecked.GetValueOrDefault(); @@ -90,8 +79,8 @@ namespace formula_manage.Windows Dilog.SelectedPath = SQL_DISPEN_bak.Text; //打开目录 Dilog.ShowNewFolderButton = false; //不显示新建文件夹按钮 // - if (Dilog.ShowDialog() == System.Windows.Forms.DialogResult.OK ) - { + if (Dilog.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { SQL_DISPEN_bak.Text = Dilog.SelectedPath; //返回选择的字符串 } } @@ -207,23 +196,23 @@ namespace formula_manage.Windows { ok = Backup(SQLNAME, SQL_DISPEN_bak.Text + "\\" + SQLNAME + System.DateTime.Now.ToString("yyyy_MM_dd_HHmmss") + ".bak"); //指定地址备份 } - else + else { ok = Backup(SQLNAME, "C:\\SUNLIGHT\\" + SQLNAME + System.DateTime.Now.ToString("yyyy_MM_dd_HHmmss") + ".bak"); //默认备份到文档文件夹 - } - - if (ok) - { - System.Windows.MessageBox.Show("备份成功"); - } - else - { - System.Windows.MessageBox.Show("备份失败"); + } + + if (ok) + { + System.Windows.MessageBox.Show("备份成功"); + } + else + { + System.Windows.MessageBox.Show("备份失败"); } } private async void Button_Click_2(object sender, RoutedEventArgs e) - { + { if (!SQLMOD) //连接数据库测试 { Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";Trusted_Connection=SSPI"; diff --git a/Windows/Sql.xaml.cs b/Windows/Sql.xaml.cs index 9f70d89..1b785ff 100644 --- a/Windows/Sql.xaml.cs +++ b/Windows/Sql.xaml.cs @@ -1,21 +1,6 @@ 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.Shapes; using System.Data.SqlClient; -using System.Net.NetworkInformation; -using System.Runtime.InteropServices; -using System.ComponentModel; -using System.Data.SqlTypes; +using System.Windows; namespace formula_manage.Windows diff --git a/Windows/Stuff.xaml.cs b/Windows/Stuff.xaml.cs index 13a3fa6..1926767 100644 --- a/Windows/Stuff.xaml.cs +++ b/Windows/Stuff.xaml.cs @@ -1,24 +1,11 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Data; +using System.Data.SqlClient; using System.Text.RegularExpressions; -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; -using GalaSoft.MvvmLight; -using formula_manage.SQLModels; -using System.Data.SqlClient; -using System.Data; -using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; -using Xceed.Wpf.AvalonDock.Themes; namespace formula_manage.Windows { @@ -88,34 +75,34 @@ namespace formula_manage.Windows /// private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e) { - e.Row.Header = e.Row.GetIndex() + 1; + e.Row.Header = e.Row.GetIndex() + 1; } private void Radiobutton(object sender, EventArgs e) { System.Windows.Controls.RadioButton Radiobutton = (sender as System.Windows.Controls.RadioButton); string radiobutton = Radiobutton.Content.ToString(); - if (radiobutton == "全部原料") + if (radiobutton == "全部原料") { - GridSql(0); - Button_ID = 0; + GridSql(0); + Button_ID = 0; } - else if (radiobutton == "染料") + else if (radiobutton == "染料") { GridSql(1); - Button_ID = 1; + Button_ID = 1; } - else if (radiobutton == "助剂") + else if (radiobutton == "助剂") { - GridSql(2); + GridSql(2); Button_ID = 2; } - else if (radiobutton == "粉体助剂") + else if (radiobutton == "粉体助剂") { GridSql(3); - Button_ID = 3; + Button_ID = 3; } - else if (radiobutton == "液体染料") + else if (radiobutton == "液体染料") { GridSql(4); Button_ID = 4; @@ -125,15 +112,15 @@ namespace formula_manage.Windows /// /// 查询数据库的方法 /// - private async void GridSql(int e ) + private async void GridSql(int e) { string Stuff_sql = null; if (e == 0) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT]";//查询语句 - else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '0' "; + else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '0' "; else if (e == 2) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '1' "; else if (e == 3) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '2' "; else if (e == 4) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '3' "; - + SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 try @@ -155,7 +142,7 @@ namespace formula_manage.Windows } private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件 - { + { Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数 Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串 int int_stuff_ProductType = 0; @@ -171,14 +158,14 @@ namespace formula_manage.Windows if (this.stuff_ProductType.Text == "染料") //原料类型0。染料,1助剂,2粉体 int_stuff_ProductType = 0; - else if (this.stuff_ProductType.Text == "助剂") - int_stuff_ProductType = 1; - else if (this.stuff_ProductType.Text == "粉体助剂") - int_stuff_ProductType = 2; - else if (this.stuff_ProductType.Text == "液体染料") + else if (this.stuff_ProductType.Text == "助剂") + int_stuff_ProductType = 1; + else if (this.stuff_ProductType.Text == "粉体助剂") + int_stuff_ProductType = 2; + else if (this.stuff_ProductType.Text == "液体染料") int_stuff_ProductType = 3; - if(Stuff_ion.Text == "分散") int_stuff_ion = 0; + if (Stuff_ion.Text == "分散") int_stuff_ion = 0; else if (Stuff_ion.Text == "酸性") int_stuff_ion = 1; else if (Stuff_ion.Text == "活性") int_stuff_ion = 2; else if (Stuff_ion.Text == "中性") int_stuff_ion = 3; @@ -215,37 +202,37 @@ namespace formula_manage.Windows if (float.Parse(this.stuff_Concentration.Text) < 0 || float.Parse(this.stuff_Concentration.Text) > 100) System.Windows.MessageBox.Show("ERR:浓度错误", "错误");//检查浓度输入数值 else - { + { try - { + { if (int_stuff_ProductType == 0 || int_stuff_ProductType == 3)//判断是否为染料,非染料写空 - { + { string colorValue = stuff_Color.Background.ToString();//获取色彩框背景色"#FFC1C2C3" string StuffColor_R = string.Format("{0:X2}", colorValue.Substring(3, 2));//获取红色参数C1 string StuffColor_G = string.Format("{0:X2}", colorValue.Substring(5, 2));//获取绿色参数C2 string StuffColor_B = string.Format("{0:X2}", colorValue.Substring(7, 2));//获取蓝色参数C3 string StuffColor = StuffColor_B + StuffColor_G + StuffColor_R;//合并16进制rgb参数 ColorCode_SQL = Convert.ToInt32(StuffColor, 16);//16进制转10进制 - if (ColorCode_SQL < 0) ColorCode_SQL = 16777215;//判断色彩数据是否有效 + if (ColorCode_SQL < 0) ColorCode_SQL = 16777215;//判断色彩数据是否有效 } - else - { - ColorCode_SQL = 16777215; + else + { + ColorCode_SQL = 16777215; } - + SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 Stuff_sql = "SELECT count(*) FROM [dbo].[PRODUCT] WHERE ProductCode = '" + Product_Code + " '";//查询语句 await conn_SC.OpenAsync(); //打开数据连 SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数 int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数 conn_SC.Close(); //关闭连接 - - if (count == 0) - { - Stuff_sql = string.Format( "INSERT INTO [dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " + - "VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')"); + + if (count == 0) + { + Stuff_sql = string.Format("INSERT INTO [dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " + + "VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')"); await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 if (Stuff_ion.Text != "") Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET [ProductIon_Type] =" + int_stuff_ion + " Where ProductCode='" + Product_Code + "'"); @@ -267,10 +254,10 @@ namespace formula_manage.Windows else if (Button_ID == 4) GridSql(4); System.Windows.MessageBox.Show("添加完成"); } - } - else + } + else { - Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET ProductName='" + Product_Name + "',Price='" + _Price + "',SUPPLIER='" + _SUPPLIER + "',ProductType=" + int_stuff_ProductType + ",Color=" + ColorCode_SQL + ",Concentration=" + _Concentration + ",GRAVITY=" + _GRAVITY + " Where ProductCode='"+ Product_Code+"'"); + Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET ProductName='" + Product_Name + "',Price='" + _Price + "',SUPPLIER='" + _SUPPLIER + "',ProductType=" + int_stuff_ProductType + ",Color=" + ColorCode_SQL + ",Concentration=" + _Concentration + ",GRAVITY=" + _GRAVITY + " Where ProductCode='" + Product_Code + "'"); await conn_SC.OpenAsync(); //打开数据连接 SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 @@ -286,7 +273,7 @@ namespace formula_manage.Windows System.Windows.MessageBox.Show("修改失败"); } else - { + { if (Button_ID == 0) GridSql(0); else if (Button_ID == 1) GridSql(1); else if (Button_ID == 2) GridSql(2); @@ -301,44 +288,44 @@ namespace formula_manage.Windows System.Windows.MessageBox.Show("请求失败,检查连接"); return; } - } + } } private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 - { + { string ShowProductName = "是否删除原料【" + this.stuff_ProductName.Text + "】" + this.stuff_ProductCode.Text;//获取原料信息并拼接提示字符串 MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料 if (showProductName == MessageBoxResult.Yes)//判断是否删除原料 { - + string Stuff_sql = string.Format("DELETE FROM [dbo].[PRODUCT] WHERE ProductCode ='" + stuff_ProductCode.Text.ToString() + "'"); - + SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 try { await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 if (sql_in == 0) { System.Windows.MessageBox.Show("ERR.C0110-2:删除失败", "错误");//判断执行是否成功 - } - else - { - if (Button_ID == 0) GridSql(0); - else if (Button_ID == 1) GridSql(1); - else if (Button_ID == 2) GridSql(2); - else if (Button_ID == 3) GridSql(3); + } + else + { + if (Button_ID == 0) GridSql(0); + else if (Button_ID == 1) GridSql(1); + else if (Button_ID == 2) GridSql(2); + else if (Button_ID == 3) GridSql(3); else if (Button_ID == 4) GridSql(4); - } + } } catch (Exception) { System.Windows.MessageBox.Show("请求失败,检查连接"); return; } - } + } } private void DataGridStuff_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件 @@ -388,7 +375,7 @@ namespace formula_manage.Windows System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();//使用调色盘控件ColorDialog if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)//打开调色盘 { - + System.Drawing.Color DColor = colorDialog.Color;////获取选中色彩信息 //System.Windows.Media.Color MColor = new System.Windows.Media.Color();//转换 System.Windows.Media.Color MColor = System.Windows.Media.Color.FromArgb(DColor.A, DColor.R, DColor.G, DColor.B);//转换并配置ARGB参数 @@ -399,5 +386,5 @@ namespace formula_manage.Windows } } - } + } } diff --git a/Windows/User.xaml.cs b/Windows/User.xaml.cs index 261268e..d47b8ce 100644 --- a/Windows/User.xaml.cs +++ b/Windows/User.xaml.cs @@ -1,24 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Data; +using System.Data.SqlClient; using System.Text.RegularExpressions; -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; -using GalaSoft.MvvmLight; -using formula_manage.SQLModels; -using System.Data.SqlClient; -using System.Data; -using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; -using Xceed.Wpf.AvalonDock.Themes; namespace formula_manage.Windows { @@ -141,49 +127,49 @@ namespace formula_manage.Windows string note = Note.Text; string Stuff_sql; - if(Capacity.Text == "停用") Cap = 0; + if (Capacity.Text == "停用") Cap = 0; else if (Capacity.Text == "限制") Cap = 1; else if (Capacity.Text == "启用") Cap = 2; - if (name != "") + if (name != "") { - try + try + { + SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 + Stuff_sql = "SELECT count(*) FROM [Dispensing].[dbo].[UserAccount] WHERE UserCode = '" + name + " '";//查询语句 + await conn_SC.OpenAsync(); //打开数据连 + SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数 + int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数 + conn_SC.Close(); //关闭连接 + + if (count == 0) { - SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 - Stuff_sql = "SELECT count(*) FROM [Dispensing].[dbo].[UserAccount] WHERE UserCode = '" + name + " '";//查询语句 - await conn_SC.OpenAsync(); //打开数据连 - SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数 - int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数 - conn_SC.Close(); //关闭连接 + if (password == "") + { + Stuff_sql = "INSERT INTO[Dispensing].[dbo].[UserAccount](UserCode ,PassWord ,GROUP_CODE ,Capacity ,Note ) " + + "VALUES ('" + name + "',null,'" + Group + "'," + Cap + ",'" + note + "')"; + } + else + { + Stuff_sql = "INSERT INTO[Dispensing].[dbo].[UserAccount](UserCode ,PassWord ,GROUP_CODE ,Capacity ,Note ) " + + "VALUES ('" + name + "'," + password + ",'" + Group + "'," + Cap + ",'" + note + "')"; + } - if (count == 0) + await conn_SC.OpenAsync(); //打开数据连接 + SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); + int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 + conn_SC.Close(); //关闭连接 + if (sql_in == 0) { - if (password == "") - { - Stuff_sql = "INSERT INTO[Dispensing].[dbo].[UserAccount](UserCode ,PassWord ,GROUP_CODE ,Capacity ,Note ) " + - "VALUES ('" + name + "',null,'" + Group + "'," + Cap + ",'" + note + "')"; - } - else - { - Stuff_sql = "INSERT INTO[Dispensing].[dbo].[UserAccount](UserCode ,PassWord ,GROUP_CODE ,Capacity ,Note ) " + - "VALUES ('" + name + "'," + password + ",'" + Group + "'," + Cap + ",'" + note + "')"; - } - - await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); - int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 - conn_SC.Close(); //关闭连接 - if (sql_in == 0) - { - System.Windows.MessageBox.Show("添加失败"); - } - else - { - GridSql(); - } - } - else + System.Windows.MessageBox.Show("添加失败"); + } + else { + GridSql(); + } + } + else + { if (password == "") { @@ -193,26 +179,26 @@ namespace formula_manage.Windows { Stuff_sql = string.Format("UPDATE [dbo].[UserAccount] SET PassWord=" + password + " ,GROUP_CODE='" + Group + "' ,Capacity=" + Cap + " ,Note='" + note + "' Where UserCode ='" + name + "'"); } - await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); - int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 - conn_SC.Close(); //关闭连接 - - if (sql_in == 0) - { - System.Windows.MessageBox.Show("修改失败"); - } - else - { - GridSql(); - } + await conn_SC.OpenAsync(); //打开数据连接 + SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); + int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 + conn_SC.Close(); //关闭连接 + + if (sql_in == 0) + { + System.Windows.MessageBox.Show("修改失败"); + } + else + { + GridSql(); } } - catch (Exception) - { - System.Windows.MessageBox.Show("请求失败,检查连接"); - return; - } + } + catch (Exception) + { + System.Windows.MessageBox.Show("请求失败,检查连接"); + return; + } } } diff --git a/Windows/client.xaml.cs b/Windows/client.xaml.cs index cf6ac20..80b255a 100644 --- a/Windows/client.xaml.cs +++ b/Windows/client.xaml.cs @@ -1,25 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Data; +using System.Data.SqlClient; using System.Text.RegularExpressions; -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; -using GalaSoft.MvvmLight; -using formula_manage.SQLModels; -using System.Data.SqlClient; -using System.Data; -using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; -using Xceed.Wpf.AvalonDock.Themes; -using static System.Net.Mime.MediaTypeNames; namespace formula_manage.Windows { @@ -71,7 +56,7 @@ namespace formula_manage.Windows { await conn_SC.OpenAsync(); //打开数据连接 SqlDataAdapter client_data = new SqlDataAdapter(client_sql, Connstr_SC); //查询 - + client_data.Fill(dataTable); //查询结果存入缓存 conn_SC.Close(); //关闭连接 @@ -89,13 +74,13 @@ namespace formula_manage.Windows /// private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e) { - e.Row.Header = e.Row.GetIndex() + 1; + e.Row.Header = e.Row.GetIndex() + 1; } /// /// 查询数据库的方法 /// - private async void GridSql() + private async void GridSql() { string client_sql = "SELECT Code ,Name , Remark FROM [dbo].[Client]";//查询语句 @@ -120,7 +105,7 @@ namespace formula_manage.Windows } private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件 - { + { Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数 string client_sql; @@ -130,22 +115,22 @@ namespace formula_manage.Windows if (string.IsNullOrEmpty(this.client_name.Text)) System.Windows.MessageBox.Show("ERR:无效的名称", "错误");//检查原料名 else - { + { try - { + { SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 client_sql = "SELECT count(*) FROM [dbo].[Client] WHERE Code = '" + client_code.Text + " '";//查询语句 await conn_SC.OpenAsync(); //打开数据连 SqlCommand cmd = new SqlCommand(client_sql, conn_SC); //查询记录数 int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数 conn_SC.Close(); //关闭连接 - - if (count == 0) + + if (count == 0) { client_sql = string.Format("INSERT INTO [dbo].[Client](Code ,Name , Remark) " + - "VALUES ('" + client_code.Text + "','" + client_name.Text + "','" + client_Remark.Text + "')"); + "VALUES ('" + client_code.Text + "','" + client_name.Text + "','" + client_Remark.Text + "')"); await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 @@ -158,10 +143,10 @@ namespace formula_manage.Windows GridSql(); System.Windows.MessageBox.Show("添加完成"); } - } - else + } + else { - client_sql = string.Format("UPDATE [dbo].[Client] SET Name='" + client_name.Text + "',Remark='" + client_Remark.Text + "' Where Code='"+ client_code.Text + "'"); + client_sql = string.Format("UPDATE [dbo].[Client] SET Name='" + client_name.Text + "',Remark='" + client_Remark.Text + "' Where Code='" + client_code.Text + "'"); await conn_SC.OpenAsync(); //打开数据连接 SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 @@ -172,9 +157,9 @@ namespace formula_manage.Windows System.Windows.MessageBox.Show("C0110-1:修改失败"); } else - { + { GridSql(); - + System.Windows.MessageBox.Show("修改完成"); } } @@ -184,40 +169,40 @@ namespace formula_manage.Windows System.Windows.MessageBox.Show("请求失败,检查连接"); return; } - } + } } private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 - { + { string ShowProductName = "是否删除【" + this.client_name.Text + "】" + this.client_code.Text;//获取信息并拼接提示字符串 MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料 if (showProductName == MessageBoxResult.Yes)//判断是否删除 { - + string Stuff_sql = string.Format("DELETE FROM [dbo].[Client] WHERE Code ='" + client_code.Text.ToString() + "'"); - + SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 try { await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 if (sql_in == 0) { System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功 - } - else - { - GridSql(); - } + } + else + { + GridSql(); + } } catch (Exception) { System.Windows.MessageBox.Show("请求失败,检查连接"); return; } - } + } } private void DataGridclient_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件 @@ -232,5 +217,5 @@ namespace formula_manage.Windows } } - } + } } diff --git a/Windows/color.xaml.cs b/Windows/color.xaml.cs index fc7b20e..90df3aa 100644 --- a/Windows/color.xaml.cs +++ b/Windows/color.xaml.cs @@ -1,25 +1,11 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Data; +using System.Data.SqlClient; using System.Text.RegularExpressions; -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; -using GalaSoft.MvvmLight; -using formula_manage.SQLModels; -using System.Data.SqlClient; -using System.Data; -using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; -using Xceed.Wpf.AvalonDock.Themes; -using static System.Net.Mime.MediaTypeNames; namespace formula_manage.Windows { @@ -31,7 +17,7 @@ namespace formula_manage.Windows public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径 DataTable dataTable = new DataTable(); //建立缓存 - + string TEXT_SQLIP; string TEXT_SQLNAME; string TEXT_SQMOD; @@ -71,7 +57,7 @@ namespace formula_manage.Windows { await conn_SC.OpenAsync(); //打开数据连接 SqlDataAdapter color_data = new SqlDataAdapter(color_sql, Connstr_SC); //查询 - + color_data.Fill(dataTable); //查询结果存入缓存 conn_SC.Close(); //关闭连接 @@ -89,13 +75,13 @@ namespace formula_manage.Windows /// private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e) { - e.Row.Header = e.Row.GetIndex() + 1; + e.Row.Header = e.Row.GetIndex() + 1; } /// /// 查询数据库的方法 /// - private async void GridSql() + private async void GridSql() { string color_sql = "SELECT COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark FROM [dbo].[COLOR]";//查询语句 @@ -120,7 +106,7 @@ namespace formula_manage.Windows } private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件 - { + { Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数 string color_sql; int ColorCode_SQL; @@ -142,22 +128,22 @@ namespace formula_manage.Windows if (string.IsNullOrEmpty(this.color_name.Text)) System.Windows.MessageBox.Show("ERR:无效的原料名称", "错误");//检查原料名 else - { + { try - { + { SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 color_sql = "SELECT count(*) FROM [dbo].[COLOR] WHERE COLOR_CODE = '" + color_code.Text + " '";//查询语句 await conn_SC.OpenAsync(); //打开数据连 SqlCommand cmd = new SqlCommand(color_sql, conn_SC); //查询记录数 int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数 conn_SC.Close(); //关闭连接 - - if (count == 0) + + if (count == 0) { color_sql = string.Format("INSERT INTO [dbo].[COLOR](COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark) " + - "VALUES ('" + color_code.Text + "','" + color_name.Text + "','" + ColorCode_SQL + "','" + color_Remark.Text + "')"); + "VALUES ('" + color_code.Text + "','" + color_name.Text + "','" + ColorCode_SQL + "','" + color_Remark.Text + "')"); await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(color_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(color_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 @@ -170,8 +156,8 @@ namespace formula_manage.Windows GridSql(); System.Windows.MessageBox.Show("添加完成"); } - } - else + } + else { color_sql = string.Format("UPDATE [dbo].[COLOR] SET COLOR_NAME='" + color_name.Text + "',COLOR_NO='" + ColorCode_SQL + "',COLOR_Remark='" + color_Remark.Text + "' Where COLOR_CODE='" + color_code.Text + "'"); await conn_SC.OpenAsync(); //打开数据连接 @@ -184,9 +170,9 @@ namespace formula_manage.Windows System.Windows.MessageBox.Show("C0110-1:修改失败"); } else - { + { GridSql(); - + System.Windows.MessageBox.Show("修改完成"); } } @@ -196,40 +182,40 @@ namespace formula_manage.Windows System.Windows.MessageBox.Show("请求失败,检查连接"); return; } - } + } } private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 - { + { string ShowProductName = "是否删除【" + this.color_name.Text + "】" + this.color_code.Text;//获取信息并拼接提示字符串 MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料 if (showProductName == MessageBoxResult.Yes)//判断是否删除 { - + string Stuff_sql = string.Format("DELETE FROM [dbo].[COLOR] WHERE COLOR_CODE ='" + color_code.Text.ToString() + "'"); - + SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 try { await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 if (sql_in == 0) { System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功 - } - else - { - GridSql(); - } + } + else + { + GridSql(); + } } catch (Exception) { System.Windows.MessageBox.Show("请求失败,检查连接"); return; } - } + } } private void DataGridcolor_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件 @@ -268,5 +254,5 @@ namespace formula_manage.Windows //ColorCode_SQL = Convert.ToInt32(colorCode, 16);//十六进制RGB转存储数值 } } - } + } } diff --git a/Windows/fabric.xaml.cs b/Windows/fabric.xaml.cs index 6334561..447a1e0 100644 --- a/Windows/fabric.xaml.cs +++ b/Windows/fabric.xaml.cs @@ -1,25 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Data; +using System.Data.SqlClient; using System.Text.RegularExpressions; -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; -using GalaSoft.MvvmLight; -using formula_manage.SQLModels; -using System.Data.SqlClient; -using System.Data; -using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; -using Xceed.Wpf.AvalonDock.Themes; -using static System.Net.Mime.MediaTypeNames; namespace formula_manage.Windows { @@ -71,7 +56,7 @@ namespace formula_manage.Windows { await conn_SC.OpenAsync(); //打开数据连接 SqlDataAdapter fabric_data = new SqlDataAdapter(fabric_sql, Connstr_SC); //查询 - + fabric_data.Fill(dataTable); //查询结果存入缓存 conn_SC.Close(); //关闭连接 @@ -89,13 +74,13 @@ namespace formula_manage.Windows /// private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e) { - e.Row.Header = e.Row.GetIndex() + 1; + e.Row.Header = e.Row.GetIndex() + 1; } /// /// 查询数据库的方法 /// - private async void GridSql() + private async void GridSql() { string fabric_sql = "SELECT Code ,Name , GYard , Remark FROM [dbo].[PRODUCTION_Material]";//查询语句 @@ -120,7 +105,7 @@ namespace formula_manage.Windows } private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件 - { + { Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数 string fabric_sql; @@ -133,22 +118,22 @@ namespace formula_manage.Windows if (string.IsNullOrEmpty(this.fabric_name.Text)) System.Windows.MessageBox.Show("ERR:无效的原料名称", "错误");//检查原料名 else - { + { try - { + { SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 fabric_sql = "SELECT count(*) FROM [dbo].[PRODUCTION_Material] WHERE Code = '" + fabric_code.Text + " '";//查询语句 await conn_SC.OpenAsync(); //打开数据连 SqlCommand cmd = new SqlCommand(fabric_sql, conn_SC); //查询记录数 int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数 conn_SC.Close(); //关闭连接 - - if (count == 0) + + if (count == 0) { fabric_sql = string.Format("INSERT INTO [dbo].[PRODUCTION_Material](Code ,Name , GYard , Remark) " + - "VALUES ('" + fabric_code.Text + "','" + fabric_name.Text + "','" + fabric_GYard.Text + "','" + fabric_Remark.Text + "')"); + "VALUES ('" + fabric_code.Text + "','" + fabric_name.Text + "','" + fabric_GYard.Text + "','" + fabric_Remark.Text + "')"); await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 @@ -161,10 +146,10 @@ namespace formula_manage.Windows GridSql(); System.Windows.MessageBox.Show("添加完成"); } - } - else + } + else { - fabric_sql = string.Format("UPDATE [dbo].[PRODUCTION_Material] SET Name='" + fabric_name.Text + "',GYard='" + fabric_GYard.Text + "',Remark='" + fabric_Remark.Text + "' Where Code='"+ fabric_code.Text + "'"); + fabric_sql = string.Format("UPDATE [dbo].[PRODUCTION_Material] SET Name='" + fabric_name.Text + "',GYard='" + fabric_GYard.Text + "',Remark='" + fabric_Remark.Text + "' Where Code='" + fabric_code.Text + "'"); await conn_SC.OpenAsync(); //打开数据连接 SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 @@ -175,9 +160,9 @@ namespace formula_manage.Windows System.Windows.MessageBox.Show("C0110-1:修改失败"); } else - { + { GridSql(); - + System.Windows.MessageBox.Show("修改完成"); } } @@ -187,40 +172,40 @@ namespace formula_manage.Windows System.Windows.MessageBox.Show("请求失败,检查连接"); return; } - } + } } private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 - { + { string ShowProductName = "是否删除【" + this.fabric_name.Text + "】" + this.fabric_code.Text;//获取信息并拼接提示字符串 MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料 if (showProductName == MessageBoxResult.Yes)//判断是否删除 { - + string Stuff_sql = string.Format("DELETE FROM [dbo].[PRODUCTION_Material] WHERE Code ='" + fabric_code.Text.ToString() + "'"); - + SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化 try { await conn_SC.OpenAsync(); //打开数据连接 - SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); + SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 if (sql_in == 0) { System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功 - } - else - { - GridSql(); - } + } + else + { + GridSql(); + } } catch (Exception) { System.Windows.MessageBox.Show("请求失败,检查连接"); return; } - } + } } private void DataGridfabric_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件 @@ -236,5 +221,5 @@ namespace formula_manage.Windows } } - } + } } diff --git a/formula_manage.csproj b/formula_manage.csproj index 56d1a0f..7672b82 100644 --- a/formula_manage.csproj +++ b/formula_manage.csproj @@ -1,7 +1,5 @@  - - Debug @@ -116,87 +114,12 @@ - - packages\CommonServiceLocator.2.0.7\lib\net47\CommonServiceLocator.dll - - - packages\CommunityToolkit.Mvvm.8.2.2\lib\netstandard2.0\CommunityToolkit.Mvvm.dll - - - packages\FastReport.Net.Demo.2024.2.11\lib\net462\FastReport.dll - - - packages\FastReport.Net.Demo.2024.2.11\lib\net462\FastReport.Bars.dll - - - packages\FastReport.Compat.2024.2.11\lib\net462\FastReport.Compat.dll - - - packages\FastReport.DataVisualization.2024.2.11\lib\net462\FastReport.DataVisualization.dll - - - packages\FastReport.Net.Demo.2024.2.11\lib\net462\FastReport.Editor.dll - - - packages\FastReport.Net.Demo.2024.2.11\lib\net462\FastReport.VSDesign.dll - - - packages\FastReport.Net.Demo.2024.2.11\lib\net462\FastReport.Web.dll - - - packages\ModernUI.WPF.1.0.9\lib\net45\FirstFloor.ModernUI.dll - - - packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.dll - - - packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Extras.dll - - - packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll - - - packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll - - - packages\Microsoft.Extensions.DependencyInjection.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.dll - - - packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - - packages\Microsoft.Extensions.Logging.8.0.0\lib\net462\Microsoft.Extensions.Logging.dll - - - packages\Microsoft.Extensions.Logging.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll - - - packages\Microsoft.Extensions.Options.8.0.2\lib\net462\Microsoft.Extensions.Options.dll - - - packages\Microsoft.Extensions.Primitives.8.0.0\lib\net462\Microsoft.Extensions.Primitives.dll - - - packages\SamOatesGames.ModernUI.Xceed.Toolkit.1.0.1905191936\lib\net45\ModernUI.Xceed.AvalonDock.dll - - - packages\SamOatesGames.ModernUI.Xceed.Toolkit.1.0.1905191936\lib\net45\ModernUI.Xceed.Toolkit.dll - - - packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll - - - packages\NModbus.3.0.81\lib\net46\NModbus.dll - - - packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll - @@ -206,9 +129,6 @@ - - packages\MvvmLightLibs.5.4.1.1\lib\net45\System.Windows.Interactivity.dll - @@ -217,27 +137,9 @@ 4.0 - - packages\ThoughtWorks.QRCode.1.1.0\lib\ThoughtWorks.QRCode.dll - - - packages\Extended.Wpf.Toolkit.4.6.0\lib\net40\Xceed.Wpf.AvalonDock.dll - - - packages\Extended.Wpf.Toolkit.4.6.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll - - - packages\Extended.Wpf.Toolkit.4.6.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll - - - packages\Extended.Wpf.Toolkit.4.6.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll - - - packages\Extended.Wpf.Toolkit.4.6.0\lib\net40\Xceed.Wpf.Toolkit.dll - @@ -476,7 +378,6 @@ - SettingsSingleFileGenerator Settings.Designer.cs @@ -518,14 +419,52 @@ + + + 2.0.7 + + + 8.2.2 + + + 4.6.0 + + + 2024.2.11 + + + 2024.2.1 + + + 4.7.0 + + + 8.0.0 + + + 8.0.1 + + + 8.0.2 + + + 5.4.1.1 + + + 13.0.3 + + + 3.0.81 + + + 1.0.1905191936 + + + 8.0.1 + + + 1.1.0 + + - - - 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - - - - - - \ No newline at end of file diff --git a/packages.config b/packages.config deleted file mode 100644 index e567142..0000000 --- a/packages.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file