diff --git a/Step.Config/Config/serverConfig.xml b/Step.Config/Config/serverConfig.xml
index b238e18f..f10fac8b 100644
--- a/Step.Config/Config/serverConfig.xml
+++ b/Step.Config/Config/serverConfig.xml
@@ -9,6 +9,7 @@
C:\PartPrg\
//PARTPRG:/
01/01/2019
+ false
true
diff --git a/Step.Config/Config/serverConfigValidator.xsd b/Step.Config/Config/serverConfigValidator.xsd
index 1c7f2eb9..bb2e14ef 100644
--- a/Step.Config/Config/serverConfigValidator.xsd
+++ b/Step.Config/Config/serverConfigValidator.xsd
@@ -14,6 +14,7 @@
+
diff --git a/Step.Config/ServerConfigController.cs b/Step.Config/ServerConfigController.cs
index aaf7447c..ec9ed26f 100644
--- a/Step.Config/ServerConfigController.cs
+++ b/Step.Config/ServerConfigController.cs
@@ -280,7 +280,8 @@ namespace Step.Config
NcName = x.Element("machineModel").Value,
SharedPath = x.Element("sharedPath").Value,
SharedName = x.Element("sharedName").Value,
- InstallationDate = x.Element("installationDate").Value
+ InstallationDate = x.Element("installationDate").Value,
+ MgiOption = Convert.ToBoolean(x.Element("mgiOption").Value)
}).FirstOrDefault();
// Read Prod Software Config with LINQ
diff --git a/Step.Database/DatabaseContext.cs b/Step.Database/DatabaseContext.cs
index 8e445abf..cab4693f 100644
--- a/Step.Database/DatabaseContext.cs
+++ b/Step.Database/DatabaseContext.cs
@@ -9,6 +9,7 @@ using System.Data.Entity.Migrations;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.ServiceProcess;
using static Step.Config.ServerConfig;
using static Step.Model.Constants;
using static Step.Utils.ExceptionManager;
@@ -58,16 +59,23 @@ namespace Step.Database
return new DatabaseContext();
}
- public static void SetUpDbConnectionAndDbConfig()
+ public static bool SetUpDbConnectionAndDbConfig()
{
try
{
System.Data.Entity.Database.SetInitializer(null);
- // Make sure database exists.
- using (var db = new DatabaseContext())
+ ServiceController service = new ServiceController("MySQL");
+ try
{
- db.Database.Initialize(false);
+ TimeSpan timeout = TimeSpan.FromSeconds(2);
+
+ service.WaitForStatus(ServiceControllerStatus.Running, timeout);
+ }
+ catch
+ {
+ Manage(ERROR_LEVEL.FATAL, "Database not started");
+ return false;
}
var migrator = new DbMigrator(new Configuration());
@@ -98,16 +106,10 @@ namespace Step.Database
catch (Exception ex)
{
Manage(ERROR_LEVEL.FATAL, ex);
+ return false;
}
-
- //catch (MySql.Data.MySqlClient.MySqlException ex)
- //{
- // if (ex.Number == 1042) // Can't find MySQLServer
- // Manage(ERROR_LEVEL.FATAL, ex);
- // else
- // Manage(ERROR_LEVEL.ERROR, ex);
- //}
+ return true;
}
public static void FindOrCreateMachineUniqueId()
@@ -163,7 +165,7 @@ namespace Step.Database
// Create default CUSTOMER user
usersController.CreateCmsDefaultUserIfNotExists(MachineConfig.MachineId, "admin", "admin", "customer", "admin", Config.ServerConfig.ServerStartupConfig.Language, ROLE_IDS.CUSTOMER_ADMIN);
usersController.CreateCmsDefaultUserIfNotExists(MachineConfig.MachineId, "operator", "operator", "customer", "operator", Config.ServerConfig.ServerStartupConfig.Language, ROLE_IDS.CUSTOMER_OPERATOR);
- usersController.CreateCmsDefaultUserIfNotExists(MachineConfig.MachineId, "mantainer", "mantainer", "customer", "mantainer", Config.ServerConfig.ServerStartupConfig.Language, ROLE_IDS.CUSTOMER_MANTAINER);
+ usersController.CreateCmsDefaultUserIfNotExists(MachineConfig.MachineId, "maintainer", "maintainer", "customer", "maintainer", Config.ServerConfig.ServerStartupConfig.Language, ROLE_IDS.CUSTOMER_MAINTAINER);
}
}
else
diff --git a/Step.Database/Migrations/Configuration.cs b/Step.Database/Migrations/Configuration.cs
index 0d69855b..72952d08 100644
--- a/Step.Database/Migrations/Configuration.cs
+++ b/Step.Database/Migrations/Configuration.cs
@@ -24,7 +24,7 @@ namespace Step.Database.Migrations
new RoleModel() { RoleId = (int)ROLE_IDS.CUSTOMER_ADMIN, Level = 30, Name = "Admin" },
new RoleModel() { RoleId = (int)ROLE_IDS.CUSTOMER_OPERATOR, Level = 20, Name = "Operator" },
- new RoleModel() { RoleId = (int)ROLE_IDS.CUSTOMER_MANTAINER, Level = 10, Name = "Mantainer" }
+ new RoleModel() { RoleId = (int)ROLE_IDS.CUSTOMER_MAINTAINER, Level = 10, Name = "Maintainer" }
);
context.FunctionsAccess.AddOrUpdate(
diff --git a/Step.Database/Step.Database.csproj b/Step.Database/Step.Database.csproj
index 29abce1d..d7aed763 100644
--- a/Step.Database/Step.Database.csproj
+++ b/Step.Database/Step.Database.csproj
@@ -91,6 +91,7 @@
+
..\packages\System.Threading.Channels.4.5.0\lib\netstandard2.0\System.Threading.Channels.dll
diff --git a/Step.Model/ConfigModels/NcConfigModel.cs b/Step.Model/ConfigModels/NcConfigModel.cs
index 9b1692ad..0c607c37 100644
--- a/Step.Model/ConfigModels/NcConfigModel.cs
+++ b/Step.Model/ConfigModels/NcConfigModel.cs
@@ -17,5 +17,6 @@ namespace Step.Model.ConfigModels
public string SharedPath { get; set; }
public string SharedName { get; set; }
public string InstallationDate { get; set; }
+ public bool MgiOption { get; set; }
}
}
diff --git a/Step.Model/Constants.cs b/Step.Model/Constants.cs
index 8115092a..89db1c60 100644
--- a/Step.Model/Constants.cs
+++ b/Step.Model/Constants.cs
@@ -26,7 +26,7 @@ namespace Step.Model
CMS_UT = 2,
CUSTOMER_ADMIN = 3,
CUSTOMER_OPERATOR = 4,
- CUSTOMER_MANTAINER = 5
+ CUSTOMER_MAINTAINER = 5
}
public enum ACTIONS
diff --git a/Step.Model/DTOModels/DTOClientConfigurationModel.cs b/Step.Model/DTOModels/DTOClientConfigurationModel.cs
index 1e8414ae..ec11a196 100644
--- a/Step.Model/DTOModels/DTOClientConfigurationModel.cs
+++ b/Step.Model/DTOModels/DTOClientConfigurationModel.cs
@@ -14,6 +14,7 @@ namespace Step.Model.DTOModels
public bool ProdEnabled { get; set; }
public string ProdPath { get; set; }
public bool Autorun { get; set; }
+ public bool MgiOption { get; set; }
public List ExtSoftwares { get; set; }
public CultureInfo DefaultLanguage
diff --git a/Step/Controllers/WebApi/ConfigurationController.cs b/Step/Controllers/WebApi/ConfigurationController.cs
index db1bb513..84644f68 100644
--- a/Step/Controllers/WebApi/ConfigurationController.cs
+++ b/Step/Controllers/WebApi/ConfigurationController.cs
@@ -45,7 +45,8 @@ namespace Step.Controllers.WebApi
ProdEnabled = SoftwareProdConfig.Enabled,
ProdPath = SoftwareProdConfig.Path,
ExtSoftwares = ExtSoftwaresConfig,
- Autorun = ServerStartupConfig.AutoOpenCmsClient
+ Autorun = ServerStartupConfig.AutoOpenCmsClient,
+ MgiOption = NcConfig.MgiOption
};
return Ok(clientConfiguration);
@@ -109,7 +110,7 @@ namespace Step.Controllers.WebApi
if (configuredAlarm == null)
restoreIsEnabled = false;
else
- restoreIsEnabled = configuredAlarm.RestoreIsActive;
+ restoreIsEnabled = configuredAlarm.RestoreIsActive;
alarmsConfig.Add(new DTOAlarmConfigModel
{
diff --git a/Step/program.cs b/Step/program.cs
index ed0b01ec..4daf1c0c 100644
--- a/Step/program.cs
+++ b/Step/program.cs
@@ -46,8 +46,7 @@ namespace Step
// Start WinForm
ServerControlWindow.Start();
-
- DatabaseContext.SetUpDbConnectionAndDbConfig();
+ bool databaseStatus = DatabaseContext.SetUpDbConnectionAndDbConfig();
// Register listener to "close application" messages
MessageServices.Current.Subscribe(SEND_STOP_SERVER, (a, b) =>
@@ -81,13 +80,15 @@ namespace Step
opt.Urls.Add("http://" + ServerStartupConfig.ServerAddress.ToString() + ":" + ServerStartupConfig.ServerPort.ToString());
using (WebApp.Start(opt))
- {
- // Start Threads
- ThreadsHandler.Start();
- // Start listeners
- ListenersHandler.Start();
-
-
+ {
+ if (databaseStatus)
+ {
+ // Start Threads
+ ThreadsHandler.Start();
+ // Start listeners
+ ListenersHandler.Start();
+ }
+
// Wait interrupt from client
StopRequest.WaitOne();
diff --git a/Step/wwwroot/src/app.business-logic.ts b/Step/wwwroot/src/app.business-logic.ts
index 04aaffc6..8088406d 100644
--- a/Step/wwwroot/src/app.business-logic.ts
+++ b/Step/wwwroot/src/app.business-logic.ts
@@ -86,9 +86,9 @@ async function loadMachineConfig() {
// set vendor type
switch (vendor) {
- case "siemens": machineInfoActions.updateMachineInfo(store, { isSiemens: true, isFanuc: false, isOsai: false, defaultLanguage: mcresult.defaultLanguage, isSCMVisualStyle: isSCM }); break;
- case "fanuc": machineInfoActions.updateMachineInfo(store, { isSiemens: false, isFanuc: true, isOsai: false, defaultLanguage: mcresult.defaultLanguage, isSCMVisualStyle: isSCM }); break;
- case "osai": machineInfoActions.updateMachineInfo(store, { isSiemens: false, isFanuc: false, isOsai: true, defaultLanguage: mcresult.defaultLanguage, isSCMVisualStyle: isSCM }); break;
+ case "siemens": machineInfoActions.updateMachineInfo(store, { isSiemens: true, isFanuc: false, isOsai: false, defaultLanguage: mcresult.defaultLanguage, isSCMVisualStyle: isSCM, mgiOption : false }); break;
+ case "fanuc": machineInfoActions.updateMachineInfo(store, { isSiemens: false, isFanuc: true, isOsai: false, defaultLanguage: mcresult.defaultLanguage, isSCMVisualStyle: isSCM, mgiOption: mcresult.mgiOption }); break;
+ case "osai": machineInfoActions.updateMachineInfo(store, { isSiemens: false, isFanuc: false, isOsai: true, defaultLanguage: mcresult.defaultLanguage, isSCMVisualStyle: isSCM, mgiOption: false }); break;
default: machineInfoActions.updateMachineInfo(store, { isSiemens: false, isFanuc: false, isOsai: false, defaultLanguage: mcresult.defaultLanguage, isSCMVisualStyle: isSCM }); break;
}
diff --git a/Step/wwwroot/src/app_modules/under-the-hood/components/nc-hmi-menu.vue b/Step/wwwroot/src/app_modules/under-the-hood/components/nc-hmi-menu.vue
index 62c14ea4..4d81ebb8 100644
--- a/Step/wwwroot/src/app_modules/under-the-hood/components/nc-hmi-menu.vue
+++ b/Step/wwwroot/src/app_modules/under-the-hood/components/nc-hmi-menu.vue
@@ -35,11 +35,16 @@ export default {
await awaiter(new DataService().setActiveScreenOnHMI(id));
},
getNumofCommands: function(){
+ debugger
//get Number of Commands
if (this.$store.state.machineInfo.isSiemens)
return 6;
- else if (this.$store.state.machineInfo.isFanuc)
- return 5;
+ else if (this.$store.state.machineInfo.isFanuc) {
+ if(this.$store.state.machineInfo.mgiOption)
+ return 6;
+ else
+ return 5;
+ }
return 0;
},
getNcName: function(){
diff --git a/Step/wwwroot/src/services/machineService.ts b/Step/wwwroot/src/services/machineService.ts
index a5b286bc..c8798d53 100644
--- a/Step/wwwroot/src/services/machineService.ts
+++ b/Step/wwwroot/src/services/machineService.ts
@@ -46,16 +46,13 @@ export class machineService extends baseRestService {
}
return null;
}
-
-
-
-
}
export interface ClientConfigurationModel {
ncVendor: string,
showHMI: boolean,
- defaultLanguage: string
+ defaultLanguage: string,
+ mgiOption: boolean
}
export interface ContactConfigurationModel {
diff --git a/Step/wwwroot/src/store/machineInfo.store.ts b/Step/wwwroot/src/store/machineInfo.store.ts
index 6b0b6949..4362fbd9 100644
--- a/Step/wwwroot/src/store/machineInfo.store.ts
+++ b/Step/wwwroot/src/store/machineInfo.store.ts
@@ -20,6 +20,7 @@ export interface MachineInfoModel {
isSiemens?: boolean,
isFanuc?: boolean,
isOsai?: boolean,
+ mgiOption?: boolean,
canChangePages?: boolean,
isSCMVisualStyle?: boolean,
@@ -66,10 +67,11 @@ export const machineInfoStore = {
cmsCoreVersion: null,
cmsClientVersion: null,
canChangePages:true,
-
+
isSiemens: false,
isFanuc: false,
isOsai: false,
+ mgiOption: false,
isSCMVisualStyle: false,
defaultLanguage: "en",
clientDefaultLanguage: "en",