|
|
@ -63,6 +63,9 @@ namespace formula_manage |
|
|
int ID_N = 1; |
|
|
int ID_N = 1; |
|
|
string DYELOT_; |
|
|
string DYELOT_; |
|
|
|
|
|
|
|
|
|
|
|
string Tlist_Weight; |
|
|
|
|
|
string Tlist_Proportion; |
|
|
|
|
|
|
|
|
public MainWindow() |
|
|
public MainWindow() |
|
|
{ |
|
|
{ |
|
|
DataContext = new MainWindowViewModel(); |
|
|
DataContext = new MainWindowViewModel(); |
|
|
@ -83,7 +86,7 @@ namespace formula_manage |
|
|
RRODUCTdataTable.Columns.Add("TARGET_WT", typeof(float)); |
|
|
RRODUCTdataTable.Columns.Add("TARGET_WT", typeof(float)); |
|
|
RRODUCTdataTable.Columns.Add("UNIT", typeof(string)); |
|
|
RRODUCTdataTable.Columns.Add("UNIT", typeof(string)); |
|
|
RRODUCTdataTable.Columns.Add("Process", typeof(string)); |
|
|
RRODUCTdataTable.Columns.Add("Process", typeof(string)); |
|
|
RRODUCTdataTable.Columns.Add("REMARK", typeof(string)); |
|
|
RRODUCTdataTable.Columns.Add("REMARK", typeof(string)); |
|
|
|
|
|
|
|
|
if (USER.Text == "ENGINEER") //工程师允许功能
|
|
|
if (USER.Text == "ENGINEER") //工程师允许功能
|
|
|
{ |
|
|
{ |
|
|
@ -135,9 +138,11 @@ namespace formula_manage |
|
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR; |
|
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
list_Weight.Text = Configini.IniReadvalue("SOFTWARE_SET", "T4"); //自定义
|
|
|
Tlist_Weight = Configini.IniReadvalue("SOFTWARE_SET", "T4"); //自定义
|
|
|
list_Proportion.Text = Configini.IniReadvalue("SOFTWARE_SET", "T5"); //自定义
|
|
|
Tlist_Proportion = Configini.IniReadvalue("SOFTWARE_SET", "T5"); //自定义
|
|
|
list_Total.Text = (double.Parse(list_Proportion.Text) * double.Parse(list_Weight.Text)).ToString(); |
|
|
list_Weight.Text = Tlist_Weight; |
|
|
|
|
|
list_Proportion.Text = Tlist_Proportion; |
|
|
|
|
|
list_Total.Text = (double.Parse(Tlist_Proportion) * double.Parse(Tlist_Weight)).ToString(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async void Permissions_() |
|
|
private async void Permissions_() |
|
|
@ -273,6 +278,27 @@ namespace formula_manage |
|
|
Number.Text = Prepose + time + str_Prepose; //生成料单号
|
|
|
Number.Text = Prepose + time + str_Prepose; //生成料单号
|
|
|
ReDye.Text = "0"; |
|
|
ReDye.Text = "0"; |
|
|
Configini.IniWritevalue("SOFTWARE_SET", " T6", time); //保存当前时
|
|
|
Configini.IniWritevalue("SOFTWARE_SET", " T6", time); //保存当前时
|
|
|
|
|
|
|
|
|
|
|
|
order.Text = ""; |
|
|
|
|
|
ReDye.Text += ""; |
|
|
|
|
|
Technology.Text = ""; |
|
|
|
|
|
Machine.Text = ""; |
|
|
|
|
|
Forms_.Text = ""; |
|
|
|
|
|
Procedures_N.Text = "1"; |
|
|
|
|
|
Procedures_P.Text = "1"; |
|
|
|
|
|
Workflow.Text = ""; |
|
|
|
|
|
|
|
|
|
|
|
list_Weight.Text = Tlist_Weight; |
|
|
|
|
|
list_Proportion.Text = Tlist_Proportion; |
|
|
|
|
|
list_Total.Text = (double.Parse(Tlist_Proportion) * double.Parse(Tlist_Weight)).ToString(); |
|
|
|
|
|
|
|
|
|
|
|
RRODUCTdataTable.Clear(); //清楚缓存表
|
|
|
|
|
|
DataRow row = RRODUCTdataTable.NewRow(); //ID列
|
|
|
|
|
|
row["ID"] = ID_N; |
|
|
|
|
|
row["STEP"] = Procedures_P.Text; |
|
|
|
|
|
row["UNIT"] = "g"; |
|
|
|
|
|
RRODUCTdataTable.Rows.Add(row); |
|
|
|
|
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
|
|
} |
|
|
} |
|
|
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
|
|
|
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
|
|
|
{ |
|
|
{ |
|
|
@ -475,7 +501,15 @@ namespace formula_manage |
|
|
RRODUCTdataTable.AcceptChanges(); |
|
|
RRODUCTdataTable.AcceptChanges(); |
|
|
|
|
|
|
|
|
SqlConnection destinationConnection = new SqlConnection(Connstr_SC); //创建一个数据库连接;
|
|
|
SqlConnection destinationConnection = new SqlConnection(Connstr_SC); //创建一个数据库连接;
|
|
|
destinationConnection.Open(); //打开连接
|
|
|
await destinationConnection.OpenAsync(); //打开连接
|
|
|
|
|
|
|
|
|
|
|
|
//写总览
|
|
|
|
|
|
string dyelots_sql = string.Format("INSERT INTO [dbo].[DYELOTS]([Dyelot] ,[ReDye] , [OrderNo] , [Program] ,[Machine] ,[DispenseMachine] ,[UserAccount] ,[SheetNo] ) " + |
|
|
|
|
|
"VALUES ('" + Number.Text + "','" + ReDye.Text + "','" + order.Text + "','" + Technology.Text + "','" + Machine.Text + "','" + Machine.Text + "','" + USER.Text + "','" + Forms_.Text + "')"); |
|
|
|
|
|
SqlCommand INSERT_cmd = new SqlCommand(dyelots_sql, destinationConnection); |
|
|
|
|
|
int dyelots_sqlIN = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
|
|
|
|
|
|
|
|
|
|
|
//写明细
|
|
|
SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection);// 实例化 sqlbulkcopy;
|
|
|
SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection);// 实例化 sqlbulkcopy;
|
|
|
bulkCopy.DestinationTableName = "dbo.DYELOTS_RECIPE";// 目标表名称/
|
|
|
bulkCopy.DestinationTableName = "dbo.DYELOTS_RECIPE";// 目标表名称/
|
|
|
bulkCopy.ColumnMappings.Add("DYELOT", "Dyelot"); |
|
|
bulkCopy.ColumnMappings.Add("DYELOT", "Dyelot"); |
|
|
@ -502,6 +536,8 @@ namespace formula_manage |
|
|
Procedures_N.Text = "1"; |
|
|
Procedures_N.Text = "1"; |
|
|
Procedures_P.Text = "1"; |
|
|
Procedures_P.Text = "1"; |
|
|
|
|
|
|
|
|
|
|
|
System.Windows.MessageBox.Show(Number.Text+"-"+ ReDye.Text + "已保存"); |
|
|
|
|
|
|
|
|
Number_Event(); |
|
|
Number_Event(); |
|
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); //记录当前单序号
|
|
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); //记录当前单序号
|
|
|
Configini.IniWritevalue("SOFTWARE_SET", " T3", str_Prepose); |
|
|
Configini.IniWritevalue("SOFTWARE_SET", " T3", str_Prepose); |
|
|
@ -693,10 +729,6 @@ namespace formula_manage |
|
|
Type_ = r[0].ItemArray[2].ToString(); |
|
|
Type_ = r[0].ItemArray[2].ToString(); |
|
|
Conc_ = r[0].ItemArray[3].ToString(); |
|
|
Conc_ = r[0].ItemArray[3].ToString(); |
|
|
Conc_ = (double.Parse(Conc_)/100).ToString(); |
|
|
Conc_ = (double.Parse(Conc_)/100).ToString(); |
|
|
// if (double.TryParse(list_Weight.Text, out ang))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// Weight_ = double.Parse(list_Weight.Text) * double.Parse(Conc_) / 100;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if ((Type_ == "0") || (Type_ == "3")) |
|
|
if ((Type_ == "0") || (Type_ == "3")) |
|
|
{ |
|
|
{ |
|
|
|