|
|
|
@ -38,6 +38,7 @@ using nGantt; |
|
|
|
using nGantt.PeriodSplitter; |
|
|
|
using ScottPlot.TickGenerators.TimeUnits; |
|
|
|
using System.Runtime.Serialization; |
|
|
|
using System.Windows.Markup; |
|
|
|
|
|
|
|
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
|
@ -51,37 +52,37 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
|
{ |
|
|
|
InitializeComponent(); |
|
|
|
DataContext = new ProductionPlanningModel(); |
|
|
|
//ch.ZoomMode = LiveChartsCore.Measure.ZoomAndPanMode.PanX | LiveChartsCore.Measure.ZoomAndPanMode.ZoomY;
|
|
|
|
Sdatepicker.Language = XmlLanguage.GetLanguage(Configini.IniReadvalue("SYS", "Language")); |
|
|
|
} |
|
|
|
|
|
|
|
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); |
|
|
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
|
|
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
|
|
|
private int GantLenght { get; set; } |
|
|
|
private DateTime minDate; |
|
|
|
private DateTime maxDate; |
|
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面时的操作
|
|
|
|
{ |
|
|
|
// List<string> qw = MainWindowViewModel.Machines.AsEnumerable().Select(row => row.Field<string>("name")).ToList();//转换列名为机台
|
|
|
|
// int asd = qw.Count();
|
|
|
|
GantLenght = 1; |
|
|
|
DateTime minDate = DateTime.Parse("2012-02-01").Date; |
|
|
|
DateTime maxDate = minDate.AddDays(GantLenght); |
|
|
|
Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd"); |
|
|
|
minDate = DateTime.Now.Date; |
|
|
|
maxDate = minDate.AddDays(1); |
|
|
|
|
|
|
|
|
|
|
|
GanttChartNEW(); |
|
|
|
} |
|
|
|
private void GanttChartNEW() |
|
|
|
{ |
|
|
|
GanttChart.ClearGantt(); |
|
|
|
GanttChart.Initialize(minDate, maxDate); |
|
|
|
var gridLineTimeLine = GanttChart.CreateTimeLine(new PeriodDaySplitter(minDate, maxDate), FormatDay); |
|
|
|
|
|
|
|
GanttChart.CreateTimeLine(new PeriodHourSplitter(minDate, maxDate), FormatHour); |
|
|
|
// GanttChart.CreateTimeLine(new PeriodDaySplitter(minDate, maxDate), FormatDayName);
|
|
|
|
|
|
|
|
// Set the timeline to atatch gridlines to
|
|
|
|
GanttChart.SetGridLinesTimeline(gridLineTimeLine, DetermineBackground); |
|
|
|
var rowgroup = GanttChart.CreateGanttRowGroup(); |
|
|
|
var row = GanttChart.CreateGanttRow(rowgroup, "GanttRow"); |
|
|
|
|
|
|
|
|
|
|
|
var rowgroup1 = GanttChart.CreateGanttRowGroup("HeaderdGanttRowGroup"); |
|
|
|
var row1 = GanttChart.CreateGanttRow(rowgroup1, "GanttRow 1"); |
|
|
|
GanttChart.AddGanttTask(row1, new GanttTask() { Start = DateTime.Parse("2012-02-01 00:30:00"), End = DateTime.Parse("2012-02-01 01:00:00"), Name = "GanttRow 1:GanttTask 1", TaskProgressVisibility = System.Windows.Visibility.Hidden }); |
|
|
|
GanttChart.AddGanttTask(row1, new GanttTask() { Start = DateTime.Parse("2012-02-01 06:00:00"), End = DateTime.Parse("2012-02-01 07:00:00"), Name = "GanttRow 1:GanttTask 2" }); |
|
|
|
GanttChart.AddGanttTask(row1, new GanttTask() { Start = DateTime.Parse("2012-02-01 10:00:00"), End = DateTime.Parse("2012-02-01 20:00:00"), Name = "GanttRow 1:GanttTask 3" }); |
|
|
|
|
|
|
|
|
|
|
|
GanttChart.AddGanttTask(row, new GanttTask() { Start = DateTime.Parse("2024-12-30 00:30:00"), End = DateTime.Parse("2024-12-30 01:00:00"), Name = "GanttRow:"+"GanttTask 1", TaskProgressVisibility = System.Windows.Visibility.Hidden }); |
|
|
|
GanttChart.AddGanttTask(row, new GanttTask() { Start = DateTime.Parse("2024-12-30 06:00:00"), End = DateTime.Parse("2024-12-30 07:00:00"), Name = "GanttRow:"+"GanttTask 2" }); |
|
|
|
GanttChart.AddGanttTask(row, new GanttTask() { Start = DateTime.Parse("2024-12-30 10:00:00"), End = DateTime.Parse("2024-12-30 20:00:00"), Name = "GanttRow:"+"GanttTask 3" }); |
|
|
|
} |
|
|
|
private string FormatYear(Period period) |
|
|
|
{ |
|
|
|
@ -135,5 +136,23 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void ListViewItem_Before(object sender, MouseButtonEventArgs e)//前一天
|
|
|
|
{ |
|
|
|
Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(-1).ToString("yyyy/MM/dd"); |
|
|
|
} |
|
|
|
private void ListViewItem_Today(object sender, MouseButtonEventArgs e)//今天
|
|
|
|
{ |
|
|
|
Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd"); |
|
|
|
} |
|
|
|
private void ListViewItem_DayAfter(object sender, MouseButtonEventArgs e)//后一天
|
|
|
|
{ |
|
|
|
Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"); |
|
|
|
} |
|
|
|
private void Sdatepicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)//时间控件
|
|
|
|
{ |
|
|
|
minDate = DateTime.Parse(sender.ToString()); |
|
|
|
maxDate = DateTime.Parse(sender.ToString()).AddDays(1); |
|
|
|
GanttChartNEW(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|