代码手动添加-2

This commit is contained in:
SIC1016\caipeilun 2024-01-29 11:18:07 +08:00
parent 229da8a188
commit 0d9d9d5779
13 changed files with 55 additions and 27 deletions

View File

@ -53,7 +53,15 @@ namespace Aitex.Core.RT.DataCenter
} }
} }
public static object Poll(string paramName) public static void CancelSubscribe(string moduleKey)
{
if (InnerDataManager != null)
{
InnerDataManager.CancelSubscribe(moduleKey);
}
}
public static object Poll(string paramName)
{ {
return (InnerDataManager == null) ? null : InnerDataManager.Poll(paramName); return (InnerDataManager == null) ? null : InnerDataManager.Poll(paramName);
} }

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using Aitex.Core.RT.ConfigCenter; using Aitex.Core.RT.ConfigCenter;
using Aitex.Core.RT.DBCore; using Aitex.Core.RT.DBCore;
using Aitex.Core.RT.Log; using Aitex.Core.RT.Log;
@ -193,7 +194,24 @@ namespace Aitex.Core.RT.DataCenter
} }
} }
public void Subscribe(string key, DataItem<object> dataItem, SubscriptionAttribute.FLAG flag) public void CancelSubscribe(string key)
{
if (_keyValueMap.ContainsKey(key))
{
var value = new DataItem<object>(() => "");
_keyValueMap.TryRemove(key, out value);
}
if (_dbRecorderList.ContainsKey(key))
{
lock (_locker)
{
_dbRecorderList.Remove(key);
}
}
}
public void Subscribe(string key, DataItem<object> dataItem, SubscriptionAttribute.FLAG flag)
{ {
if (string.IsNullOrWhiteSpace(key)) if (string.IsNullOrWhiteSpace(key))
{ {

View File

@ -12,7 +12,9 @@ namespace Aitex.Core.RT.DataCenter
void Subscribe(string moduleKey, DataItem<object> dataItem, SubscriptionAttribute.FLAG flag); void Subscribe(string moduleKey, DataItem<object> dataItem, SubscriptionAttribute.FLAG flag);
object Poll(string key); void CancelSubscribe(string moduleKey);
object Poll(string key);
Dictionary<string, object> PollData(IEnumerable<string> keys); Dictionary<string, object> PollData(IEnumerable<string> keys);

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Data; using System.Data;
using Aitex.Core.RT.DBCore; using Aitex.Core.RT.DBCore;
using DocumentFormat.OpenXml.Office.Word;
namespace MECF.Framework.Common.DBCore namespace MECF.Framework.Common.DBCore
{ {
@ -26,29 +27,28 @@ namespace MECF.Framework.Common.DBCore
} }
} }
public static void UpdateElapseTimePM(string pmName, int minutes) public static void UpdateElapseTimePM(string pmName, int second)
{ {
string cmdText = $"Select \"guid\",\"elapse_minutes\" from \"runtime_data\" where \"ispm\"='true' and \"device_name\"='{pmName}';"; string cmdText = $"Select \"Process_Seconds\" from \"runtime_data\" where \"Module\"='{pmName}';";
DataSet dataSet = DB.ExecuteDataSet(cmdText); DataSet dataSet = DB.ExecuteDataSet(cmdText);
if (dataSet != null && dataSet.Tables != null && dataSet.Tables[0].Rows.Count > 0) if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count == 1 && dataSet.Tables[0].Rows.Count == 1)
{ {
cmdText = ""; long num = Convert.ToInt64(dataSet.Tables[0].Rows[0]["Process_Seconds"].ToString()) + second;
for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++) cmdText = $"Update \"runtime_data\" set \"Process_Seconds\"='{num}' where \"Module\"='{pmName}';";
{ DB.ExecuteNonQuery(cmdText);
long num = Convert.ToInt64(dataSet.Tables[0].Rows[i]["elapse_minutes"].ToString()) + minutes; }
string arg = dataSet.Tables[0].Rows[i]["guid"].ToString();
cmdText += $"Update \"runtime_data\" set \"elapse_minutes\"='{num}' where \"guid\"='{arg}';";
}
if (!string.IsNullOrEmpty(cmdText))
{
DB.InsertSql(cmdText);
}
}
else else
{ {
cmdText = $"INSERT INTO \"runtime_data\" (\"guid\", \"device_name\", \"set_minutes\" , \"elapse_minutes\", \"ispm\" )VALUES ('{Guid.NewGuid()}', '{pmName}', {0}, {minutes}, 'true');"; cmdText = $"INSERT INTO \"runtime_data\" ( \"Module\", \"Process_Seconds\")VALUES ('{pmName}',{second});";
DB.InsertSql(cmdText); DB.ExecuteNonQuery(cmdText);
} }
} }
}
public static void ResetElapseTimePM(string pmName)
{
string cmdText = $"Update \"runtime_data\" set \"Process_Seconds\"='{0}' where \"Module\"='{pmName}';";
DB.ExecuteNonQuery(cmdText);
}
}
} }

View File

@ -11,11 +11,11 @@ namespace MECF.Framework.Common.DBCore
DB.InsertSql(sql); DB.InsertSql(sql);
} }
public static void InsertPMThinkness(string pmName, int coating1, int max1, int coating2, int max2) public static void InsertPMThinkness(string startdate, string pmName, double thickness)
{ {
string text = Guid.NewGuid().ToString(); string sql = $"INSERT INTO \"pm_thickness_data\"(\"startdate\", \"pm_name\", \"thickness\") VALUES ('{startdate}', '{pmName}', '{thickness}');";
string sql = $"INSERT INTO \"pm_thickness_data\"(\"guid\", \"pm_name\", \"coating1\", \"max1\", \"coating2\", \"max2\") VALUES ('{text}', '{pmName}', '{coating1}', '{max1}', '{coating2}', '{max2}');"; DB.ExecuteNonQuery(sql);
DB.InsertSql(sql);
} }
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 840 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B