|
|
@@ -145,7 +145,6 @@ class StockController extends Controller
|
|
|
return $this->responseController->makeResponse(true, "ERR_STOCK_REG009: El proveedor no existe.", [], 500);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
|
|
|
$arrCodeImages = array();
|
|
|
foreach ($requestData['IMAGEN'] as $key => $encIdFile) {
|
|
|
@@ -2859,7 +2858,6 @@ class StockController extends Controller
|
|
|
return $this->responseController->makeResponse(true, 'No se pudo desencriptar el pre-código del equipamientos.', [], 500);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
try {
|
|
|
$validateInsertUbAr = DB::table('S002V01TUBAR')->insert([
|
|
|
'UBAR_NULI' => $requestData['NUMERO_LINEA'],
|
|
|
@@ -5980,4 +5978,91 @@ class StockController extends Controller
|
|
|
return $this->responseController->makeResponse(false, 'ÉXITO: Registro Exitoso');
|
|
|
}
|
|
|
|
|
|
+ public function getTools ($user, $line) {
|
|
|
+ $arrResponseCheckUser = $this->resourcesController->checkUserEnc($user, $line);
|
|
|
+ if ($arrResponseCheckUser['error']) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, $arrResponseCheckUser['msg'], [], 401);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ $arrStock = DB::table('S002V01TINST')
|
|
|
+ ->where([
|
|
|
+ ['INST_NULI', '=', $line],
|
|
|
+ ])->get([
|
|
|
+ 'INST_IDIS AS ID',
|
|
|
+ 'INST_MODE AS NOMB',
|
|
|
+ 'INST_COMO AS MODE',
|
|
|
+ // ' AS CANTDISP',
|
|
|
+ // ' AS TYPE',
|
|
|
+ // ' AS UNIT',
|
|
|
+ ]);
|
|
|
+ $arrStock = json_decode(json_encode($arrStock), true);
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener los artículos en stock.', $th->getMessage(), 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ $arrTools = [];
|
|
|
+ $arrSpares = [];
|
|
|
+ foreach ($arrStock as $stock) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ $items = DB::table('S002V01TSTAR')
|
|
|
+ ->where([
|
|
|
+ ['STAR_NULI', '=', $line],
|
|
|
+ ['STAR_IDIS', '=', $stock['ID']],
|
|
|
+ ])
|
|
|
+ ->join('S002V01TUNID', 'UNID_IDUN', '=', 'STAR_IDUN')
|
|
|
+ ->get([
|
|
|
+ 'UNID_NOMB AS UNIT',
|
|
|
+ 'STAR_CONS AS TYPE',
|
|
|
+ ]);
|
|
|
+ $items = json_decode(json_encode($items), true);
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener los datos de las herramientas y refacciones.', $th->getMessage(), 500);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $stock['CANTDISP'] = count($items);
|
|
|
+ foreach ($items as $item) {
|
|
|
+ if ($item['TYPE'] === 'Si') {
|
|
|
+ $stock['TYPE'] = 'Refaccción';
|
|
|
+ } else {
|
|
|
+ $stock['TYPE'] = 'Herramienta';
|
|
|
+ }
|
|
|
+ $stock['UNIT'] = $item['UNIT'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($stock['TYPE'] === 'Refaccción') {
|
|
|
+ $arrTools[] = $stock;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $arrSpares[] = $stock;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return $this->responseController->makeResponse(false, "ÉXITO: Consulta Exitosa", [ 'HERRAMIENTAS' => $arrTools, 'REFACCIONES' => $arrSpares ]);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getSpares ($user, $line) {
|
|
|
+ $arrResponseCheckUser = $this->resourcesController->checkUserEnc($user, $line);
|
|
|
+ if ($arrResponseCheckUser['error']) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, $arrResponseCheckUser['msg'], [], 401);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* try {
|
|
|
+ $arrSpares = DB::table('S002V01TINST')
|
|
|
+ ->where([
|
|
|
+ 'STAR_NULI', '', $line,
|
|
|
+ ])
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ //throw $th;
|
|
|
+ } */
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|