static void Main() { //AllocConsole();//调用系统API,调用控制台窗口 try { ManagerProgram mp = new ManagerProgram(); mp.InitialMTmanager(); } catch (Exception ex) { MessageBox.Show("ManagerProgram exception error:" + ex.Message); } XMLGetModel.XMLRead(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new LoginForm()); //FreeConsole();//释放控制台 }
private void ManulImport_MainBom() { try { XMLGetModel.XMLRead(); string category_Str = ""; string category_chn = ""; StringBuilder strconn = DgdDealHelper.GetCombineInfo(Constant.Maingage_dt.Copy()); for (int m = 0; m < 2; m++) { if (m == 0) { category_Str = "AnalogLC"; category_chn = "模拟传感器"; } else { category_Str = "DigitalLC"; category_chn = "数字传感器"; } DataTable model_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct GENERIC_MODEL from MT_CZ_ASSORTMENTTYPE where CATEGORY='{0}' and ME is not null", category_Str), null); for (int k = 0; k < model_dt.Rows.Count; k++) { DataTable Assmely_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct GENERIC_ASSEMBLY from MT_CZ_ASSORTMENTTYPE where GENERIC_MODEL='{0}' and GENERIC_ASSEMBLY is not null and ME is not null", model_dt.Rows[k][0]), null); for (int i = 0; i < Assmely_dt.Rows.Count; i++) { DataTable bom_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct ME from MT_CZ_ASSORTMENTTYPE where GENERIC_ASSEMBLY='{0}' and ME is not null", Assmely_dt.Rows[i][0]), null); for (int j = 0; j < bom_dt.Rows.Count; j++) { sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (lcbom_meaid,lcbom,lcassembly,lcproductclass,lcproductmodel,lcbominfo,lcbominfo_test,modifieddate)values('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", Constant.MainBom_sqlname, Guid.NewGuid(), bom_dt.Rows[j][0], Assmely_dt.Rows[i][0], category_chn, model_dt.Rows[k][0], strconn, strconn, DateTime.Now), null); } } } } MessageBox.Show("done"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ManulImport_sgseries() { try { XMLGetModel.XMLRead(); StringBuilder strconn = DgdDealHelper.GetCombineInfo(Constant.Sgseries_dt.Copy()); DataTable gage_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct gagebom from {0} where isactive='1'", "MT_CZ_PRODUCTION_GAGE"), null); for (int i = 0; i < gage_dt.Rows.Count; i++) { sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (sgseriesbom,sgseriesinfo,sgseriesinfo_test,modifiedby,modifieddate)values('{1}','{2}','{3}','{4}','{5}')", Constant.SGseries_sqlname, gage_dt.Rows[i][0], strconn, strconn, "HT", DateTime.Now), null); } MessageBox.Show("done1"); //this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }