Преглед на файлове

Corrección orden de trabajo correctivo

Jose Brito преди 1 година
родител
ревизия
4d00ba31dd

+ 8 - 14
sistema-mantenimiento-front/src/app/components/corrective-maintenance/operations-management/corrective-order-form/corrective-order-form.component.ts

@@ -522,10 +522,8 @@ export class CorrectiveOrderFormComponent implements OnInit {
       }else{
         let employeesArr: EmployeesListItem[] = [];
         for(const employee of employees.response){
-          let idEnc = await this._encService.encrypt(`${employee.ID_EMPLOYEE}`);
-
-          employee.NAME = `${employee.NAME} (${employee.ID_EMPLOYEE})`;
-          employee.ID_EMPLOYEE = idEnc;
+          let idDec = await this._encService.decrypt(employee.ID_EMPLOYEE);
+          employee.NAME = `${employee.NAME} (${idDec})`;
 
           if(employee.STATUS == 'Activo'){
             employeesArr.push(employee);
@@ -562,20 +560,18 @@ export class CorrectiveOrderFormComponent implements OnInit {
       }else{
         let subcontratistsArr: SubcontratistItem[] = [];
         for(const subcontratist of subcontratists.response){
-          let idEnc = await this._encService.encrypt(`${subcontratist.ID_SUBCONTRATIST}`);
+          let idDec = await this._encService.decrypt(subcontratist.ID_SUBCONTRATIST);
 
           if(this.correctiveWorkOrder != null){
             let idResponsibleArr = this.correctiveWorkOrder.ID_RESPONSABLE.split('(').reverse();
             let idResponsibleStr = idResponsibleArr[0].replace(')', '');
 
-            if(this.correctiveWorkOrder.TIPO_RESPONSABLE == 'Subcontratista' && subcontratist.ID_SUBCONTRATIST == idResponsibleStr){
-              this.orderFormGroup.controls['responsibleUserControl'].setValue(`${idEnc}|subcontratist`);
+            if(this.correctiveWorkOrder.TIPO_RESPONSABLE == 'Subcontratista' && idDec == idResponsibleStr){
+              this.orderFormGroup.controls['responsibleUserControl'].setValue(`${subcontratist.ID_SUBCONTRATIST}|subcontratist`);
             }
           }
 
-          subcontratist.NAME = `${subcontratist.NAME} (${subcontratist.ID_SUBCONTRATIST})`;
-          subcontratist.ID_SUBCONTRATIST = idEnc;
-
+          subcontratist.NAME = `${subcontratist.NAME} (${idDec})`;
           if(subcontratist.STATUS == 'Activo'){
             subcontratistsArr.push(subcontratist);
           }
@@ -609,10 +605,8 @@ export class CorrectiveOrderFormComponent implements OnInit {
       if(!this.hasError){
         let workTeamsArr: any[] = [];
         for(const workTeam of workTeams.response){
-          let idEnc = await this._encService.encrypt(`${workTeam.WORKTEAM_ID}`);
-
-          workTeam.NAME = `${workTeam.NAME} (${workTeam.WORKTEAM_ID})`;
-          workTeam.WORKTEAM_ID = idEnc;
+          let idDec = await this._encService.decrypt(workTeam.WORKTEAM_ID);
+          workTeam.NAME = `${workTeam.NAME} (${idDec})`;
 
           if(workTeam.STATUS == 'Activo'){
             workTeamsArr.push(workTeam);

+ 4 - 10
sistema-mantenimiento-front/src/app/components/corrective-maintenance/security-management/block-dialog/block-dialog.component.ts

@@ -56,11 +56,8 @@ export class BlockDialogComponent implements OnInit {
       }else{
         let employeesArr: EmployeesListItem[] = [];
         for(const employee of employees.response){
-          let idEnc = await this._encService.encrypt(`${employee.ID_EMPLOYEE}`);
-
-          employee.NAME = `${employee.NAME} (${employee.ID_EMPLOYEE})`;
-          employee.ID_EMPLOYEE = idEnc;
-
+          let idDec = await this._encService.decrypt(employee.ID_EMPLOYEE);
+          employee.NAME = `${employee.NAME} (${idDec})`;
           if(employee.STATUS == 'Activo'){
             employeesArr.push(employee);
           }
@@ -94,11 +91,8 @@ export class BlockDialogComponent implements OnInit {
       if(!this.hasError){
         let subcontratistsArr: SubcontratistItem[] = [];
         for(const subcontratist of subcontratists.response){
-          let idEnc = await this._encService.encrypt(`${subcontratist.ID_SUBCONTRATIST}`);
-
-          subcontratist.NAME = `${subcontratist.NAME} (${subcontratist.ID_SUBCONTRATIST})`;
-          subcontratist.ID_SUBCONTRATIST = idEnc;
-
+          let idDec = await this._encService.decrypt(subcontratist.ID_SUBCONTRATIST);
+          subcontratist.NAME = `${subcontratist.NAME} (${idDec})`;
           if(subcontratist.STATUS == 'Activo'){
             subcontratistsArr.push(subcontratist);
           }

+ 1 - 1
sistema-mantenimiento-front/src/app/components/corrective-maintenance/security-management/security-management.component.html

@@ -122,7 +122,7 @@
           <button mat-raised-button color="primary" class="override_no_shadow mr-10 animated fadeIn" (click)="openBlockDialog()">
             <mat-icon>add</mat-icon> Añadir bloqueo
           </button>
-          <button mat-mini-fab class="cyan_dark_background white_font override_no_shadow mr-10" matTooltip="Actualizar datos" (click)="getSecurityManagements()">
+          <button mat-mini-fab class="cyan_dark_background white_font override_no_shadow mr-10" matTooltip="Actualizar datos" (click)="getBlockRegisters()">
             <mat-icon>refresh</mat-icon>
           </button>
         </div>

+ 1 - 1
sistema-mantenimiento-front/src/app/components/corrective-maintenance/security-management/security-management.component.ts

@@ -354,7 +354,7 @@ export class SecurityManagementComponent implements OnInit {
       await lastValueFrom(this._correctiveMaintenanceService.registerBlock(formData));
 
       this._resourcesService.openSnackBar('El bloqueo se agregó correctamente.');
-      console.log(formData);
+      this.getBlockRegisters();
     }catch(error: any){
       if(error.error == undefined){
         this._resourcesService.openSnackBar('Ocurrió un error inesperado');

+ 2 - 3
sistema-mantenimiento-front/src/app/components/system-admin/architecture-monitoring/architecture-monitoring.component.ts

@@ -95,9 +95,9 @@ export class ArchitectureMonitoringComponent implements OnInit {
       }
     }catch(error: any){
       if(error.error == undefined){
-        this._resourcesService.openSnackBar('Ocurrió un error inesperado.');
+        this._resourcesService.openSnackBar('Ocurrió un error inesperado (1).');
       }else if(error.error.msg == undefined){
-        this._resourcesService.openSnackBar('Ocurrió un error inesperado.');
+        this._resourcesService.openSnackBar('Ocurrió un error inesperado (2).');
       }else{
         this._resourcesService.openSnackBar(error.error.msg);
       }
@@ -254,7 +254,6 @@ export class ArchitectureMonitoringComponent implements OnInit {
         }
       }
     }catch(error: any){
-      this._resourcesService.openSnackBar('Ocurrió un error inesperado.');
     }
   }
 

+ 2 - 0
sistema-mantenimiento-front/src/app/components/template/template.component.ts

@@ -498,6 +498,8 @@ export class TemplateComponent implements OnInit {
 
       this._socketService.notificationPublished().subscribe(async (notificationData) => {
         try{
+          console.log(notificationData);
+          
           let audienceStr = await this._encService.decrypt(notificationData.audience);
           let audienceArr = JSON.parse(audienceStr);