|
|
|
@ -162,41 +162,52 @@ export class CanvasShareDataService {
|
|
|
|
|
} |
|
|
|
|
public getCarTypesAndCount(): Map<string, number> { |
|
|
|
|
let cars = new Map<string, number>(); |
|
|
|
|
let ids = new Array(); |
|
|
|
|
this.planSelectData.forEach(element => { |
|
|
|
|
if (element != null) { |
|
|
|
|
let data = JSON.parse(element.data); |
|
|
|
|
|
|
|
|
|
console.log(data.DefinedIncrement); |
|
|
|
|
console.log(data.Increment); |
|
|
|
|
console.log(data.Stock); |
|
|
|
|
|
|
|
|
|
Object.keys(data.DefinedIncrement).forEach(key => { |
|
|
|
|
let name = data.DefinedIncrement[key].Name; |
|
|
|
|
let id = data.DefinedIncrement[key].Id; |
|
|
|
|
if (this.types.includes(name)) { |
|
|
|
|
if (cars.get(name) === undefined) { |
|
|
|
|
cars.set(name, 1); |
|
|
|
|
cars.set(name, 1); |
|
|
|
|
ids.push(id); |
|
|
|
|
} else { |
|
|
|
|
cars.set(name, cars.get(name) + 1); |
|
|
|
|
if (!ids.includes(id)) { |
|
|
|
|
cars.set(name, cars.get(name) + 1); |
|
|
|
|
ids.push(id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
Object.keys(data.Increment).forEach(key => { |
|
|
|
|
let name = data.Increment[key].Name; |
|
|
|
|
let id = data.Increment[key].Id; |
|
|
|
|
if (this.types.includes(name)) { |
|
|
|
|
if (cars.get(name) === undefined) { |
|
|
|
|
cars.set(name, 1); |
|
|
|
|
cars.set(name, 1); |
|
|
|
|
ids.push(id); |
|
|
|
|
} else { |
|
|
|
|
cars.set(name, cars.get(name) + 1); |
|
|
|
|
if (!ids.includes(id)) { |
|
|
|
|
cars.set(name, cars.get(name) + 1); |
|
|
|
|
ids.push(id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
Object.keys(data.Stock).forEach(key => { |
|
|
|
|
let name = data.Stock[key].Name; |
|
|
|
|
let id = data.Stock[key].Id; |
|
|
|
|
if (this.types.includes(name)) { |
|
|
|
|
if (cars.get(name) === undefined) { |
|
|
|
|
cars.set(name, 1); |
|
|
|
|
cars.set(name, 1); |
|
|
|
|
ids.push(id); |
|
|
|
|
} else { |
|
|
|
|
cars.set(name, cars.get(name) + 1); |
|
|
|
|
if (!ids.includes(id)) { |
|
|
|
|
cars.set(name, cars.get(name) + 1); |
|
|
|
|
ids.push(id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|