PartialDeliveriesController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Http\Controllers\ResponseController;
  4. use App\Http\Controllers\EncryptionController;
  5. use App\Http\Controllers\ResourcesController;
  6. use Illuminate\Http\Request;
  7. use Illuminate\Support\Carbon;
  8. use Illuminate\Support\Facades\DB;
  9. use Illuminate\Support\Facades\Validator;
  10. class PartialDeliveriesController extends Controller
  11. {
  12. private $responseController;
  13. private $encController;
  14. private $resourcesController;
  15. public function __construct(){
  16. $this->responseController = new ResponseController();
  17. $this->encController = new EncryptionController();
  18. $this->resourcesController = new ResourcesController();
  19. }
  20. public function getPartialDeliveries($line) {
  21. DB::beginTransaction();
  22. try {
  23. $getPartial = DB::table('S002V01THIOR')
  24. ->where('HIOR_ESOR', '=', 'Recibido Parcial')
  25. ->where('HIOR_NULI', '=', $line)
  26. ->get([
  27. 'HIOR_IDHO',
  28. 'HIOR_NUOR',
  29. 'HIOR_ESOR',
  30. 'HIOR_DESC',
  31. 'HIOR_EVI1',
  32. 'HIOR_EVI2',
  33. 'HIOR_POEN',
  34. 'HIOR_ESTA',
  35. 'HIOR_USRE',
  36. 'HIOR_FERE',
  37. 'HIOR_USMO',
  38. 'HIOR_FEMO',
  39. ]);
  40. } catch (\Throwable $th) {
  41. DB::rollBack();
  42. return $this->responseController->makeResponse(true, "ERR_PARTIAL_DELIVERIES_REG004: Ocurrió un error al momento de obtener los registros.", [], 500);
  43. }
  44. DB::commit();
  45. return $this->responseController->makeResponse(false, "ÉXITO: Consulta Exitosa", $getPartial);
  46. }
  47. }