Merge branch 'develop' of https://bitbucket.org/ncarminati/cms_step into develop

This commit is contained in:
Alessandro Francia
2018-09-24 16:55:51 +02:00
17 changed files with 119 additions and 13 deletions
+1
View File
@@ -15,5 +15,6 @@
<language>en</language>
<enableDirectoryBrowsing>true</enableDirectoryBrowsing>
<databaseAddress>localhost</databaseAddress>
<autoOpenCmsClient>true</autoOpenCmsClient>
</serverConfig>
</serverConfig>
@@ -25,6 +25,7 @@
<xs:element name="language" type="xs:language" minOccurs='1' maxOccurs='1' default="en"/>
<xs:element name="enableDirectoryBrowsing" type="xs:boolean" default="false"/>
<xs:element name="databaseAddress" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="autoOpenCmsClient" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
+23
View File
@@ -49,4 +49,27 @@
<lang langKey="it">Raffreddamento 7</lang>
</cooling7>
</coolingLocalizedNames>
<magazineNames>
<magazine>
<id>1</id>
<localizedNames>
<lang langKey="en">Magazine 1</lang>
<lang langKey="it">Magazzino 1</lang>
</localizedNames>
</magazine>
<magazine>
<id>2</id>
<localizedNames>
<lang langKey="en">Magazine 2</lang>
<lang langKey="it">Magazzino 2</lang>
</localizedNames>
</magazine>
<magazine>
<id>3</id>
<localizedNames>
<lang langKey="en">Magazine 3</lang>
<lang langKey="it">Magazzino 3</lang>
</localizedNames>
</magazine>
</magazineNames>
</root>
@@ -102,6 +102,31 @@
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="magazineNames">
<xs:complexType>
<xs:sequence>
<xs:element name="magazine" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
<xs:element name="id" type="xs:int"/>
<xs:element name="localizedNames">
<xs:complexType>
<xs:sequence>
<xs:element name="lang" type="langType" minOccurs="0" maxOccurs="unbounded">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
+15 -1
View File
@@ -198,7 +198,8 @@ namespace Step.Config
ServerAddress = x.Element("serverAddress").Value,
ServerPort = Convert.ToInt32(x.Element("serverPort").Value),
EnableDirectoryBrowsing = Convert.ToBoolean(x.Element("enableDirectoryBrowsing").Value),
DatabaseAddress = x.Element("databaseAddress").Value
DatabaseAddress = x.Element("databaseAddress").Value,
AutoOpenCmsClient = Convert.ToBoolean(x.Element("autoOpenCmsClient").Value)
}).FirstOrDefault();
}
@@ -391,6 +392,19 @@ namespace Step.Config
})
.FirstOrDefault();
ToolManagerConfig.MagazineNames = xmlConfigFile
.Root
.Descendants("magazineNames")
.Elements()
.Select(x => new MagazineNamesModel()
{
MagazineId = Convert.ToInt32(x.Element("id").Value),
LocalizedNames = x.Element("localizedNames").Elements().ToDictionary( // Read localized names and convert into a dictionary
y => y.Attribute("langKey").Value, y => y.Value
),
})
.ToList();
}
public static void ReadMacros()
+3 -2
View File
@@ -31,10 +31,11 @@ namespace Step.Database.Controllers
{
dbCtx.Queue.RemoveRange(dbCtx.Queue);
foreach(var item in PartProgramQueue)
var dbRows = new List<QueueItemsModel>();
foreach (var item in PartProgramQueue)
{
// Create database model
var dbRows = item.Value.Select(x => new QueueItemsModel()
dbRows =item.Value.Select(x => new QueueItemsModel()
{
Id = x.Id,
AbsolutePath = x.AbsolutePath,
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Step.Model.ConfigModels
{
public class MagazineNamesModel
{
public int MagazineId { get; set; }
public Dictionary<string, string> LocalizedNames { get; set; }
}
}
@@ -14,5 +14,6 @@ namespace Step.Model.ConfigModels
public string ServerAddress { get; set; }
public bool EnableDirectoryBrowsing { get; set; }
public string DatabaseAddress { get; set; }
public bool AutoOpenCmsClient { get; set; }
}
}
@@ -24,6 +24,7 @@ namespace Step.Model.ConfigModels
public CooligTranslations CooligsTranslations { get; set; }
public List<MagazineNamesModel> MagazineNames { get; set; }
}
public class CooligTranslations
+1
View File
@@ -62,6 +62,7 @@
<ItemGroup>
<Compile Include="ConfigModels\AlarmsConfigModel.cs" />
<Compile Include="ConfigModels\HeadsConfigModel.cs" />
<Compile Include="ConfigModels\MagazineNamesModel.cs" />
<Compile Include="ConfigModels\MaintenanceConfigModel.cs" />
<Compile Include="ConfigModels\NcSoftKeysModel.cs" />
<Compile Include="ConfigModels\ServerConfigModel.cs" />
+1 -1
View File
@@ -115,7 +115,7 @@ namespace Step.UI
MessageServices.Current.Publish("StopServer");
}
private void StartCMSClient(string url)
public static void StartCMSClient(string url)
{
//Setup the Path Variable
String CMSClientPath = "";
@@ -40,6 +40,7 @@ namespace Step.Controllers.WebApi
Dictionary<string, string> alarmsNames = GetPlcAlarmsTranslations(language);
Dictionary<string, string> headsNames = GetLocalizedHeadsNames(language);
Dictionary<string, string> coolingNames = GetCoolingTranslations(language);
Dictionary<string, string> magazinesNames = GetMagazineTranslations(language);
// Concat maintenances dictionary with translations dictionary
@@ -55,6 +56,8 @@ namespace Step.Controllers.WebApi
{
translations[coolingItem.Key] = coolingItem.Value;
}
// Magazines
translations = translations.Concat(magazinesNames).ToDictionary(x => x.Key, x => x.Value);
if (translations == null)
return InternalServerError();
@@ -205,5 +208,20 @@ namespace Step.Controllers.WebApi
}
return dictionary;
}
private static Dictionary<string, string> GetMagazineTranslations(string language)
{
Dictionary<string, string> translatedNames = new Dictionary<string, string>();
foreach (var mag in ToolManagerConfig.MagazineNames)
{
translatedNames.Add(
"magazine_name_" + mag.MagazineId,
GetValueFromLocalizationList(mag.LocalizedNames, language, "Magazine_" + mag.MagazineId)
);
}
return translatedNames;
}
}
}
+3
View File
@@ -75,6 +75,9 @@ namespace Step
// Start listeners
ListenersHandler.Start();
if (ServerStartupConfig.AutoOpenCmsClient)
ServerControlWindow.StartCMSClient(null);
// Wait interrupt from client
StopRequest.WaitOne();
LogInfo("Application closed");
+1 -1
View File
@@ -1616,7 +1616,7 @@
}
}
}
.expanded{
.job-expanded{
width: 623px !important;
height: auto !important;
}
+1 -1
View File
@@ -6636,7 +6636,7 @@ footer .container button.big:before {
border-radius: 2px;
padding: 5px 10px;
}
.expanded {
.job-expanded {
width: 623px !important;
height: auto !important;
}
@@ -609,12 +609,14 @@ export default class depot extends Vue {
}
public updateMagStatusAndgetStoreTitle(id: number): string {
var mag = this.magazines.find(d => d.id == id);
if (mag && mag.loadingIsActive && mag.signalRLoadingIsActive)
this.magazineLocked = false;
else
this.magazineLocked = true;
if(this.magazines.length > 0){
var mag = this.magazines.find(d => d.id == id);
console.log("MAG", mag.signalRLoadingIsActive)
if (mag && mag.loadingIsActive && mag.signalRLoadingIsActive)
this.magazineLocked = false;
else
this.magazineLocked = true;
}
if (mag && mag.type)
this.magazineType = mag.type;
@@ -1,6 +1,6 @@
<template>
<!-- <div class="test-container"> -->
<div class="objects-job" :class="{'min': min, 'expanded': expanded}">
<div class="objects-job" :class="{'min': min, 'job-expanded': expanded}">
<div class="main">
<div class="objects-job-image">
<img :src="imgSource" />