Compare commits
8
Commits
759f4506f1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70bc68b372 | ||
|
|
0f342b087e | ||
|
|
ee52b719e4 | ||
|
|
d49b0afb9d | ||
|
|
a70454b971 | ||
|
|
ec76dc6ae4 | ||
|
|
8eb970e3df | ||
|
|
758be5db6e |
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());
|
||||
|
||||
@@ -11,6 +11,7 @@ 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;
|
||||
@@ -80,9 +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
|
||||
@@ -96,7 +99,7 @@ namespace ProcessManageUI
|
||||
}
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{ // 程序默认启动时隐藏窗体
|
||||
Hide();
|
||||
//Hide();
|
||||
|
||||
IP.Text = SQLIP;
|
||||
MOD.Text = SQMOD;
|
||||
@@ -104,6 +107,7 @@ namespace ProcessManageUI
|
||||
USER.Text = SQLUSER;
|
||||
PAW.Text = SQLPASWORD;
|
||||
TIMEMS.Text = _intervalMs.ToString();
|
||||
dbr_machine = int.Parse(Configini.IniReadvalue("SQL_SERVER", "SQLM"));
|
||||
|
||||
Datalog.Text = "启动";
|
||||
Datalog.AppendText("\n读取配置");
|
||||
@@ -126,7 +130,8 @@ namespace ProcessManageUI
|
||||
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 AND StepNumber IS NOT NULL AND ProductCode IS NOT NULL AND ReDye IS NOT NULL";
|
||||
" ' 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";
|
||||
@@ -154,6 +159,7 @@ namespace ProcessManageUI
|
||||
int StepNumber = DyelotsBulkedRecipe.Rows[0].Field<int>("StepNumber");
|
||||
double gram = 0;
|
||||
int type_id = 0;
|
||||
string machine_T = "";
|
||||
DataRow[] rowdat = DyelotsBulkedRecipe.Select("Dyelot ='" + Dyelot + "' AND ReDye='"+ ReDye+ "' AND StepNumber ='"+ StepNumber+"'");//行
|
||||
|
||||
foreach (DataRow row in rowdat)//删除指定信息行
|
||||
@@ -165,17 +171,19 @@ namespace ProcessManageUI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
Datalog.AppendText(ex.ToString());
|
||||
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");
|
||||
@@ -184,26 +192,41 @@ namespace ProcessManageUI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
LogGing.ERRDATA(ex, Dyelot);
|
||||
Datalog.AppendText(ex.ToString());
|
||||
}
|
||||
|
||||
string DyelotsBulkedRecipe_updata = "UPDATE [dbo].[DyelotsBulkedRecipe] SET Process ='"+NAME+
|
||||
"' ,ProductClass='" +Class+ "',MixTankNo='"+ TANK +
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
LogGing.LogGingDATA( "转换工单:" + Dyelot + "重染" + ReDye + "步骤" + StepNumber + "流程:" + NAME);
|
||||
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;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{//错误处理
|
||||
LogGing.ERRDATA(ex);
|
||||
LogGing.ERRDATA(ex,"NULL");
|
||||
Datalog.AppendText(ex.ToString());
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in new issue
Block a user