sc 1 month ago
parent
commit
758be5db6e
  1. 29
      ProcessManageUI/MainWindow.xaml.cs

29
ProcessManageUI/MainWindow.xaml.cs

@ -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;
@ -83,6 +84,7 @@ namespace ProcessManageUI
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 +98,7 @@ namespace ProcessManageUI
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{ // 程序默认启动时隐藏窗体
Hide();
//Hide();
IP.Text = SQLIP;
MOD.Text = SQMOD;
@ -104,6 +106,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读取配置");
@ -154,6 +157,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)//删除指定信息行
@ -187,16 +191,29 @@ namespace ProcessManageUI
LogGing.ERRDATA(ex);
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");
string DyelotsBulkedRecipe_updata = "UPDATE [dbo].[DyelotsBulkedRecipe] SET Process ='"+NAME+
"' ,ProductClass='" +Class+ "',MixTankNo='"+ TANK +
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 + "步骤" + StepNumber + "流程:" + NAME+"机台:" + machine_T);
}
Datalog.AppendText("\n" + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") + $" 转换完成{Count}条");
Count = 0;

Loading…
Cancel
Save