WIP MGI Fanuc

WIP Override & process data
Fix maintainer
This commit is contained in:
Lucio Maranta
2019-06-06 12:45:50 +02:00
parent a93aaba321
commit 7ce41d51bb
15 changed files with 52 additions and 38 deletions
+1
View File
@@ -9,6 +9,7 @@
<sharedPath>C:\PartPrg\</sharedPath>
<sharedName>//PARTPRG:/</sharedName>
<installationDate>01/01/2019</installationDate>
<mgiOption>false</mgiOption>
</ncConfig>
<softwareProdConfig>
<enabled>true</enabled>
@@ -14,6 +14,7 @@
<xs:element name="sharedPath" type="xs:string" minOccurs='1' maxOccurs='1'/>
<xs:element name="sharedName" type="xs:string" minOccurs='1' maxOccurs='1'/>
<xs:element name="installationDate" type="xs:string" minOccurs='1' maxOccurs='1'/>
<xs:element name="mgiOption" type="xs:boolean" minOccurs='1' maxOccurs='1'/>
</xs:all>
</xs:complexType>
</xs:element>
+2 -1
View File
@@ -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
+15 -13
View File
@@ -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<DatabaseContext>(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
+1 -1
View File
@@ -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(
+1
View File
@@ -91,6 +91,7 @@
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Threading.Channels, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.4.5.0\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
</Reference>
+1
View File
@@ -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; }
}
}
+1 -1
View File
@@ -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
@@ -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<ExtSoftwareModel> ExtSoftwares { get; set; }
public CultureInfo DefaultLanguage
@@ -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
{
+10 -9
View File
@@ -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<App_Start.Startup>(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();
+3 -3
View File
@@ -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;
}
@@ -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(){
+2 -5
View File
@@ -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 {
+3 -1
View File
@@ -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",