|
|
@@ -379,56 +379,171 @@ export class SimulationDialogComponent implements OnInit {
|
|
|
await this.timeout(750);
|
|
|
idStep++;
|
|
|
|
|
|
- let stepFive: ExecutionStep = {
|
|
|
- id: idStep,
|
|
|
- icon: 'attach_money',
|
|
|
- label: 'Resultado del costo de los operadores de mantenimiento',
|
|
|
- isMain: true
|
|
|
- }
|
|
|
-
|
|
|
- this.steps.push(stepFive);
|
|
|
- this.scrollToBottom();
|
|
|
- await this.timeout(750);
|
|
|
- idStep++;
|
|
|
-
|
|
|
- let analisisObj = JSON.parse(this.orderSimulation?.ANALISIS!);
|
|
|
- let presonalObj = JSON.parse(this.orderSimulation?.PERSONAL!);
|
|
|
- let teamsConf = analisisObj.teamsConf;
|
|
|
- let totalCost = 0;
|
|
|
- let keys = Object.keys(teamsConf);
|
|
|
+ if(this.includeCharge){
|
|
|
+ let stepFive: ExecutionStep = {
|
|
|
+ id: idStep,
|
|
|
+ icon: 'attach_money',
|
|
|
+ label: 'Resultado del costo de los operadores de mantenimiento',
|
|
|
+ isMain: true
|
|
|
+ }
|
|
|
+
|
|
|
+ this.steps.push(stepFive);
|
|
|
+ this.scrollToBottom();
|
|
|
+ await this.timeout(750);
|
|
|
+ idStep++;
|
|
|
+
|
|
|
+ let analisisObj = JSON.parse(this.orderSimulation?.ANALISIS!);
|
|
|
+ let personalObj = JSON.parse(this.orderSimulation?.PERSONAL!);
|
|
|
+ let teamsConf = analisisObj.teamsConf;
|
|
|
+ let personalTotalCost = 0;
|
|
|
+ let keys = Object.keys(teamsConf);
|
|
|
+
|
|
|
+ for(const key of keys){
|
|
|
+ let teamConf = personalObj.filter((item: any) => item.ID == key)[0];
|
|
|
+ let team = teamsConf[key];
|
|
|
+
|
|
|
+ for(const user of team){
|
|
|
+ let usrLabel = `${user.USER}, ${teamConf.NOMB} - ${teamConf.ESP}, costo por hora: $${user.COST}, horas requeridas: ${user.HOURS}, costo total: $${parseInt(user.COST) * parseInt(user.HOURS)}`;
|
|
|
+ let usrStep: ExecutionStep = {
|
|
|
+ id: idStep,
|
|
|
+ icon: 'remove',
|
|
|
+ label: usrLabel,
|
|
|
+ isMain: false
|
|
|
+ };
|
|
|
+
|
|
|
+ personalTotalCost += parseInt(user.COST) * parseInt(user.HOURS);
|
|
|
+
|
|
|
+ this.steps.push(usrStep);
|
|
|
+ this.scrollToBottom();
|
|
|
+ await this.timeout(500);
|
|
|
+ idStep++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let stepSix: ExecutionStep = {
|
|
|
+ id: idStep,
|
|
|
+ icon: 'payments',
|
|
|
+ label: `Costo total de los operadores: $${personalTotalCost}`,
|
|
|
+ isMain: true
|
|
|
+ };
|
|
|
+
|
|
|
+ this.steps.push(stepSix);
|
|
|
+ this.scrollToBottom();
|
|
|
+ await this.timeout(750);
|
|
|
+ idStep++;
|
|
|
+
|
|
|
+ let stepSeven: ExecutionStep = {
|
|
|
+ id: idStep,
|
|
|
+ icon: 'attach_money',
|
|
|
+ label: `Resultado del costo de las herramientas y refacciones`,
|
|
|
+ isMain: true
|
|
|
+ };
|
|
|
+
|
|
|
+ this.steps.push(stepSeven);
|
|
|
+ this.scrollToBottom();
|
|
|
+ await this.timeout(750);
|
|
|
+ idStep++;
|
|
|
|
|
|
- for(const key of keys){
|
|
|
- let teamConf = presonalObj.filter((item: any) => item.ID == key)[0];
|
|
|
- let team = teamsConf[key];
|
|
|
+ let toolsConf = analisisObj.toolsConf;
|
|
|
+ let toolsTotalCost = 0;
|
|
|
|
|
|
- for(const user of team){
|
|
|
- let usrLabel = `${user.USER}, ${teamConf.NOMB} - ${teamConf.ESP}, costo por hora: $${user.COST}, horas requeridas: ${user.HOURS}, costo total: $${parseInt(user.COST) * parseInt(user.HOURS)}`;
|
|
|
- let usrStep: ExecutionStep = {
|
|
|
+ for(const tool of toolsConf){
|
|
|
+ let toolLabel = `${tool.NOM} - ${tool.REQ} ${tool.UNIT}(s) requerida(s), costo unitario: $${tool.COSTUNIT}, costo total: $${tool.COSTTOTAL}`;
|
|
|
+ let toolStep: ExecutionStep = {
|
|
|
id: idStep,
|
|
|
icon: 'remove',
|
|
|
- label: usrLabel,
|
|
|
+ label: toolLabel,
|
|
|
isMain: false
|
|
|
};
|
|
|
+
|
|
|
+ toolsTotalCost += tool.COSTTOTAL;
|
|
|
+
|
|
|
+ this.steps.push(toolStep);
|
|
|
+ this.scrollToBottom();
|
|
|
+ await this.timeout(500);
|
|
|
+ idStep++;
|
|
|
+ }
|
|
|
|
|
|
- totalCost += parseInt(user.COST) * parseInt(user.HOURS);
|
|
|
+ let sparePartsConf = analisisObj.sparePartsConf;
|
|
|
|
|
|
- this.steps.push(usrStep);
|
|
|
+ for(const part of sparePartsConf){
|
|
|
+ let partLabel = `${part.NOM} - ${part.REQ} ${part.UNIT}(s) requerida(s), costo unitario: $${part.COSTUNIT}, costo total: $${part.COSTTOTAL}`;
|
|
|
+ let partStep: ExecutionStep = {
|
|
|
+ id: idStep,
|
|
|
+ icon: 'remove',
|
|
|
+ label: partLabel,
|
|
|
+ isMain: false
|
|
|
+ };
|
|
|
+
|
|
|
+ toolsTotalCost += part.COSTTOTAL;
|
|
|
+
|
|
|
+ this.steps.push(partStep);
|
|
|
this.scrollToBottom();
|
|
|
await this.timeout(500);
|
|
|
idStep++;
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ let stepEight: ExecutionStep = {
|
|
|
+ id: idStep,
|
|
|
+ icon: 'payments',
|
|
|
+ label: `Costo total de las herramientas y refacciones: $${toolsTotalCost}`,
|
|
|
+ isMain: true
|
|
|
+ };
|
|
|
+
|
|
|
+ this.steps.push(stepEight);
|
|
|
+ this.scrollToBottom();
|
|
|
+ await this.timeout(750);
|
|
|
+ idStep++;
|
|
|
+
|
|
|
+ let stepNine: ExecutionStep = {
|
|
|
+ id: idStep,
|
|
|
+ icon: 'payments',
|
|
|
+ label: `Costo total de la operación: $${personalTotalCost + toolsTotalCost}`,
|
|
|
+ isMain: true
|
|
|
+ };
|
|
|
+
|
|
|
+ this.steps.push(stepNine);
|
|
|
+ this.scrollToBottom();
|
|
|
+ }else{
|
|
|
+ let stepFive: ExecutionStep = {
|
|
|
+ id: idStep,
|
|
|
+ icon: 'engineering',
|
|
|
+ label: 'Operadores de mantenimiento',
|
|
|
+ isMain: true
|
|
|
+ }
|
|
|
|
|
|
- let stepSix: ExecutionStep = {
|
|
|
- id: idStep,
|
|
|
- icon: 'payments',
|
|
|
- label: `Costo total de los operadores: $${totalCost}`,
|
|
|
- isMain: true
|
|
|
- };
|
|
|
+ this.steps.push(stepFive);
|
|
|
+ this.scrollToBottom();
|
|
|
+ await this.timeout(750);
|
|
|
|
|
|
- this.steps.push(stepSix);
|
|
|
- this.scrollToBottom();
|
|
|
- idStep++;
|
|
|
+ let analisisObj = JSON.parse(this.orderSimulation?.ANALISIS!);
|
|
|
+ let personalObj = JSON.parse(this.orderSimulation?.PERSONAL!);
|
|
|
+ let teamsConf = analisisObj.teamsConf;
|
|
|
+ let totalCost = 0;
|
|
|
+ let keys = Object.keys(teamsConf);
|
|
|
+
|
|
|
+ for(const key of keys){
|
|
|
+ let teamConf = personalObj.filter((item: any) => item.ID == key)[0];
|
|
|
+ let team = teamsConf[key];
|
|
|
+
|
|
|
+ for(const user of team){
|
|
|
+ let usrLabel = `${user.USER}, ${teamConf.NOMB} - ${teamConf.ESP}`;
|
|
|
+ let usrStep: ExecutionStep = {
|
|
|
+ id: idStep,
|
|
|
+ icon: 'remove',
|
|
|
+ label: usrLabel,
|
|
|
+ isMain: false
|
|
|
+ };
|
|
|
+
|
|
|
+ totalCost += parseInt(user.COST) * parseInt(user.HOURS);
|
|
|
+
|
|
|
+ this.steps.push(usrStep);
|
|
|
+ this.scrollToBottom();
|
|
|
+ await this.timeout(500);
|
|
|
+ idStep++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
this.simulating = false;
|
|
|
this.hasBeenSimulated = true;
|
|
|
@@ -450,7 +565,7 @@ export class SimulationDialogComponent implements OnInit {
|
|
|
}else if(error.error.msg == undefined){
|
|
|
this.openSnackBar('Ocurrió un error inesperado.');
|
|
|
}else{
|
|
|
- this.openSnackBar(error.error.msg );
|
|
|
+ this.openSnackBar(error.error.msg);
|
|
|
}
|
|
|
}
|
|
|
}
|