Compare commits
28
Commits
7cecda0e29
...
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 |
No files matched your search
@@ -40,7 +40,7 @@ namespace ProcessManageUI
|
|||||||
directoryInfo.Create();//创建日志路径
|
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 Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||||
string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录
|
string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录
|
||||||
@@ -57,6 +57,7 @@ namespace ProcessManageUI
|
|||||||
// wr.Close();
|
// wr.Close();
|
||||||
FileStream fil = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
FileStream fil = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
||||||
StreamWriter wfil = new StreamWriter(fil);//创建文件
|
StreamWriter wfil = new StreamWriter(fil);//创建文件
|
||||||
|
wfil.WriteLine("[" + Log_timehms + "];[DYELOT] ||" + d);
|
||||||
wfil.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
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 source] ||" + dat.Source.ToString() + Environment.NewLine.ToString());
|
||||||
wfil.WriteLine("[" + Log_timehms + "];[Error message] ||" + dat.Message.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);//创建写入文件
|
FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine("[" + Log_timehms + "];[DYELOT] ||" + d);
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + dat.ToString() + 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());
|
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:ProcessManageUI"
|
xmlns:local="clr-namespace:ProcessManageUI"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainWindow" Height="450" Width="800">
|
Loaded="Window_Loaded"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
Title="ProcessManage" Height="450" Width="800" >
|
||||||
<Grid>
|
<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>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -1,23 +1,28 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
using System.Xml.Linq;
|
||||||
using static ProcessManageUI.SqliteHelper;
|
using static ProcessManageUI.SqliteHelper;
|
||||||
using static System.Net.WebRequestMethods;
|
|
||||||
|
|
||||||
namespace ProcessManageUI
|
namespace ProcessManageUI
|
||||||
{
|
{
|
||||||
@@ -26,7 +31,46 @@ namespace ProcessManageUI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow : Window
|
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 SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
private static string SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
private static string SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
private static string SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
private static string SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
@@ -37,8 +81,11 @@ namespace ProcessManageUI
|
|||||||
private static DataTable Gram = new DataTable();
|
private static DataTable Gram = new DataTable();
|
||||||
private static int Count = 0;
|
private static int Count = 0;
|
||||||
private static readonly int _intervalMs = int.Parse(Configini.IniReadvalue("SQL_SERVER", "SQL6"));
|
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 static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly static string DBAddress = Environment.CurrentDirectory + "\\ProcessManage.db"; //数据库路径
|
private readonly static string DBAddress = Environment.CurrentDirectory + "\\ProcessManage.db"; //数据库路径
|
||||||
|
private int DATAGRID_TABLE;
|
||||||
|
private int dbr_machine=0;
|
||||||
|
|
||||||
//设置定时器
|
//设置定时器
|
||||||
DispatcherTimer disTimer = new DispatcherTimer
|
DispatcherTimer disTimer = new DispatcherTimer
|
||||||
@@ -48,29 +95,43 @@ namespace ProcessManageUI
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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 = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
Gram = SQLiteHelpers.ExecuteDataSet("select * from Gram", null).Tables[0]; //读取表写入缓存
|
Gram = SQLiteHelpers.ExecuteDataSet("select * from Gram", null).Tables[0]; //读取表写入缓存
|
||||||
Product = SQLiteHelpers.ExecuteDataSet("select * from ProcessManage", null).Tables[0];
|
Product = SQLiteHelpers.ExecuteDataSet("select * from ProcessManage", null).Tables[0];
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Close();
|
||||||
|
|
||||||
|
Datalog.AppendText("\n设定循环时间" + _intervalMs + "MS");
|
||||||
disTimer.Tick += EXTask;
|
disTimer.Tick += EXTask;
|
||||||
disTimer.Start();//计时开始
|
disTimer.Start();//计时开始
|
||||||
}
|
|
||||||
|
|
||||||
|
initNotifyIcon();
|
||||||
|
}
|
||||||
|
|
||||||
private void EXTask(object sender, EventArgs e)
|
private void EXTask(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
disTimer.Stop();//停止计时
|
disTimer.Stop();//停止计时
|
||||||
string Connstr_SC;
|
string Connstr_SC;
|
||||||
string DyelotsBulkedRecipe_sql = "SELECT * FROM [dbo].[DyelotsBulkedRecipe] WHERE Created > '"
|
string DyelotsBulkedRecipe_sql =
|
||||||
+ DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd") + "' AND ProductType = '1' AND Process IS NULL";
|
"SELECT * FROM [dbo].[DyelotsBulkedRecipe] WHERE Created > '" + DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd") +
|
||||||
try
|
" ' 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";
|
||||||
DyelotsBulkedRecipe.Clear();
|
|
||||||
Datalog.Text = null;
|
|
||||||
|
|
||||||
if (SQMOD == "Windows Authentication")
|
if (SQMOD == "Windows Authentication")
|
||||||
{
|
{
|
||||||
Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";Trusted_Connection=SSPI";
|
Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
@@ -82,7 +143,11 @@ namespace ProcessManageUI
|
|||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||||
conn_SC.OpenAsync(); //连接数据库
|
conn_SC.OpenAsync(); //连接数据库
|
||||||
SqlDataAdapter DyelotsBulkedRecipe_ = new SqlDataAdapter(DyelotsBulkedRecipe_sql, Connstr_SC);
|
SqlDataAdapter DyelotsBulkedRecipe_ = new SqlDataAdapter(DyelotsBulkedRecipe_sql, Connstr_SC);
|
||||||
conn_SC.Close();
|
try
|
||||||
|
{
|
||||||
|
DyelotsBulkedRecipe.Clear();
|
||||||
|
Datalog.Text = null;
|
||||||
|
Datalog.AppendText(DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") +" 开始转换");
|
||||||
DyelotsBulkedRecipe_.Fill(DyelotsBulkedRecipe);
|
DyelotsBulkedRecipe_.Fill(DyelotsBulkedRecipe);
|
||||||
|
|
||||||
for (int i = DyelotsBulkedRecipe.Rows.Count; i > 0; i--)
|
for (int i = DyelotsBulkedRecipe.Rows.Count; i > 0; i--)
|
||||||
@@ -90,9 +155,12 @@ namespace ProcessManageUI
|
|||||||
if (DyelotsBulkedRecipe.Rows.Count <= 0) { break; }//跳出循环
|
if (DyelotsBulkedRecipe.Rows.Count <= 0) { break; }//跳出循环
|
||||||
|
|
||||||
string Dyelot = DyelotsBulkedRecipe.Rows[0].Field<string>("Dyelot");
|
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;
|
double gram = 0;
|
||||||
int type_id = 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)//删除指定信息行
|
foreach (DataRow row in rowdat)//删除指定信息行
|
||||||
{
|
{
|
||||||
@@ -101,33 +169,149 @@ namespace ProcessManageUI
|
|||||||
int a = Product.Select("ProductCode = " + row.Field<string>("ProductCode")).First().Field<int>("ProductType");
|
int a = Product.Select("ProductCode = " + row.Field<string>("ProductCode")).First().Field<int>("ProductType");
|
||||||
if (a > type_id) type_id = a;
|
if (a > type_id) type_id = a;
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogGing.ERRDATA(ex, Dyelot);
|
||||||
|
Datalog.AppendText("Dyelot="+Dyelot+"=="+ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
gram += row.Field<double>("Grams");
|
gram += row.Field<double>("Grams");
|
||||||
row.Delete();
|
row.Delete();
|
||||||
row.AcceptChanges();
|
row.AcceptChanges();
|
||||||
}
|
}
|
||||||
string NAME = Gram.Select("Type='"+type_id +"' and min<'"+gram+"' and max>'"+gram+"'").First().Field<string>("name");
|
|
||||||
|
|
||||||
|
string NAME = "Process";
|
||||||
|
int Class = 0;
|
||||||
|
int TANK = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
Count++;
|
NAME = Gram.Select("Type='" + type_id + "' and min<=" + (int)gram + " and max>" + (int)gram + "").First().Field<string>("name");
|
||||||
Datalog.AppendText("\n" + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") + " 转换工单:" + Dyelot + "流程:"+ NAME);
|
Class = Gram.Select("Type='" + type_id + "' and min<=" + (int)gram + " and max>" + (int)gram + "").First().Field<int>("Class");
|
||||||
LogGing.LogGingDATA( "转换工单:" + Dyelot + "流程:");
|
TANK = Gram.Select("Type='" + type_id + "' and min<=" + (int)gram + " and max>" + (int)gram + "").First().Field<int>("TANK");
|
||||||
}
|
}
|
||||||
Datalog.AppendText("\n" + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") + $" 转换{Count}条");
|
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 + "-重染:"+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}条");
|
||||||
Count = 0;
|
Count = 0;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{//错误处理
|
{//错误处理
|
||||||
LogGing.ERRDATA(ex);
|
LogGing.ERRDATA(ex,"NULL");
|
||||||
Datalog.AppendText(ex.ToString());
|
Datalog.AppendText(ex.ToString());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
conn_SC.Close();
|
||||||
disTimer.Start();//计时开始
|
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>
|
<Deterministic>true</Deterministic>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -34,9 +35,17 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>sunlight_logo.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupObject>ProcessManageUI.App</StartupObject>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@@ -104,5 +113,8 @@
|
|||||||
<Version>1.0.119</Version>
|
<Version>1.0.119</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="sunlight_logo.ico" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Reference in new issue
Block a user