You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
4.9 KiB
127 lines
4.9 KiB
using MaterialDesignThemes.Wpf;
|
|
using OpenTK.Graphics.ES11;
|
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Markup;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using System.Xaml;
|
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.View
|
|
{
|
|
/// <summary>
|
|
/// CurveView.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class CurveView : UserControl
|
|
{
|
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
|
public static DataTable WorkOrder = new DataTable(); //物料缓存
|
|
public static string CurveDiagram;
|
|
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
|
private string SYS_machines =null;
|
|
|
|
public CurveView()
|
|
{
|
|
InitializeComponent();
|
|
|
|
Sdatepicker.Language = XmlLanguage.GetLanguage(Configini.IniReadvalue("SYS", "Language"));
|
|
}
|
|
|
|
public static object Selet_Machines(DataTable DB, string name, int key)//查询
|
|
{
|
|
try
|
|
{
|
|
lock (DB)
|
|
{
|
|
DataRow drEmployee = DB.Rows[key];
|
|
object index = drEmployee.Field<object>(name);
|
|
return index;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
// LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
|
return "ERR";
|
|
}
|
|
}
|
|
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
|
|
|
Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd");
|
|
|
|
Picture.Content = new View.CurveDiagram();
|
|
}
|
|
|
|
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
CurveDiagram =Select_WorkOrderNumder.Text;
|
|
Picture.Content = new View.CurveDiagram();
|
|
}
|
|
|
|
private void ListViewItem_Before(object sender, MouseButtonEventArgs e)//前一天
|
|
{
|
|
Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(-1).ToString("yyyy/MM/dd");
|
|
if (!string.IsNullOrEmpty(SYS_machines)) { }
|
|
}
|
|
|
|
private void ListViewItem_Today(object sender, MouseButtonEventArgs e)//今天
|
|
{
|
|
Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd");
|
|
if (!string.IsNullOrEmpty(SYS_machines)) { }
|
|
}
|
|
|
|
private void ListViewItem_DayAfter(object sender, MouseButtonEventArgs e)//后一天
|
|
{
|
|
Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd");
|
|
if (!string.IsNullOrEmpty(SYS_machines)) { }
|
|
}
|
|
|
|
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)//选择机台
|
|
{
|
|
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
|
if (rownum != -1)//判断鼠标定位是否有效
|
|
{
|
|
SYS_machines = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
}
|
|
}
|
|
|
|
private void GridWorkOrder_MouseDoubleClick(object sender, MouseButtonEventArgs e)//选择料单
|
|
{
|
|
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
|
if (rownum != -1)//判断鼠标定位是否有效
|
|
{
|
|
SYS_machines = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
}
|
|
}
|
|
|
|
private void Sdatepicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)//
|
|
{
|
|
string SysTime = DateTime.Parse(sender.ToString()).ToString("yyyy/MM/dd");
|
|
string SysTimeDays = DateTime.Parse(sender.ToString()).AddDays(1).ToString("yyyy/MM/dd");
|
|
|
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
SQLiteHelpers.Open(); //打开数据库
|
|
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where " + "StartTime>='" + SysTime + "'and StartTime<='" + SysTimeDays + "'", null).Tables[0]; //读取表写入缓存
|
|
SQLiteHelpers.Close();
|
|
|
|
GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
|
|
}
|
|
}
|
|
}
|
|
|