diff --git a/UserClass/LogGing.cs b/UserClass/LogGing.cs index f681838..ac78453 100644 --- a/UserClass/LogGing.cs +++ b/UserClass/LogGing.cs @@ -23,7 +23,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass StreamWriter wr = new StreamWriter(fs);//创建文件 wr.WriteLine(Log_time + dat); wr.Close(); - } else { @@ -55,10 +54,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass { if (!File.Exists(log_path))//检查文件并写入 { - FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建文件 - StreamWriter wr = new StreamWriter(fs);//创建文件 - wr.Close(); - FileStream fil = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件 + // FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建文件 + // StreamWriter wr = new StreamWriter(fs);//创建文件 + // wr.Close(); + FileStream fil = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建写入文件 StreamWriter wfil = new StreamWriter(fil);//创建文件 wfil.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString()); wfil.WriteLine("[" + Log_timehms + "];[Error source] ||" + dat.Source.ToString() + Environment.NewLine.ToString()); diff --git a/View/DyeingPlanView.xaml.cs b/View/DyeingPlanView.xaml.cs index 4247d05..da25328 100644 --- a/View/DyeingPlanView.xaml.cs +++ b/View/DyeingPlanView.xaml.cs @@ -132,7 +132,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View string Machines_ = comboBoxMachine.Text; string State_ = "100"; string Dyelot_ = comboBoxDyelot.Text; - // string color_ = color_color.Background.ToString(); + string color_ = color.Background.ToString(); SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 try @@ -465,7 +465,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View if (e.Key == Key.Enter) { string Connstr_SC; - string DYELOTS_sql = "SELECT * FROM [dbo].[DYELOTS] WHERE OrderNo = '" + comboBoxWorkOrder.Text + "'";//单号查询语句 + string DYELOTS_sql = "SELECT * FROM [dbo].[DYELOTS] WHERE Dyelot = '" + comboBoxWorkOrder.Text + "'";//单号查询语句 try { if (MainWindowViewModel.SQMOD == "Windows Authentication") @@ -483,23 +483,38 @@ namespace SunlightCentralizedControlManagement_SCCM_.View DataTable ds = new DataTable(); DYELOTS_data.Fill(ds); - comboBoxDyelot.Text = ds.AsEnumerable().Select(row => row.Field("Dyelot")).First(); - comboBoxMachine.Text = ds.AsEnumerable().Select(row => row.Field("Machine")).First(); TEXTColorNumber.Text = ds.AsEnumerable().Select(row => row.Field("ColorNo")).First(); TEXTColorName.Text = ds.AsEnumerable().Select(row => row.Field("ColorName")).First(); TEXTClient.Text = ds.AsEnumerable().Select(row => row.Field("CustomerName")).First(); TEXTClothSpecies.Text = ds.AsEnumerable().Select(row => row.Field("FabricName")).First(); - TEXTClothWeight.Text = ds.AsEnumerable().Select(row => row.Field("TotalWeight")).First().ToString(); + TEXTClothWeight.Text = ds.AsEnumerable().Select(row => row.Field("TotalWeight")).First().ToString(); TEXTBathRatio.Text = ds.AsEnumerable().Select(row => row.Field("LiquidRatio")).First(); TEXTTotal.Text = ds.AsEnumerable().Select(row => row.Field("TotalVolume")).First(); - TEXTUSER.Text = ds.AsEnumerable().Select(row => row.Field("UserAccount")).First(); + comboBoxDyelot.Text = ds.AsEnumerable().Select(row => row.Field("Dyelot")).First(); + + string machine_ = ds.AsEnumerable().Select(row => row.Field("Machine")).First();//机台 + if (MainWindowViewModel.Machines.Select("Name ='"+machine_+"'").Length == 0) + { + comboBoxMachine.Text = null; + } + else + { + comboBoxMachine.Text = machine_; + } + string user_ = ds.AsEnumerable().Select(row => row.Field("UserAccount")).First();//用户名 + if (!String.IsNullOrEmpty(user_)) TEXTUSER.Text = user_; comboBoxProgram.Text = ds.AsEnumerable().Select(row => row.Field("Program")).First(); - color_= color.Background.ToString(); + + if (ds.AsEnumerable().Select(row => row.Field("color")).First() > 0)//颜色 + { + string colorValue = string.Format("{0:X6}", ds.AsEnumerable().Select(row => row.Field("color")).First());//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0” + color.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString( + "#FF" + colorValue.Substring(4, 2) + colorValue.Substring(2, 2) + colorValue.Substring(0, 2))); + } } catch (Exception ex) { LogGing.ERRDATA(ex); - } } }