From 3750987db07882d1a4fd50be2a412364d7b16bde Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Mon, 1 Apr 2019 17:58:54 +0200 Subject: [PATCH] Fix tool table Added field to scada images ("clickEnabled") --- Step.Config/ServerConfigController.cs | 2 +- .../DTOModels/Scada/ScadaSchemaModel.cs | 16 ++++-- .../components/card-scada-production.vue | 2 +- .../src/app_modules/scada/components/scada.ts | 5 +- .../app_modules/scada/components/scada.vue | 4 +- .../tooling/components/load-depot.ts | 2 +- .../tooling/components/load-depot.vue | 2 - .../tooling/components/tooling-depot.ts | 7 ++- .../tooling/components/tooling-equipment.ts | 10 +++- .../tooling/components/tooling-families.ts | 44 ++++++++------ .../tooling/components/tooling-families.vue | 2 +- Step/wwwroot/src/store/tooling.store.ts | 57 ++++++++++++------- 12 files changed, 96 insertions(+), 57 deletions(-) diff --git a/Step.Config/ServerConfigController.cs b/Step.Config/ServerConfigController.cs index 81e76ecb..6f0e6238 100644 --- a/Step.Config/ServerConfigController.cs +++ b/Step.Config/ServerConfigController.cs @@ -207,7 +207,7 @@ namespace Step.Config Buttons = x.Buttons.Select(y => { y.Id = i++; return y; }).ToArray(), Images = x.Images.Select(y => { y.Id = i++; - y.Path = GetImageBase64String(SCADA_DIRECTORY + y.Path, schema.BackgroundImage); + y.Name = GetImageBase64String(SCADA_DIRECTORY + name, y.Name); return y; }) .ToArray(), diff --git a/Step.Model/DTOModels/Scada/ScadaSchemaModel.cs b/Step.Model/DTOModels/Scada/ScadaSchemaModel.cs index 55e98f1d..717b870a 100644 --- a/Step.Model/DTOModels/Scada/ScadaSchemaModel.cs +++ b/Step.Model/DTOModels/Scada/ScadaSchemaModel.cs @@ -68,8 +68,8 @@ namespace Step.Model.DTOModels.Scada //[XmlElement("id")] public int Id { get; set; } - [XmlElement("imagePath")] - public string Path { get; set; } + [XmlElement("imageName")] + public string Name { get; set; } [XmlElement("label")] public ScadaSchemaLabelDataModel Label { get; set; } @@ -159,17 +159,17 @@ namespace Step.Model.DTOModels.Scada public class ScadaSchemaPositionModel { - [XmlElement("x")] + [XmlAttribute("x")] public int X { get; set; } - [XmlElement("y")] + [XmlAttribute("y")] public int Y { get; set; } } public class ScadaSchemaSizeModel { - [XmlElement("x")] + [XmlAttribute("x")] public int X { get; set; } - [XmlElement("y")] + [XmlAttribute("y")] public int Y { get; set; } } @@ -196,6 +196,10 @@ namespace Step.Model.DTOModels.Scada [XmlAttribute("negate")] public bool Negate { get; set; } + + [XmlAttribute("clickEnabled")] + public bool ClickEnabled { get; set; } + [XmlElement("memVisibleIndex")] public string MemVisibleIndex { get; set; } diff --git a/Step/wwwroot/src/app_modules/scada/components/card-scada-production.vue b/Step/wwwroot/src/app_modules/scada/components/card-scada-production.vue index fe2577a4..a4266ca8 100644 --- a/Step/wwwroot/src/app_modules/scada/components/card-scada-production.vue +++ b/Step/wwwroot/src/app_modules/scada/components/card-scada-production.vue @@ -7,7 +7,7 @@ k.id == id); diff --git a/Step/wwwroot/src/app_modules/tooling/components/load-depot.vue b/Step/wwwroot/src/app_modules/tooling/components/load-depot.vue index 37e98990..e11462f6 100644 --- a/Step/wwwroot/src/app_modules/tooling/components/load-depot.vue +++ b/Step/wwwroot/src/app_modules/tooling/components/load-depot.vue @@ -16,8 +16,6 @@ {{calcItemName(s)}} -
{{'load_depot_error_fit' | localize('Spazio troppo piccolo per caricare questo utensile')}} diff --git a/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts b/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts index 249d0f40..b6fbe1f3 100644 --- a/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts +++ b/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts @@ -304,6 +304,10 @@ export default class depot extends Vue { this.onLoading = false; + this.setAssistedTooling() + } + + private setAssistedTooling(){ // Set assistedTooling procedure if(this.magazines && !this.isSiemens){ var mag = this.magazines.find(x => x.id == this.depotId) @@ -312,7 +316,6 @@ export default class depot extends Vue { } } - async loadData() { if (this.isSiemens) { return Promise.all([ @@ -494,12 +497,14 @@ export default class depot extends Vue { new ToolingService().GetNcTools() ])); } + if(this.isSiemens) toolingActions.updateBusyStatusPositions(store,this.magazineType,this.depot); else toolingActions.updateBusyStatusPositions(store,this.magazineType,this.depotNc); this.onLoading = false; + this.setAssistedTooling() } public dataForOpenInfoShank(id) { diff --git a/Step/wwwroot/src/app_modules/tooling/components/tooling-equipment.ts b/Step/wwwroot/src/app_modules/tooling/components/tooling-equipment.ts index 52aea3d4..bfddc8ce 100644 --- a/Step/wwwroot/src/app_modules/tooling/components/tooling-equipment.ts +++ b/Step/wwwroot/src/app_modules/tooling/components/tooling-equipment.ts @@ -428,7 +428,6 @@ export default class toolingEquipment extends Vue { } public cancel = function () { - console.log("CANCEL", this.selectedTool, this.copySelectedTool) if(this.isSiemens){ if (this.copySelectedTool) { this.selectedTool = Object.assign({},this.copySelectedTool); @@ -441,11 +440,11 @@ export default class toolingEquipment extends Vue { toolingActions.updateNcTool(store, this.copySelectedTool); } } - - + if (!this.selectedTool || !this.selectedTool.id) { this.selectedTool = null; } else { + // If select tool exist populate edgesData field for (let l in this.selectedTool.edgesData) { if (this.selectedTool.edgesData[l].id <= 0) { this.selectedTool.edgesData.splice(l, 1); @@ -831,6 +830,11 @@ public isEquipmentSelected(offset){ return; } + if(this.newToolId <= 0){ + this.canAddNewTool = false; + return; + } + var tool = this.ncTools.find(k => k.id == this.newToolId); if(tool) diff --git a/Step/wwwroot/src/app_modules/tooling/components/tooling-families.ts b/Step/wwwroot/src/app_modules/tooling/components/tooling-families.ts index 45395c70..9778608c 100644 --- a/Step/wwwroot/src/app_modules/tooling/components/tooling-families.ts +++ b/Step/wwwroot/src/app_modules/tooling/components/tooling-families.ts @@ -136,20 +136,21 @@ export default class toolingFamilies extends Vue { public addFamily() { let newFam = {}; - this.familyConfiguration = []; + //this.familyConfiguration = []; - for (let f in (this.$store.state as AppModel).tooling.familyConfiguration) { - let element = (this.$store.state as AppModel).tooling.familyConfiguration[f]; - if (!element.readOnly) { - this.familyConfiguration.push(element); - } - newFam[element.name] = element.minValue; - if(element.name == "name"){ - newFam[element.name] = ""; - } - } + // for (let f in (this.$store.state as AppModel).tooling.familyConfiguration) { + // let element = (this.$store.state as AppModel).tooling.familyConfiguration[f]; + // if (!element.readOnly) { + // this.familyConfiguration.push(element); + // } + // newFam[element.name] = element.minValue; + // if(element.name == "name"){ + // newFam[element.name] = ""; + // } + // } this.selectedTool = Object.assign({}, newFam); + this.copySelectedFamily = Object.assign({}, newFam); this.disableList = true; this.enableModify = false; @@ -179,18 +180,20 @@ export default class toolingFamilies extends Vue { } public cancel = function () { - if (this.selectedTool.id == null || this.selectedTool.id == 0) { + + if (!this.selectedTool || !this.selectedTool.id) { this.selectedTool = null; } // Copy backup family data into selectedFamily - if (this.copySelectedFamily) { + if (this.copySelectedFamily.id) { this.selectedTool = Object.assign({},this.copySelectedFamily); toolingActions.updateNcTool(store, this.copySelectedFamily); } this.disableList = false; this.enableModify = false; + this.enableFamilyCreation = false; } // public cancelNewFamily = function(){ @@ -349,11 +352,16 @@ export default class toolingFamilies extends Vue { @Watch("newFamilyId") public canAddTool(){ - var familiy = this.ncFamilies.find(k => k.id == this.newFamilyId); + if(this.newFamilyId <= 0){ + this.canAddNewFamily = false; + } + else { + var familiy = this.ncFamilies.find(k => k.id == this.newFamilyId); - if(familiy) - this.canAddNewFamily = false; - else - this.canAddNewFamily = true; + if(familiy) + this.canAddNewFamily = false; + else + this.canAddNewFamily = true; + } } } diff --git a/Step/wwwroot/src/app_modules/tooling/components/tooling-families.vue b/Step/wwwroot/src/app_modules/tooling/components/tooling-families.vue index 52d5ceb1..d3626cab 100644 --- a/Step/wwwroot/src/app_modules/tooling/components/tooling-families.vue +++ b/Step/wwwroot/src/app_modules/tooling/components/tooling-families.vue @@ -151,7 +151,7 @@
-
{{'tooling_equipment_newlabel' | localize("Creazione Nuova Famiglia")}}
+
{{'tooling_families_boxright_newlabel' | localize("Creazione Nuova Famiglia")}}
diff --git a/Step/wwwroot/src/store/tooling.store.ts b/Step/wwwroot/src/store/tooling.store.ts index 5532cd25..f551496d 100644 --- a/Step/wwwroot/src/store/tooling.store.ts +++ b/Step/wwwroot/src/store/tooling.store.ts @@ -189,27 +189,46 @@ export const toolingStore = { return null } }, - positionCompatible : (state) => (id,posType) : boolean =>{ - - if(!posType || posType==0) - return true; - - let tool = state.tools.find(t => t.id === id); - - if(tool){ - - if(tool.magazinePositionType == posType) + positionCompatible : (state) => (id, posType) : boolean =>{ + var isSiemens = machineInfoStore.state.isSiemens; + if(isSiemens) { + if(!posType || posType==0) return true; - else + + // Find tool + let tool = state.tools.find(t => t.id === id); + if(tool) { + if(tool.magazinePositionType == posType) // Check tool position + return true; + else + return false; + } + else { + // If tool not exist check shank positionType + let shank = state.shanks.find(t => t.id === id); + if(!shank) + return false; + + if(shank.magazinePositionType == posType) + return true; + else + return false; + } + } + else { + // Find tool + let tool = state.ncTools.find(t => t.id === id); + if(tool) { + // Find tool family + let fam = state.ncFamilies.find(f => f.id == tool.familyId) + if(fam && fam.toolType == posType) // Check type + return true; + else + return false; + } + return false; - } - else{ - let shank = state.shanks.find(t => t.id === id); - if(shank.magazinePositionType == posType) - return true; - else - return false; - } + } } }, mutations: {