Merge branch 'copy_packinglists' into 'development'

Duplicate packing list for admin CIEF reference

See merge request CIEFWorldwideSdnBhd/shipping-portal!89
This commit is contained in:
omair saleh
2021-12-17 02:26:38 +00:00
2 changed files with 8 additions and 2 deletions
@@ -21,6 +21,7 @@ use App\Classes\Modules\Unity\Services\CreatesContract;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\ContainerTypes;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\Order;
use App\Models\PackingList;
@@ -194,7 +195,7 @@ class FetchLoadedContainersFromVTPortalProcessor
$order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->update(['entity_hash_id' => $supervisorContractEntity->hash_id, 'entity_signature' => $supervisorContractEntity->entity_signature_hash_id]);
$importerContractEntity = $this->unityCreateContractEntity->execute($contractReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->appointee->unity_hash_id);
$order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->update(['entity_hash_id' => $importerContractEntity->hash_id, 'entity_signature' => $importerContractEntity->entity_signature_hash_id]);
$order->orderRoles()->where('role_id', '=', RoleT::IMPORTER)->first()->update(['entity_hash_id' => $importerContractEntity->hash_id, 'entity_signature' => $importerContractEntity->entity_signature_hash_id]);
$this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
@@ -207,6 +208,10 @@ class FetchLoadedContainersFromVTPortalProcessor
$packingList = $this->createPackingListProcessor->execute($packingListObject, $order);
$container->packingLists()->attach($packingList);
//Duplicate a copy for internal reference
$packingListObject = new PackingListObject($packingListReference, RoleTypes::SUPER_ADMIN, PackingListType::SHIPPING_PACKING_LIST, (int) filter_var($marking, FILTER_SANITIZE_NUMBER_INT) <= 1000 ? ApprovalStatus::PENDING_VERIFICATION : ApprovalStatus::SUSPENDED, $contractReference);
$packingList = $this->createPackingListProcessor->execute($packingListObject, $packingList);
foreach($contractObligations as $obligation) {
$stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id);
$this->createsStep->execute($packingList, $stepObject);
+2 -1
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use App\Classes\General\Interfaces\Steppable;
use App\Classes\General\Interfaces\Transportable;
use App\Classes\General\Interfaces\Packable;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -11,7 +12,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class PackingList extends AbstractModel implements Transportable, Steppable
class PackingList extends AbstractModel implements Transportable, Steppable, Packable
{
use SoftDeletes;