Compare commits
32
Commits
35e9b740d8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70bc68b372 | ||
|
|
0f342b087e | ||
|
|
ee52b719e4 | ||
|
|
d49b0afb9d | ||
|
|
a70454b971 | ||
|
|
ec76dc6ae4 | ||
|
|
8eb970e3df | ||
|
|
758be5db6e | ||
|
|
759f4506f1 | ||
|
|
79cb7ef123 | ||
|
|
6e825efa8f | ||
|
|
1d9294b251 | ||
|
|
5e0d427927 | ||
|
|
3173e682ef | ||
|
|
16a481507e | ||
|
|
2f0c5ebead | ||
|
|
315eacabdf | ||
|
|
b7dde23675 | ||
|
|
f3c46db4be | ||
|
|
ea94a9e3f1 | ||
|
|
7bf56802f7 | ||
|
|
5d1a6af9a9 | ||
|
|
0c159c510f | ||
|
|
0203a9c6ba | ||
|
|
d8f7107efd | ||
|
|
79340a57d2 | ||
|
|
86f87bade0 | ||
|
|
b998ce1e35 | ||
|
|
7cecda0e29 | ||
|
|
b9fd99fbd3 | ||
|
|
6e18b4a684 | ||
|
|
d01175e5c5 |
No files matched your search
@@ -40,7 +40,7 @@ namespace ProcessManageUI
|
||||
directoryInfo.Create();//创建日志路径
|
||||
}
|
||||
}
|
||||
public static void ERRDATA(System.Exception dat)
|
||||
public static void ERRDATA(System.Exception dat,string d)
|
||||
{
|
||||
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录
|
||||
@@ -57,6 +57,7 @@ namespace ProcessManageUI
|
||||
// wr.Close();
|
||||
FileStream fil = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wfil = new StreamWriter(fil);//创建文件
|
||||
wfil.WriteLine("[" + Log_timehms + "];[DYELOT] ||" + d);
|
||||
wfil.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||
wfil.WriteLine("[" + Log_timehms + "];[Error source] ||" + dat.Source.ToString() + Environment.NewLine.ToString());
|
||||
wfil.WriteLine("[" + Log_timehms + "];[Error message] ||" + dat.Message.ToString() + Environment.NewLine.ToString());
|
||||
@@ -67,6 +68,7 @@ namespace ProcessManageUI
|
||||
{
|
||||
FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
wr.WriteLine("[" + Log_timehms + "];[DYELOT] ||" + d);
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + dat.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + dat.Message.ToString() + Environment.NewLine.ToString());
|
||||
|
||||
@@ -5,9 +5,48 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProcessManageUI"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
Loaded="Window_Loaded"
|
||||
ResizeMode="NoResize"
|
||||
Title="ProcessManage" Height="450" Width="800" >
|
||||
<Grid>
|
||||
<TextBox x:Name="Datalog" Margin="30,30,300,30"/>
|
||||
|
||||
<Grid Margin="30,30,300,30" >
|
||||
<TextBox x:Name="Datalog" IsReadOnly="True" VerticalScrollBarVisibility="Visible" />
|
||||
<DataGrid x:Name="data_Grid" FontSize="15" Visibility="Collapsed" />
|
||||
</Grid>
|
||||
<Button Content="染料" HorizontalAlignment="Right" Height="20" Margin="0,0,20,90" VerticalAlignment="Bottom" Width="100"
|
||||
Click="Button_Click_1"/>
|
||||
<Button Content="流程" HorizontalAlignment="Right" Height="20" Margin="0,0,20,60" VerticalAlignment="Bottom" Width="100"
|
||||
Click="Button_Click_2"/>
|
||||
<Button Content="储存" HorizontalAlignment="Right" Height="20" Margin="0,0,20,30" VerticalAlignment="Bottom" Width="100"
|
||||
Click="Button_Click_3"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,10,20,130" TextWrapping="NoWrap" VerticalAlignment="Bottom" Width="250"
|
||||
FontSize="14" x:Name="inf"/>
|
||||
<Grid Margin="0,30,0,0" Width="300" HorizontalAlignment="Right" Height="220" VerticalAlignment="Top" Background="#FFE4E4E4">
|
||||
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,10,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"
|
||||
FontSize="14" x:Name="IP"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,40,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"
|
||||
FontSize="14" x:Name="MOD" IsReadOnly="True"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,70,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"
|
||||
FontSize="14" x:Name="NAME"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,100,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"
|
||||
FontSize="14" x:Name="USER"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,130,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"
|
||||
FontSize="14" x:Name="PAW"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,160,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"
|
||||
FontSize="14" x:Name="TIMEMS"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="20" Margin="0,10,240,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="50"
|
||||
Text="地址" FontSize="16"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="20" Margin="0,40,240,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="50"
|
||||
Text="类型" FontSize="16"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="20" Margin="0,70,240,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="50"
|
||||
Text="数据库" FontSize="16"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="20" Margin="0,100,240,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="50"
|
||||
Text="账号" FontSize="16"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="20" Margin="0,130,240,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="50"
|
||||
Text="密码" FontSize="16"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="20" Margin="0,160,240,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="50"
|
||||
Text="周期(ms)" FontSize="16"/>
|
||||
<Button Content="保存" HorizontalAlignment="Right" Height="21" Margin="0,0,20,5" VerticalAlignment="Bottom" Width="100" Click="Button_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,23 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
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 System.Windows.Threading;
|
||||
using System.Xml.Linq;
|
||||
using static ProcessManageUI.SqliteHelper;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace ProcessManageUI
|
||||
{
|
||||
@@ -26,7 +31,46 @@ namespace ProcessManageUI
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private static IniFile.IniFiles Configini = new IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "ProcessManageConfigini.ini");
|
||||
private readonly System.Windows.Forms.NotifyIcon nIcon = new System.Windows.Forms.NotifyIcon();
|
||||
private void initNotifyIcon()
|
||||
{
|
||||
nIcon.Visible = true;
|
||||
nIcon.Icon = new Icon("./sunlight_logo.ico");
|
||||
nIcon.Text = "溶解流程自动选择";
|
||||
nIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(show_Click);
|
||||
nIcon.ContextMenu = new System.Windows.Forms.ContextMenu();
|
||||
System.Windows.Forms.MenuItem show = new System.Windows.Forms.MenuItem("打开");
|
||||
show.Click += new EventHandler(show_Click);
|
||||
nIcon.ContextMenu.MenuItems.Add(show);
|
||||
System.Windows.Forms.MenuItem exit = new System.Windows.Forms.MenuItem("退出");
|
||||
exit.Click += new EventHandler(exit_Click);
|
||||
nIcon.ContextMenu.MenuItems.Add(exit);
|
||||
}
|
||||
private void exit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
private void show_Click(object Sender, EventArgs e)
|
||||
{
|
||||
if (WindowState == WindowState.Minimized)
|
||||
WindowState = WindowState.Normal;
|
||||
Show();
|
||||
Activate();
|
||||
}
|
||||
protected override void OnStateChanged(EventArgs e)
|
||||
{
|
||||
if (WindowState == WindowState.Minimized) Hide();
|
||||
|
||||
base.OnStateChanged(e);
|
||||
}
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
Hide();
|
||||
base.OnClosing(e);
|
||||
}
|
||||
|
||||
private static IniFile.IniFiles Configini = new IniFile.IniFiles(Environment.CurrentDirectory + "\\ProcessManageConfigini.ini");
|
||||
private static string SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||
private static string SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||
private static string SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||
@@ -37,8 +81,11 @@ namespace ProcessManageUI
|
||||
private static DataTable Gram = new DataTable();
|
||||
private static int Count = 0;
|
||||
private static readonly int _intervalMs = int.Parse(Configini.IniReadvalue("SQL_SERVER", "SQL6"));
|
||||
private static readonly int _type = int.Parse(Configini.IniReadvalue("SQL_SERVER", "SQL7"));
|
||||
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
private readonly static string DBAddress = Environment.CurrentDirectory + "\\ProcessManage.db"; //数据库路径
|
||||
private int DATAGRID_TABLE;
|
||||
private int dbr_machine=0;
|
||||
|
||||
//设置定时器
|
||||
DispatcherTimer disTimer = new DispatcherTimer
|
||||
@@ -48,41 +95,59 @@ namespace ProcessManageUI
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
}
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{ // 程序默认启动时隐藏窗体
|
||||
//Hide();
|
||||
|
||||
IP.Text = SQLIP;
|
||||
MOD.Text = SQMOD;
|
||||
NAME.Text = SQLNAME;
|
||||
USER.Text = SQLUSER;
|
||||
PAW.Text = SQLPASWORD;
|
||||
TIMEMS.Text = _intervalMs.ToString();
|
||||
dbr_machine = int.Parse(Configini.IniReadvalue("SQL_SERVER", "SQLM"));
|
||||
|
||||
Datalog.Text = "启动";
|
||||
Datalog.AppendText("\n读取配置");
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
Gram = SQLiteHelpers.ExecuteDataSet("select * from Gram", null).Tables[0]; //读取表写入缓存
|
||||
Product = SQLiteHelpers.ExecuteDataSet("select * from ProcessManage", null).Tables[0];
|
||||
SQLiteHelpers.Close();
|
||||
Product = SQLiteHelpers.ExecuteDataSet("select * from ProcessManage", null).Tables[0];
|
||||
SQLiteHelpers.Close();
|
||||
|
||||
Datalog.AppendText("\n设定循环时间" + _intervalMs + "MS");
|
||||
disTimer.Tick += EXTask;
|
||||
disTimer.Start();//计时开始
|
||||
}
|
||||
|
||||
initNotifyIcon();
|
||||
}
|
||||
|
||||
private void EXTask(object sender, EventArgs e)
|
||||
{
|
||||
disTimer.Stop();//停止计时
|
||||
string Connstr_SC;
|
||||
string DyelotsBulkedRecipe_sql = "SELECT * FROM [dbo].[DyelotsBulkedRecipe] WHERE Created > '"
|
||||
+ DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd") + "' AND ProductType = '1' AND Process IS NULL";
|
||||
string DyelotsBulkedRecipe_sql =
|
||||
"SELECT * FROM [dbo].[DyelotsBulkedRecipe] WHERE Created > '" + DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd") +
|
||||
" ' and Created <'" + DateTime.Now.AddMinutes(-1).ToString("yyyy/MM/dd") +
|
||||
"' AND ProductType = '" + _type + "' AND Process IS NULL AND StepNumber IS NOT NULL AND ProductCode IS NOT NULL AND ReDye IS NOT NULL";
|
||||
if (SQMOD == "Windows Authentication")
|
||||
{
|
||||
Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";Trusted_Connection=SSPI";
|
||||
}
|
||||
else
|
||||
{
|
||||
Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";User ID=" + SQLUSER + ";Password=" + SQLPASWORD;
|
||||
}
|
||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||
conn_SC.OpenAsync(); //连接数据库
|
||||
SqlDataAdapter DyelotsBulkedRecipe_ = new SqlDataAdapter(DyelotsBulkedRecipe_sql, Connstr_SC);
|
||||
try
|
||||
{
|
||||
DyelotsBulkedRecipe.Clear();
|
||||
Datalog.Text = null;
|
||||
|
||||
if (SQMOD == "Windows Authentication")
|
||||
{
|
||||
Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";Trusted_Connection=SSPI";
|
||||
}
|
||||
else
|
||||
{
|
||||
Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";User ID=" + SQLUSER + ";Password=" + SQLPASWORD;
|
||||
}
|
||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||
conn_SC.OpenAsync(); //连接数据库
|
||||
SqlDataAdapter DyelotsBulkedRecipe_ = new SqlDataAdapter(DyelotsBulkedRecipe_sql, Connstr_SC);
|
||||
conn_SC.Close();
|
||||
Datalog.AppendText(DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") +" 开始转换");
|
||||
DyelotsBulkedRecipe_.Fill(DyelotsBulkedRecipe);
|
||||
|
||||
for (int i = DyelotsBulkedRecipe.Rows.Count; i > 0; i--)
|
||||
@@ -90,36 +155,163 @@ namespace ProcessManageUI
|
||||
if (DyelotsBulkedRecipe.Rows.Count <= 0) { break; }//跳出循环
|
||||
|
||||
string Dyelot = DyelotsBulkedRecipe.Rows[0].Field<string>("Dyelot");
|
||||
int ReDye = DyelotsBulkedRecipe.Rows[0].Field<int>("ReDye");
|
||||
int StepNumber = DyelotsBulkedRecipe.Rows[0].Field<int>("StepNumber");
|
||||
double gram = 0;
|
||||
int type_id = 0;
|
||||
DataRow[] rowdat = DyelotsBulkedRecipe.Select("Dyelot ='" + Dyelot + "'");//行
|
||||
string machine_T = "";
|
||||
DataRow[] rowdat = DyelotsBulkedRecipe.Select("Dyelot ='" + Dyelot + "' AND ReDye='"+ ReDye+ "' AND StepNumber ='"+ StepNumber+"'");//行
|
||||
|
||||
foreach (DataRow row in rowdat)//删除指定信息行
|
||||
{
|
||||
row.Field<string>("ProductCode");
|
||||
try
|
||||
{
|
||||
int a = Product.Select("ProductCode = " + row.Field<string>("ProductCode")).First().Field<int>("ProductType");
|
||||
if (a > type_id) type_id = a;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex, Dyelot);
|
||||
Datalog.AppendText("Dyelot="+Dyelot+"=="+ex.ToString());
|
||||
}
|
||||
|
||||
gram += row.Field<double>("Grams");
|
||||
row.Delete();
|
||||
row.AcceptChanges();
|
||||
}
|
||||
|
||||
string NAME = "Process";
|
||||
int Class = 0;
|
||||
int TANK = 0;
|
||||
|
||||
try
|
||||
{
|
||||
NAME = Gram.Select("Type='" + type_id + "' and min<=" + (int)gram + " and max>" + (int)gram + "").First().Field<string>("name");
|
||||
Class = Gram.Select("Type='" + type_id + "' and min<=" + (int)gram + " and max>" + (int)gram + "").First().Field<int>("Class");
|
||||
TANK = Gram.Select("Type='" + type_id + "' and min<=" + (int)gram + " and max>" + (int)gram + "").First().Field<int>("TANK");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex, Dyelot);
|
||||
Datalog.AppendText(ex.ToString());
|
||||
}
|
||||
|
||||
string DyelotsBulkedRecipe_updata = "UPDATE [dbo].[DyelotsBulkedRecipe] SET Process ='" + NAME +
|
||||
"' ,ProductClass='" + Class + "',MixTankNo='" + TANK +
|
||||
"' WHERE Dyelot ='" + Dyelot + "' AND ReDye='" + ReDye + "' AND StepNumber ='" + StepNumber + "'";
|
||||
|
||||
if (dbr_machine == 1)//添加机台
|
||||
{
|
||||
string DyelotsBulkedRecipe_machine = "SELECT * FROM[dbo].[Dyelots] " +
|
||||
" WHERE Dyelot ='" + Dyelot + "' AND ReDye='" + ReDye + "'";
|
||||
SqlDataAdapter DyelotsBulkedRecipe_m = new SqlDataAdapter(DyelotsBulkedRecipe_machine, conn_SC);
|
||||
DataTable dataTableM = new DataTable();
|
||||
DyelotsBulkedRecipe_m.Fill(dataTableM);
|
||||
machine_T = dataTableM.Rows[0].Field<string>("Machine");
|
||||
|
||||
DyelotsBulkedRecipe_updata = "UPDATE [dbo].[DyelotsBulkedRecipe] SET Process ='" + NAME +
|
||||
"' ,ProductClass='" + Class + "',MixTankNo='" + TANK + "',Machine='" + machine_T +
|
||||
"' WHERE Dyelot ='" + Dyelot + "' AND ReDye='" + ReDye + "' AND StepNumber ='" + StepNumber + "'";
|
||||
}
|
||||
|
||||
SqlCommand DyelotsBulkedRecipe_UP = new SqlCommand(DyelotsBulkedRecipe_updata, conn_SC);
|
||||
Count++;
|
||||
Datalog.AppendText("\n" + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") + " 转换工单:" + Dyelot + "流程:");
|
||||
LogGing.LogGingDATA( "转换工单:" + Dyelot + "流程:");
|
||||
Datalog.AppendText("\n" + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") +
|
||||
" 转换工单:" + Dyelot + "-重染:"+ReDye+"-步骤:"+StepNumber+"\n影响行数"+
|
||||
DyelotsBulkedRecipe_UP.ExecuteNonQuery() + "-流程:"+ NAME+ "-机台:" + machine_T);
|
||||
LogGing.LogGingDATA( "转换工单:" + Dyelot + "重染" + ReDye + "质量" + gram + "步骤" + StepNumber + "流程:" + NAME+"机台:" + machine_T);
|
||||
}
|
||||
Datalog.AppendText("\n" + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") + $" 转换{Count}条");
|
||||
Datalog.AppendText("\n" + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") + $" 转换完成{Count}条");
|
||||
Count = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{//错误处理
|
||||
LogGing.ERRDATA(ex);
|
||||
LogGing.ERRDATA(ex,"NULL");
|
||||
Datalog.AppendText(ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn_SC.Close();
|
||||
disTimer.Start();//计时开始
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Configini.IniWritevalue("SQL_SERVER", "SQL1", IP.Text);
|
||||
Configini.IniWritevalue("SQL_SERVER", "SQL2", NAME.Text);
|
||||
Configini.IniWritevalue("SQL_SERVER", "SQL3", MOD.Text);
|
||||
Configini.IniWritevalue("SQL_SERVER", "SQL4", USER.Text);
|
||||
Configini.IniWritevalue("SQL_SERVER", "SQL5", PAW.Text);
|
||||
Configini.IniWritevalue("SQL_SERVER", "SQL6", TIMEMS.Text);
|
||||
inf.Text = "数据库设定已储存";
|
||||
}
|
||||
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
disTimer.Stop();//停止计时
|
||||
data_Grid.ItemsSource = Product.DefaultView;
|
||||
DATAGRID_TABLE = 1;
|
||||
inf.Text = "设定染料信息";
|
||||
data_Grid.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||
{
|
||||
disTimer.Stop();//停止计时
|
||||
data_Grid.ItemsSource = Gram.DefaultView;
|
||||
DATAGRID_TABLE = 2;
|
||||
inf.Text = "设定流程信息";
|
||||
data_Grid.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void Button_Click_3(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DATAGRID_TABLE == 1)
|
||||
{
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("ProcessManage", null, null);
|
||||
DataTable data_t = Product.Clone();
|
||||
Product.AcceptChanges();
|
||||
for (int i = 0; i < Product.Rows.Count; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
DataRow dt = Product.Rows[i];//行转换
|
||||
DataRow drT = data_t.NewRow();
|
||||
drT.ItemArray = dt.ItemArray;
|
||||
data_t.Rows.InsertAt(drT, 0);
|
||||
SQLiteHelpers.InsertData("ProcessManage", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
|
||||
inf.Text = "染料信息已储存";
|
||||
}
|
||||
else if (DATAGRID_TABLE == 2)
|
||||
{
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("Gram", null, null);
|
||||
DataTable data_t = Gram.Clone();
|
||||
Gram.AcceptChanges();
|
||||
for (int i = 0; i < Gram.Rows.Count; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
DataRow dt = Gram.Rows[i];//行转换
|
||||
DataRow drT = data_t.NewRow();
|
||||
drT.ItemArray = dt.ItemArray;
|
||||
data_t.Rows.InsertAt(drT, 0);
|
||||
SQLiteHelpers.InsertData("Gram", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
|
||||
inf.Text = "流程信息已储存";
|
||||
}
|
||||
|
||||
data_Grid.Visibility=Visibility.Collapsed;
|
||||
disTimer.Start();//计时
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -16,7 +16,7 @@
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
@@ -24,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -34,9 +35,17 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>sunlight_logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>ProcessManageUI.App</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -104,5 +113,8 @@
|
||||
<Version>1.0.119</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="sunlight_logo.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Reference in new issue
Block a user