* Added machine model, and new database relations

* Added first centralized database config and  added machine self-registration into db
* Fix database migration with new database
* Refactor
This commit is contained in:
Lucio Maranta
2018-01-17 10:24:18 +01:00
parent b26ec6cc43
commit fa485d902b
32 changed files with 457 additions and 141 deletions
+24 -34
View File
@@ -10,7 +10,7 @@ using CMS_CORE.Fanuc;
using CMS_CORE.Osai;
using CMS_CORE.Siemens;
using Step.NC;
using static Step.Config.StartupConfig;
using static Step.Config.ServerConfig;
using static Step.Utils.Constants;
using TeamDev.SDK.MVVM;
using System.Diagnostics;
@@ -23,7 +23,8 @@ namespace Step.Core
{
ThreadsFunctions.Read_Alarms,
ThreadsFunctions.Read_Nc_Generic_Info,
ThreadsFunctions.Read_Axes
ThreadsFunctions.Read_Axes,
ThreadsFunctions.StatThread
};
private static List<Thread> RunningThreadsList = new List<Thread>();
internal static Dictionary<String, String> RunningThreadStatus = new Dictionary<String, String>();
@@ -36,51 +37,40 @@ namespace Step.Core
public static void StartWorkers()
{
lock (RunningThreadsList)
RunningThreadStatus.Clear();
// For each function run in the list a thread
ThreadFunctionsList.ForEach(threadFunction =>
{
RunningThreadStatus.Clear();
// Run new Thread in the list
Thread t = new Thread(() =>
threadFunction()
);
t.Start();
// Add thread to running threads list
RunningThreadsList.Add(t);
// For each function run in the list a thread
ThreadFunctionsList.ForEach(threadFunction =>
{
// Run new Thread in the list
Thread t = new Thread(() =>
threadFunction()
);
t.Start();
// Add thread to running threads list
RunningThreadsList.Add(t);
RunningThreadStatus.Add(threadFunction.Method.Name, "---");
});
MessageServices.Current.Publish(MVVM_NC_THREADS, null, RunningThreadStatus);
StatThread = new Thread(() => ThreadsFunctions.StatThread());
StatThread.Start();
}
RunningThreadStatus.Add(threadFunction.Method.Name, "---");
});
MessageServices.Current.Publish(MVVM_NC_THREADS, null, RunningThreadStatus);
}
public static void Stop()
{
{
// Stop each thread
RunningThreadsList.ForEach(thread =>
{
thread.Abort();
});
if(StatThread != null)
StatThread.Abort();
// No running status
// Remove threads from running status
RunningThreadsList.Clear();
lock (RunningThreadsList)
{
RunningThreadStatus.Clear();
RunningThreadStatus.Add("TryNcConnection", "---");
MessageServices.Current.Publish(MVVM_NC_THREADS, null, RunningThreadStatus);
}
RunningThreadStatus.Clear();
RunningThreadStatus.Add("TryNcConnection", "---");
MessageServices.Current.Publish(MVVM_NC_THREADS, null, RunningThreadStatus);
}
}
}