Fix Shanks behaviour

This commit is contained in:
Nicola Carminati
2018-05-31 12:57:38 +02:00
parent 6af1d7e562
commit b9c316e8d0
4 changed files with 66 additions and 13 deletions
+1
View File
@@ -224,6 +224,7 @@
<tooling_equipment_param_magpos_positionId>Positione</tooling_equipment_param_magpos_positionId>
<tooling_equipment_param_magpos_type>Tipo</tooling_equipment_param_magpos_type>
<tooling_equipment_param_magpos_disabled>Disabilitata</tooling_equipment_param_magpos_disabled>
<tooling_equipment_param_position>Posizione</tooling_equipment_param_position>
<tooling_family_param_name>Nome</tooling_family_param_name>
<!-- Tool Manager - Cutting-Edge Param -->
+2 -1
View File
@@ -203,7 +203,7 @@
<tooling_equipment_param_name>Name</tooling_equipment_param_name>
<tooling_equipment_param_childId>Child Id</tooling_equipment_param_childId>
<tooling_equipment_param_multitoolId>Multitool Id</tooling_equipment_param_multitoolId>
<tooling_equipment_param_isEnabled>Tool Enambled</tooling_equipment_param_isEnabled>
<tooling_equipment_param_isEnabled>Tool Enabled</tooling_equipment_param_isEnabled>
<tooling_equipment_param_isActive>Tool Active</tooling_equipment_param_isActive>
<tooling_equipment_param_isInhibited>Tool Inhibited</tooling_equipment_param_isInhibited>
<tooling_equipment_param_inFixedPlace>Tool In Fixed Place</tooling_equipment_param_inFixedPlace>
@@ -223,6 +223,7 @@
<tooling_equipment_param_magpos_positionId>Position Id</tooling_equipment_param_magpos_positionId>
<tooling_equipment_param_magpos_type>Position Type</tooling_equipment_param_magpos_type>
<tooling_equipment_param_magpos_disabled>Disabled</tooling_equipment_param_magpos_disabled>
<tooling_equipment_param_position>Position</tooling_equipment_param_position>
<tooling_family_param_name>Name</tooling_family_param_name>
+58 -9
View File
@@ -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) {
@@ -256,6 +279,12 @@ export default class toolingShanks extends Vue {
this.selectedTool.childsTools.splice(l, 1);
}
}
if(this.selectedTool.childsTools.length < this.maxToolsPerMultitools){
this.enableAddChildsTools = false;
}
else{
this.enableAddChildsTools = true;
}
this.disableList = false;
})
// new ToolingService().SetEdgeData(tool,model).then(response => {
@@ -276,6 +305,18 @@ export default class toolingShanks extends Vue {
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 => {
@@ -290,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;
@@ -39,7 +39,7 @@
<button class="tab" :class="{'active': enableParameters}" @click="selectTab('Parameters')">{{'tooling_parameters_tab' | localize("Parametri")}}</button>
<div class="tab-box-scroll scrollable">
<button v-for="ct in selectedTool.childsTools" :key="ct.id" class="tab" :class="{'active': selectedEquipment == ct}" v-if="ct.id != null" @click="selectTab(ct)">
<span v-if="ct.id>0">{{'tooling_childtoolsshanks_skill_tools' | localize("Utensile %d",ct.id)}}</span>
<span v-if="ct.id>0">{{'tooling_childtoolsshanks_skill_tools' | localize("Utensile %s",ct.id)}}</span>
<span v-if="!ct.id || ct.id<=0">{{'tooling_childtoolsshanks_new' | localize("Aggiungi Utensile")}}</span>
</button>
<div class="tab plus" :class="{'avoid-clicks': enableAddChildsTools}">
@@ -76,9 +76,11 @@
<div class="list-skill-shanks scrollable">
<div class="list-skill-shanks-category">
<div class="skill-shanks-category">
<input-box type="select" :title="'tooling_equipment_param_Position' | localize('Posizione')" v-model="posSelected">
<option v-for="(s) in this.maxMultitools" v-if="availablePosition(s)" :key="s" :value="s">{{s}}</option>
</input-box>
<input-box type="select" :title="'tooling_equipment_param_id' | localize('Id Utensile')" v-model="toolSelected">
<option v-for="(s, k) in availableTools" :key="k" :value="s">{{s.id}}</option>
<option v-for="(s, k) in availableTools" :key="k" :value="s">{{s.familyName}} - {{s.id}}</option>
</input-box>
</div>
</div>