private void Save(string tableName) { if (BarCode == "") { return; } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckTestFile(BarCode), "AllTestValue.sdf", "", "")) { return; } string sqlstr = "Insert into {0} values('{1:yyyy-MM-dd HH:mm:ss}','{2}','{3}','{4}',{5},{6},'{7}',{8},'{9}'{10}{11})"; string d = ""; string b = ""; for (int i = 0; i < D.Length; i++) { d = string.Format("{0},{1:F3}", d, this.D[i]); } for (int i = 0; i < B.Length; i++) { b = string.Format("{0},'{1}'", b, B[i]); } sql.Write(string.Format(sqlstr, tableName, TestTime, BarCode, ID, Mode, TestNo, JiQi, IsPass, StepID, Step, d, b)); sql.Close(); }
public void Save() { if (BarCode == "") { return; } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckTestFile(BarCode), "AllTestValue.sdf", "", "")) { return; } string str = "insert into TestOil Values('{0:yyyy-MM-dd HH:mm:ss}','{1}','{2}','{3}','{4}','{5}',{6},{7:f3},{8:f3},'{9}',{10},'{11}',{12:f3},'{13}'{14}{15})"; string s = ""; string d = ""; for (int i = 0; i < DingLiang.Length; i++) { d = string.Format("{0},{1:F3}", d, DingLiang[i]); } for (int i = 0; i < ShiFa.Length; i++) { s = string.Format("{0},{1:F3}", s, ShiFa[i]); } str = string.Format(str, FaLiaoShiJian, FaPiaoHaoMa, BarCode, ShiBieMa, GuiJiHao, YouPin, ChengXuShu, DingLiangHeJi, ShiFaHeJi, GuoChengJieGuo, YiBiaoDiZhi, ZiDong, LiuLiangXiShu, LeiXingMiaoShu, d, s); sql.Write(str); sql.Close(); }
public void Save() { frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Write <ushort>(0, 3); string tmpBarCode = ""; string sheDingLiang = ""; string shiJiLiang = ""; string jieGuo = ""; string leiXing = ""; if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out tmpBarCode, 104)) { if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out tmpBarCode, 104)) { return; } } if (tmpBarCode == "") { return; } if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out sheDingLiang, 168)) { if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out sheDingLiang, 168)) { return; } } if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out shiJiLiang, 232)) { if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out shiJiLiang, 232)) { return; } } if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out jieGuo, 296)) { if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out jieGuo, 296)) { return; } } if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out leiXing, 360)) { if (!frmMain.mMain.AllMeterData.AllCommunite[32].Sons[0].Read <string>(out leiXing, 360)) { return; } } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckTestFile(tmpBarCode), "AllTestValue.sdf", "", "")) { return; } sql.Write(string.Format("insert into TestChongZhu Values('{0}','{1}','{2}','{3}')", sheDingLiang, shiJiLiang, jieGuo, leiXing)); sql.Close(); }
private void Save() { //记录状态为1时,记录数据,读到此状态后,将此状态复位 frmMain.mMain.AllMeterData.AllCommunite[31].Sons[0].Write <ushort>(0, 3); string tmpBarCode = ""; if (!frmMain.mMain.AllMeterData.AllCommunite[31].Sons[0].Read <string>(out tmpBarCode, 40)) { if (!frmMain.mMain.AllMeterData.AllCommunite[31].Sons[0].Read <string>(out tmpBarCode, 40)) { return; } } if (tmpBarCode == "") { return; } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckTestFile(tmpBarCode), "AllTestValue.sdf", "", "")) { return; } sql.Write(string.Format("insert into TestChongHaiHuiShou Values ('{0}','{1}',{2},{3:F10},{4:F10},{5:F10})", (GongWeiHao == 1 ? "A" : "B"), (JieGuo == 1), ChouKongShiJian, ChongDanYaLi, ChouKongYaLi, ChongHaiYaLi)); sql.Close(); }
/// <summary> /// 保存B路实时数据 /// </summary> private void SaveTmpB() { if (bBarCode == "") { if (!frmMain.mMain.AllMeterData.AllCommunite[31].Sons[0].Read <string>(out bBarCode, 40)) { if (!frmMain.mMain.AllMeterData.AllCommunite[31].Sons[0].Read <string>(out bBarCode, 40)) { return; } } if (bBarCode == "") { return; } } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckTestFile(bBarCode), "AllTestValue.sdf", "", "")) { return; } sql.Write(string.Format("insert into TestChongHaiB (Press) values ({0:F10})", BLuShiShiYaLi)); sql.Close(); }
public void Save() { if (BarCode == "") { return; } if (frmMain.mMain.FlushUserLogin.InfoLineStation.Count >= this.WorkStation) { this.UserName = frmMain.mMain.FlushUserLogin.InfoLineStation[this.WorkStation - 1].UserName; } All.Class.Sqlce sql = new All.Class.Sqlce(); switch (WorkStation) { case 11: if (!sql.Login(CheckTestResultFile.CheckLenNingFile(BarCode), "AllLenNingValue.sdf", "", "")) { return; } break; default: if (!sql.Login(CheckTestResultFile.CheckTestFile(BarCode), "AllTestValue.sdf", "", "")) { return; } break; } sql.Write(string.Format("insert into TestAnZhuang Values({0},'{1}','{2}','{3:yyyy-MM-dd HH:mm:ss}')", WorkStation, StationName, UserName, TestTime)); sql.Close(); }
/// <summary> /// 保存实时漏率 /// </summary> private void SaveTmp() { if (barCode == "") { if (!frmMain.mMain.AllMeterData.AllCommunite[30].Sons[0].Read <string>(out barCode, 40)) { if (!frmMain.mMain.AllMeterData.AllCommunite[30].Sons[0].Read <string>(out barCode, 40)) { return; } } if (barCode == "") { return; } } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckLenNingFile(barCode), "AllLenNingValue.sdf", "", "")) { return; } sql.Write(string.Format("insert into TestLouLv (LouLv) Values ({0:F10})", ShiShiLouLv)); sql.Close(); }
/// <summary> /// 保存检测结果 /// </summary> private void Save() { //记录状态为1时,记录数据,读到此状态后,将此状态复位 frmMain.mMain.AllMeterData.AllCommunite[30].Sons[0].Write <ushort>(0, 2); string tmpBarCode = ""; if (!frmMain.mMain.AllMeterData.AllCommunite[30].Sons[0].Read <string>(out tmpBarCode, 40)) { if (!frmMain.mMain.AllMeterData.AllCommunite[30].Sons[0].Read <string>(out tmpBarCode, 40)) { return; } } if (tmpBarCode == "") { return; } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckLenNingFile(tmpBarCode), "AllLenNingValue.sdf", "", "")) { return; } sql.Write(string.Format("insert into TestJianLou Values ('{0}',{1},{2},{3},{4},{5})", JieGuo, HaiJianShiJian, ZongJiePai, XuLieHao, ZhenKongDu, LouLv)); sql.Close(); }
public void Save() { if (BarCode == "") { return; } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckTestFile(BarCode), "AllTestValue.sdf", "", "")) { return; } sql.Write(string.Format("insert into TestAnGui Values('{0}',{1:F3},{2:F3},{3:F3},{4:F3},'{5}','{6}','{7}','{8}')", BarCode, d[0], d[1], d[2], d[3], b[0], b[1], b[2], b[3])); sql.Close(); }
/// <summary> /// 保存曲线 /// </summary> private void Save() { if (BarCode == "") { return; } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckTestFile(BarCode), "AllTestValue.sdf", "", "")) { return; } sql.Write(string.Format("insert into TestChouKong (Data1,Data2,Data3,Data4,Data5) values ({0},{1},{2},{3},{4})", Value[0], Value[1], Value[2], Value[3], Value[4])); sql.Close(); }
public void Save() { if (BarCode == "") { return; } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckTestFile(BarCode), "AllTestValue.sdf", "", "")) { return; } sql.Write(string.Format("insert into TestYaSuoJi values({0},'{1}','{2}','{3}')", this.Index, this.TestBar, this.Result, this.TestName)); sql.Close(); }
public void Save() { if (BarCode == "") { return; } All.Class.Sqlce sql = new All.Class.Sqlce(); if (!sql.Login(CheckTestResultFile.CheckTestFile(BarCode), "AllTestValue.sdf", "", "")) { return; } if (Repair) { sql.Write(string.Format("update StatueError Set Repair='true',RepairTime='{0:yyyy-MM-dd HH:mm:ss}' where Error='{1}'", DateTime.Now, Text)); } else { sql.Write(string.Format("delete from StatueError where Error='{0}'", Text)); sql.Write(string.Format("insert into StatueError Values({0},'{1}',{2},'{3:yyyy-MM-dd HH:mm:ss}','{4}','{5:yyyy-MM-dd HH:mm:ss}')", WorkStation, Text, ErrorNum, ErrorTime, Repair, RepairTime)); sql.Close(); } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt; Report.dsReport dsr; Microsoft.Reporting.WinForms.ReportDataSource rd; All.Class.Sqlce sql = new All.Class.Sqlce(); string direcotry = ""; string fileName = ""; switch (listBox1.Text) { case "氦检记录": case "漏率曲线": direcotry = HeiFeiMidea.CheckTestResultFile.CheckLenNingFile(lenNingCode); fileName = "AllLenNingValue.sdf"; //if (!System.IO.File.Exists(string.Format("{0}\\{1}",direcotry,fileName))) //{ // direcotry = string.Format("{0}\\Data\\TestData\\LenNingFile\\U880-22016102700{1:D2}\\", Application.StartupPath, (int)All.Class.Num.GetRandom(1, 40)); //} break; default: direcotry = HeiFeiMidea.CheckTestResultFile.CheckTestFile(barCode); fileName = "AllTestValue.sdf"; break; } if (!sql.Login(direcotry, fileName, "", "")) { All.Window.MetroMessageBox.Show(this, "打开对应数据库失败,当前未保存此项数据", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } switch (listBox1.Text) { case "安装记录": rptAnZhuang.Location = new Point(0, 0); rptAnZhuang.Size = panel1.Size; rptAnZhuang.BringToFront(); rptAnZhuang.Visible = true; dt = sql.Read("select * from TestAnZhuang"); dt.TableName = "dtAnZhuang"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtAnZhuang", dsr.Tables["dtAnZhuang"]); rptAnZhuang.LocalReport.DataSources.Clear(); rptAnZhuang.LocalReport.DataSources.Add(rd); rptAnZhuang.RefreshReport(); break; case "配件记录": rptPeiJian.Location = new Point(0, 0); rptPeiJian.Size = panel1.Size; rptPeiJian.BringToFront(); rptPeiJian.Visible = true; dt = sql.Read("select * from TestYaSuoJi"); dt.TableName = "dtPeiJian"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtPeiJian", dsr.Tables["dtPeiJian"]); rptPeiJian.LocalReport.DataSources.Clear(); rptPeiJian.LocalReport.DataSources.Add(rd); rptPeiJian.RefreshReport(); break; case "注油记录": rptOil.Location = new Point(0, 0); rptOil.Size = panel1.Size; rptOil.BringToFront(); rptOil.Visible = true; dt = sql.Read("select * from TestOil"); dt.TableName = "dtOil"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtOil", dsr.Tables["dtOil"]); rptOil.LocalReport.DataSources.Clear(); rptOil.LocalReport.DataSources.Add(rd); rptOil.RefreshReport(); break; case "检漏记录": rptChongHaiHuiShou.Location = new Point(0, 0); rptChongHaiHuiShou.Size = panel1.Size; rptChongHaiHuiShou.BringToFront(); rptChongHaiHuiShou.Visible = true; dt = sql.Read("select * from TestChongHaiHuiShou"); dt.TableName = "dtChongHaiHuiShou"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtChongHaiHuiShou", dsr.Tables["dtChongHaiHuiShou"]); rptChongHaiHuiShou.LocalReport.DataSources.Clear(); rptChongHaiHuiShou.LocalReport.DataSources.Add(rd); rptChongHaiHuiShou.RefreshReport(); break; case "检漏曲线A": rptChongHaiYaLiQuXian.Location = new Point(0, 0); rptChongHaiYaLiQuXian.Size = panel1.Size; rptChongHaiYaLiQuXian.BringToFront(); rptChongHaiYaLiQuXian.Visible = true; dt = sql.Read("select * from TestChongHaiA"); dt.TableName = "dtChongHaiHuiShouTmp"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtChongHaiHuiShouTmp", dsr.Tables["dtChongHaiHuiShouTmp"]); rptChongHaiYaLiQuXian.LocalReport.DataSources.Clear(); rptChongHaiYaLiQuXian.LocalReport.DataSources.Add(rd); rptChongHaiYaLiQuXian.RefreshReport(); break; case "检漏曲线B": rptChongHaiYaLiQuXian.Location = new Point(0, 0); rptChongHaiYaLiQuXian.Size = panel1.Size; rptChongHaiYaLiQuXian.BringToFront(); rptChongHaiYaLiQuXian.Visible = true; dt = sql.Read("select * from TestChongHaiB"); dt.TableName = "dtChongHaiHuiShouTmp"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtChongHaiHuiShouTmp", dsr.Tables["dtChongHaiHuiShouTmp"]); rptChongHaiYaLiQuXian.LocalReport.DataSources.Clear(); rptChongHaiYaLiQuXian.LocalReport.DataSources.Add(rd); rptChongHaiYaLiQuXian.RefreshReport(); break; case "充注记录": rptChongZhu.Location = new Point(0, 0); rptChongZhu.Size = panel1.Size; rptChongZhu.BringToFront(); rptChongZhu.Visible = true; dt = sql.Read("select * from TestChongZhu"); dt.TableName = "dtChongZhu"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtChongZhu", dsr.Tables["dtChongZhu"]); rptChongZhu.LocalReport.DataSources.Clear(); rptChongZhu.LocalReport.DataSources.Add(rd); rptChongZhu.RefreshReport(); break; case "抽空曲线": rptChouKongQuXIan.Location = new Point(0, 0); rptChouKongQuXIan.Size = panel1.Size; rptChouKongQuXIan.BringToFront(); rptChouKongQuXIan.Visible = true; dt = sql.Read("select Data1,Data2,Data3,Data4,Data5 from TestChouKong"); if (dt != null) { dt.Columns.Add("ID", typeof(int)); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["ID"] = i + 1; } } dt.TableName = "dtChouKongQuXian"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtChouKongQuXian", dsr.Tables["dtChouKongQuXian"]); rptChouKongQuXIan.LocalReport.DataSources.Clear(); rptChouKongQuXIan.LocalReport.DataSources.Add(rd); rptChouKongQuXIan.RefreshReport(); break; case "检测记录": rptJianCeData.Location = new Point(0, 0); rptJianCeData.Size = panel1.Size; rptJianCeData.BringToFront(); rptJianCeData.Visible = true; dt = sql.Read("select * from TestJianCe"); dt.TableName = "dtTestStep"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtTestStep", dsr.Tables["dtTestStep"]); rptJianCeData.LocalReport.DataSources.Clear(); rptJianCeData.LocalReport.DataSources.Add(rd); rptJianCeData.RefreshReport(); break; case "检测实时": rptJianCeData.Location = new Point(0, 0); rptJianCeData.Size = panel1.Size; rptJianCeData.BringToFront(); rptJianCeData.Visible = true; dt = sql.Read("select * from TestJianCeTmp"); dt.TableName = "dtTestStep"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtTestStep", dsr.Tables["dtTestStep"]); rptJianCeData.LocalReport.DataSources.Clear(); rptJianCeData.LocalReport.DataSources.Add(rd); rptJianCeData.RefreshReport(); break; case "检测曲线": rptXingNengQuXian.Location = new Point(0, 0); rptXingNengQuXian.Size = panel1.Size; rptXingNengQuXian.BringToFront(); rptXingNengQuXian.Visible = true; dt = sql.Read("select * from TestJianCeTmp"); dt.TableName = "dtTestStep"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtTestStep", dsr.Tables["dtTestStep"]); rptXingNengQuXian.LocalReport.DataSources.Clear(); rptXingNengQuXian.LocalReport.DataSources.Add(rd); rptXingNengQuXian.RefreshReport(); break; case "安检记录": rptAnGui.Location = new Point(0, 0); rptAnGui.Size = panel1.Size; rptAnGui.BringToFront(); rptAnGui.Visible = true; dt = sql.Read("select * from TestAnGui"); dt.TableName = "dtAnGui"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtAnGui", dsr.Tables["dtAnGui"]); rptAnGui.LocalReport.DataSources.Clear(); rptAnGui.LocalReport.DataSources.Add(rd); rptAnGui.RefreshReport(); break; case "影像记录": rptYinXiang.Location = new Point(0, 0); rptYinXiang.Size = panel1.Size; rptYinXiang.BringToFront(); rptYinXiang.Visible = true; System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(direcotry); allYinXiangFile.Clear(); foreach (System.IO.FileInfo fi in di.GetFiles()) { if (All.Control.PicturePlayer.FileFilter.ToUpper().IndexOf(fi.Extension.ToUpper()) >= 0) { allYinXiangFile.Add(fi.FullName); } } InitImage(); break; case "氦检记录": rptTestJianLou.Location = new Point(0, 0); rptTestJianLou.Size = panel1.Size; rptTestJianLou.BringToFront(); rptTestJianLou.Visible = true; dt = sql.Read("select * from TestJianLou"); dt.TableName = "dtTestJianLou"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtTestJianLou", dsr.Tables["dtTestJianLou"]); rptTestJianLou.LocalReport.DataSources.Clear(); rptTestJianLou.LocalReport.DataSources.Add(rd); rptTestJianLou.RefreshReport(); break; case "漏率曲线": rptLouLv.Location = new Point(0, 0); rptLouLv.Size = panel1.Size; rptLouLv.BringToFront(); rptLouLv.Visible = true; dt = sql.Read("select * from TestLouLv"); dt.TableName = "dtTestLouLv"; dsr = new Report.dsReport(); dsr.Load(dt.CreateDataReader(), LoadOption.Upsert, dt.TableName); rd = new Microsoft.Reporting.WinForms.ReportDataSource("dtTestLouLv", dsr.Tables["dtTestLouLv"]); rptLouLv.LocalReport.DataSources.Clear(); rptLouLv.LocalReport.DataSources.Add(rd); rptLouLv.RefreshReport(); break; } sql.Close(); }