diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index a5c1fe8..7886d39 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -303,6 +303,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties { } } + /// + /// 查找类似 Color 的本地化字符串。 + /// + public static string Color { + get { + return ResourceManager.GetString("Color", resourceCulture); + } + } + /// /// 查找类似 Compute 的本地化字符串。 /// diff --git a/Properties/Resources.en-US.resx b/Properties/Resources.en-US.resx index 264c930..fa18c67 100644 --- a/Properties/Resources.en-US.resx +++ b/Properties/Resources.en-US.resx @@ -936,4 +936,7 @@ Multi + + Color + \ No newline at end of file diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 6b7f391..2436b6a 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -936,4 +936,7 @@ Multi + + Color + \ No newline at end of file diff --git a/Properties/Resources.zh-CN.resx b/Properties/Resources.zh-CN.resx index dc1e303..8fb671d 100644 --- a/Properties/Resources.zh-CN.resx +++ b/Properties/Resources.zh-CN.resx @@ -936,4 +936,7 @@ 多机 + + 颜色 + \ No newline at end of file diff --git a/View/ProductionPlanningEdit.xaml b/View/ProductionPlanningEdit.xaml index 5525274..026b66b 100644 --- a/View/ProductionPlanningEdit.xaml +++ b/View/ProductionPlanningEdit.xaml @@ -18,6 +18,8 @@ + ("EndTime").ToString(); //读取计划表写入缓存 if (DateTime.Now < DateTime.Parse(sTime)) { - StartTime_=DateTime.Parse(sTime).AddMinutes(1).ToString("yy/MM/dd HH:mm:ss"); + StartTime_=DateTime.Parse(sTime).AddMinutes(1).ToString("yyyy/M/d HH:mm:ss"); } else { - StartTime_= DateTime.Now.AddMinutes(1).ToString("yy/MM/dd HH:mm:ss"); + StartTime_= DateTime.Now.AddMinutes(1).ToString("yyyy/M/d HH:mm:ss"); } } catch (Exception) { - StartTime_= DateTime.Now.AddMinutes(1).ToString("yy/MM/dd HH:mm:ss"); + StartTime_= DateTime.Now.AddMinutes(1).ToString("yyyy/M/d HH:mm:ss"); } SQLiteHelpers.Close(); //关闭连接 string Time_ = DateTime.Parse(ProgramName.Select("ProgramName='" + ProgramName_ + "'"). First().Field("Time").ToString()).ToString("HH:mm:ss"); - string EndTime_ = (DateTime.Parse(StartTime_)+ DateTime.Parse(Time_).TimeOfDay).ToString(); + string EndTime_ = (DateTime.Parse(StartTime_)+ DateTime.Parse(Time_).TimeOfDay).ToString("yyyy/M/d HH:mm:ss"); //插入数据信息 Dictionary WorkOrder_new = new Dictionary();//缓存函数 @@ -128,7 +129,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View WorkOrder_new.Add("Dyelot", Dyelot_); WorkOrder_new.Add("Remark", null); WorkOrder_new.Add("lock", 0); - WorkOrder_new.Add("color", null); + WorkOrder_new.Add("color", color_); SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入 @@ -140,13 +141,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.View { string sTime; string StartTime_; - string WorkOrder_ = sArray[i] + "_" + DateTime.Now.ToString("yyMMddHHmmss"); + string WorkOrder_ = sArray[i] + "_" + DateTime.Now.ToString("yyMMddHHmmss")+i; string ProgramName_ = comboBoxProgram.Text; string ProgramID_ = ProgramName.Select("ProgramName='" + ProgramName_ + "'"). First().Field("ProgramID").ToString(); string Machines_ = sArray[i]; string State_ = "100"; string Dyelot_ = comboBoxDyelot.Text; + string color_ = color_color.Background.ToString(); SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 try @@ -156,16 +158,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View Tables[0].Select().First().Field("EndTime").ToString(); //读取计划表写入缓存 if (DateTime.Now < DateTime.Parse(sTime)) { - StartTime_ = DateTime.Parse(sTime).AddMinutes(1).ToString("yy/MM/dd HH:mm:ss"); + StartTime_ = DateTime.Parse(sTime).AddMinutes(1).ToString("yyyy/M/d HH:mm:ss"); } else { - StartTime_ = DateTime.Now.AddMinutes(1).ToString("yy/MM/dd HH:mm:ss"); + StartTime_ = DateTime.Now.AddMinutes(1).ToString("yyyy/M/d HH:mm:ss"); } } catch (Exception) { - StartTime_ = DateTime.Now.AddMinutes(1).ToString("yy/MM/dd HH:mm:ss"); + StartTime_ = DateTime.Now.AddMinutes(1).ToString("yyyy/M/d HH:mm:ss"); } SQLiteHelpers.Close(); //关闭连接 @@ -186,7 +188,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View WorkOrder_new.Add("Dyelot", Dyelot_); WorkOrder_new.Add("Remark", null); WorkOrder_new.Add("lock", 0); - WorkOrder_new.Add("color", null); + WorkOrder_new.Add("color", color_); SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入 @@ -258,12 +260,28 @@ namespace SunlightCentralizedControlManagement_SCCM_.View } + 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_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转存储数值 + + } + } + string ProgramID; string ProgramNAME; string Numder = null; string ID = null; - string P1, P2, P3, P4, P5; - + string P1, P2, P3, P4, P5; private void Grid_data_MouseDoubleClick(object sender, MouseButtonEventArgs e) { int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量 diff --git a/View/ProductionPlanningView.xaml b/View/ProductionPlanningView.xaml index 0b84953..cfdd75c 100644 --- a/View/ProductionPlanningView.xaml +++ b/View/ProductionPlanningView.xaml @@ -32,8 +32,8 @@ - + diff --git a/View/ProductionPlanningView.xaml.cs b/View/ProductionPlanningView.xaml.cs index cdb11f3..168f27a 100644 --- a/View/ProductionPlanningView.xaml.cs +++ b/View/ProductionPlanningView.xaml.cs @@ -67,7 +67,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View private DateTime maxDate; private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面时的操作 { - Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd"); + Sdatepicker.Text = DateTime.Now.ToString("yyyy/M/d HH:mm:ss"); minDate = DateTime.Now.Date; maxDate = minDate.AddDays(1); //添加表右键功能 @@ -112,7 +112,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View System.Windows.Media.Color colorBackground = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#FF336FA8"); try { - colorBackground = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#"+dataRows[j].Field("color")); + colorBackground = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(dataRows[j].Field("color")); } catch (Exception) { } //FF336FA8 @@ -122,6 +122,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View End = DateTime.Parse(dataRows[j].Field("EndTime")), Name = Properties.Resources.ProcessName + ";" + dataRows[j].Field("ProgramName"), Background = colorBackground, + ID = dataRows[j].Field("WorkOrder"), TaskProgressVisibility = System.Windows.Visibility.Hidden }); } @@ -140,11 +141,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + ganttTask.Name, "Delete ", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { - ///执行删除 + ///执行删除 SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 - SQLiteHelpers.Delete( - "WorkOrder", "StartTime='" + ganttTask.Start + "'and EndTime='" + ganttTask.End + "'", null); + SQLiteHelpers.Delete("WorkOrder", "WorkOrder='" + ganttTask.ID + "'", null); SQLiteHelpers.Close(); GanttChartNEW(); } @@ -189,17 +189,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View private void ListViewItem_Before(object sender, MouseButtonEventArgs e)//前一天 { Picture.Width = 0; - Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(-1).ToString("yyyy/MM/dd"); + Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(-1).ToString("yyyy/M/d HH:mm:ss"); } private void ListViewItem_Today(object sender, MouseButtonEventArgs e)//今天 { Picture.Width = 0; - Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd"); + Sdatepicker.Text = DateTime.Now.ToString("yyyy/M/d HH:mm:ss"); } private void ListViewItem_DayAfter(object sender, MouseButtonEventArgs e)//后一天 { Picture.Width = 0; - Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"); + Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/M/d HH:mm:ss"); } private void Sdatepicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)//时间控件 {