代码手动添加-2
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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))
|
||||||
{
|
{
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 892 B |
After Width: | Height: | Size: 418 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 792 B |
After Width: | Height: | Size: 840 B |
After Width: | Height: | Size: 401 B |