mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-27 16:34:27 +00:00
update api
This commit is contained in:
+8
-2
@@ -58,8 +58,14 @@ class UpdateContainerLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
|
||||
$object = new ContainerObject( $container->packing_list_id , $request->input('container_reference'), $request->input('container_type'), $request->input('seal_reference'));
|
||||
|
||||
$object = new ContainerObject(
|
||||
$request->input('container_reference'),
|
||||
$container->container_number,
|
||||
$request->input('container_type'),
|
||||
$request->input('seal_reference'),
|
||||
$container->status,
|
||||
);
|
||||
|
||||
$this->canUpdateContainer->passes($object);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class ContainerObject implements DataTransferObject
|
||||
private $containerNumber;
|
||||
|
||||
/** @var string */
|
||||
private $sealNumber;
|
||||
private $sealReference;
|
||||
|
||||
/** @var int */
|
||||
private $containerType;
|
||||
@@ -26,15 +26,15 @@ class ContainerObject implements DataTransferObject
|
||||
* ContainerObject constructor.
|
||||
* @param string $reference
|
||||
* @param string $containerNumber
|
||||
* @param string $sealNumber
|
||||
* @param string $sealReference
|
||||
* @param int $containerType
|
||||
* @param int $status
|
||||
*/
|
||||
public function __construct(string $reference, string $containerNumber, string $sealNumber, int $containerType, int $status)
|
||||
public function __construct(string $reference, string $containerNumber, string $sealReference, int $containerType, int $status)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$this->containerNumber = $containerNumber;
|
||||
$this->sealNumber = $sealNumber;
|
||||
$this->sealReference = $sealReference;
|
||||
$this->containerType = $containerType;
|
||||
$this->status = $status;
|
||||
}
|
||||
@@ -58,9 +58,9 @@ class ContainerObject implements DataTransferObject
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSealNumber(): string
|
||||
public function getSealReference(): string
|
||||
{
|
||||
return $this->sealNumber;
|
||||
return $this->sealReference;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ class CreatesContainer extends AbstractUpdateRelationshipRecord
|
||||
$model->reference = $object->getReference();
|
||||
$model->container_number = $object->getContainerNumber();
|
||||
$model->container_type = $object->getContainerType();
|
||||
$model->seal_reference = $object->getSealNumber();
|
||||
$model->seal_reference = $object->getSealReference();
|
||||
$model->status = $object->getStatus();
|
||||
|
||||
return $this->handler($owner->containers(), $model);
|
||||
|
||||
@@ -17,7 +17,7 @@ class UpdatesContainer extends AbstractUpdateRecord
|
||||
*/
|
||||
public function execute(Container $model, ContainerObject $object) {
|
||||
|
||||
$model->container_reference = $object->getContainerReference();
|
||||
$model->reference = $object->getReference();
|
||||
$model->container_type = $object->getContainerType();
|
||||
$model->seal_reference = $object->getSealReference();
|
||||
|
||||
|
||||
@@ -58,7 +58,14 @@ class CreateTransportLogic extends AbstractControllerLogic
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$object = new TransportObject($request->input('type'), $request->input('courier'), $request->input('tracking_number'), null, null, ApprovalStatus::PENDING_SUBMISSION);
|
||||
$object = new TransportObject(
|
||||
$request->input('type'),
|
||||
$request->input('courier'),
|
||||
$request->input('tracking_number'),
|
||||
null,
|
||||
null,
|
||||
pprovalStatus::PENDING_SUBMISSION
|
||||
);
|
||||
|
||||
$this->canCreateTransport->passes($object);
|
||||
|
||||
|
||||
@@ -58,7 +58,14 @@ class UpdateTransportLogic extends AbstractControllerLogic
|
||||
{
|
||||
$query = $this->fetchesTransport->execute(['id' => $request->route('id')]);
|
||||
|
||||
$object = new TransportObject($request->input('type'), $request->input('courier'), $request->input('tracking_number'), $request->input('dispatch_date'), $request->input('drop_date'), $request->input('status'));
|
||||
$object = new TransportObject(
|
||||
$request->input('type'),
|
||||
$request->input('courier'),
|
||||
$request->input('tracking_number'),
|
||||
$request->input('dispatch_date'),
|
||||
$request->input('drop_date'),
|
||||
$request->input('status')
|
||||
);
|
||||
|
||||
$this->canUpdateTransport->passes($object);
|
||||
|
||||
|
||||
@@ -172,49 +172,49 @@ class CompaniesTableSeeder extends Seeder
|
||||
|
||||
}
|
||||
|
||||
if(true){
|
||||
$companies = OldCompany::all();
|
||||
// if(true){
|
||||
// $companies = OldCompany::all();
|
||||
|
||||
foreach($companies as $company){
|
||||
// foreach($companies as $company){
|
||||
|
||||
$marking = explode("CIEF/", $company->marking);
|
||||
// $marking = explode("CIEF/", $company->marking);
|
||||
|
||||
if(count($marking) < 2){
|
||||
continue;
|
||||
}
|
||||
// if(count($marking) < 2){
|
||||
// continue;
|
||||
// }
|
||||
|
||||
$marking = str_replace(' ', '', str_replace('/', '', $marking[1]));
|
||||
// $marking = str_replace(' ', '', str_replace('/', '', $marking[1]));
|
||||
|
||||
|
||||
/** @var Company $newCompany */
|
||||
$newCompany = $this->createCompanyProcessor->execute($company->name, CompanyType::COMPANY_BUSINESS, ApprovalStatus::PENDING_SUBMISSION);
|
||||
// /** @var Company $newCompany */
|
||||
// $newCompany = $this->createCompanyProcessor->execute($company->name, CompanyType::COMPANY_BUSINESS, ApprovalStatus::PENDING_SUBMISSION);
|
||||
|
||||
$this->updatesCompanyStatus->execute($newCompany, ApprovalStatus::APPROVED);
|
||||
// $this->updatesCompanyStatus->execute($newCompany, ApprovalStatus::APPROVED);
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($newCompany, BusinessType::IMPORTER);
|
||||
// /** @var CompanyModule $companyModule */
|
||||
// $companyModule = $this->createCompanyModuleProcessor->execute($newCompany, BusinessType::IMPORTER);
|
||||
|
||||
$connectionObject = new CompanyConnectionObject($companyModule, 'CIEF', $marking);
|
||||
// $connectionObject = new CompanyConnectionObject($companyModule, 'CIEF', $marking);
|
||||
|
||||
$connection = $this->createsCompanyConnection->execute($connectionObject);
|
||||
$this->approvesCompanyConnection->execute($connection);
|
||||
// $connection = $this->createsCompanyConnection->execute($connectionObject);
|
||||
// $this->approvesCompanyConnection->execute($connection);
|
||||
|
||||
$i = 0;
|
||||
foreach($company->addresses as $address){
|
||||
$this->createAddressFromOldAddressProcessor->execute($address, $companyModule);
|
||||
$contact = preg_replace("/[^0-9.]/", "", $address->contact);
|
||||
if($contact){
|
||||
$i++;
|
||||
if($i === 1) {
|
||||
$contactObject = new ContactObject('', $contact, $company->email, '',);
|
||||
$this->createContactProcessor->execute($contactObject, $newCompany);
|
||||
}
|
||||
}
|
||||
// $i = 0;
|
||||
// foreach($company->addresses as $address){
|
||||
// $this->createAddressFromOldAddressProcessor->execute($address, $companyModule);
|
||||
// $contact = preg_replace("/[^0-9.]/", "", $address->contact);
|
||||
// if($contact){
|
||||
// $i++;
|
||||
// if($i === 1) {
|
||||
// $contactObject = new ContactObject('', $contact, $company->email, '',);
|
||||
// $this->createContactProcessor->execute($contactObject, $newCompany);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user