diff --git a/Step/wwwroot/src/components/tooling/tooling-depot.ts b/Step/wwwroot/src/components/tooling/tooling-depot.ts index 5918f91b..11770b0f 100644 --- a/Step/wwwroot/src/components/tooling/tooling-depot.ts +++ b/Step/wwwroot/src/components/tooling/tooling-depot.ts @@ -53,6 +53,12 @@ export default class depot extends Vue { return this.getAvaiableTools[index - this.getAvaiableMultiTools.length]; } + public getPayloadForNcAvailableShank(index: number): any{ + if (index < this.getNcAvailableShank.length){ + return this.getNcAvailableShank[index]; + } + } + public onDrag({ isSource, payload, willAcceptDrop }) { this.draggingIn = true; this.draggingTool = payload; @@ -288,13 +294,28 @@ export default class depot extends Vue { alert("sadasdsa"); } - public toolIsInError(tool) { + public toolIsInWarning(tool){ if (tool) return (this.$store.getters as ToolingGetters).toolIsInWarning(tool.id); else return null; } + public ncShankgIsInWarning(shank){ + return (this.$store.getters as ToolingGetters).ncShankIsInWarning(shank.id); + } + + public toolIsInError(model) { + if(model){ + if(this.typeNc == "Demo"){ + this.toolIsInWarning(model) + } + else{ + this.ncShankgIsInWarning(model); + } + } + } + public returnChild(elem) { if (!elem) return null; @@ -466,11 +487,11 @@ export default class depot extends Vue { if (this.draggingTool && this.draggingPosition == position.positionId) { if (this.ncToolAtPosition(position.positionId) || position.disabled || !this.checkMagPosType(position.type)) return - this.draggingIn = false; this.draggingTool = null; - var toolToAdd = event.payload; - new DepotService().AddToolToDepotNc(this.depotId, position.positionId, { toolId: toolToAdd.id }).then(response => { + var shankToAdd = event.payload; + + new DepotService().AddToolToDepotNc(this.depotId, position.positionId, { shankId: shankToAdd.id }).then(response => { }); } @@ -487,7 +508,11 @@ export default class depot extends Vue { // new DepotService().AddToolToDepotNc(this.depotId, position.positionId, { toolId: toolToAdd.id }).then(response => { // }); - public removeToolsToDepot(position, toolToAdd) { + public removeToolsToDepot(position, model) { + debugger + if(model.shankId){ + model.id = model.shankId; + } if (this.editable){ if(this.typeNc == "Demo"){ new DepotService().RemoveToolToDepot(this.depotId, position).then(response => { @@ -495,7 +520,7 @@ export default class depot extends Vue { }); } else{ - new DepotService().RemoveToolToDepotNc(this.depotId, position).then(response => { + new DepotService().RemoveToolToDepotNc(this.depotId, position, {shankId: model.id}).then(response => { }); } diff --git a/Step/wwwroot/src/components/tooling/tooling-depot.vue b/Step/wwwroot/src/components/tooling/tooling-depot.vue index 88a91789..98480c16 100644 --- a/Step/wwwroot/src/components/tooling/tooling-depot.vue +++ b/Step/wwwroot/src/components/tooling/tooling-depot.vue @@ -123,7 +123,7 @@
- +
@@ -150,11 +150,11 @@ {{'depot_avaiable_position' | localize("Posizione disponibile")}} diff --git a/Step/wwwroot/src/services/depotService.ts b/Step/wwwroot/src/services/depotService.ts index be380cbc..6a0f6aba 100644 --- a/Step/wwwroot/src/services/depotService.ts +++ b/Step/wwwroot/src/services/depotService.ts @@ -42,9 +42,9 @@ export class DepotService extends baseRestService { return result; } - async AddToolToDepotNc(magazineId, positionId, toolId) { - let result = await this.Put < any > (this.BASE_URL + "nc/magazine/" + magazineId + "/load/position/" + positionId, toolId); - depotActions.setDepot(store, result); + async AddToolToDepotNc(magazineId, positionId, shankId) { + let result = await this.Put < any > (this.BASE_URL + "nc/magazine/" + magazineId + "/load/position/" + positionId, shankId); + depotActions.setNcDepot(store, result); this.GetNcShankAvailable(); return result; } @@ -56,8 +56,8 @@ export class DepotService extends baseRestService { return result; } - async RemoveToolToDepotNc(magazineId, positionId) { - let result = await this.Put < any > (this.BASE_URL + "nc/magazine/" + magazineId + "/unload/position/" + positionId, {}); + async RemoveToolToDepotNc(magazineId, positionId, model) { + let result = await this.Put < any > (this.BASE_URL + "nc/magazine/" + magazineId + "/unload/position/" + positionId, model); depotActions.removeNcShankFromDepot(store, {magazineId:magazineId, positionId:positionId}as server.DepotNcModel); this.GetNcShankAvailable(); return result; diff --git a/Step/wwwroot/src/store/depot.store.ts b/Step/wwwroot/src/store/depot.store.ts index 47394448..b9a67012 100644 --- a/Step/wwwroot/src/store/depot.store.ts +++ b/Step/wwwroot/src/store/depot.store.ts @@ -11,7 +11,8 @@ export interface DepotStoreModel { export interface DepotActions { updateDepot(context, model:server.DepotModel[]); updateNcDepot(context, model: server.DepotNcModel[]); - setDepot(context, model:server.DepotModel); + setDepot(context, model:server.DepotModel); + setNcDepot(context, model: server.DepotNcModel); removeToolFromDepot(context, model:server.DepotModel); removeNcShankFromDepot(context, model: server.DepotNcModel); updateAvailableMultiTool(context, model:server.MultiTools[]); @@ -54,7 +55,16 @@ export interface DepotStoreModel { else{ store.depot.push(model); } - }, + }, + setNcDepot(store, model: server.DepotNcModel){ + let d = store.depotNc.find(d => model.positionId == d.positionId && model.magazineId == d.magazineId); + if(d){ + store.depotNc.splice(store.depot.indexOf(d), 1, model); + } + else{ + store.depotNc.push(model); + } + }, RemoveToolFromDepot(store, model:server.DepotModel) { let d = store.depot.find(d => model.positionId == d.positionId && model.magazineId == d.magazineId); if (d) { @@ -102,7 +112,10 @@ export interface DepotStoreModel { actions: { setDepot(context, model:server.DepotModel) { context.commit("setDepot", model); - }, + }, + setNcDepot(context, model: server.DepotNcModel){ + context.commit("setNcDepot", model); + }, updateDepot(context, model:server.DepotModel[]) { context.commit("UpdateDepot", model); }, diff --git a/Step/wwwroot/src/store/tooling.store.ts b/Step/wwwroot/src/store/tooling.store.ts index c49b314e..035daaf2 100644 --- a/Step/wwwroot/src/store/tooling.store.ts +++ b/Step/wwwroot/src/store/tooling.store.ts @@ -33,6 +33,7 @@ export interface ToolingStoreModel { export interface ToolingGetters{ toolIsInWarning : (id) => boolean; + ncShankIsInWarning : (id) => boolean; positionCompatible : (id,posType) => boolean; } @@ -157,6 +158,15 @@ export const toolingStore = { } }, + ncShankIsInWarning : (state) => (id) : boolean =>{ + let ncShank = state.ncShanks.find(t => t.id === id); + if(ncShank){ + return ncShank.disabled || ncShank.broken || ncShank.residualLife <= 0; + } + else{ + return null + } + }, positionCompatible : (state) => (id,posType) : boolean =>{ if(!posType || posType==0)