diff --git a/Step.Utils/languages/IT.xml b/Step.Utils/languages/IT.xml index fc5c1e33..7be24cce 100644 --- a/Step.Utils/languages/IT.xml +++ b/Step.Utils/languages/IT.xml @@ -224,6 +224,7 @@ Positione Tipo Disabilitata + Posizione Nome diff --git a/Step.Utils/languages/en.xml b/Step.Utils/languages/en.xml index dba018a9..bcf3ee5d 100644 --- a/Step.Utils/languages/en.xml +++ b/Step.Utils/languages/en.xml @@ -203,7 +203,7 @@ Name Child Id Multitool Id - Tool Enambled + Tool Enabled Tool Active Tool Inhibited Tool In Fixed Place @@ -223,6 +223,7 @@ Position Id Position Type Disabled + Position Name diff --git a/Step/wwwroot/src/components/depot.vue b/Step/wwwroot/src/components/depot.vue index 07af9e30..fe9cc6d7 100644 --- a/Step/wwwroot/src/components/depot.vue +++ b/Step/wwwroot/src/components/depot.vue @@ -21,8 +21,8 @@ - - + +
@@ -39,6 +39,7 @@ diff --git a/Step/wwwroot/src/components/tooling-shanks.ts b/Step/wwwroot/src/components/tooling-shanks.ts index 3513e629..d5cd3efd 100644 --- a/Step/wwwroot/src/components/tooling-shanks.ts +++ b/Step/wwwroot/src/components/tooling-shanks.ts @@ -54,6 +54,7 @@ export default class toolingShanks extends Vue { public selectedEquipment: any = null; public toolSelected: any = null; + public posSelected: any = null; public enableModify: any = false; @@ -92,6 +93,26 @@ export default class toolingShanks extends Vue { this.disableList = true; } + public availablePosition(pos) { + return !this.selectedTool.childsTools.find( + function (obj){ + return obj.multitoolId==pos + } + ); + } + + public getFirstAvailablePosition(){ + if(!this.selectedTool) + return 0; + var i; + for (i = 1; i < (this.maxToolsPerMultitools+1); i++) { + if(this.availablePosition(i)) + return i; + } + return 0; + + } + public addShank() { this.selectedTool = {}; @@ -178,6 +199,7 @@ export default class toolingShanks extends Vue { // this.enableAddToolToShank = true; this.selectTab(obj); this.toolSelected = response.tools[0]; + this.posSelected = this.getFirstAvailablePosition(); }); // this.disableList = true; // this.enableModify = true; @@ -227,6 +249,14 @@ export default class toolingShanks extends Vue { this.shankConfiguration = (this.$store.state as AppModel).tooling.shankConfiguration; this.disableList = false; + + if(this.shanks.length < this.maxMultitools){ + this.enableAddShank = false; + } + else{ + this.enableAddShank = true; + } + }); } @@ -241,14 +271,7 @@ export default class toolingShanks extends Vue { public addToolsToShank(shank) { let model = this.toolSelected; - for (let l in this.selectedTool.childsTools) { - if (this.selectedTool.childsTools[l].multitoolId) { - model.multitoolId = this.selectedTool.childsTools[l].multitoolId + 1; - } - if (this.selectedTool.childsTools[l].id < 0) { - model.multitoolId = 1; - } - } + model.multitoolId = this.posSelected; new ToolingService().addToolToShank(shank, model).then(response => { this.selectTab(response); for (let l in this.selectedTool.childsTools) { @@ -277,18 +300,23 @@ export default class toolingShanks extends Vue { () => { let model = this.selectedEquipment; new ToolingService().removeToolToShank(shank, model).then(response => { - new DepotService().GetToolAvailable(); this.disableList = false; this.enableParameters = true; this.enableModify = false; this.enableEquipment = false; this.selectedEquipment = null; + for (let l in this.selectedTool.childsTools) { + if (this.selectedTool.childsTools[l].id <= 0) { + this.selectedTool.childsTools.splice(l, 1); + } + } if(this.selectedTool.childsTools.length < this.maxToolsPerMultitools){ this.enableAddChildsTools = false; } else{ this.enableAddChildsTools = true; } + }) }, null); // new ToolingService().SetEdgeData(tool,model).then(response => { @@ -303,7 +331,15 @@ export default class toolingShanks extends Vue { ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_delete", "Richiesta di conferma"), this.$options.filters.localize("modal_confirm_delete_shank", "Confermi la cancellazione del codolo?"), () => { - new ToolingService().DeleteShank(model).then(response => { + new ToolingService().DeleteShank(model).then(response => { + + + if(this.shanks.length < this.maxMultitools){ + this.enableAddShank = false; + } + else{ + this.enableAddShank = true; + } this.selectedEquipment = null; this.enableEquipment = false; this.enableParameters = true; diff --git a/Step/wwwroot/src/components/tooling-shanks.vue b/Step/wwwroot/src/components/tooling-shanks.vue index 16f1a411..e8f45b39 100644 --- a/Step/wwwroot/src/components/tooling-shanks.vue +++ b/Step/wwwroot/src/components/tooling-shanks.vue @@ -39,7 +39,7 @@
@@ -76,9 +76,11 @@
- + + + - +