families, shanks, magazines positions
This commit is contained in:
Vendored
+29
@@ -30,4 +30,33 @@ declare module server{
|
||||
preAlarm: boolean,
|
||||
edgesData: object
|
||||
}
|
||||
export interface Families{
|
||||
id: number,
|
||||
familyName: string,
|
||||
childsTools: Array<ChildsTools>
|
||||
}
|
||||
export interface ChildsTools{
|
||||
id: number,
|
||||
type: number,
|
||||
childId: number
|
||||
}
|
||||
|
||||
export interface Shanks{
|
||||
id: number,
|
||||
childsTools: Array<ShanksChildsTools>
|
||||
}
|
||||
|
||||
export interface ShanksChildsTools{
|
||||
toolId: number,
|
||||
childId: number,
|
||||
familyName: string,
|
||||
type: number
|
||||
}
|
||||
|
||||
export interface MagazinesPositions{
|
||||
id: number,
|
||||
magazineId: number,
|
||||
type: number
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ async function loadMachineConfig() {
|
||||
ds.GetNcSoftKeysConfiguration();
|
||||
ds.GetHeadsConfiguration();
|
||||
ts.GetToolTableConfiguration();
|
||||
ts.GetFamilies();
|
||||
ts.GetShanks();
|
||||
ts.GetMagazinesPositions();
|
||||
|
||||
// load default language
|
||||
if ((store.state as AppModel).localization.currentLanguage == "")
|
||||
|
||||
@@ -14,4 +14,20 @@ export class ToolingService extends baseRestService {
|
||||
let result = await this.Get<server.Tool[]>("api/tool_table/tools");
|
||||
toolingActions.updateTools(store, result);
|
||||
}
|
||||
|
||||
async GetFamilies(){
|
||||
let result = await this.Get<server.Families[]>("api/tool_table/families");
|
||||
toolingActions.updateFamilies(store, result);
|
||||
console.log(result);
|
||||
}
|
||||
async GetShanks(){
|
||||
let result = await this.Get<server.Shanks[]>("api/tool_table/shanks");
|
||||
toolingActions.updateShanks(store, result);
|
||||
console.log(result);
|
||||
}
|
||||
async GetMagazinesPositions(){
|
||||
let result = await this.Get<server.MagazinesPositions[]>("api/tool_table/magazines_positions");
|
||||
toolingActions.updateMagazinesPositions(store, result);
|
||||
console.log(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,18 @@ export interface ToolingStoreModel {
|
||||
magazines: Array<server.MagazineModel>
|
||||
fieldsConfiguration: Array<Object>
|
||||
tools: Array<server.Tool>
|
||||
families: Array<server.Families>
|
||||
shanks: Array<server.Shanks>
|
||||
magazinesPositions: Array<server.MagazinesPositions>
|
||||
}
|
||||
|
||||
export interface ToolingActions {
|
||||
updateMagazine(context, model: server.MagazineModel[]);
|
||||
updateTool(context, model: server.Tool);
|
||||
updateTools(context, model: server.Tool[]);
|
||||
updateFamilies(context, model: server.Families[]);
|
||||
updateShanks(context, model: server.Shanks[]);
|
||||
updateMagazinesPositions(context, model: server.MagazinesPositions[]);
|
||||
}
|
||||
|
||||
export const toolingStore = {
|
||||
@@ -17,7 +23,10 @@ export const toolingStore = {
|
||||
magazines: [],
|
||||
fieldsConfiguration: [],
|
||||
_tools: new Map<number, server.Tool>(),
|
||||
tools: []
|
||||
tools: [],
|
||||
families: [],
|
||||
shanks: [],
|
||||
magazinesPositions: []
|
||||
} as ToolingStoreModel,
|
||||
mutations: {
|
||||
UpdateMagazine(store, model: server.MagazineModel[]) {
|
||||
@@ -28,6 +37,21 @@ export const toolingStore = {
|
||||
UpdateTool(store, model: server.Tool) {
|
||||
store._tools.set(model.id, model);
|
||||
store.tools = Array.from(store._tools.values());
|
||||
},
|
||||
UpdateFamilies(store, model: server.Families[]){
|
||||
for (const key in model){
|
||||
store.families.push(model[key]);
|
||||
}
|
||||
},
|
||||
UpdateShanks(store, model: server.Shanks[]){
|
||||
for (const key in model){
|
||||
store.shanks.push(model[key]);
|
||||
}
|
||||
},
|
||||
UpdateMagazinesPositions(store, model: server.MagazinesPositions[]){
|
||||
for (const key in model){
|
||||
store.magazinesPositions.push(model[key]);
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -42,6 +66,15 @@ export const toolingStore = {
|
||||
const element = model[key];
|
||||
context.commit("UpdateTool", element);
|
||||
}
|
||||
},
|
||||
updateFamilies(context, model: server.Families[]){
|
||||
context.commit("UpdateFamilies", model);
|
||||
},
|
||||
updateShanks(context, model: server.Shanks[]){
|
||||
context.commit("UpdateShanks", model);
|
||||
},
|
||||
updateMagazinesPositions(context, model: server.MagazinesPositions[]){
|
||||
context.commit("UpdateMagazinesPositions", model);
|
||||
}
|
||||
|
||||
} as ToolingActions
|
||||
|
||||
Reference in New Issue
Block a user