浏览代码

Combinación de avancess API

Jose Brito 2 年之前
父节点
当前提交
e9978416fa

+ 27 - 0
sistema-mantenimiento-back/app/Http/Controllers/CountersActivatorsController.php

@@ -98,6 +98,32 @@ class CountersActivatorsController extends Controller{
             ['ACTI_TIAC', '=', $type]
         ])->get()->all();
 
+        foreach($activators as $key=>$activator){
+            $activator->IDACTIVADOR = $this->encryptionController->encrypt($activator->IDACTIVADOR);
+            $activator->PRIORIDAD = $this->encryptionController->encrypt($activator->PRIORIDAD);
+
+            if($activator->TIPOACTIVACION == 'Medida' || $activator->TIPOACTIVACION == 'Valor'){
+                $activationConfigArr = json_decode($activator->CONDICIONES, true);
+                $magnitude = DB::table('S002V01TMAGN')->where([
+                    ['MAGN_NULI', '=', $line],
+                    ['MAGN_IDMA', '=', $activationConfigArr['magnitude']]
+                ])->first();
+
+                $unit = DB::table('S002V01TLIME')->where([
+                    ['LIME_NULI', '=', $line],
+                    ['LIME_IDME', '=', $activationConfigArr['unit']],
+                    ['LIME_MAGN', '=', $activationConfigArr['magnitude']],
+                ])->first();
+
+                $activationConfigArr['magnitude'] = $magnitude->MAGN_MAGN . " (" . $activationConfigArr['magnitude']  . ")";
+                $activationConfigArr['unit'] = $unit->LIME_ACME . " - " . $unit->LIME_NOME . " (" . $activationConfigArr['unit']  . ")";
+
+                $activator->CONDICIONES = json_encode($activationConfigArr);
+            }
+
+            $activators[$key] = $activator;
+        }
+
         $now = $this->functionsController->now();
         $nowStr = $now->toDateTimeString();
         $actions = DB::getQueryLog();
@@ -554,6 +580,7 @@ class CountersActivatorsController extends Controller{
             'CONA_UTTI' => $form['time_interval_tolerance_unit'],
             'CONA_IDSC' => $idSCADA,
             'CONA_COEQ' => $equipmentCode,
+            'CONA_COVI' => '[]',
             'CONA_USRE' => $idUser,
             'CONA_FERE' => $nowStr,
         ]);

文件差异内容过多而无法显示
+ 682 - 682
sistema-mantenimiento-back/app/Http/Controllers/DocumentManagementController.php


+ 10 - 11
sistema-mantenimiento-back/app/Http/Controllers/EquipmentManagementController.php

