|
|
@ -41,6 +41,7 @@ using System.Runtime.Serialization; |
|
|
using System.Windows.Markup; |
|
|
using System.Windows.Markup; |
|
|
using System.Collections.ObjectModel; |
|
|
using System.Collections.ObjectModel; |
|
|
using SkiaSharp; |
|
|
using SkiaSharp; |
|
|
|
|
|
using System.Windows.Threading; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
@ -55,6 +56,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
InitializeComponent(); |
|
|
InitializeComponent(); |
|
|
DataContext = new ProductionPlanningModel(); |
|
|
DataContext = new ProductionPlanningModel(); |
|
|
Sdatepicker.Language = XmlLanguage.GetLanguage(Configini.IniReadvalue("SYS", "Language")); |
|
|
Sdatepicker.Language = XmlLanguage.GetLanguage(Configini.IniReadvalue("SYS", "Language")); |
|
|
|
|
|
CountDown(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); |
|
|
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); |
|
|
@ -80,7 +82,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private ObservableCollection<ContextMenuItem> ganttTaskContextMenuItems = new ObservableCollection<ContextMenuItem>(); |
|
|
private ObservableCollection<ContextMenuItem> ganttTaskContextMenuItems = new ObservableCollection<ContextMenuItem>(); |
|
|
private void GanttChartNEW() |
|
|
public void GanttChartNEW() |
|
|
{ |
|
|
{ |
|
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
SQLiteHelpers.Open(); //打开数据库
|
|
|
SQLiteHelpers.Open(); //打开数据库
|
|
|
@ -94,7 +96,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
GanttChart.Initialize(minDate, maxDate); |
|
|
GanttChart.Initialize(minDate, maxDate); |
|
|
var gridLineTimeLine = GanttChart.CreateTimeLine(new PeriodDaySplitter(minDate, maxDate), FormatDay); |
|
|
var gridLineTimeLine = GanttChart.CreateTimeLine(new PeriodDaySplitter(minDate, maxDate), FormatDay); |
|
|
GanttChart.CreateTimeLine(new PeriodHourSplitter(minDate, maxDate), FormatHour); |
|
|
GanttChart.CreateTimeLine(new PeriodHourSplitter(minDate, maxDate), FormatHour); |
|
|
|
|
|
|
|
|
// Set the timeline to atatch gridlines to
|
|
|
// Set the timeline to atatch gridlines to
|
|
|
GanttChart.SetGridLinesTimeline(gridLineTimeLine, DetermineBackground); |
|
|
GanttChart.SetGridLinesTimeline(gridLineTimeLine, DetermineBackground); |
|
|
var rowgroup = GanttChart.CreateGanttRowGroup(); |
|
|
var rowgroup = GanttChart.CreateGanttRowGroup(); |
|
|
@ -108,13 +109,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
|
|
|
|
|
|
for (int j = 0; j < dataRows.Count(); j++) //列表排程
|
|
|
for (int j = 0; j < dataRows.Count(); j++) //列表排程
|
|
|
{ |
|
|
{ |
|
|
// if(string.IsNullOrEmpty(dataRows[j].Field<string>("color")))
|
|
|
GanttChart.AddGanttTask(row, new GanttTask() |
|
|
|
|
|
{ |
|
|
GanttChart.AddGanttTask(row, new GanttTask() { |
|
|
|
|
|
Start = DateTime.Parse(dataRows[j].Field<string>("StartTime")), |
|
|
Start = DateTime.Parse(dataRows[j].Field<string>("StartTime")), |
|
|
End = DateTime.Parse(dataRows[j].Field<string>("EndTime")), |
|
|
End = DateTime.Parse(dataRows[j].Field<string>("EndTime")), |
|
|
Name = Properties.Resources.ProcessName + ";" + dataRows[j].Field<string>("ProgramName"), |
|
|
Name = Properties.Resources.ProcessName + ";" + dataRows[j].Field<string>("ProgramName"), |
|
|
TaskProgressVisibility = System.Windows.Visibility.Hidden }); |
|
|
TaskProgressVisibility = System.Windows.Visibility.Hidden |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}//创建日程图
|
|
|
}//创建日程图
|
|
|
@ -174,25 +175,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
} |
|
|
} |
|
|
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e) |
|
|
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e) |
|
|
{ |
|
|
{ |
|
|
|
|
|
Picture.Width = 0; |
|
|
// Select_WorkOrderNumder.Text;
|
|
|
// Select_WorkOrderNumder.Text;
|
|
|
} |
|
|
} |
|
|
private void ListViewItem_Before(object sender, MouseButtonEventArgs e)//前一天
|
|
|
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/MM/dd"); |
|
|
} |
|
|
} |
|
|
private void ListViewItem_Today(object sender, MouseButtonEventArgs e)//今天
|
|
|
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/MM/dd"); |
|
|
} |
|
|
} |
|
|
private void ListViewItem_DayAfter(object sender, MouseButtonEventArgs e)//后一天
|
|
|
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/MM/dd"); |
|
|
} |
|
|
} |
|
|
private void Sdatepicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)//时间控件
|
|
|
private void Sdatepicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)//时间控件
|
|
|
{ |
|
|
{ |
|
|
|
|
|
Picture.Width = 0; |
|
|
minDate = DateTime.Parse(sender.ToString()); |
|
|
minDate = DateTime.Parse(sender.ToString()); |
|
|
maxDate = DateTime.Parse(sender.ToString()).AddDays(1); |
|
|
maxDate = DateTime.Parse(sender.ToString()).AddDays(1); |
|
|
GanttChartNEW(); |
|
|
GanttChartNEW(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void CountDown() |
|
|
|
|
|
{ |
|
|
|
|
|
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
|
|
|
|
|
{ |
|
|
|
|
|
Interval = TimeSpan.FromSeconds(1)//秒
|
|
|
|
|
|
}; |
|
|
|
|
|
timer1s.Tick += Tick_Event_1S; |
|
|
|
|
|
timer1s.Start(); |
|
|
|
|
|
} |
|
|
|
|
|
public static bool UI; |
|
|
|
|
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
|
|
|
|
|
{ |
|
|
|
|
|
if (UI) |
|
|
|
|
|
{ |
|
|
|
|
|
GanttChartNEW(); |
|
|
|
|
|
UI= false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|