diff --git a/Step/wwwroot/src/@types/tooling.d.ts b/Step/wwwroot/src/@types/tooling.d.ts index 02625e44..6fd773f0 100644 --- a/Step/wwwroot/src/@types/tooling.d.ts +++ b/Step/wwwroot/src/@types/tooling.d.ts @@ -87,7 +87,11 @@ declare module server { } export interface EdgesData { - + id: number, + residualLife: number, + nominalLife: number, + preAlmLife: number, + edgeAdditionalParams: Object } export interface Families { diff --git a/Step/wwwroot/src/components/tooling-equipment.ts b/Step/wwwroot/src/components/tooling-equipment.ts index 12e4e707..9d075fc1 100644 --- a/Step/wwwroot/src/components/tooling-equipment.ts +++ b/Step/wwwroot/src/components/tooling-equipment.ts @@ -12,7 +12,7 @@ export default class toolingEquipment extends Vue { public toolsConfiguration: server.ToolsConfiguration[] = null; - public get edgeConfiguration(): server.EdgeConfiguration[] { return (this.$store.state as AppModel).tooling.edgesConfiguration; } + public edgeConfiguration: server.EdgeConfiguration[] = null; public selectedTool: any = null; public selectedEquipment: any = null; @@ -45,6 +45,7 @@ export default class toolingEquipment extends Vue { await new ToolingService().GetEdgeAdditionalParamsConfiguration(); this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; + this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; } public selectTool(item){ @@ -78,6 +79,7 @@ export default class toolingEquipment extends Vue { } else if (elem){ this.selectedEquipment = elem; + console.log(this.selectedEquipment); this.enableEquipment = true; this.enableParameters = false; } @@ -103,20 +105,25 @@ export default class toolingEquipment extends Vue { private internalCounter = -1; public addEdge(){ - debugger; + debugger + this.edgeConfiguration = []; var obj = { edgeAdditionalParams:{}}; - for (const key in this.edgeConfiguration) { - const element = this.edgeConfiguration[key]; - obj[element.name] = null; + for (const key in (this.$store.state as AppModel).tooling.edgesConfiguration) { + const element = (this.$store.state as AppModel).tooling.edgesConfiguration[key]; + if (!element.readOnly) { + this.edgeConfiguration.push(element); + } + obj[element.name] = 0; } let fields = this.getDynamicFields(this.selectedTool.toolType); for (const key in fields) { const element = fields[key]; - obj.edgeAdditionalParams[element] = null; + obj.edgeAdditionalParams[element] = 0; } obj["id"] = this.internalCounter--; this.selectedTool.edgesData.push(obj); + console.log(this.selectedTool.edgesData); } async save(item) { @@ -126,13 +133,64 @@ export default class toolingEquipment extends Vue { htmlelement.scrollTop = htmlelement.scrollHeight; this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; + this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; }); } async modify(model) { - debugger new ToolingService().UpdateSiemensTool(model).then(response => { this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; + this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; + }); + } + + async saveEdge(tool, model){ + debugger + delete model.id; + new ToolingService().SetEdgeData(tool,model).then(response => { + this.selectedEquipment = response; + + this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; + this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; + }); + } + + async modifyEdge(tool, model){ + debugger + new ToolingService().UpdateEdgeData(tool,model).then(response => { + this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; + this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; + }); + } + + async buttonSave(tool: any, edge: any){ + debugger + if(tool.id){ + if(edge.id >= 0){ + this.modifyEdge(tool, edge); + } + else if (edge.id == -1){ + this.saveEdge(tool, edge); + } + else{ + this.modify(tool); + } + } + else{ + this.save(tool); + } + } + + async deleteTool(model) { + new ToolingService().DeleteTool(model).then(response => { + this.selectedTool = null; + }); + } + + async deleteEdgeData(tool, model){ + debugger + new ToolingService().DeleteEdgeData(tool, model).then(response => { + this.selectedTool = null; }); } diff --git a/Step/wwwroot/src/components/tooling-equipment.vue b/Step/wwwroot/src/components/tooling-equipment.vue index b24c8789..f63fa691 100644 --- a/Step/wwwroot/src/components/tooling-equipment.vue +++ b/Step/wwwroot/src/components/tooling-equipment.vue @@ -34,11 +34,11 @@