utensili taglienti
This commit is contained in:
Vendored
+5
-1
@@ -87,7 +87,11 @@ declare module server {
|
||||
}
|
||||
|
||||
export interface EdgesData {
|
||||
|
||||
id: number,
|
||||
residualLife: number,
|
||||
nominalLife: number,
|
||||
preAlmLife: number,
|
||||
edgeAdditionalParams: Object
|
||||
}
|
||||
|
||||
export interface Families {
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
<button class="tab" :class="{'active': enableParameters}" @click="selectTab('Parameters')">Parametri</button>
|
||||
<div class="tab-box-scroll scrollable">
|
||||
<button v-for="ed in selectedTool.edgesData" :key="ed.id" class="tab" :class="{'active': selectedEquipment == ed}" @click="selectTab(ed)">{{'tooling_edgesdataequip_skill_tools' | localize("Tagliente")}} {{ed.id}}</button>
|
||||
<button class="tab" :class="{'active': enableParameters}" @click="addEdge()">+</button>
|
||||
<button class="tab" @click="addEdge()">+</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-right-body" v-if="enableParameters">
|
||||
<button class="btn"><i class="fa fa-trash"></i></button>
|
||||
<button class="btn" @click="deleteTool(selectedTool)"><i class="fa fa-trash"></i></button>
|
||||
<div class="box-right-label-header">Modifica di {{selectedTool.id}} {{selectedTool.familyName}}</div>
|
||||
<div class="list-skill-equipment scrollable">
|
||||
<div class="list-skill-equipment-category" v-for="c in categories" :key="c">
|
||||
@@ -54,14 +54,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-right-body" v-if="enableEquipment">
|
||||
<button class="btn"><i class="fa fa-trash"></i></button>
|
||||
<button class="btn" @click="deleteEdgeData(selectedTool,selectedEquipment)"><i class="fa fa-trash"></i></button>
|
||||
<div class="box-right-label-header">{{'tooling_edgesdata_skill_tools' | localize("Tagliente")}} {{(selectedEquipment.id > 0 ? selectedEquipment.id : "")}}</div>
|
||||
<div class="list-skill-equipment scrollable">
|
||||
<div v-for="ed in selectedTool.edgesData" :key="ed.id" v-if="selectedEquipment == ed" class="list-skill-equipment-category" >
|
||||
<div v-for="c in categoriesEdge" :key="c" class="skill-equipment-category">
|
||||
<div class="skill-equipment-category">{{'tooling_equipment_list_category_' + c | localize(c)}}</div>
|
||||
<div v-for="ce in categoriesEdge" :key="ce" class="skill-equipment-category">
|
||||
<div class="skill-equipment-category">{{'tooling_equipment_list_category_' + ce | localize(ce)}}</div>
|
||||
<input-box v-for="c in edgeConfiguration" :key="c.name"
|
||||
v-if="c.name != ''"
|
||||
v-if="c.name != '' && c.category == ce"
|
||||
v-model="ed[c.name]"
|
||||
:read-only="c.readOnly"
|
||||
:title="c.name | localize(c.name)" :type="c.type">
|
||||
@@ -83,7 +83,7 @@
|
||||
</div>
|
||||
<div class="tooling-equipment-footer">
|
||||
<button class="btn" @click="cancel('/tooling')">{{'tooling_equipment_button_cancel' | localize("Annulla")}}</button>
|
||||
<button class="btn blue-reverse" @click="selectedTool.id ? modify(selectedTool) : save(selectedTool)">{{'tooling_equipment_button_save' | localize("Salva")}}</button>
|
||||
<button class="btn blue-reverse" @click="buttonSave(selectedTool, selectedEquipment)">{{'tooling_equipment_button_save' | localize("Salva")}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -122,14 +122,34 @@ export class ToolingService extends baseRestService {
|
||||
return response;
|
||||
}
|
||||
async UpdateSiemensTool(model: any){
|
||||
debugger
|
||||
var response = await this.Put<any>("/api/tool_table/siemens/tool/" + model.id, model);
|
||||
// debo salvare il modello perchè le families non hanno ID e quindi devo utilizzare il vecchio ID che mi genero lato client.
|
||||
toolingActions.updateTool(store, model);
|
||||
return response;
|
||||
}
|
||||
async DeleteTool(id: any) {
|
||||
await this.Delete<any>("/api/tool_table/tool/" + id);
|
||||
async DeleteTool(model: any) {
|
||||
debugger
|
||||
var result = await this.Delete<any>("/api/tool_table/tool/" + model.id);
|
||||
toolingActions.deleteTool(store, model);
|
||||
return result;
|
||||
}
|
||||
async SetEdgeData(tool: any,model: any){
|
||||
debugger
|
||||
var result = await this.Post<any>("/api/tool_table/tool/" + tool.id + "/edge", model);
|
||||
toolingActions.updateEdgeData(store, result);
|
||||
return result;
|
||||
}
|
||||
async UpdateEdgeData(tool: any, model: any){
|
||||
debugger
|
||||
var result = await this.Put<any>("/api/tool_table/tool/"+ tool.id + "/edge/" + model.id, model);
|
||||
toolingActions.updateEdgeData(store, model);
|
||||
return result;
|
||||
}
|
||||
async DeleteEdgeData(tool: any, model: any){
|
||||
debugger
|
||||
var result = await this.Delete<any>("/api/tool_table/tool/" + tool.id + "/edge/" + model.id);
|
||||
toolingActions.deleteEdgeData(store, model);
|
||||
return result;
|
||||
}
|
||||
async DeleteFamily(model: any) {
|
||||
var result = await this.Delete<any>("/api/tool_table/family/" + model.oldName);
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface ToolingStoreModel {
|
||||
magazinePosConfiguration: Array<server.MagazinePosConfiguration>
|
||||
edgesConfiguration: Array<server.EdgeConfiguration>
|
||||
edgesAdditionalParamsConfiguration: Map<string, Array<string>>
|
||||
edgesData: Array<server.EdgesData>
|
||||
}
|
||||
|
||||
export interface ToolingActions {
|
||||
@@ -43,9 +44,12 @@ export interface ToolingActions {
|
||||
updateEdgeConfiguration(context, model: server.EdgeConfiguration);
|
||||
updateEdgeConfigurations(context, model: server.EdgeConfiguration[]);
|
||||
updateEdgeAdditionalParamsConfiguration(context, model: Map<string, Array<string>>);
|
||||
updateEdgeData(context, model: server.EdgesData);
|
||||
|
||||
deleteFamily(context, familyName: string);
|
||||
deleteShank(context, model: server.Shanks);
|
||||
deleteTool(context, model: server.Tool);
|
||||
deleteEdgeData(context, model: server.EdgesData);
|
||||
}
|
||||
|
||||
export const toolingStore = {
|
||||
@@ -74,7 +78,8 @@ export const toolingStore = {
|
||||
edgesConfiguration: [],
|
||||
_edgesConfiguration: new Map<string, server.EdgeConfiguration>(),
|
||||
edgesAdditionalParamsConfiguration: null,
|
||||
test: 0
|
||||
edgesData: [],
|
||||
_edgesData: new Map<number, server.EdgesData>()
|
||||
} as ToolingStoreModel,
|
||||
mutations: {
|
||||
UpdateMagazine(store, model: server.MagazineModel[]) {
|
||||
@@ -83,10 +88,13 @@ export const toolingStore = {
|
||||
}
|
||||
},
|
||||
UpdateTool(store, model: server.Tool) {
|
||||
debugger
|
||||
store._tools.set(model.id, model);
|
||||
store.tools = Array.from(store._tools.values());
|
||||
},
|
||||
UpdateEdgeData(store, model: server.EdgesData){
|
||||
store._edgesData.set(model.id, model);
|
||||
store.edgesData = Array.from(store._edgesData.values());
|
||||
},
|
||||
UpdateFamily(store, model: any) {
|
||||
if (!model.uid)
|
||||
model.uid = UUID("-");
|
||||
@@ -144,6 +152,15 @@ export const toolingStore = {
|
||||
store._shanks.delete(model.id);
|
||||
store.shanks = Array.from(store._shanks.values());
|
||||
},
|
||||
DeleteTool(store, model: server.Tool) {
|
||||
debugger
|
||||
store._tools.delete(model.id);
|
||||
store.tools = Array.from(store._tools.values());
|
||||
},
|
||||
DeleteEdgeData(store, model: server.EdgesData){
|
||||
store._edgesData.delete(model.id);
|
||||
store.edgesData = Array.from(store._edgesData.values());
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
deleteFamily(context, familyname: string) {
|
||||
@@ -152,6 +169,12 @@ export const toolingStore = {
|
||||
deleteShank(context, model: server.Shanks) {
|
||||
context.commit("DeleteShank", model);
|
||||
},
|
||||
deleteTool(context, model: server.Tool){
|
||||
context.commit("DeleteTool", model);
|
||||
},
|
||||
deleteEdgeData(context, model: server.EdgesData){
|
||||
context.commit("DeleteEdgeData", model);
|
||||
},
|
||||
modifyFamily(context, { oldName, model }) {
|
||||
context.commit("ModifyFamily", { oldName, model });
|
||||
},
|
||||
@@ -161,6 +184,9 @@ export const toolingStore = {
|
||||
modifyMagPos(context, model: server.MagazinesPositions) {
|
||||
context.commit("ModifyMagPos", model);
|
||||
},
|
||||
updateEdgeData(context, model: server.EdgesData){
|
||||
context.commit("UpdateEdgeData", model);
|
||||
},
|
||||
updateMagazine(context, model: server.MagazineModel[]) {
|
||||
context.commit("UpdateMagazine", model);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user