diff --git a/Libs/CMS_CORE_Library.dll b/Libs/CMS_CORE_Library.dll index 73a2c477..61b948f0 100644 Binary files a/Libs/CMS_CORE_Library.dll and b/Libs/CMS_CORE_Library.dll differ diff --git a/Step.Config/Config/scadaValidator.xsd b/Step.Config/Config/scadaValidator.xsd index cdf6b389..dbc2dcb7 100644 --- a/Step.Config/Config/scadaValidator.xsd +++ b/Step.Config/Config/scadaValidator.xsd @@ -144,13 +144,29 @@ - - + + + + + + + + + - - + + + + + + + + + + + diff --git a/Step.Config/ServerConfigController.cs b/Step.Config/ServerConfigController.cs index 34cd2e42..4dc7d765 100644 --- a/Step.Config/ServerConfigController.cs +++ b/Step.Config/ServerConfigController.cs @@ -219,7 +219,7 @@ namespace Step.Config // Cycle inside xml files foreach (var file in files) { - validateScada(SCADA_PAGES_SCHEMA_PATH, SCADA_DIRECTORY + file.Name); + // validateScada(SCADA_PAGES_SCHEMA_PATH, SCADA_DIRECTORY + file.Name); StreamReader sr = new StreamReader(SCADA_DIRECTORY + file.Name); XmlSerializer xmlSerializer = new XmlSerializer(typeof(ScadaSchemaModel)); @@ -248,7 +248,6 @@ namespace Step.Config }) .ToArray(); - if (schema.IsInProductionPage == true) ProductionScadaSchema.Add(schema); else diff --git a/Step.Model/DTOModels/DTOHeadModel.cs b/Step.Model/DTOModels/DTOHeadModel.cs index 06d4bcfd..6d51ec8e 100644 --- a/Step.Model/DTOModels/DTOHeadModel.cs +++ b/Step.Model/DTOModels/DTOHeadModel.cs @@ -79,7 +79,6 @@ namespace Step.Model.DTOModels public override bool Equals(object obj) { - // Object is not a DTOSpindleModel if (!(obj is DTOSpindleModel item)) return false; @@ -119,7 +118,6 @@ namespace Step.Model.DTOModels public override bool Equals(object obj) { - // Object is not a DTOSpindleModel if (!(obj is DTOAbrasiveWaterJet item)) return false; diff --git a/Step.Model/DTOModels/Scada/DTOScadaModel.cs b/Step.Model/DTOModels/Scada/DTOScadaModel.cs index 1e726f8a..0f9bf9c2 100644 --- a/Step.Model/DTOModels/Scada/DTOScadaModel.cs +++ b/Step.Model/DTOModels/Scada/DTOScadaModel.cs @@ -12,6 +12,7 @@ namespace Step.Model.DTOModels.Scada public List Images { get; set; } public List ProgressBars { get; set; } public List Inputs { get; set; } + public List Labels { get; set; } public DTOScadaModel() { @@ -20,6 +21,7 @@ namespace Step.Model.DTOModels.Scada Images = new List(); ProgressBars = new List(); Inputs = new List(); + Labels = new List(); } public override bool Equals(object obj) @@ -47,6 +49,10 @@ namespace Step.Model.DTOModels.Scada if (!listAreEquals) return false; + listAreEquals = item.Labels.All(Labels.Contains); + if (!listAreEquals) + return false; + return true; } @@ -76,7 +82,7 @@ namespace Step.Model.DTOModels.Scada public class DTOScadaButtonModel { public int Id { get; set; } - public bool Enabled { get; set; } + public bool IsEnabled { get; set; } public override bool Equals(object obj) { @@ -86,7 +92,7 @@ namespace Step.Model.DTOModels.Scada if (item.Id != Id) return false; - if (item.Enabled != Enabled) + if (item.IsEnabled != IsEnabled) return false; return true; @@ -204,4 +210,27 @@ namespace Step.Model.DTOModels.Scada return base.GetHashCode(); } } + + public class DTOScadaLabelModel + { + public int Id { get; set; } + + public bool IsVisible { get; set; } + + public override bool Equals(object obj) + { + if (!(obj is DTOScadaLabelModel item)) + return false; + + if (item.IsVisible != IsVisible) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } } \ No newline at end of file diff --git a/Step.Model/DTOModels/Scada/ScadaSchemaModel.cs b/Step.Model/DTOModels/Scada/ScadaSchemaModel.cs index 4338f1d9..e7365b5e 100644 --- a/Step.Model/DTOModels/Scada/ScadaSchemaModel.cs +++ b/Step.Model/DTOModels/Scada/ScadaSchemaModel.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Xml.Serialization; namespace Step.Model.DTOModels.Scada @@ -21,7 +22,6 @@ namespace Step.Model.DTOModels.Scada public class ScadaSchemaLayerModel { - //[XmlElement("id")] public int Id { get; set; } [XmlArray("buttons")] @@ -86,7 +86,6 @@ namespace Step.Model.DTOModels.Scada public class ScadaSchemaLabelModel { - //[XmlElement("id")] public int Id { get; set; } [XmlElement("label")] @@ -97,6 +96,9 @@ namespace Step.Model.DTOModels.Scada [XmlElement("size")] public ScadaSchemaSizeModel Size { get; set; } + + [XmlElement("memEnabledIndex")] + public string MemEnabledIndex { get; set; } } public class ScadaSchemaProgressBarModel @@ -104,9 +106,6 @@ namespace Step.Model.DTOModels.Scada //[XmlElement("id")] public int Id { get; set; } - //[XmlElement("label")] - //public ScadaSchemaLabelDataModel Label { get; set; } - [XmlElement("position")] public ScadaSchemaPositionModel Position { get; set; } @@ -132,17 +131,16 @@ namespace Step.Model.DTOModels.Scada public ScadaSchemaSizeModel Size { get; set; } [XmlElement("status")] - public ScadaSchemaInputDataModel Status { get; set; } - + public ScadaSchemaInputDataModel Status { get; set; } } /// /// Support objects /// - public class ScadaSchemaLabelDataModel + public class ScadaSchemaLabelDataModel { - [XmlElement("backgroundColor")] - public string BackgroundColor { get; set; } + [XmlElement("backgroundColor")] + public string BackgroundColor { get; set; } [XmlElement("textAlign")] public string TextAlign { get; set; } @@ -150,11 +148,21 @@ namespace Step.Model.DTOModels.Scada [XmlElement("textColor")] public string TextColor { get; set; } - [XmlElement("textContent")] - public string TextContent { get; set; } - [XmlElement("textSize")] public int TextSize { get; set; } + + + [XmlElement("textContent")] + public LocalizedText[] TextContents { get; set; } + } + + public class LocalizedText + { + [XmlAttribute("langKey")] + public string LangKey { get; set; } + + [XmlText] + public string TextContent { get; set; } } public class ScadaSchemaPositionModel diff --git a/Step.NC/NcHandler.cs b/Step.NC/NcHandler.cs index 22c12eac..d4aafe81 100644 --- a/Step.NC/NcHandler.cs +++ b/Step.NC/NcHandler.cs @@ -1005,17 +1005,42 @@ namespace Step.NC // Cycle through elements, use the max number of elements between layer components in order to be optimized for (int i = 0; i < GetMaxCountBetweenLayerComponents(layer); i++) { + if (layer.Labels.ElementAtOrDefault(i) != null) + { + if(layer.Labels[i].MemEnabledIndex != null) + { + // Read enabled from PLC + cmsError = numericalControl.PLC_RScadaValue(layer.Labels[i].MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val); + if (cmsError.IsError()) + return cmsError; + // Populate & add new object into scada model + scadaValue.Labels.Add(new DTOScadaLabelModel() + { + Id = layer.Labels[i].Id, + IsVisible = Convert.ToBoolean(val) + }); + } + else + { + scadaValue.Labels.Add(new DTOScadaLabelModel() + { + Id = layer.Labels[i].Id, + IsVisible = true + }); + } + } if (layer.Buttons.ElementAtOrDefault(i) != null) { // Read enabled from PLC cmsError = numericalControl.PLC_RScadaValue(layer.Buttons[i].Status.MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val); if (cmsError.IsError()) return cmsError; + // Populate & add new object into scada model scadaValue.Buttons.Add(new DTOScadaButtonModel() { Id = layer.Buttons[i].Id, - Enabled = Convert.ToBoolean(val) + IsEnabled = Convert.ToBoolean(val) }); } diff --git a/Step/Controllers/WebApi/LanguageController.cs b/Step/Controllers/WebApi/LanguageController.cs index 578b65fc..0f1ddb76 100644 --- a/Step/Controllers/WebApi/LanguageController.cs +++ b/Step/Controllers/WebApi/LanguageController.cs @@ -56,6 +56,8 @@ namespace Step.Controllers.WebApi Dictionary coolingNames = GetCoolingTranslations(language); Dictionary magazinesNames = GetMagazineTranslations(language); + Dictionary scadaTranslations = GetScadaTranslations(language); + // Concat maintenances dictionary with translations dictionary translations = translations.Concat(maintenanceNames).ToDictionary(x => x.Key, x => x.Value); @@ -72,6 +74,8 @@ namespace Step.Controllers.WebApi } // Magazines translations = translations.Concat(magazinesNames).ToDictionary(x => x.Key, x => x.Value); + // Scada + translations = translations.Concat(scadaTranslations).ToDictionary(x => x.Key, x => x.Value); if (translations == null) return InternalServerError(); @@ -236,5 +240,30 @@ namespace Step.Controllers.WebApi return translatedNames; } + + private static Dictionary GetScadaTranslations(string language) + { + Dictionary translatedNames = new Dictionary(); + + // Loop throught labels Scada -> Layers -> Labels + foreach(var scada in ProductionScadaSchema.Concat(ConfiguredScadaSchema)) + { + foreach(var layer in scada.Layers) + { + foreach(var label in layer.Labels) + { + // Find selected language + var translatedValue = label.Label.TextContents.Where(y => y.LangKey == language).FirstOrDefault(); + if (translatedValue != null) + translatedNames.Add("scada_label_" + label.Id, translatedValue.TextContent); + else + // default value + translatedNames.Add("scada_label_" + label.Id, "scada_label_" + label.Id); + } + } + } + + return translatedNames; + } } } \ No newline at end of file diff --git a/Step/Listeners/SignalR/SignalRListener.cs b/Step/Listeners/SignalR/SignalRListener.cs index 9afd9050..dd3acc1a 100644 --- a/Step/Listeners/SignalR/SignalRListener.cs +++ b/Step/Listeners/SignalR/SignalRListener.cs @@ -182,7 +182,6 @@ namespace Step.Listeners.SignalR ShankId = tool.ShankId ?? 0 }; } - } } diff --git a/Step/wwwroot/assets/styles/base/head.less b/Step/wwwroot/assets/styles/base/head.less index f48c5085..db6f529e 100644 --- a/Step/wwwroot/assets/styles/base/head.less +++ b/Step/wwwroot/assets/styles/base/head.less @@ -16,6 +16,7 @@ border-radius: 2px; box-shadow: 0px 1px 2px 0 rgba(0, 0, 0, 0.4); display: flex; + flex-wrap: wrap; label { color: #4b4b4b; font-size: 18px; @@ -105,7 +106,8 @@ } .tool-box{ overflow: hidden; - .tool-name{ + width: 102px; + .tool-name { white-space: pre; line-height: 41px; } @@ -159,15 +161,19 @@ color: @color-squash !important; } } - .tool-box, .vacuum { width: 88px; flex-shrink: 0; } - .load-box, .abrasive { width: 100%; } + .load-box { + width: 102px; + } + .tool-box{ + width: 116px; + } &.selected { box-shadow: inset 0px 0px 0px 2px #51adff; @@ -183,6 +189,23 @@ } } } + + .smooth-enter-active, .smooth-leave-active { + height:94px; + transition: height .5s; + overflow: hidden; + } + .smooth-enter-active-to { + height:94px; + } + + .detail-box { + height:94px; + } + .smooth-enter, .smooth-leave-to { + height: 0; + transition: height .5s; + } } .head-place-holder{ diff --git a/Step/wwwroot/assets/styles/style.css b/Step/wwwroot/assets/styles/style.css index 2b4cdc0b..9c8bedf8 100644 --- a/Step/wwwroot/assets/styles/style.css +++ b/Step/wwwroot/assets/styles/style.css @@ -6314,6 +6314,7 @@ footer .container button.big:before { border-radius: 2px; box-shadow: 0px 1px 2px 0 rgba(0, 0, 0, 0.4); display: flex; + flex-wrap: wrap; } .head-spindle > *, .head-production > *, @@ -6436,6 +6437,7 @@ footer .container button.big:before { .head-production .tool-box, .head-awj .tool-box { overflow: hidden; + width: 102px; } .head-spindle .tool-box .tool-name, .head-production .tool-box .tool-name, @@ -6558,23 +6560,27 @@ footer .container button.big:before { .head-awj .load-box.warning span { color: #f5a623 !important; } -.head-spindle .tool-box, -.head-production .tool-box, -.head-awj .tool-box, .head-spindle .vacuum, .head-production .vacuum, .head-awj .vacuum { width: 88px; flex-shrink: 0; } -.head-spindle .load-box, -.head-production .load-box, -.head-awj .load-box, .head-spindle .abrasive, .head-production .abrasive, .head-awj .abrasive { width: 100%; } +.head-spindle .load-box, +.head-production .load-box, +.head-awj .load-box { + width: 102px; +} +.head-spindle .tool-box, +.head-production .tool-box, +.head-awj .tool-box { + width: 116px; +} .head-spindle.selected, .head-production.selected, .head-awj.selected { @@ -6597,6 +6603,35 @@ footer .container button.big:before { border-color: #fff !important; color: #fff; } +.head-spindle .smooth-enter-active, +.head-production .smooth-enter-active, +.head-awj .smooth-enter-active, +.head-spindle .smooth-leave-active, +.head-production .smooth-leave-active, +.head-awj .smooth-leave-active { + height: 94px; + transition: height .5s; + overflow: hidden; +} +.head-spindle .smooth-enter-active-to, +.head-production .smooth-enter-active-to, +.head-awj .smooth-enter-active-to { + height: 94px; +} +.head-spindle .detail-box, +.head-production .detail-box, +.head-awj .detail-box { + height: 94px; +} +.head-spindle .smooth-enter, +.head-production .smooth-enter, +.head-awj .smooth-enter, +.head-spindle .smooth-leave-to, +.head-production .smooth-leave-to, +.head-awj .smooth-leave-to { + height: 0; + transition: height .5s; +} .head-place-holder { width: 240px; height: 102px; diff --git a/Step/wwwroot/src/@types/scada.d.ts b/Step/wwwroot/src/@types/scada.d.ts index 70f72c85..d6b39a03 100644 --- a/Step/wwwroot/src/@types/scada.d.ts +++ b/Step/wwwroot/src/@types/scada.d.ts @@ -57,6 +57,7 @@ declare module scada { interface labelControl extends baseControl { label: label, + isEnabled: boolean } interface buttonControl extends baseControl { diff --git a/Step/wwwroot/src/app_modules/production/components/head-production.vue b/Step/wwwroot/src/app_modules/production/components/head-production.vue index 38992321..dc521c3c 100644 --- a/Step/wwwroot/src/app_modules/production/components/head-production.vue +++ b/Step/wwwroot/src/app_modules/production/components/head-production.vue @@ -1,3 +1,4 @@ +