1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using Aitex.Core.RT.DBCore;
- using CyberX8_Core;
- namespace MECF.Framework.Common.DBCore
- {
- public class LeakCheckDataRecorder
- {
- public static void Add(int leakCheckTime, double beginPressure, double endPressure, double leakRate, string status, string mode,string moduleName,string gaslines="")
- {
- string sql = string.Format(
- "INSERT INTO \"leak_check_data\"(\"guid\", \"operate_time\", \"status\" , \"leak_rate\", \"start_pressure\", \"stop_pressure\", \"mode\", \"leak_check_time\" , \"module_name\", \"gasline_selection\")VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}','{8}','{9}' );",
- Guid.NewGuid(),
- DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),
- status,
- leakRate,
- beginPressure,
- endPressure,
- mode,
- leakCheckTime,
- moduleName,
- gaslines);
-
- DB.Insert(sql);
- }
- public static List<PMLeakCheckResult> GetAllLeakCheckData(string moduleName)
- {
- List<PMLeakCheckResult> result = new List<PMLeakCheckResult>();
- string sql = $"SELECT * FROM \"leak_check_data\" where \"module_name\"='{moduleName}' order by operate_time desc LIMIT 15";
- DataSet ds = DB.ExecuteDataset(sql);
- if (ds == null)
- return result;
- if (ds.Tables.Count==0)
- return result;
- for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
- {
- PMLeakCheckResult checkresult = new PMLeakCheckResult();
- checkresult.CheckDate= ds.Tables[0].Rows[i]["operate_time"].ToString();
- checkresult.StartPressure =Convert.ToDouble( ds.Tables[0].Rows[i]["start_pressure"].ToString());
- checkresult.EndPressure = Convert.ToDouble(ds.Tables[0].Rows[i]["stop_pressure"].ToString());
- checkresult.LeakCheckTime = Convert.ToInt32(ds.Tables[0].Rows[i]["leak_check_time"].ToString());
- checkresult.LeakRate = Convert.ToDouble(ds.Tables[0].Rows[i]["leak_rate"].ToString());
- checkresult.CheckMode = ds.Tables[0].Rows[i]["mode"].ToString();
- checkresult.GasLines = ds.Tables[0].Rows[i]["gasline_selection"].ToString();
- checkresult.Result = ds.Tables[0].Rows[i]["status"].ToString();
- result.Add(checkresult);
- }
- ds.Clear();
- return result;
- }
- }
- }
|