diff --git a/app/Classes/Modules/PackingLists/Processors/FetchContainersFromYdPortalProcessor.php b/app/Classes/Modules/PackingLists/Processors/FetchContainersFromYdPortalProcessor.php index b76c2db3..a9459f8f 100644 --- a/app/Classes/Modules/PackingLists/Processors/FetchContainersFromYdPortalProcessor.php +++ b/app/Classes/Modules/PackingLists/Processors/FetchContainersFromYdPortalProcessor.php @@ -2,7 +2,9 @@ namespace App\Classes\Modules\PackingLists\Processors; +use App\Classes\Exceptions\AccessForbiddenException; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\RequestValidationException; use App\Classes\Exceptions\ResourceNotFoundException; use App\Classes\Modules\Companies\Services\FetchesCompanyModule; use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal; @@ -38,6 +40,7 @@ use App\Models\Order; use App\Models\PackingList; use App\Models\Transport; use Carbon\Carbon; +use GuzzleHttp\Exception\GuzzleException; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; @@ -47,18 +50,6 @@ class FetchContainersFromYdPortalProcessor /** @var FetchesDataFromYDPortal */ private $fetchesDataFRomYDPortal; - /** @var FetchesOrder */ - private $fetchesOrder; - - /** @var UpdatesContractObligation */ - private $updatesContractObligations; - - /** @var CreatePackingListProcessor */ - private $createPackingListProcessor; - - /** @var CreatePackageProcessor */ - private $createPackageProcessor; - /** @var CreatesTransport */ private $createsTransport; @@ -68,75 +59,31 @@ class FetchContainersFromYdPortalProcessor /** @var FetchesContainer */ private $fetchesContainer; - /** @var FetchesPackingList */ - private $fetchesPackingList; - - /** @var FetchesCompanyModule */ - private $fetchesCompanyModule; - /** @var CreateContainerProcessor */ private $createContainerProcessor; - /** @var CreatesContract */ - private $unityCreateContract; - - /** @var AssignContractEntityProcessor */ - private $unityAssignContractEntity; - - /** @var CreateContractEntityProcessor */ - private $unityCreateContractEntity; - - /** @var CreatesStep */ - private $createsStep; - - /** @var ActivateContractProcessor */ - private $unityActivateContract; - /** - * FetchOrderListsFromYdPortalProcessor constructor. * @param FetchesDataFromYDPortal $fetchesDataFRomYDPortal - * @param FetchesOrder $fetchesOrder - * @param UpdatesContractObligation $updatesContractObligations - * @param CreatePackingListProcessor $createPackingListProcessor - * @param CreatePackageProcessor $createPackageProcessor * @param CreatesTransport $createsTransport * @param CreatesSchedule $createsSchedule * @param FetchesContainer $fetchesContainer - * @param FetchesPackingList $fetchesPackingList - * @param FetchesCompanyModule $fetchesCompanyModule * @param CreateContainerProcessor $createContainerProcessor - * @param CreatesContract $unityCreateContract - * @param AssignContractEntityProcessor $unityAssignContractEntity - * @param CreateContractEntityProcessor $unityCreateContractEntity - * @param CreatesStep $createsStep - * @param ActivateContractProcessor $unityActivateContract */ - public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, FetchesOrder $fetchesOrder, UpdatesContractObligation $updatesContractObligations, CreatePackingListProcessor $createPackingListProcessor, CreatePackageProcessor $createPackageProcessor, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule, FetchesContainer $fetchesContainer, FetchesPackingList $fetchesPackingList, FetchesCompanyModule $fetchesCompanyModule, CreateContainerProcessor $createContainerProcessor, CreatesContract $unityCreateContract, AssignContractEntityProcessor $unityAssignContractEntity, CreateContractEntityProcessor $unityCreateContractEntity, CreatesStep $createsStep, ActivateContractProcessor $unityActivateContract) + public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule, FetchesContainer $fetchesContainer, CreateContainerProcessor $createContainerProcessor) { $this->fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal; - $this->fetchesOrder = $fetchesOrder; - $this->updatesContractObligations = $updatesContractObligations; - $this->createPackingListProcessor = $createPackingListProcessor; - $this->createPackageProcessor = $createPackageProcessor; $this->createsTransport = $createsTransport; $this->createsSchedule = $createsSchedule; $this->fetchesContainer = $fetchesContainer; - $this->fetchesPackingList = $fetchesPackingList; - $this->fetchesCompanyModule = $fetchesCompanyModule; $this->createContainerProcessor = $createContainerProcessor; - $this->unityCreateContract = $unityCreateContract; - $this->unityAssignContractEntity = $unityAssignContractEntity; - $this->unityCreateContractEntity = $unityCreateContractEntity; - $this->createsStep = $createsStep; - $this->unityActivateContract = $unityActivateContract; } /** - * @param Carbon|null $start - * @param Carbon|null $end * @return void - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws MalformedRequestException + * @throws AccessForbiddenException + * @throws RequestValidationException */ public function execute() { diff --git a/app/Classes/Modules/PackingLists/Processors/FetchContainersUpdatesFromYdPortalProcessor.php b/app/Classes/Modules/PackingLists/Processors/FetchContainersUpdatesFromYdPortalProcessor.php index 73f2f9a8..ecc99f4e 100644 --- a/app/Classes/Modules/PackingLists/Processors/FetchContainersUpdatesFromYdPortalProcessor.php +++ b/app/Classes/Modules/PackingLists/Processors/FetchContainersUpdatesFromYdPortalProcessor.php @@ -51,7 +51,7 @@ class FetchContainersUpdatesFromYdPortalProcessor foreach ($containers as $container) { $time_start = microtime(true); - $packingList = $container->packingLists()->first(); + $packingList = $container->packingLists()->random(); $trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [ 'trakingno' => $packingList->reference diff --git a/routes/web.php b/routes/web.php index b1e5f02b..60b5e990 100644 --- a/routes/web.php +++ b/routes/web.php @@ -807,7 +807,7 @@ Route::get('/invoices/show-duplicated', function(Request $request){ ->having('count', '>', 1) ->get(); - // delete invoice type suspended + // delete invoice type suspended echo '
| Invoice Owner ID | "; echo "Invoice Owner ID | "; echo "