diff --git a/View/DyeingPlanView.xaml b/View/DyeingPlanView.xaml index c863c36..ad4403c 100644 --- a/View/DyeingPlanView.xaml +++ b/View/DyeingPlanView.xaml @@ -10,7 +10,7 @@ d:DesignHeight="900" d:DesignWidth="1100"> + FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxWorkOrder_KeyDown"/> - + diff --git a/View/DyeingPlanView.xaml.cs b/View/DyeingPlanView.xaml.cs index 393f36e..734566c 100644 --- a/View/DyeingPlanView.xaml.cs +++ b/View/DyeingPlanView.xaml.cs @@ -1,11 +1,13 @@ using Newtonsoft.Json.Linq; using nGantt.GanttChart; +using ScottPlot.Palettes; using SunlightCentralizedControlManagement_SCCM_.UserClass; using SunlightCentralizedControlManagement_SCCM_.ViewModel; using SunlightCentralizedControlManagement_SCCM_.WindowsView; using System; using System.Collections.Generic; using System.Data; +using System.Data.SqlClient; using System.Linq; using System.Text; using System.Text.RegularExpressions; @@ -99,12 +101,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View } string[] pArray = Regex.Split(comboBoxProgram.Text, @"\+", RegexOptions.IgnoreCase); - //单机器信息写入 string sTime; string StartTime_; string WorkOrder_ = comboBoxMachine.Text + "_" + DateTime.Now.ToString("yyMMddHHmmss"); - if (!string.IsNullOrEmpty(WorkOrder_n)) WorkOrder_ = WorkOrder_n; + if (!string.IsNullOrEmpty(comboBoxWorkOrder.Text)) WorkOrder_ = comboBoxWorkOrder.Text; string ProgramName_ = comboBoxProgram.Text; string ProgramID_ = null; for (int j = 0; j < pArray.Length; j++) @@ -459,13 +460,41 @@ namespace SunlightCentralizedControlManagement_SCCM_.View Picture.Content = new View.CurveTemp(TEMPTable); } - private void comboBoxWorkOrder_KeyDown(object sender, KeyEventArgs e)//工单输入 + private async void comboBoxWorkOrder_KeyDown(object sender, KeyEventArgs e)//工单输入 { if (e.Key == Key.Enter) { + string Connstr_SC; + string DYELOTS_sql = "SELECT count(*) FROM [dbo].[DYELOTS] WHERE OrderNo = '" + comboBoxWorkOrder.Text + "'";//单号查询语句 try { - //do what you want + if (MainWindowViewModel.SQMOD == "Windows Authentication") + { + Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI"; + } + else + { + Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD; + } + SqlConnection conn_SC = new SqlConnection(Connstr_SC); + await conn_SC.OpenAsync(); //连接数据库 + SqlDataAdapter DYELOTS_data = new SqlDataAdapter(DYELOTS_sql, Connstr_SC); //查询 + conn_SC.Close(); + + 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(); + 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(); + comboBoxProgram.Text = ds.AsEnumerable().Select(row => row.Field("Program")).First(); + color_= color.Background.ToString(); } catch (Exception ex) { @@ -500,5 +529,21 @@ namespace SunlightCentralizedControlManagement_SCCM_.View TEXTTotal.SelectionStart, e.Text)); TEXTTotal.Text = TEXTTotal.Text.Trim(); } + private void color_color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//颜色 + { + 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参数 + color.Background = new SolidColorBrush(MColor);//ARGB参数输出至Color的背景色 + //string colorCode = string.Format("{0:X2}", DColor.B) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.R);//反向十六进制RGB + //string colorCode = string.Format("{0:X2}", DColor.R) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.B);//正向十六进制RGB + //ColorCode_SQL = Convert.ToInt32(colorCode, 16);//十六进制RGB转存储数值 + + } + } } } diff --git a/View/EngineerSetView.xaml.cs b/View/EngineerSetView.xaml.cs index 8e7ce8d..ca6b4f2 100644 --- a/View/EngineerSetView.xaml.cs +++ b/View/EngineerSetView.xaml.cs @@ -102,7 +102,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View MainWindowViewModel.SQLNAME = TEXT_SQLNAME.Text; MainWindowViewModel.SQMOD = TEXT_SQMOD.Text; MainWindowViewModel.SQLUSER = TEXT_SQLUSER.Text; - MainWindowViewModel.SQLNAME = TEXT_SQLNAME.Text; + MainWindowViewModel.SQLPASWORD = TEXT_SQLPASWORD.Text; MainWindowViewModel.SQL_LINK();//更新设定 } }