2023-04-13 11:51:03 +08:00
|
|
|
using System;
|
|
|
|
using System.Data;
|
|
|
|
using Aitex.Core.RT.DBCore;
|
2024-01-29 11:18:07 +08:00
|
|
|
using DocumentFormat.OpenXml.Office.Word;
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
namespace MECF.Framework.Common.DBCore
|
|
|
|
{
|
|
|
|
public class RuntimeDataRecorder
|
|
|
|
{
|
|
|
|
public static void UpdateElapseTimeSystem(int minutes)
|
|
|
|
{
|
2024-01-30 08:54:51 +08:00
|
|
|
string cmdText = $"Select \"guid\",\"elapse_minutes\" from \"runtime_data2\" where \"ispm\"='false';";
|
2023-06-27 15:46:42 +08:00
|
|
|
DataSet dataSet = DB.ExecuteDataSet(cmdText);
|
2023-04-13 11:51:03 +08:00
|
|
|
if (dataSet != null && dataSet.Tables != null && dataSet.Tables[0].Rows.Count > 0)
|
|
|
|
{
|
|
|
|
cmdText = "";
|
|
|
|
for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
|
|
|
|
{
|
|
|
|
long num = Convert.ToInt64(dataSet.Tables[0].Rows[i]["elapse_minutes"].ToString()) + minutes;
|
|
|
|
string arg = dataSet.Tables[0].Rows[i]["guid"].ToString();
|
2024-01-30 08:54:51 +08:00
|
|
|
cmdText += $"Update \"runtime_data2\" set \"elapse_minutes\"='{num}' where \"guid\"='{arg}';";
|
2023-04-13 11:51:03 +08:00
|
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(cmdText))
|
|
|
|
{
|
2023-06-27 15:46:42 +08:00
|
|
|
DB.InsertSql(cmdText);
|
2023-04-13 11:51:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-29 11:18:07 +08:00
|
|
|
public static void UpdateElapseTimePM(string pmName, int second)
|
2023-04-13 11:51:03 +08:00
|
|
|
{
|
2024-01-30 08:54:51 +08:00
|
|
|
string cmdText = $"Select \"Process_Seconds\" from \"runtime_data2\" where \"Module\"='{pmName}';";
|
2023-06-27 15:46:42 +08:00
|
|
|
DataSet dataSet = DB.ExecuteDataSet(cmdText);
|
2024-01-29 11:18:07 +08:00
|
|
|
if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count == 1 && dataSet.Tables[0].Rows.Count == 1)
|
2023-04-13 11:51:03 +08:00
|
|
|
{
|
2024-01-29 11:18:07 +08:00
|
|
|
long num = Convert.ToInt64(dataSet.Tables[0].Rows[0]["Process_Seconds"].ToString()) + second;
|
2024-01-30 08:54:51 +08:00
|
|
|
cmdText = $"Update \"runtime_data2\" set \"Process_Seconds\"='{num}' where \"Module\"='{pmName}';";
|
2024-01-29 11:18:07 +08:00
|
|
|
DB.ExecuteNonQuery(cmdText);
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
else
|
|
|
|
{
|
2024-01-30 08:54:51 +08:00
|
|
|
cmdText = $"INSERT INTO \"runtime_data2\" ( \"Module\", \"Process_Seconds\")VALUES ('{pmName}',{second});";
|
2024-01-29 11:18:07 +08:00
|
|
|
DB.ExecuteNonQuery(cmdText);
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
}
|
2024-01-29 11:18:07 +08:00
|
|
|
|
|
|
|
public static void ResetElapseTimePM(string pmName)
|
|
|
|
{
|
2024-01-30 08:54:51 +08:00
|
|
|
string cmdText = $"Update \"runtime_data2\" set \"Process_Seconds\"='{0}' where \"Module\"='{pmName}';";
|
2024-01-29 11:18:07 +08:00
|
|
|
DB.ExecuteNonQuery(cmdText);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
}
|