@@ -124,6 +124,7 @@ class EquipmentManagementController extends Controller{
             'FAMI_COFA AS CODIGOFAMILIA',
             'FAMI_NOFA AS NOMBREFAMILIA',
             'FAMI_ICON AS ICONO',
+            'FAMI_ICPE AS ICONO_PERSONALIZADO',
             'FAMI_ESTA AS ESTADO',
             'FAMI_USRE AS USRREG',
             'FAMI_FERE AS FECREG',
@@ -471,6 +472,7 @@ class EquipmentManagementController extends Controller{
             'SUBF_COSU AS CODIGOSUBFAMILIA',
             'SUBF_NOSU AS NOMBRESUBFAMILIA',
             'SUBF_ICON AS ICONO',
+            'SUBF_ICPE AS ICONO_PERSONALIZADO',
             'SUBF_ESTA AS ESTADO',
             'SUBF_USRE AS USRREG',
             'SUBF_FERE AS FECREG',
@@ -2442,10 +2444,8 @@ class EquipmentManagementController extends Controller{
             ['PCEQ_NULI', '=', $line],
             ['PCEQ_ESRE', '=', 'Revisión'],
         ])->get()->all();
-        
 
         $idUserEnc = $this->encryptionController->encrypt($idUser);
-        
         foreach($pendingEquipments as $key=>$equipment){
             $equipment->IDREG = $this->encryptionController->encrypt($equipment->IDREG);
             $equipment->CODIGO = $this->encryptionController->encrypt($equipment->CODIGO);
@@ -2454,12 +2454,13 @@ class EquipmentManagementController extends Controller{
             $imagesGalleryFn = [];
             foreach($imagesGalleryArr as $imageCode){
                 $imageCodeEnc = $this->encryptionController->encrypt($imageCode);
-                $response = $this->documentManagementController->privateGetPublicDocumentURL(
+                $publicUri = $this->documentManagementController->privateGetPublicDocumentURL(
                     $imageCodeEnc,
                     $idUserEnc,
                     $line
                 );
 
+                $response = json_decode($publicUri->original, true);
                 if($response['error']){
                     return $this->responseController->makeresponse(true, $response['msg'], [], 500);
                 }else{
@@ -2590,9 +2591,9 @@ class EquipmentManagementController extends Controller{
         $originLocationFilt = array_filter($locationsArrDec, function ($v, $k) use ($originLocation) {
             return $v['CODE'] == $originLocation;
         }, ARRAY_FILTER_USE_BOTH);
+
         $pendingEquipment->UBICACION_ORIGEN = end($originLocationFilt)['LOCATION'] . " (" . $pendingEquipment->UBICACION_ORIGEN . ")";
         $levelsArr = [];
-
     
         for($i = 5; $i > 0; $i--){
             $levelsArr[] = [
@@ -2648,7 +2649,7 @@ class EquipmentManagementController extends Controller{
         $imagesGalleryFn = [];
         foreach($imagesGalleryArr as $imageCode){
             $imageCodeEnc = $this->encryptionController->encrypt($imageCode);
-            $publicUri = $this->documentManagementController->getPublicDocumentURL(
+            $publicUri = $this->documentManagementController->privateGetPublicDocumentURL(
                 $imageCodeEnc,
                 $idUserEnc,
                 $line
@@ -2789,8 +2790,6 @@ class EquipmentManagementController extends Controller{
             return $this->responseController->makeResponse(true, 'El pre-registro se encuentra aprobado.', [], 400);
         }
 
-
-
         $now = $this->functionsController->now();
         $nowStr = $now->toDateTimeString();
         if($form['status'] == 'Rechazado'){
@@ -3024,7 +3023,7 @@ class EquipmentManagementController extends Controller{
             $imagesGalleryFn = [];
             foreach($imagesGalleryArr as $imageCode){
                 $imageCodeEnc = $this->encryptionController->encrypt($imageCode);
-                $publicUri = $this->documentManagementController->getPublicDocumentURL(
+                $publicUri = $this->documentManagementController->privateGetPublicDocumentURL(
                     $imageCodeEnc,
                     $idUserEnc,
                     $line
@@ -3133,7 +3132,7 @@ class EquipmentManagementController extends Controller{
             $imagesGalleryFn = [];
             foreach($imagesGalleryArr as $imageCode){
                 $imageCodeEnc = $this->encryptionController->encrypt($imageCode);
-                $publicUri = $this->documentManagementController->getPublicDocumentURL(
+                $publicUri = $this->documentManagementController->privateGetPublicDocumentURL(
                     $imageCodeEnc,
                     $idUserEnc,
                     $line
@@ -3223,7 +3222,7 @@ class EquipmentManagementController extends Controller{
             $imagesGalleryFn = [];
             foreach($imagesGalleryArr as $imageCode){
                 $imageCodeEnc = $this->encryptionController->encrypt($imageCode);
-                $publicUri = $this->documentManagementController->getPublicDocumentURL(
+                $publicUri = $this->documentManagementController->privateGetPublicDocumentURL(
                     $imageCodeEnc,
                     $idUserEnc,
                     $line
@@ -3409,7 +3408,7 @@ class EquipmentManagementController extends Controller{
         $imagesGalleryFn = [];
         foreach($imagesGalleryArr as $imageCode){
             $imageCodeEnc = $this->encryptionController->encrypt($imageCode);
-            $publicUri = $this->documentManagementController->getPublicDocumentURL(
+            $publicUri = $this->documentManagementController->privateGetPublicDocumentURL(
                 $imageCodeEnc,
                 $idUserEnc,
                 $line

+ 6 - 0
sistema-mantenimiento-back/app/Http/Controllers/FunctionsController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use DateTime;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Support\Facades\DB;
@@ -444,4 +445,9 @@ class FunctionsController extends Controller{
         $str = str_replace( array_keys( $transliteration ),  array_values( $transliteration ), $value);
         return $str;
     }
+
+    public function validateDate($date, $format = 'Y-m-d H:i:s'): bool {
+        $d = DateTime::createFromFormat($format, $date);
+        return $d && $d->format($format) == $date;
+    }
 }

+ 72 - 0
sistema-mantenimiento-back/app/Http/Controllers/InterventionController.php

@@ -408,4 +408,76 @@ class InterventionController extends Controller{
         $this->functionsController->registerLog($actions, $idUser, $nowStr, $idac, $line);
         return $this->responseController->makeResponse(false, 'EXITO', $preventiveInterventions);
     }
+
+    public function getAllRegisteredSpecialties($idUser, $line) {
+        DB::enableQueryLog();
+
+        $idUser = $this->encryptionController->decrypt($idUser);
+        if(!$idUser){
+            return $this->responseController->makeResponse(true, 'El ID del usuario que realizó la solicitud no está encriptado correctamente', [], 400);
+        }
+
+        $usr = DB::table('S002V01TUSUA')->where([
+            ['USUA_NULI', '=', $line],
+            ['USUA_IDUS', '=', $idUser],
+        ])->first();
+
+        if(is_null($usr)){
+            return $this->responseController->makeResponse(true, 'El usuario que realizó la consulta no está registrado', [], 404);
+        }
+
+        $workTeamsSpecialties = DB::table('S002V01TEQMA')->select([
+            DB::raw('DISTINCT(EQMA_ESPE) AS ESPECIALIDAD')
+        ])->get()->all();
+
+        $specialtiesArrFn = [];
+        foreach($workTeamsSpecialties as $specialty){
+            if(!in_array($specialty->ESPECIALIDAD, $specialtiesArrFn)){
+                $specialtiesArrFn[] = $specialty->ESPECIALIDAD;
+            }
+        }
+
+        $employeesSpecialties = DB::table('S002V01TPERS')->select([
+            DB::raw('DISTINCT(PERS_ESPE) AS ESPECIALIDAD')
+        ])->get()->all();
+
+        foreach($employeesSpecialties as $specialty){
+            if(!in_array($specialty->ESPECIALIDAD, $specialtiesArrFn)){
+                $specialtiesArrFn[] = $specialty->ESPECIALIDAD;
+            }
+        }
+
+        $subcontratistsSpecialties = DB::table('S002V01TPESU')->select([
+            DB::raw('DISTINCT(PESU_ESPE) AS ESPECIALIDAD')
+        ])->get()->all();
+
+        foreach($subcontratistsSpecialties as $specialty){
+            if(!in_array($specialty->ESPECIALIDAD, $specialtiesArrFn)){
+                $specialtiesArrFn[] = $specialty->ESPECIALIDAD;
+            }
+        }
+
+        foreach($specialtiesArrFn as $key=>$val){
+            $specialtiesArrFn[$key] = $this->encryptionController->encrypt($val);
+        }
+
+        $now = $this->functionsController->now();
+        $nowStr = $now->toDateTimeString();
+        $actions = DB::getQueryLog();
+        $name = $this->functionsController->joinName($usr->USUA_NOMB, $usr->USUA_APPA, $usr->USUA_APMA);
+        
+        $idac = $this->functionsController->registerActivity(
+            $line,
+            'S002V01M11GPRS',
+            '-',
+            '-',
+            'Consulta',
+            "El usuario $name (" . $usr->USUA_IDUS . ") las especialidades registradas.",
+            $idUser,
+            $nowStr,
+        );
+
+        $this->functionsController->registerLog($actions, $idUser, $nowStr, $idac, $line);
+        return $this->responseController->makeResponse(false, 'EXITO', ['ESPECIALIDADES' => $specialtiesArrFn]);
+    }
 }

文件差异内容过多而无法显示
+ 398 - 336
sistema-mantenimiento-back/app/Http/Controllers/PreventiveMaintenanceController.php


部分文件因为文件数量过多而无法显示