|
@@ -1584,7 +1584,7 @@ class EquipmentManagementController extends Controller{
|
|
|
'origin_element' => 'required_unless:code_type,4|string',
|
|
'origin_element' => 'required_unless:code_type,4|string',
|
|
|
'origin_element_enc' => 'required_if:code_type,=,4|string',
|
|
'origin_element_enc' => 'required_if:code_type,=,4|string',
|
|
|
'origin_coords' => 'required|string|min:7|max:7',
|
|
'origin_coords' => 'required|string|min:7|max:7',
|
|
|
- 'origin_coords_plane' => 'required|string',
|
|
|
|
|
|
|
+ 'origin_coords_plane' => 'string',
|
|
|
'family' => 'required|string',
|
|
'family' => 'required|string',
|
|
|
'subfamily' => 'required|string',
|
|
'subfamily' => 'required|string',
|
|
|
'status' => 'required|string',
|
|
'status' => 'required|string',
|
|
@@ -2566,6 +2566,7 @@ class EquipmentManagementController extends Controller{
|
|
|
if(!$idUser){
|
|
if(!$idUser){
|
|
|
return $this->responseController->makeResponse(true, 'El ID de usuario no fue encriptado correctamente.', [], 400);
|
|
return $this->responseController->makeResponse(true, 'El ID de usuario no fue encriptado correctamente.', [], 400);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// Obtención del usuario
|
|
// Obtención del usuario
|
|
|
$usr = DB::table('S002V01TUSUA')->where([
|
|
$usr = DB::table('S002V01TUSUA')->where([
|
|
|
['USUA_NULI', '=', $form['linea']],
|
|
['USUA_NULI', '=', $form['linea']],
|
|
@@ -2583,16 +2584,13 @@ class EquipmentManagementController extends Controller{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $infoAdquisition = (array) DB::table('S002V01TINAR')
|
|
|
|
|
- ->where([
|
|
|
|
|
- ['INAR_IDIN', '=', $form['id_description']],
|
|
|
|
|
- ['INAR_NULI', '=', $form['linea']],
|
|
|
|
|
- ])
|
|
|
|
|
- ->join('S002V01TDEAR', 'DEAR_IDDE', '=', 'INAR_IDDE')
|
|
|
|
|
- ->join('S002V01TUNID', 'UNID_IDUN', '=', 'DEAR_IDUN')
|
|
|
|
|
- ->first([
|
|
|
|
|
- 'DEAR_CAAR AS CANTIDAD_ARTICULOS',
|
|
|
|
|
- ]);
|
|
|
|
|
|
|
+ $infoAdquisition = (array) DB::table('S002V01TINAR')->select([
|
|
|
|
|
+ 'DEAR_CAAR AS CANTIDAD_ARTICULOS',
|
|
|
|
|
+ ])->where([
|
|
|
|
|
+ ['INAR_IDIN', '=', $form['id_description']],
|
|
|
|
|
+ ['INAR_NULI', '=', $form['linea']],
|
|
|
|
|
+ ])->join('S002V01TDEAR', 'DEAR_IDDE', '=', 'INAR_IDDE')
|
|
|
|
|
+ ->join('S002V01TUNID', 'UNID_IDUN', '=', 'DEAR_IDUN')->first();
|
|
|
} catch (\Throwable $th) {
|
|
} catch (\Throwable $th) {
|
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener la información de la adquisición.', $th->getMessage(), 404);
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener la información de la adquisición.', $th->getMessage(), 404);
|
|
|
}
|
|
}
|
|
@@ -2660,10 +2658,12 @@ class EquipmentManagementController extends Controller{
|
|
|
if(!$originLocation){
|
|
if(!$originLocation){
|
|
|
return $this->responseController->makeResponse(true, 'La ubicación de origen no fue encriptada correctamente.', [], 400);
|
|
return $this->responseController->makeResponse(true, 'La ubicación de origen no fue encriptada correctamente.', [], 400);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// Se verifica con la información del sistema
|
|
// Se verifica con la información del sistema
|
|
|
$originLocationFilt = array_filter($locationsArrDec, function($v, $k) use ($originLocation) {
|
|
$originLocationFilt = array_filter($locationsArrDec, function($v, $k) use ($originLocation) {
|
|
|
return $v['CODE'] == $originLocation;
|
|
return $v['CODE'] == $originLocation;
|
|
|
}, ARRAY_FILTER_USE_BOTH);
|
|
}, ARRAY_FILTER_USE_BOTH);
|
|
|
|
|
+
|
|
|
// Se verifica que la ubicacion exista en la información del sistema
|
|
// Se verifica que la ubicacion exista en la información del sistema
|
|
|
if(count($originLocationFilt) < 1){
|
|
if(count($originLocationFilt) < 1){
|
|
|
return $this->responseController->makeResponse(true, 'La ubicación de origen no se encuentra registrada en el sistema.', [], 404);
|
|
return $this->responseController->makeResponse(true, 'La ubicación de origen no se encuentra registrada en el sistema.', [], 404);
|
|
@@ -2674,15 +2674,18 @@ class EquipmentManagementController extends Controller{
|
|
|
if(!$originLevel){
|
|
if(!$originLevel){
|
|
|
return $this->responseController->makeResponse(true, 'El nivel de origen no fue encriptado correctamente.', [], 400);
|
|
return $this->responseController->makeResponse(true, 'El nivel de origen no fue encriptado correctamente.', [], 400);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// Se obtienen los niveles disponibles
|
|
// Se obtienen los niveles disponibles
|
|
|
$supportedLevels = [];
|
|
$supportedLevels = [];
|
|
|
for($i = 5; $i > 0; $i--){
|
|
for($i = 5; $i > 0; $i--){
|
|
|
$supportedLevels[] = "S0$i";
|
|
$supportedLevels[] = "S0$i";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
for($i = 0; $i <= 15; $i++){
|
|
for($i = 0; $i <= 15; $i++){
|
|
|
$tag = $i < 10 ? "P0$i" : "P$i";
|
|
$tag = $i < 10 ? "P0$i" : "P$i";
|
|
|
$supportedLevels[] = $tag;
|
|
$supportedLevels[] = $tag;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// Se verifica que el origen sea válido
|
|
// Se verifica que el origen sea válido
|
|
|
if(!in_array($originLevel, $supportedLevels)){
|
|
if(!in_array($originLevel, $supportedLevels)){
|
|
|
return $this->responseController->makeResponse(true, 'El nivel de origen seleccionado es inválido.', [], 400);
|
|
return $this->responseController->makeResponse(true, 'El nivel de origen seleccionado es inválido.', [], 400);
|
|
@@ -2693,6 +2696,7 @@ class EquipmentManagementController extends Controller{
|
|
|
if(!$originOccupationStr){
|
|
if(!$originOccupationStr){
|
|
|
return $this->responseController->makeResponse(true, 'La ocupación de origen no fue encriptada correctamente.', [], 400);
|
|
return $this->responseController->makeResponse(true, 'La ocupación de origen no fue encriptada correctamente.', [], 400);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// Se obtiene la información de la ocupación
|
|
// Se obtiene la información de la ocupación
|
|
|
$originOccupationArea = substr($originOccupationStr, 0, 2);
|
|
$originOccupationArea = substr($originOccupationStr, 0, 2);
|
|
|
$originOccupationID = substr($originOccupationStr, 2);
|
|
$originOccupationID = substr($originOccupationStr, 2);
|
|
@@ -2701,81 +2705,88 @@ class EquipmentManagementController extends Controller{
|
|
|
['OCUP_AREA', '=', $originOccupationArea],
|
|
['OCUP_AREA', '=', $originOccupationArea],
|
|
|
['OCUP_IDOC', '=', $originOccupationID]
|
|
['OCUP_IDOC', '=', $originOccupationID]
|
|
|
])->first();
|
|
])->first();
|
|
|
|
|
+
|
|
|
// Se verifica que exista la ocupació
|
|
// Se verifica que exista la ocupació
|
|
|
if(is_null($originOccupation)){
|
|
if(is_null($originOccupation)){
|
|
|
return $this->responseController->makeResponse(true, 'La ocupación de origen seleccionada no existe.', [], 404);
|
|
return $this->responseController->makeResponse(true, 'La ocupación de origen seleccionada no existe.', [], 404);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
-
|
|
|
|
|
$form['origin_element'] = null;
|
|
$form['origin_element'] = null;
|
|
|
-
|
|
|
|
|
$idWarehouse = $this->encryptionController->decrypt($form['warehouse']);
|
|
$idWarehouse = $this->encryptionController->decrypt($form['warehouse']);
|
|
|
|
|
+
|
|
|
if ($idWarehouse === false) {
|
|
if ($idWarehouse === false) {
|
|
|
return $this->responseController->makeResponse(true, 'El almacen no está encriptado correctamente.', [], 404);
|
|
return $this->responseController->makeResponse(true, 'El almacen no está encriptado correctamente.', [], 404);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
$idArea = $this->encryptionController->decrypt($form['area']);
|
|
$idArea = $this->encryptionController->decrypt($form['area']);
|
|
|
if ($idArea === false) {
|
|
if ($idArea === false) {
|
|
|
return $this->responseController->makeResponse(true, 'El área no está encriptado correctamente.', [], 404);
|
|
return $this->responseController->makeResponse(true, 'El área no está encriptado correctamente.', [], 404);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
$idLevel = $this->encryptionController->decrypt($form['level']);
|
|
$idLevel = $this->encryptionController->decrypt($form['level']);
|
|
|
if ($idLevel === false) {
|
|
if ($idLevel === false) {
|
|
|
return $this->responseController->makeResponse(true, 'El nivel no está encriptado correctamente.', [], 404);
|
|
return $this->responseController->makeResponse(true, 'El nivel no está encriptado correctamente.', [], 404);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
$idZone = $this->encryptionController->decrypt($form['zone']);
|
|
$idZone = $this->encryptionController->decrypt($form['zone']);
|
|
|
if ($idZone === false) {
|
|
if ($idZone === false) {
|
|
|
return $this->responseController->makeResponse(true, 'La zona no está encriptado correctamente.', [], 404);
|
|
return $this->responseController->makeResponse(true, 'La zona no está encriptado correctamente.', [], 404);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $validateWarehouse = DB::table('S002V01TALMA')
|
|
|
|
|
- ->where('ALMA_COAL', '=', $idWarehouse)
|
|
|
|
|
- ->where('ALMA_NULI', '=', $form['linea'])
|
|
|
|
|
- ->exists();
|
|
|
|
|
|
|
+ $validateWarehouse = DB::table('S002V01TALMA')->where([
|
|
|
|
|
+ ['ALMA_COAL', '=', $idWarehouse],
|
|
|
|
|
+ ['ALMA_NULI', '=', $form['linea']]
|
|
|
|
|
+ ])->exists();
|
|
|
} catch (\Throwable $th) {
|
|
} catch (\Throwable $th) {
|
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al validar el almacen.', [], 500);
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al validar el almacen.', [], 500);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (!$validateWarehouse) {
|
|
if (!$validateWarehouse) {
|
|
|
return $this->responseController->makeResponse(true, 'El almacen no existe.', [], 500);
|
|
return $this->responseController->makeResponse(true, 'El almacen no existe.', [], 500);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $validateArea = DB::table('S002V01TAREA')
|
|
|
|
|
- ->where('AREA_COAL', '=', $idWarehouse)
|
|
|
|
|
- ->where('AREA_COAR', '=', $idArea)
|
|
|
|
|
- ->where('AREA_NULI', '=', $form['linea'])
|
|
|
|
|
- ->exists();
|
|
|
|
|
|
|
+ $validateArea = DB::table('S002V01TAREA')->where([
|
|
|
|
|
+ ['AREA_COAL', '=', $idWarehouse],
|
|
|
|
|
+ ['AREA_COAR', '=', $idArea],
|
|
|
|
|
+ ['AREA_NULI', '=', $form['linea']]
|
|
|
|
|
+ ])->exists();
|
|
|
} catch (\Throwable $th) {
|
|
} catch (\Throwable $th) {
|
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al validar el almacen.', [], 500);
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al validar el almacen.', [], 500);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (!$validateArea) {
|
|
if (!$validateArea) {
|
|
|
return $this->responseController->makeResponse(true, 'El almacen no existe.', [], 500);
|
|
return $this->responseController->makeResponse(true, 'El almacen no existe.', [], 500);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $validateLevel = DB::table('S002V01TNIVE')
|
|
|
|
|
- ->where('NIVE_COAL', '=', $idWarehouse)
|
|
|
|
|
- ->where('NIVE_COAR', '=', $idArea)
|
|
|
|
|
- ->where('NIVE_CONI', '=', $idLevel)
|
|
|
|
|
- ->where('NIVE_NULI', '=', $form['linea'])
|
|
|
|
|
- ->exists();
|
|
|
|
|
|
|
+ $validateLevel = DB::table('S002V01TNIVE')->where([
|
|
|
|
|
+ ['NIVE_COAL', '=', $idWarehouse],
|
|
|
|
|
+ ['NIVE_COAR', '=', $idArea],
|
|
|
|
|
+ ['NIVE_CONI', '=', $idLevel],
|
|
|
|
|
+ ['NIVE_NULI', '=', $form['linea']]
|
|
|
|
|
+ ])->exists();
|
|
|
} catch (\Throwable $th) {
|
|
} catch (\Throwable $th) {
|
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al validar el almacen.', [], 500);
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al validar el almacen.', [], 500);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (!$validateLevel) {
|
|
if (!$validateLevel) {
|
|
|
return $this->responseController->makeResponse(true, 'El almacen no existe.', [], 500);
|
|
return $this->responseController->makeResponse(true, 'El almacen no existe.', [], 500);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $validateZone = DB::table('S002V01TZONA')
|
|
|
|
|
- ->where('ZONA_COAL', '=', $idWarehouse)
|
|
|
|
|
- ->where('ZONA_COAR', '=', $idArea)
|
|
|
|
|
- ->where('ZONA_CONI', '=', $idLevel)
|
|
|
|
|
- ->where('ZONA_COZO', '=', $idZone)
|
|
|
|
|
- ->where('ZONA_NULI', '=', $form['linea'])
|
|
|
|
|
- ->exists();
|
|
|
|
|
|
|
+ $validateZone = DB::table('S002V01TZONA')->where([
|
|
|
|
|
+ ['ZONA_COAL', '=', $idWarehouse],
|
|
|
|
|
+ ['ZONA_COAR', '=', $idArea],
|
|
|
|
|
+ ['ZONA_CONI', '=', $idLevel],
|
|
|
|
|
+ ['ZONA_COZO', '=', $idZone],
|
|
|
|
|
+ ['ZONA_NULI', '=', $form['linea']]
|
|
|
|
|
+ ])->exists();
|
|
|
} catch (\Throwable $th) {
|
|
} catch (\Throwable $th) {
|
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al validar el almacen.', [], 500);
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al validar el almacen.', [], 500);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (!$validateZone) {
|
|
if (!$validateZone) {
|
|
|
return $this->responseController->makeResponse(true, 'El almacen no existe.', [], 500);
|
|
return $this->responseController->makeResponse(true, 'El almacen no existe.', [], 500);
|
|
|
}
|
|
}
|
|
@@ -2979,10 +2990,12 @@ class EquipmentManagementController extends Controller{
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
try {
|
|
try {
|
|
|
- $getEquipment = DB::table('S002V01TPCEQ')
|
|
|
|
|
- ->where('PCEQ_NULI', '=', $form['linea'])
|
|
|
|
|
- ->where('PCEQ_NUSE', 'LIKE', '0-%')
|
|
|
|
|
- ->get(['PCEQ_NUSE AS NUMERO_SERIE']);
|
|
|
|
|
|
|
+ $getEquipment = DB::table('S002V01TPCEQ')->select([
|
|
|
|
|
+ 'PCEQ_NUSE AS NUMERO_SERIE'
|
|
|
|
|
+ ])->where([
|
|
|
|
|
+ ['PCEQ_NULI', '=', $form['linea']],
|
|
|
|
|
+ ['PCEQ_NUSE', 'LIKE', '0-%']
|
|
|
|
|
+ ])->get();
|
|
|
} catch (\Throwable $th) {
|
|
} catch (\Throwable $th) {
|
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener los artículos.', $th->getMessage(), 400);
|
|
return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener los artículos.', $th->getMessage(), 400);
|
|
|
}
|
|
}
|
|
@@ -3373,7 +3386,7 @@ class EquipmentManagementController extends Controller{
|
|
|
|
|
|
|
|
$lbsDestinyTag = substr($lbsDestinyTag, 0, -1);
|
|
$lbsDestinyTag = substr($lbsDestinyTag, 0, -1);
|
|
|
$lbsDestinyTag .= "+" . $parameters['destinyCoords'];
|
|
$lbsDestinyTag .= "+" . $parameters['destinyCoords'];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$pbs = ['family', 'subfamily', 'status'];
|
|
$pbs = ['family', 'subfamily', 'status'];
|
|
|
$pbsStr = "";
|
|
$pbsStr = "";
|
|
|
foreach($pbs as $ctrl){
|
|
foreach($pbs as $ctrl){
|
|
@@ -3622,6 +3635,19 @@ class EquipmentManagementController extends Controller{
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if($type == 'model'){
|
|
|
|
|
+ $modelStr = implode('', $validVal1);
|
|
|
|
|
+ $model = substr($modelStr, -5);
|
|
|
|
|
+ $modelFn = "";
|
|
|
|
|
+
|
|
|
|
|
+ for($i = strlen($model); $i < 5; $i++){
|
|
|
|
|
+ $modelFn .= 'X';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $modelFn = $modelFn . $model;
|
|
|
|
|
+ return $modelFn;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$validLength = count($validVal1);
|
|
$validLength = count($validVal1);
|
|
|
$validVal2 = "";
|
|
$validVal2 = "";
|
|
|
|
|
|
|
@@ -4556,6 +4582,8 @@ class EquipmentManagementController extends Controller{
|
|
|
'EQUI_NIOR' => $pendingEquipment->PCEQ_NIOR,
|
|
'EQUI_NIOR' => $pendingEquipment->PCEQ_NIOR,
|
|
|
'EQUI_OCOR' => $pendingEquipment->PCEQ_OCOR,
|
|
'EQUI_OCOR' => $pendingEquipment->PCEQ_OCOR,
|
|
|
'EQUI_ELOR' => $pendingEquipment->PCEQ_ELOR,
|
|
'EQUI_ELOR' => $pendingEquipment->PCEQ_ELOR,
|
|
|
|
|
+ 'EQUI_COOR' => $pendingEquipment->PCEQ_COOR,
|
|
|
|
|
+ 'EQUI_PCOR' => $pendingEquipment->PCEQ_PCOR,
|
|
|
'EQUI_ALMA' => $pendingEquipment->PCEQ_ALMA,
|
|
'EQUI_ALMA' => $pendingEquipment->PCEQ_ALMA,
|
|
|
'EQUI_AREA' => $pendingEquipment->PCEQ_AREA,
|
|
'EQUI_AREA' => $pendingEquipment->PCEQ_AREA,
|
|
|
'EQUI_NIVE' => $pendingEquipment->PCEQ_NIVE,
|
|
'EQUI_NIVE' => $pendingEquipment->PCEQ_NIVE,
|
|
@@ -4571,6 +4599,8 @@ class EquipmentManagementController extends Controller{
|
|
|
'EQUI_NIDE' => $pendingEquipment->PCEQ_NIDE,
|
|
'EQUI_NIDE' => $pendingEquipment->PCEQ_NIDE,
|
|
|
'EQUI_OCDE' => $pendingEquipment->PCEQ_OCDE,
|
|
'EQUI_OCDE' => $pendingEquipment->PCEQ_OCDE,
|
|
|
'EQUI_ELDE' => $pendingEquipment->PCEQ_ELDE,
|
|
'EQUI_ELDE' => $pendingEquipment->PCEQ_ELDE,
|
|
|
|
|
+ 'EQUI_CODE' => $pendingEquipment->PCEQ_CODE,
|
|
|
|
|
+ 'EQUI_PCDE' => $pendingEquipment->PCEQ_PCDE,
|
|
|
'EQUI_KIDE' => $pendingEquipment->PCEQ_KIDE,
|
|
'EQUI_KIDE' => $pendingEquipment->PCEQ_KIDE,
|
|
|
'EQUI_SEDE' => $pendingEquipment->PCEQ_SEDE,
|
|
'EQUI_SEDE' => $pendingEquipment->PCEQ_SEDE,
|
|
|
'EQUI_TCDE' => $pendingEquipment->PCEQ_TCDE,
|
|
'EQUI_TCDE' => $pendingEquipment->PCEQ_TCDE,
|
|
@@ -4585,6 +4615,7 @@ class EquipmentManagementController extends Controller{
|
|
|
'EQUI_HICO' => $hico,
|
|
'EQUI_HICO' => $hico,
|
|
|
'EQUI_GAIM' => $pendingEquipment->PCEQ_GAIM,
|
|
'EQUI_GAIM' => $pendingEquipment->PCEQ_GAIM,
|
|
|
'EQUI_DORE' => $pendingEquipment->PCEQ_DORE,
|
|
'EQUI_DORE' => $pendingEquipment->PCEQ_DORE,
|
|
|
|
|
+ 'EQUI_OTCO' => $pendingEquipment->PCEQ_OTCO,
|
|
|
'EQUI_USRE' => $idUser,
|
|
'EQUI_USRE' => $idUser,
|
|
|
'EQUI_FERE' => $nowStr,
|
|
'EQUI_FERE' => $nowStr,
|
|
|
]);
|
|
]);
|
|
@@ -4598,58 +4629,58 @@ class EquipmentManagementController extends Controller{
|
|
|
'PCEQ_USMO' => $idUser,
|
|
'PCEQ_USMO' => $idUser,
|
|
|
'PCEQ_FEMO' => $nowStr,
|
|
'PCEQ_FEMO' => $nowStr,
|
|
|
]);
|
|
]);
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- if ($pendingEquipment->PCEQ_TICO === '7') {
|
|
|
|
|
- try {
|
|
|
|
|
- $star = (array) DB::table('S002V01TSTAR')
|
|
|
|
|
- ->where('STAR_IDPC', '=', $pendingEquipment->PCEQ_IDPR)
|
|
|
|
|
- ->where('STAR_ESTA', '=', 'Pendiente')
|
|
|
|
|
- ->where('STAR_NULI', '=', $form['linea'])
|
|
|
|
|
- ->first();
|
|
|
|
|
- } catch (\Throwable $th) {
|
|
|
|
|
- return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener los artículos en Stock.', [], 500);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ($pendingEquipment->PCEQ_TICO === '7') {
|
|
|
|
|
+ try {
|
|
|
|
|
+ $star = (array) DB::table('S002V01TSTAR')->where([
|
|
|
|
|
+ ['STAR_IDPC', '=', $pendingEquipment->PCEQ_IDPR],
|
|
|
|
|
+ ['STAR_ESTA', '=', 'Pendiente'],
|
|
|
|
|
+ ['STAR_NULI', '=', $form['linea']]
|
|
|
|
|
+ ])->first();
|
|
|
|
|
+ } catch (\Throwable $th) {
|
|
|
|
|
+ return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener los artículos en Stock.', [], 500);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if ( !empty($star) && !is_null($star) ) {
|
|
|
|
|
|
|
+ if ( !empty($star) && !is_null($star) ) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ $validateUpdate = DB::table('S002V01TSTAR')->where([
|
|
|
|
|
+ ['STAR_IDPC', '=', $pendingEquipment->PCEQ_IDPR],
|
|
|
|
|
+ ['STAR_ESTA', '=', 'Pendiente'],
|
|
|
|
|
+ ['STAR_NULI', '=', $form['linea']]
|
|
|
|
|
+ ])->update([
|
|
|
|
|
+ 'STAR_ESTA' => 'Activo',
|
|
|
|
|
+ 'STAR_USMO' => $idUser,
|
|
|
|
|
+ 'STAR_FEMO' => $nowStr,
|
|
|
|
|
+ 'STAR_FEAR' => DB::raw('CURRENT_TIMESTAMP'),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ } catch (\Throwable $th) {
|
|
|
|
|
+ return $this->responseController->makeResponse(true, 'Ocurrió un al actualizar el stock.', [], 500);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- try {
|
|
|
|
|
- $validateUpdate = DB::table('S002V01TSTAR')
|
|
|
|
|
- ->where('STAR_IDPC', '=', $pendingEquipment->PCEQ_IDPR)
|
|
|
|
|
- ->where('STAR_ESTA', '=', 'Pendiente')
|
|
|
|
|
- ->where('STAR_NULI', '=', $form['linea'])
|
|
|
|
|
- ->update([
|
|
|
|
|
- 'STAR_ESTA' => 'Activo',
|
|
|
|
|
- 'STAR_USMO' => $idUser,
|
|
|
|
|
- 'STAR_FEMO' => $nowStr,
|
|
|
|
|
- 'STAR_FEAR' => DB::raw('CURRENT_TIMESTAMP'),
|
|
|
|
|
- ]);
|
|
|
|
|
- } catch (\Throwable $th) {
|
|
|
|
|
- return $this->responseController->makeResponse(true, 'Ocurrió un al actualizar el stock.', [], 500);
|
|
|
|
|
- }
|
|
|
|
|
- if (!$validateUpdate) {
|
|
|
|
|
- return $this->responseController->makeResponse(true, 'No se pudo actualizar la información en stock.', [], 500);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!$validateUpdate) {
|
|
|
|
|
+ return $this->responseController->makeResponse(true, 'No se pudo actualizar la información en stock.', [], 500);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ $validateUpdate = DB::table('S002V01TUBAR')->where([
|
|
|
|
|
+ ['UBAR_IDST', '=', $star['STAR_IDST']],
|
|
|
|
|
+ ['UBAR_ESTA', '=', 'Pendiente'],
|
|
|
|
|
+ ['UBAR_NULI', '=', $form['linea']]
|
|
|
|
|
+ ])->update([
|
|
|
|
|
+ 'UBAR_COUB' => $previewCode,
|
|
|
|
|
+ 'UBAR_ESTA' => 'Activo',
|
|
|
|
|
+ 'UBAR_USMO' => $idUser,
|
|
|
|
|
+ 'UBAR_FEMO' => $nowStr,
|
|
|
|
|
+ 'UBAR_FEAR' => DB::raw('CURRENT_TIMESTAMP'),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ } catch (\Throwable $th) {
|
|
|
|
|
+ return $this->responseController->makeResponse(true, 'Ocurrió un al actualizar el stock.', [], 500);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- try {
|
|
|
|
|
- $validateUpdate = DB::table('S002V01TUBAR')
|
|
|
|
|
- ->where('UBAR_IDST', '=', $star['STAR_IDST'])
|
|
|
|
|
- ->where('UBAR_ESTA', '=', 'Pendiente')
|
|
|
|
|
- ->where('UBAR_NULI', '=', $form['linea'])
|
|
|
|
|
- ->update([
|
|
|
|
|
- 'UBAR_COUB' => $previewCode,
|
|
|
|
|
- 'UBAR_ESTA' => 'Activo',
|
|
|
|
|
- 'UBAR_USMO' => $idUser,
|
|
|
|
|
- 'UBAR_FEMO' => $nowStr,
|
|
|
|
|
- 'UBAR_FEAR' => DB::raw('CURRENT_TIMESTAMP'),
|
|
|
|
|
- ]);
|
|
|
|
|
- } catch (\Throwable $th) {
|
|
|
|
|
- return $this->responseController->makeResponse(true, 'Ocurrió un al actualizar el stock.', [], 500);
|
|
|
|
|
- }
|
|
|
|
|
- if (!$validateUpdate) {
|
|
|
|
|
- return $this->responseController->makeResponse(true, 'No se pudo actualizar la información en stock.', [], 500);
|
|
|
|
|
|
|
+ if (!$validateUpdate) {
|
|
|
|
|
+ return $this->responseController->makeResponse(true, 'No se pudo actualizar la información en stock.', [], 500);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -4846,6 +4877,115 @@ class EquipmentManagementController extends Controller{
|
|
|
return $this->responseController->makeResponse(false, 'EXITO.', $equipments);
|
|
return $this->responseController->makeResponse(false, 'EXITO.', $equipments);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getFilteredEquipmentChildren($search, $parent, $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);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $parent = $this->encryptionController->decrypt($parent);
|
|
|
|
|
+ if(!$parent){
|
|
|
|
|
+ return $this->responseController->makeResponse(true, 'El código del equipamiento relacionado no está encriptado correctamente', [], 400);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $parentObj = DB::table('S002V01TEQUI')->where([
|
|
|
|
|
+ ['EQUI_COEQ', '=', $parent],
|
|
|
|
|
+ ['EQUI_NULI', '=', $line]
|
|
|
|
|
+ ])->first();
|
|
|
|
|
+
|
|
|
|
|
+ if(is_null($parentObj)){
|
|
|
|
|
+ return $this->responseController->makeResponse(true, 'El equipo relacionado no está registrado', [], 404);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $search = 'dell';
|
|
|
|
|
+ $equipments = DB::table('S002V01TEQUI')->select([
|
|
|
|
|
+ 'EQUI_COEQ AS CODIGO',
|
|
|
|
|
+ 'EQUI_TIPO AS TIPO',
|
|
|
|
|
+ 'EQUI_MODE AS MODELO',
|
|
|
|
|
+ 'EQUI_IDEQ AS ID_EQUIPO',
|
|
|
|
|
+ 'EQUI_ESFU AS ESTADO_FUNCIONAMIENTO',
|
|
|
|
|
+ 'EQUI_GAIM AS GALERIA_IMAGENES',
|
|
|
|
|
+ 'EQUI_ELOR AS ELEMENTO_ORIGEN',
|
|
|
|
|
+ 'EQUI_TICO AS TIPO_CODIGO',
|
|
|
|
|
+ 'EQUI_EQPA AS EQUIPO_PADRE',
|
|
|
|
|
+ ])->where([
|
|
|
|
|
+ ['EQUI_NULI', '=', $line],
|
|
|
|
|
+ ['EQUI_ESEQ', '=', 'I'],
|
|
|
|
|
+ ['EQUI_JERA', '=', 'Hijo'],
|
|
|
|
|
+ ['EQUI_EQPA', '=', $parent]
|
|
|
|
|
+ ])->where(function(Builder $query) use($search) {
|
|
|
|
|
+ $query->where('EQUI_TIPO', 'like', "%$search%")
|
|
|
|
|
+ ->orWhere('EQUI_MODE', 'like', "%$search%")
|
|
|
|
|
+ ->orWhere('EQUI_IDEQ', 'like', "%$search%")
|
|
|
|
|
+ ->orWhere('EQUI_COEQ', 'like', "%$search%");
|
|
|
|
|
+ })->limit(50)->orderBy('EQUI_FEMO', 'desc')
|
|
|
|
|
+ ->orderBy('EQUI_FERE', 'desc')->get()->all();
|
|
|
|
|
+
|
|
|
|
|
+ $idUserEnc = $this->encryptionController->encrypt($idUser);
|
|
|
|
|
+ foreach($equipments as $key=>$equipment){
|
|
|
|
|
+ $children = DB::table('S002V01TEQUI')->where([
|
|
|
|
|
+ ['EQUI_NULI', '=', $line],
|
|
|
|
|
+ ['EQUI_EQPA', '=', $equipment->CODIGO],
|
|
|
|
|
+ ])->get()->all();
|
|
|
|
|
+
|
|
|
|
|
+ $equipment->CODIGO = $this->encryptionController->encrypt($equipment->CODIGO);
|
|
|
|
|
+ $equipment->ID_EQUIPO = $this->encryptionController->encrypt($equipment->ID_EQUIPO);
|
|
|
|
|
+ $equipment->EQUIPO_PADRE = is_null($equipment->EQUIPO_PADRE) ? null : $this->encryptionController->encrypt($equipment->EQUIPO_PADRE);
|
|
|
|
|
+
|
|
|
|
|
+ $imagesGalleryArr = json_decode($equipment->GALERIA_IMAGENES, true);
|
|
|
|
|
+ $imagesGalleryFn = [];
|
|
|
|
|
+ foreach($imagesGalleryArr as $imageCode){
|
|
|
|
|
+ $imageCodeEnc = $this->encryptionController->encrypt($imageCode);
|
|
|
|
|
+ $publicUri = $this->documentManagementController->privateGetPublicDocumentURL(
|
|
|
|
|
+ $imageCodeEnc,
|
|
|
|
|
+ $idUserEnc,
|
|
|
|
|
+ $line
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ if($publicUri['error']){
|
|
|
|
|
+ return $this->responseController->makeresponse(true, $publicUri['msg'], [], 500);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $uriEnc = $this->encryptionController->encrypt($publicUri['response']['public_uri']);
|
|
|
|
|
+ $imagesGalleryFn[] = $uriEnc;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $equipment->GALERIA_IMAGENES = json_encode($imagesGalleryFn);
|
|
|
|
|
+ $equipment->TIENE_HIJOS = count($children) > 0 ? 'Si' : 'No';
|
|
|
|
|
+ $equipments[$key] = $equipment;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $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,
|
|
|
|
|
+ 'S002V01M07GEEQ',
|
|
|
|
|
+ 'S002V01F01ADEQ',
|
|
|
|
|
+ 'S002V01P01MEEQ',
|
|
|
|
|
+ 'Consulta',
|
|
|
|
|
+ "El usuario $name (" . $usr->USUA_IDUS . ") consultó los equipamientos registrados.",
|
|
|
|
|
+ $idUser,
|
|
|
|
|
+ $nowStr,
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ $this->functionsController->registerLog($actions, $idUser, $nowStr, $idac, $line);
|
|
|
|
|
+ return $this->responseController->makeResponse(false, 'EXITO.', $equipments);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function getEquipmentsBySubfamily($familyCode, $subfamilyCode, $idUser, $line) {
|
|
public function getEquipmentsBySubfamily($familyCode, $subfamilyCode, $idUser, $line) {
|
|
|
DB::enableQueryLog();
|
|
DB::enableQueryLog();
|
|
|
|
|
|
|
@@ -5049,6 +5189,56 @@ class EquipmentManagementController extends Controller{
|
|
|
return $this->responseController->makeResponse(false, 'EXITO.', $equipments);
|
|
return $this->responseController->makeResponse(false, 'EXITO.', $equipments);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getEquipmentHasChildren($parentCode, $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);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $parentCode = $this->encryptionController->decrypt($parentCode);
|
|
|
|
|
+ if(!$parentCode){
|
|
|
|
|
+ return $this->responseController->makeResponse(true, 'El código del equipamiento padre no está encriptado correctamente', [], 400);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $hasChildren = DB::table('S002V01TEQUI')->select([
|
|
|
|
|
+ DB::raw("COUNT(*) AS HIJOS")
|
|
|
|
|
+ ])->where([
|
|
|
|
|
+ ['EQUI_NULI', '=', $line],
|
|
|
|
|
+ ['EQUI_JERA', '=', 'Hijo'],
|
|
|
|
|
+ ['EQUI_EQPA', '=', $parentCode],
|
|
|
|
|
+ ])->first();
|
|
|
|
|
+
|
|
|
|
|
+ $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,
|
|
|
|
|
+ 'S002V01M07GEEQ',
|
|
|
|
|
+ 'S002V01F01ADEQ',
|
|
|
|
|
+ 'S002V01P02DEEQ',
|
|
|
|
|
+ 'Consulta',
|
|
|
|
|
+ "El usuario $name (" . $usr->USUA_IDUS . ") consultó los equipamientos relacionados al equipamiento $parentCode.",
|
|
|
|
|
+ $idUser,
|
|
|
|
|
+ $nowStr,
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ $this->functionsController->registerLog($actions, $idUser, $nowStr, $idac, $line);
|
|
|
|
|
+ return $this->responseController->makeResponse(false, 'EXITO.', ['TIENE_HIJOS' => intval($hasChildren->HIJOS) > 0 ? 'S' : 'N']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function getEquipmentDetails($equipmentCode, $idUser, $line) {
|
|
public function getEquipmentDetails($equipmentCode, $idUser, $line) {
|
|
|
DB::enableQueryLog();
|
|
DB::enableQueryLog();
|
|
|
|
|
|