|
|
@@ -33,6 +33,182 @@ class StockController extends Controller
|
|
|
$this->functionsController = new FunctionsController();
|
|
|
}
|
|
|
|
|
|
+ // Crear Artículo en Stock
|
|
|
+ public function createArtitleWithoutOrder(Request $request) {
|
|
|
+ $validator = Validator::make($request->all(), [
|
|
|
+ 'ARTICULO' => 'required',
|
|
|
+ 'MODELO' => 'required',
|
|
|
+ 'CODIGO_MODELO' => 'required',
|
|
|
+ 'FAMILIA' => 'required',
|
|
|
+ 'SUBFAMILIA' => 'required',
|
|
|
+ 'UNIDAD' => 'required',
|
|
|
+ 'CODIGO_BARRAS' => 'required',
|
|
|
+ 'CANTIDAD' => 'required',
|
|
|
+ 'STOCK_MINIMO' => 'required',
|
|
|
+ 'STOCK_MAXIMO' => 'required',
|
|
|
+ 'REPARACION' => 'required|boolean',
|
|
|
+ 'CONSUMIBLE' => 'required|boolean',
|
|
|
+ 'PELIGROSO' => 'required|boolean',
|
|
|
+ // 'FECHA_VENCIMIENTO' => '',
|
|
|
+ // 'PROVEEDOR' => 'required',
|
|
|
+ 'IMAGEN' => 'required',
|
|
|
+ 'NUMERO_LINEA' => 'required',
|
|
|
+ 'USUARIO' => 'required',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if ($validator->fails()) {
|
|
|
+ return $this->responseController->makeResponse(
|
|
|
+ true,
|
|
|
+ "ERR_STOCK_REG000: Se encontraron uno o más errores.",
|
|
|
+ $this->responseController->makeErrors($validator->errors()->messages()),
|
|
|
+ 401
|
|
|
+ );
|
|
|
+ }
|
|
|
+ DB::beginTransaction();
|
|
|
+ $requestData = $request->all();
|
|
|
+ try {
|
|
|
+ $user = $this->encController->decrypt($requestData['USUARIO']);
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG001: Ocurrió un error al obtener el usuario.", $th->getMessage(), 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ $validateFamily = DB::table('S002V01TFAMI')
|
|
|
+ ->where('FAMI_COFA','=', $requestData['FAMILIA'])
|
|
|
+ ->where('FAMI_NULI','=', $requestData['NUMERO_LINEA'])
|
|
|
+ ->where('FAMI_ESTA','=','Activo')
|
|
|
+ ->exists();
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG002: Ocurrió un error al validar la familia.", $th->getMessage(), 500);
|
|
|
+ }
|
|
|
+ if (!$validateFamily) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG003: La familia no existe.", [], 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ $validateSubfamily = DB::table('S002V01TSUBF')
|
|
|
+ ->where('SUBF_COSU','=', $requestData['SUBFAMILIA'])
|
|
|
+ ->where('SUBF_NULI','=', $requestData['NUMERO_LINEA'])
|
|
|
+ ->where('SUBF_ESTA','=','Activo')
|
|
|
+ ->exists();
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG004: Ocurrió un error al validar la subfamilia.", $th->getMessage(), 500);
|
|
|
+ }
|
|
|
+ if (!$validateSubfamily) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG005: La subfamilia no existe.", [], 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ $validateUnit = DB::table('S002V01TUNID')
|
|
|
+ ->where('UNID_IDUN','=', $requestData['UNIDAD'])
|
|
|
+ ->where('UNID_NULI','=', $requestData['NUMERO_LINEA'])
|
|
|
+ ->where('UNID_ESTA','=','Activo')
|
|
|
+ ->exists();
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG006: Ocurrió un error al validar la unidad.", $th->getMessage(), 500);
|
|
|
+ }
|
|
|
+ if (!$validateUnit) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG007: La unidad no existe.", [], 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ $requestData['PROVEEDOR'] = $requestData['PROVEEDOR'] === '' ? null : $requestData['PROVEEDOR'];
|
|
|
+
|
|
|
+ if (!is_null($requestData['PROVEEDOR'])) {
|
|
|
+ try {
|
|
|
+ $validateUnit = DB::table('S002V01TPROV')
|
|
|
+ ->where('PROV_NUPR','=', $requestData['PROVEEDOR'])
|
|
|
+ ->where('PROV_NULI','=', $requestData['NUMERO_LINEA'])
|
|
|
+ ->where('PROV_ESTA','=','Activo')
|
|
|
+ ->exists();
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG008: Ocurrió un error al validar el proveedor.", $th->getMessage(), 500);
|
|
|
+ }
|
|
|
+ if (!$validateUnit) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG009: El proveedor no existe.", [], 500);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $arrCodeImages = array();
|
|
|
+ foreach ($requestData['IMAGEN'] as $key => $encIdFile) {
|
|
|
+
|
|
|
+ $idFile = $this->encController->decrypt($encIdFile);
|
|
|
+ $tempFile = DB::table('S002V01TARTE')->where([
|
|
|
+ ['ARTE_NULI', '=', $requestData['NUMERO_LINEA']],
|
|
|
+ ['ARTE_IDAR', '=', $idFile],
|
|
|
+ ])->first();
|
|
|
+
|
|
|
+ if(is_null($tempFile)){
|
|
|
+ return $this->responseController->makeResponse(true, 'ERR_ARTITLE_REG006: El archivo consultado no está registrado', [], 404);
|
|
|
+ }else if($tempFile->ARTE_ESTA == 'Eliminado'){
|
|
|
+ return $this->responseController->makeResponse(true, 'ERR_ARTITLE_REG007: El archivo consultado está eliminado', [], 404);
|
|
|
+ }
|
|
|
+ $fileResponse = $this->documentManagementController->moveFinalFile(
|
|
|
+ intval($requestData['NUMERO_LINEA']),
|
|
|
+ 'GIST',
|
|
|
+ 'FO',
|
|
|
+ $tempFile,
|
|
|
+ $user,
|
|
|
+ );
|
|
|
+ if(!$fileResponse[0]){
|
|
|
+ return $this->responseController->makeResponse(true, 'ERR_ARTITLE_REG008: '.$fileResponse[1], [], 400);
|
|
|
+ }
|
|
|
+ $arrCodeImages[] = $this->encController->encrypt($fileResponse[1]);
|
|
|
+ }
|
|
|
+ $jsonImages = json_encode($arrCodeImages);
|
|
|
+
|
|
|
+ $now = $this->functionsController->now();
|
|
|
+ $currentDate = $now->toDateTimeString();
|
|
|
+
|
|
|
+ try {
|
|
|
+ $validateRegister = DB::table('S002V01TSTAR')->insert([
|
|
|
+ // 'STAR_CODI' => $requestData['CODIGO_STOCK'],
|
|
|
+ 'STAR_ARTI' => $requestData['ARTICULO'],
|
|
|
+ 'STAR_MODE' => $requestData['MODELO'],
|
|
|
+ 'STAR_COMO' => $requestData['CODIGO_MODELO'],
|
|
|
+ 'STAR_IDFA' => $requestData['FAMILIA'],
|
|
|
+ 'STAR_IDSU' => $requestData['SUBFAMILIA'],
|
|
|
+ 'STAR_NUPR' => $requestData['PROVEEDOR'],
|
|
|
+ 'STAR_IDUN' => $requestData['UNIDAD'],
|
|
|
+ 'STAR_COBA' => $requestData['CODIGO_BARRAS'],
|
|
|
+ 'STAR_CANT' => $requestData['CANTIDAD'],
|
|
|
+ 'STAR_STMI' => $requestData['STOCK_MINIMO'],
|
|
|
+ 'STAR_STMA' => $requestData['STOCK_MAXIMO'],
|
|
|
+ 'STAR_REPA' => $requestData['REPARACION'],
|
|
|
+ 'STAR_CONS' => $requestData['CONSUMIBLE'],
|
|
|
+ 'STAR_PELI' => $requestData['PELIGROSO'],
|
|
|
+ 'STAR_FEVE' => $requestData['FECHA_VENCIMIENTO'],
|
|
|
+ 'STAR_IMAG' => $jsonImages,
|
|
|
+ 'STAR_TIAD' => 'Sin Pedido',
|
|
|
+ 'STAR_NULI' => $requestData['NUMERO_LINEA'],
|
|
|
+ 'STAR_USRE' => $user,
|
|
|
+ 'STAR_FERE' => $currentDate,
|
|
|
+ 'STAR_FEAR' => DB::raw('CURRENT_TIMESTAMP'),
|
|
|
+ ]);
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG011: Ocurrió un error al registrar el artículo.", $th->getMessage(), 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$validateRegister) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_STOCK_REG012: No se pudo registrar el artículo.", [], 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ DB::commit();
|
|
|
+ return $this->responseController->makeResponse(false, "EXITO: Registro Exitoso");
|
|
|
+ }
|
|
|
+
|
|
|
+ // FUNCIÓN GESTIÓN DE ALMACENES
|
|
|
public function getWarehouse( $user, $line ) {
|
|
|
$arrResponseCheckUser = $this->resourcesController->checkUserEnc($user, $line);
|
|
|
if ($arrResponseCheckUser['error']) {
|
|
|
@@ -599,182 +775,6 @@ class StockController extends Controller
|
|
|
|
|
|
}
|
|
|
|
|
|
- // Crear Artículo en Stock
|
|
|
- public function createArtitleWithoutOrder(Request $request) {
|
|
|
- $validator = Validator::make($request->all(), [
|
|
|
- 'ARTICULO' => 'required',
|
|
|
- 'MODELO' => 'required',
|
|
|
- 'CODIGO_MODELO' => 'required',
|
|
|
- 'FAMILIA' => 'required',
|
|
|
- 'SUBFAMILIA' => 'required',
|
|
|
- 'UNIDAD' => 'required',
|
|
|
- 'CODIGO_BARRAS' => 'required',
|
|
|
- 'CANTIDAD' => 'required',
|
|
|
- 'STOCK_MINIMO' => 'required',
|
|
|
- 'STOCK_MAXIMO' => 'required',
|
|
|
- 'REPARACION' => 'required|boolean',
|
|
|
- 'CONSUMIBLE' => 'required|boolean',
|
|
|
- 'PELIGROSO' => 'required|boolean',
|
|
|
- // 'FECHA_VENCIMIENTO' => '',
|
|
|
- // 'PROVEEDOR' => 'required',
|
|
|
- 'IMAGEN' => 'required',
|
|
|
- 'NUMERO_LINEA' => 'required',
|
|
|
- 'USUARIO' => 'required',
|
|
|
- ]);
|
|
|
-
|
|
|
- if ($validator->fails()) {
|
|
|
- return $this->responseController->makeResponse(
|
|
|
- true,
|
|
|
- "ERR_STOCK_REG000: Se encontraron uno o más errores.",
|
|
|
- $this->responseController->makeErrors($validator->errors()->messages()),
|
|
|
- 401
|
|
|
- );
|
|
|
- }
|
|
|
- DB::beginTransaction();
|
|
|
- $requestData = $request->all();
|
|
|
- try {
|
|
|
- $user = $this->encController->decrypt($requestData['USUARIO']);
|
|
|
- } catch (\Throwable $th) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG001: Ocurrió un error al obtener el usuario.", $th->getMessage(), 500);
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- $validateFamily = DB::table('S002V01TFAMI')
|
|
|
- ->where('FAMI_COFA','=', $requestData['FAMILIA'])
|
|
|
- ->where('FAMI_NULI','=', $requestData['NUMERO_LINEA'])
|
|
|
- ->where('FAMI_ESTA','=','Activo')
|
|
|
- ->exists();
|
|
|
- } catch (\Throwable $th) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG002: Ocurrió un error al validar la familia.", $th->getMessage(), 500);
|
|
|
- }
|
|
|
- if (!$validateFamily) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG003: La familia no existe.", [], 500);
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- $validateSubfamily = DB::table('S002V01TSUBF')
|
|
|
- ->where('SUBF_COSU','=', $requestData['SUBFAMILIA'])
|
|
|
- ->where('SUBF_NULI','=', $requestData['NUMERO_LINEA'])
|
|
|
- ->where('SUBF_ESTA','=','Activo')
|
|
|
- ->exists();
|
|
|
- } catch (\Throwable $th) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG004: Ocurrió un error al validar la subfamilia.", $th->getMessage(), 500);
|
|
|
- }
|
|
|
- if (!$validateSubfamily) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG005: La subfamilia no existe.", [], 500);
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- $validateUnit = DB::table('S002V01TUNID')
|
|
|
- ->where('UNID_IDUN','=', $requestData['UNIDAD'])
|
|
|
- ->where('UNID_NULI','=', $requestData['NUMERO_LINEA'])
|
|
|
- ->where('UNID_ESTA','=','Activo')
|
|
|
- ->exists();
|
|
|
- } catch (\Throwable $th) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG006: Ocurrió un error al validar la unidad.", $th->getMessage(), 500);
|
|
|
- }
|
|
|
- if (!$validateUnit) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG007: La unidad no existe.", [], 500);
|
|
|
- }
|
|
|
-
|
|
|
- $requestData['PROVEEDOR'] = $requestData['PROVEEDOR'] === '' ? null : $requestData['PROVEEDOR'];
|
|
|
-
|
|
|
- if (!is_null($requestData['PROVEEDOR'])) {
|
|
|
- try {
|
|
|
- $validateUnit = DB::table('S002V01TPROV')
|
|
|
- ->where('PROV_NUPR','=', $requestData['PROVEEDOR'])
|
|
|
- ->where('PROV_NULI','=', $requestData['NUMERO_LINEA'])
|
|
|
- ->where('PROV_ESTA','=','Activo')
|
|
|
- ->exists();
|
|
|
- } catch (\Throwable $th) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG008: Ocurrió un error al validar el proveedor.", $th->getMessage(), 500);
|
|
|
- }
|
|
|
- if (!$validateUnit) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG009: El proveedor no existe.", [], 500);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $arrCodeImages = array();
|
|
|
- foreach ($requestData['IMAGEN'] as $key => $encIdFile) {
|
|
|
-
|
|
|
- $idFile = $this->encController->decrypt($encIdFile);
|
|
|
- $tempFile = DB::table('S002V01TARTE')->where([
|
|
|
- ['ARTE_NULI', '=', $requestData['NUMERO_LINEA']],
|
|
|
- ['ARTE_IDAR', '=', $idFile],
|
|
|
- ])->first();
|
|
|
-
|
|
|
- if(is_null($tempFile)){
|
|
|
- return $this->responseController->makeResponse(true, 'ERR_ARTITLE_REG006: El archivo consultado no está registrado', [], 404);
|
|
|
- }else if($tempFile->ARTE_ESTA == 'Eliminado'){
|
|
|
- return $this->responseController->makeResponse(true, 'ERR_ARTITLE_REG007: El archivo consultado está eliminado', [], 404);
|
|
|
- }
|
|
|
- $fileResponse = $this->documentManagementController->moveFinalFile(
|
|
|
- intval($requestData['NUMERO_LINEA']),
|
|
|
- 'GIST',
|
|
|
- 'FO',
|
|
|
- $tempFile,
|
|
|
- $user,
|
|
|
- );
|
|
|
- if(!$fileResponse[0]){
|
|
|
- return $this->responseController->makeResponse(true, 'ERR_ARTITLE_REG008: '.$fileResponse[1], [], 400);
|
|
|
- }
|
|
|
- $arrCodeImages[] = $this->encController->encrypt($fileResponse[1]);
|
|
|
- }
|
|
|
- $jsonImages = json_encode($arrCodeImages);
|
|
|
-
|
|
|
- $now = $this->functionsController->now();
|
|
|
- $currentDate = $now->toDateTimeString();
|
|
|
-
|
|
|
- try {
|
|
|
- $validateRegister = DB::table('S002V01TSTAR')->insert([
|
|
|
- // 'STAR_CODI' => $requestData['CODIGO_STOCK'],
|
|
|
- 'STAR_ARTI' => $requestData['ARTICULO'],
|
|
|
- 'STAR_MODE' => $requestData['MODELO'],
|
|
|
- 'STAR_COMO' => $requestData['CODIGO_MODELO'],
|
|
|
- 'STAR_IDFA' => $requestData['FAMILIA'],
|
|
|
- 'STAR_IDSU' => $requestData['SUBFAMILIA'],
|
|
|
- 'STAR_NUPR' => $requestData['PROVEEDOR'],
|
|
|
- 'STAR_IDUN' => $requestData['UNIDAD'],
|
|
|
- 'STAR_COBA' => $requestData['CODIGO_BARRAS'],
|
|
|
- 'STAR_CANT' => $requestData['CANTIDAD'],
|
|
|
- 'STAR_STMI' => $requestData['STOCK_MINIMO'],
|
|
|
- 'STAR_STMA' => $requestData['STOCK_MAXIMO'],
|
|
|
- 'STAR_REPA' => $requestData['REPARACION'],
|
|
|
- 'STAR_CONS' => $requestData['CONSUMIBLE'],
|
|
|
- 'STAR_PELI' => $requestData['PELIGROSO'],
|
|
|
- 'STAR_FEVE' => $requestData['FECHA_VENCIMIENTO'],
|
|
|
- 'STAR_IMAG' => $jsonImages,
|
|
|
- 'STAR_TIAD' => 'Sin Pedido',
|
|
|
- 'STAR_NULI' => $requestData['NUMERO_LINEA'],
|
|
|
- 'STAR_USRE' => $user,
|
|
|
- 'STAR_FERE' => $currentDate,
|
|
|
- 'STAR_FEAR' => DB::raw('CURRENT_TIMESTAMP'),
|
|
|
- ]);
|
|
|
- } catch (\Throwable $th) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG011: Ocurrió un error al registrar el artículo.", $th->getMessage(), 500);
|
|
|
- }
|
|
|
-
|
|
|
- if (!$validateRegister) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_STOCK_REG012: No se pudo registrar el artículo.", [], 500);
|
|
|
- }
|
|
|
-
|
|
|
- DB::commit();
|
|
|
- return $this->responseController->makeResponse(false, "EXITO: Registro Exitoso");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public function getAreaByWarehouse($idWarehouse, $user, $line) {
|
|
|
try {
|
|
|
$idWarehouse = $this->encController->decrypt($idWarehouse);
|
|
|
@@ -1035,22 +1035,6 @@ class StockController extends Controller
|
|
|
}
|
|
|
|
|
|
|
|
|
- try {
|
|
|
- $validateExistCode = DB::table('S002V01TAREA')
|
|
|
- ->where('AREA_NULI', '=', $requestData['NUMERO_LINEA'])
|
|
|
- ->where('AREA_COAR', '!=', $idArea)
|
|
|
- ->where('AREA_ESTA', '=', 'Activo')
|
|
|
- ->exists();
|
|
|
- } catch (\Throwable $th) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, 'ERR_AREA_UPD007: Ocurrió un error al verificar el código del área.', $th->getMessage(), 500);
|
|
|
- }
|
|
|
- if ($validateExistCode) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, 'ERR_AREA_UPD008: El código del área ya se encuentra registrado.', [], 406);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
$now = $this->functionsController->now();
|
|
|
$currentDate = $now->toDateTimeString();
|
|
|
|
|
|
@@ -1206,7 +1190,6 @@ class StockController extends Controller
|
|
|
return $this->responseController->makeResponse(false, "ÉXITO: Eliminación Exitosa");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public function getLevelByAreaWarehouse($idWarehouse, $idArea, $user, $line) {
|
|
|
try {
|
|
|
$idWarehouse = $this->encController->decrypt($idWarehouse);
|
|
|
@@ -1687,8 +1670,6 @@ class StockController extends Controller
|
|
|
return $this->responseController->makeResponse(false, "ÉXITO: Eliminación Exitosa");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
public function getZoneByLevelAreaWarehouse($idWarehouse, $idArea, $idLevel, $user, $line) {
|
|
|
try {
|
|
|
$idWarehouse = $this->encController->decrypt($idWarehouse);
|
|
|
@@ -2224,7 +2205,7 @@ class StockController extends Controller
|
|
|
return $this->responseController->makeResponse(false, "ÉXITO: Eliminación Exitosa");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ // FUNCIÓN RECEPCIÓN DE ARTÍCULOS
|
|
|
public function registerToStock(Request $request) {
|
|
|
$validator = Validator::make($request->all(), [
|
|
|
'WAREHOUSE' => 'required|string',
|
|
|
@@ -2445,7 +2426,7 @@ class StockController extends Controller
|
|
|
}
|
|
|
if (is_null($orden)) {
|
|
|
DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, 'La orden de compra no exite.', [], 500);
|
|
|
+ return $this->responseController->makeResponse(true, 'La orden de compra no existe.', [], 500);
|
|
|
}
|
|
|
|
|
|
$now = $this->functionsController->now();
|
|
|
@@ -2782,4 +2763,66 @@ class StockController extends Controller
|
|
|
DB::commit();
|
|
|
return $this->responseController->makeResponse(false, "ÉXITO: Registro Exitoso");
|
|
|
}
|
|
|
+
|
|
|
+ // FUNCIÓN INTERCAMBIO DE ARTICULOS ENTRE ALMACENES
|
|
|
+ public function getCurrentLocationArtitles($user, $line) {
|
|
|
+ try {
|
|
|
+ $arrStockArtitle = DB::table('S002V01TSTAR')
|
|
|
+ ->where('STAR_NULI', '=', $line)
|
|
|
+ ->where('STAR_ESTA', '=', 'Activo')
|
|
|
+ ->where('INST_NULI', '=', $line)
|
|
|
+ ->where('INST_ESTA', '=', 'Activo')
|
|
|
+ ->where('UBAR_ESTA', '=', 'Activo')
|
|
|
+ ->join('S002V01TUBAR', 'UBAR_IDST', '=', 'STAR_IDST')
|
|
|
+ ->join('S002V01TINST', 'INST_IDIS', '=', 'STAR_IDIS')
|
|
|
+ ->join('S002V01TFAMI', 'FAMI_COFA', '=', 'INST_COFA')
|
|
|
+ ->join('S002V01TSUBF', 'SUBF_COSU', '=', 'INST_COSU')
|
|
|
+
|
|
|
+ ->join('S002V01TALMA', 'ALMA_COAL', '=', 'UBAR_COAL')
|
|
|
+ ->join('S002V01TAREA', 'AREA_COAR', '=', 'UBAR_COAR')
|
|
|
+ ->join('S002V01TNIVE', 'NIVE_CONI', '=', 'UBAR_CONI')
|
|
|
+ ->join('S002V01TZONA', 'ZONA_COZO', '=', 'UBAR_COZO')
|
|
|
+ ->get([
|
|
|
+ 'STAR_IDST AS ID_STOCK',
|
|
|
+ 'INST_IDIS AS ID_INFORMACION_STOCK',
|
|
|
+ 'FAMI_NOFA AS NOMBRE_FAMILIA',
|
|
|
+ 'SUBF_NOSU AS NOMBRE_SUBFAMILIA',
|
|
|
+ 'INST_ARTI AS ARTITULO',
|
|
|
+ 'INST_MODE AS MODELO',
|
|
|
+ 'INST_COMO AS CODIGO_MODELO',
|
|
|
+ 'INST_IMAG AS IMAGENES',
|
|
|
+ 'UBAR_COUB AS CODIGO',
|
|
|
+ DB::raw('CONCAT(ALMA_NOAL, " (", ALMA_COAL, ")") AS NOMBRE_ALMACEN'),
|
|
|
+ DB::raw('CONCAT(AREA_NOAR, " (", AREA_COAR, ")") AS NOMBRE_AREA'),
|
|
|
+ DB::raw('CONCAT(NIVE_NONI, " (", NIVE_CONI, ")") AS NOMBRE_NIVEL'),
|
|
|
+ DB::raw('CONCAT(ZONA_NOZO, " (", ZONA_COZO, ")") AS NOMBRE_ZONA'),
|
|
|
+ ]);
|
|
|
+ $arrStockArtitle = json_decode(json_encode($arrStockArtitle), true);
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ return $this->responseController->makeResponse(true, 'Ocurrió un error al obtener la información del stock.', $th->getMessage(), 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($arrStockArtitle as $key => $stockArtitle) {
|
|
|
+ $imagesGallery = [];
|
|
|
+ $arrImages = json_decode($stockArtitle['IMAGENES']);
|
|
|
+ foreach($arrImages as $image) {
|
|
|
+ $imageCodeEnc = $this->encController->encrypt($image);
|
|
|
+ $response = $this->documentManagementController->privateGetPublicDocumentURL(
|
|
|
+ $imageCodeEnc,
|
|
|
+ $user,
|
|
|
+ $line
|
|
|
+ );
|
|
|
+ if($response['error']){
|
|
|
+ return $this->responseController->makeresponse(true, $response['msg'], [], 500);
|
|
|
+ }
|
|
|
+ $imagesGallery[] = $response['response']['public_uri'];
|
|
|
+ }
|
|
|
+ $stockArtitle['IMAGENES'] = $imagesGallery;
|
|
|
+ $arrStockArtitle[$key] = $stockArtitle;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->responseController->makeResponse(false, "ÉXITO: Consulta Exitosa", $arrStockArtitle);
|
|
|
+ }
|
|
|
+
|
|
|
+ // FUNCIÓN PARA JOSÉ LUIS
|
|
|
}
|