Browse Source

料单搜索

master
sc 7 months ago
parent
commit
3f2fb3d2e8
  1. 9
      UserClass/LogGing.cs
  2. 31
      View/DyeingPlanView.xaml.cs

9
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());

31
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<string>("Dyelot")).First();
comboBoxMachine.Text = ds.AsEnumerable().Select(row => row.Field<string>("Machine")).First();
TEXTColorNumber.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorNo")).First();
TEXTColorName.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorName")).First();
TEXTClient.Text = ds.AsEnumerable().Select(row => row.Field<string>("CustomerName")).First();
TEXTClothSpecies.Text = ds.AsEnumerable().Select(row => row.Field<string>("FabricName")).First();
TEXTClothWeight.Text = ds.AsEnumerable().Select(row => row.Field<float>("TotalWeight")).First().ToString();
TEXTClothWeight.Text = ds.AsEnumerable().Select(row => row.Field<Double>("TotalWeight")).First().ToString();
TEXTBathRatio.Text = ds.AsEnumerable().Select(row => row.Field<string>("LiquidRatio")).First();
TEXTTotal.Text = ds.AsEnumerable().Select(row => row.Field<string>("TotalVolume")).First();
TEXTUSER.Text = ds.AsEnumerable().Select(row => row.Field<string>("UserAccount")).First();
comboBoxDyelot.Text = ds.AsEnumerable().Select(row => row.Field<string>("Dyelot")).First();
string machine_ = ds.AsEnumerable().Select(row => row.Field<string>("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<string>("UserAccount")).First();//用户名
if (!String.IsNullOrEmpty(user_)) TEXTUSER.Text = user_;
comboBoxProgram.Text = ds.AsEnumerable().Select(row => row.Field<string>("Program")).First();
color_= color.Background.ToString();
if (ds.AsEnumerable().Select(row => row.Field<int>("color")).First() > 0)//颜色
{
string colorValue = string.Format("{0:X6}", ds.AsEnumerable().Select(row => row.Field<int>("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);
}
}
}

Loading…
Cancel
Save