sc 1 year ago
parent
commit
0d349bd922
  1. 26
      View/TechnologicalProcessView.xaml.cs
  2. 14
      View/WorkOrderView.xaml.cs

26
View/TechnologicalProcessView.xaml.cs

@ -1,5 +1,7 @@
using System;
using DyeingComputer.UserClass;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -9,9 +11,11 @@ using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static DyeingComputer.UserClass.SqliteHelper;
namespace DyeingComputer.View
{
@ -23,8 +27,28 @@ namespace DyeingComputer.View
public TechnologicalProcessView()
{
InitializeComponent();
TechnologicalProcess_sql();
}
public static object workName;
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
DataSet sql; //内存数据缓存
public void TechnologicalProcess_sql()
{
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
string sql_script = "select * from ProgramSteps where ProgramID = '" + workName + "'";
if (sql != null) sql.Clear(); //清空缓存
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
name.Text = SQLiteHelpers.ExecuteScalar("select ProgramName from ProgramName where ProgramID = '" + workName + "'", null).ToString();
SQLiteHelpers.Close(); //关闭连接
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
}
}
}

14
View/WorkOrderView.xaml.cs

@ -152,6 +152,20 @@ namespace DyeingComputer.View
Process_id = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
_lock = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
}
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
string sql_script = "select * from ProgramName where ProgramID = '" + Process_id + "'";
int i = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0].Rows.Count; //读取计划表写入缓存
SQLiteHelpers.Close(); //关闭连接
if(i == 0)
{
WorkOrder_Numder = null;
Process_id = null;
Process_Name = null;
}
}
private void UserControl_KeyDown(object sender, KeyEventArgs e)

Loading…
Cancel
Save