ADD signalr + filtro SIM troppo verboso
This commit is contained in:
@@ -670,6 +670,48 @@ public static class ThreadsFunctions
|
||||
ncAdapter.Dispose();
|
||||
}
|
||||
}
|
||||
public static void ReadProdPanelData()
|
||||
{
|
||||
NcAdapter ncAdapter = new NcAdapter();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
|
||||
try
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncAdapter.Connect();
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
|
||||
while (true)
|
||||
{
|
||||
sw.Restart();
|
||||
|
||||
// Check if client is connected
|
||||
if (ncAdapter.numericalControl.NC_IsConnected())
|
||||
{
|
||||
// Get new data from PLC (and log if changed...)
|
||||
libraryError = ncAdapter.ReadProdPanel(out DTOThermoPanelProd currentProdPanel);
|
||||
if (libraryError.IsError())
|
||||
ManageLibraryError(libraryError);
|
||||
|
||||
MessageServices.Current.Publish(SEND_THERMO_PROD_PANEL_DATA, null, currentProdPanel);
|
||||
}
|
||||
else
|
||||
RestoreConnection();
|
||||
|
||||
sw.Stop();
|
||||
|
||||
//Update thread timer
|
||||
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
|
||||
// Wait 500 ms
|
||||
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
|
||||
}
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
ncAdapter.Dispose();
|
||||
}
|
||||
}
|
||||
public static void ReadProdInfoData()
|
||||
{
|
||||
NcAdapter ncAdapter = new NcAdapter();
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Thermo.Active.Core
|
||||
// ThreadsFunctions.ReadNcSoftKeysData,
|
||||
ThreadsFunctions.ReadGaugeData,
|
||||
ThreadsFunctions.ReadProdInfoData,
|
||||
ThreadsFunctions.ReadProdPanelData,
|
||||
ThreadsFunctions.ReadProdCycleData,
|
||||
ThreadsFunctions.ReadRecipeData,
|
||||
ThreadsFunctions.ReadWarmersData,
|
||||
@@ -47,13 +48,11 @@ namespace Thermo.Active.Core
|
||||
{
|
||||
ThreadsFunctions.RestoreConnection();
|
||||
|
||||
//Setup CMS Connect
|
||||
//if(Config.ServerConfig.CmsConnectConfig.Enabled)
|
||||
if (Config.ServerConfig.ServerStartupConfig.CmsConnectReady)
|
||||
{
|
||||
Thread t = new Thread(() => ThreadSetupCmsConnect());
|
||||
t.Start();
|
||||
Thread.Sleep(50);
|
||||
Thread.Sleep(30);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -318,6 +318,7 @@ namespace Thermo.Active.Model
|
||||
public const string SEND_THERMO_WARMERS_DATA = "SEND_THERMO_WARMERS_DATA";
|
||||
public const string SEND_THERMO_AREA_DATA = "SEND_THERMO_AREA_DATA";
|
||||
public const string SEND_THERMO_GAUGE_DATA = "SEND_THERMO_GAUGE_DATA";
|
||||
public const string SEND_THERMO_PROD_PANEL_DATA = "SEND_THERMO_PROD_PANEL_DATA";
|
||||
public const string SEND_THERMO_PROD_INFO_DATA = "SEND_THERMO_PROD_INFO_DATA";
|
||||
public const string SEND_THERMO_PROD_CYCLE_DATA = "SEND_THERMO_PROD_CYCLE_DATA";
|
||||
|
||||
|
||||
@@ -42,10 +42,11 @@ namespace Thermo.Active.Model.DTOModels.ThProd
|
||||
return false;
|
||||
if (LastTCiclo != item.LastTCiclo)
|
||||
return false;
|
||||
if (!Enumerable.SequenceEqual(TS_Cadenza,item.TS_Cadenza))
|
||||
return false;
|
||||
if (!Enumerable.SequenceEqual(TS_TCiclo, item.TS_TCiclo))
|
||||
return false;
|
||||
// FIXME TODO rimettere quando NON sim
|
||||
//if (!Enumerable.SequenceEqual(TS_Cadenza,item.TS_Cadenza))
|
||||
// return false;
|
||||
//if (!Enumerable.SequenceEqual(TS_TCiclo, item.TS_TCiclo))
|
||||
// return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1324,7 +1324,7 @@ namespace Thermo.Active.NC
|
||||
// calcolo primo/ultimo e divido...
|
||||
DateTime fine = prodInfoDataList[0].DtEvent;
|
||||
DateTime inizio = prodInfoDataList[prodInfoDataList.Count - 1].DtEvent;
|
||||
double TCMedio = fine.Subtract(inizio).TotalSeconds / prodInfoDataList.Count;
|
||||
double TCMedio = Math.Abs(fine.Subtract(inizio).TotalSeconds / prodInfoDataList.Count);
|
||||
// simulo
|
||||
var rand = new Random();
|
||||
List<int> numList = new List<int>();
|
||||
|
||||
@@ -116,6 +116,10 @@ namespace Thermo.Active.Listeners
|
||||
{
|
||||
SignalRListener.sendThermoGaugeData(a);
|
||||
}));
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_THERMO_PROD_PANEL_DATA, (a, b) =>
|
||||
{
|
||||
SignalRListener.SendThermoProdPanelData(a);
|
||||
}));
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_THERMO_PROD_INFO_DATA, (a, b) =>
|
||||
{
|
||||
SignalRListener.SendThermoProdInfoData(a);
|
||||
|
||||
@@ -416,6 +416,18 @@ namespace Thermo.Active.Listeners.SignalR
|
||||
context.Clients.Group("ncData").gaugeData(currLiveProd);
|
||||
}
|
||||
}
|
||||
public static void SendThermoProdPanelData(object prodPanelData)
|
||||
{
|
||||
DTOThermoPanelProd currProdPanel = prodPanelData as DTOThermoPanelProd;
|
||||
|
||||
if (!LastProdPanelData.Equals(currProdPanel))
|
||||
{
|
||||
LastProdPanelData = currProdPanel;
|
||||
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
context.Clients.Group("ncData").prodPanelData(currProdPanel);
|
||||
}
|
||||
}
|
||||
public static void SendThermoProdInfoData(object prodInfoData)
|
||||
{
|
||||
ProdInfoModel currProdInfo = prodInfoData as ProdInfoModel;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Thermo.Active.Listeners
|
||||
public static Dictionary<string, DTOThermoProd> LastLiveProdData = new Dictionary<string, DTOThermoProd>();
|
||||
public static ThermoModels.ProdCycleModel LastProdCycleData = new ThermoModels.ProdCycleModel();
|
||||
public static ThermoModels.ProdInfoModel LastProdInfoData = new ThermoModels.ProdInfoModel();
|
||||
|
||||
public static DTOThermoPanelProd LastProdPanelData = new DTOThermoPanelProd();
|
||||
|
||||
|
||||
public static bool LastIsNcConnected = false;
|
||||
|
||||
@@ -30,4 +30,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("0.9.32")]
|
||||
[assembly: AssemblyVersion("0.9.33")]
|
||||
Reference in New Issue
Block a user