|
|
@@ -2347,8 +2347,9 @@ class EquipmentManagementController extends Controller{
|
|
|
'level' => 'required_if:code_type,=,7|string',
|
|
|
'zone' => 'required_if:code_type,=,7|string',
|
|
|
'number_items' => 'required|integer',
|
|
|
+ 'id_description' => 'required|string',
|
|
|
]);
|
|
|
-
|
|
|
+
|
|
|
if($validator->fails()){
|
|
|
return $this->responseController->makeResponse(
|
|
|
true,
|
|
|
@@ -2378,6 +2379,29 @@ class EquipmentManagementController extends Controller{
|
|
|
return $this->responseController->makeResponse(true, 'El usuario que realizó la petición no existe.', [], 404);
|
|
|
}
|
|
|
|
|
|
+ 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',
|
|
|
+ ]);
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener la información de la adquisición.', $th->getMessage(), 404);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (empty($infoAdquisition)) {
|
|
|
+ return $this->responseController->makeResponse(true, 'No existe la información de la adquisición.', [], 404);
|
|
|
+ }
|
|
|
+
|
|
|
+ $infoAdquisition['CANTIDAD_ARTICULOS'] = intval($infoAdquisition['CANTIDAD_ARTICULOS']);
|
|
|
+ $form['number_items'] = intval($form['number_items']);
|
|
|
+ $form['number_items'] = $infoAdquisition['CANTIDAD_ARTICULOS'] * $form['number_items'];
|
|
|
+
|
|
|
// El código del equipo padre se inicializa
|
|
|
$eqpa = null;
|
|
|
// Si la jerarquía es de tipo "Hijo", Entonces
|