From 4892340a26e6b7f7463bf6c14eebb0b3c67a049c Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Wed, 20 Mar 2019 16:56:10 +0100 Subject: [PATCH] Assistedtooling fix Fix siemens tool table Added dynamic tool in spindle --- Step.Config/ServerConfigController.cs | 5 +- .../WebApi/NcToolManagerController.cs | 2 +- .../tooling/components/load-depot.ts | 1 + .../tooling/components/tooling-depot.ts | 50 ++++++++----------- .../tooling/components/tooling-depot.vue | 12 ++--- .../tooling/components/tooling-equipment.ts | 33 +++++------- .../tooling/components/tooling-equipment.vue | 10 ++-- .../app_modules/tooling/components/tooling.ts | 18 ++++--- 8 files changed, 61 insertions(+), 70 deletions(-) diff --git a/Step.Config/ServerConfigController.cs b/Step.Config/ServerConfigController.cs index 9f6d1b27..8bf767fc 100644 --- a/Step.Config/ServerConfigController.cs +++ b/Step.Config/ServerConfigController.cs @@ -453,8 +453,9 @@ namespace Step.Config .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 + AssistedTooling = Convert.ToBoolean(x.Element("assistedTooling").Value), + LocalizedNames = x.Element("localizedNames").Elements().ToDictionary( // Read localized names and convert into a dictionary + y => y.Attribute("langKey").Value, y => y.Value ), }) .ToList(); diff --git a/Step/Controllers/WebApi/NcToolManagerController.cs b/Step/Controllers/WebApi/NcToolManagerController.cs index 0951c511..cce345bf 100644 --- a/Step/Controllers/WebApi/NcToolManagerController.cs +++ b/Step/Controllers/WebApi/NcToolManagerController.cs @@ -884,7 +884,7 @@ namespace Step.Controllers.WebApi using(NcToolManagerController toolsManager = new NcToolManagerController()) { - var tool = toolsManager.FindTool(data.ToolId); + var tool = toolsManager.FindTool(data.ToolId); if (tool == null) return BadRequest(); diff --git a/Step/wwwroot/src/app_modules/tooling/components/load-depot.ts b/Step/wwwroot/src/app_modules/tooling/components/load-depot.ts index 68fd33d6..3f8e74e9 100644 --- a/Step/wwwroot/src/app_modules/tooling/components/load-depot.ts +++ b/Step/wwwroot/src/app_modules/tooling/components/load-depot.ts @@ -60,6 +60,7 @@ export default { save() { this.magazineId = ModalHelper.loadDepotModal.magazineId; this.positionId = ModalHelper.loadDepotModal.positionId; + if(this.isSiemens()){ new DepotService().AddToolToDepot(this.magazineId, this.positionId, { toolId: this.toolSelected.id }).then(response => { Factory.Get(MessageService).deleteChannel("esc_pressed"); 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 f87c706b..bbf16dd9 100644 --- a/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts +++ b/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts @@ -184,7 +184,7 @@ export default class depot extends Vue { public get ncPositions_2_2(): server.NcMagazinesPositions[] { var clonedArray = this.ncPositions.slice(); if (this.ncPositions.length > 0) { - return clonedArray.splice(Math.ceil(this.ncPositions.length / 2), this.ncPositions.length - 1); + return clonedArray.splice(Math.ceil(this.ncPositions.length / 2), this.ncPositions.length - 1); } return []; } @@ -256,28 +256,27 @@ export default class depot extends Vue { // Controllo se l'utensile è un utensile montato nel mandrino public checkIfToolIsMountedInSpindle(toolId) { - if(!this.toolMountedInSpindle) - this.populateMountedToolsInSplindle() + + const heads = this.$store.state.machineInfo.heads - for (let i = 0; i < this.toolMountedInSpindle.length; i++) { - const head = this.toolMountedInSpindle[i]; - - if(toolId === head.mountedTool){ - return head.id - } + for (let i = 0; i < heads.length; i++) { + const head = this.$store.getters.getHeadsProperty(heads[i].id) + if(head) + if(toolId === head.mountedTool){ + return head.id + } } return 0; } // Polola gli utensili montati in mandrino - public populateMountedToolsInSplindle() + /*populateMountedToolsInSplindle() { this.toolMountedInSpindle = [] const heads = this.$store.state.machineInfo.heads - for (let i = 0; i < heads.length; i++) { - const head = this.getHeadsProperty(heads[i].id) + const head = this.$store.getters.getHeadsProperty(heads[i].id) if(head.mountedTool) this.toolMountedInSpindle.push(head) } @@ -286,16 +285,12 @@ export default class depot extends Vue { getHeadsProperty(id) { var r = this.$store.getters.getHeadsProperty(id); return r || {}; - } + }*/ depotId: number = 0; magazineLocked: boolean = false; editable: boolean = false; - async created() { - this.populateMountedToolsInSplindle(); - } - async mounted() { this.modalBlockMagazine(); this.depotId = this.$route.params.id; @@ -308,9 +303,9 @@ export default class depot extends Vue { toolingActions.updateBusyStatusPositions(store,this.magazineType,this.depotNc); this.onLoading = false; - + // Set assistedTooling procedure - if(this.magazines){ + if(this.magazines && !this.isSiemens){ var mag = this.magazines.find(x => x.id == this.depotId) if(mag) this.assistedToolingIsActive = mag.assistedToolingIsActive @@ -596,12 +591,10 @@ export default class depot extends Vue { } public openModalLoadDepot(action, positionId, positionType) { - console.log("AZIONE", action, positionId, positionType) if(action == "UNLOAD") { // Unload case // Call assisted unload api const tool = this.ncToolAtPosition(positionId) new DepotService().StartAssistedToolingProcedure(tool.id, Number(this.depotId), positionId, 2).then(response => { - console.log(response) }); } else { @@ -731,13 +724,14 @@ export default class depot extends Vue { if (mag && mag.type) this.magazineType = mag.type; - if (mag && mag.name) - return this.$options.filters.localize('store_title_magazine', "Magazzino") + " " + id + ": " + mag.name; - else if (id) - return this.$options.filters.localize('store_title_magazine', "Magazzino") + " " + id; - else - return this.$options.filters.localize('store_title_magazine', "Magazzino"); - + if(this.isSiemens){ + if (mag && mag.name) + return this.$options.filters.localize('store_title_magazine', "Magazzino") + " " + id + ": " + mag.name; + else if (id) + return this.$options.filters.localize('magazine_name_' + id, "Magazzino"); + } else { + return this.$options.filters.localize('magazine_name_' + id, "Magazzino"); + } } public calculateAvailablePositions() { diff --git a/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.vue b/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.vue index 147bff92..ea5b8fe3 100644 --- a/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.vue +++ b/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.vue @@ -89,7 +89,7 @@
-
+
-
+
- +
{{'depot_label_search' | localize("Seleziona un utensile e trascinalo nel magazzino corrispondente:")}} @@ -189,7 +189,7 @@ class="depot-position" :class="{'drop':draggingIn,'selected': currentPosition == idx, 'disabled':pos.disabled}" :magpos-occupied="ncToolAtPosition(pos.positionId) || pos.busyStatus != 4" - :toolMounted="pos.busyStatus != 4" + :toolMounted="ncToolAtPosition(pos.positionId)" :editable="editable" :disabled="pos.disabled" @click="openModalLoadDepot" > @@ -213,7 +213,7 @@
-
+
-
+
- +
{{'tooling_equipment_editlabel' | localize("Modifica utensile %d", selectedTool.id,selectedTool.familyName)}}
{{'tooling_equipment_editlabel' | localize("Modifica utensile %d", selectedTool.id)}}
{{'tooling_equipment_newlabel' | localize("Creazione Nuovo Utensile")}}
@@ -108,8 +108,8 @@