diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/AssignPackingListOrderLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/AssignPackingListOrderLogic.php index 6fbbb2c7..cba73aa8 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/AssignPackingListOrderLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/AssignPackingListOrderLogic.php @@ -2,6 +2,7 @@ namespace App\Classes\Modules\PackingLists\ControllersLogic; +use App\Classes\Exceptions\ResourceNotFoundException; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\PackingLists\Services\FetchesPackingList; use App\Classes\Modules\Orders\Services\FetchesOrder; @@ -148,7 +149,7 @@ class AssignPackingListOrderLogic extends AbstractControllerLogic $stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id); $this->createsStep->execute($packing_list, $stepObject); } - } catch (\Exception $exception) { + } catch (ResourceNotFoundException $exception) { } diff --git a/app/Classes/Modules/PackingLists/Processors/FetchLoadedContainersFromVTPortalProcessor.php b/app/Classes/Modules/PackingLists/Processors/FetchLoadedContainersFromVTPortalProcessor.php index b29dc77b..c0c9d24b 100644 --- a/app/Classes/Modules/PackingLists/Processors/FetchLoadedContainersFromVTPortalProcessor.php +++ b/app/Classes/Modules/PackingLists/Processors/FetchLoadedContainersFromVTPortalProcessor.php @@ -222,17 +222,23 @@ class FetchLoadedContainersFromVTPortalProcessor $allow_contract = true; try { - $order = $this->fetchesOrder->execute(['reference' => $orderNumber]); + $warehousePackingList = $this->fetchesPackingList->execute(['reference' => $packingList[3]]); + $order = $warehousePackingList->owner; } catch (ResourceNotFoundException $exception) { try { - $order = $this->fetchesOrder->execute(['reference' => substr($orderNumber, -9)]); + $order = $this->fetchesOrder->execute(['reference' => $orderNumber]); } catch (ResourceNotFoundException $exception) { - $order = $this->fetchesCompanyModule->execute(['id' => 1]); - $allow_contract = false; - } + try { + $order = $this->fetchesOrder->execute(['reference' => substr($orderNumber, -9)]); + } catch (ResourceNotFoundException $exception) { + $order = $this->fetchesCompanyModule->execute(['id' => 1]); + $allow_contract = false; + } + } } + $packingListReference = $packingList[3]; $package = $packingList; $deliveryDate = $package[1] ? Carbon::parse($package[1]) : null;