mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-24 15:05:09 +00:00
add loading date for container table
This commit is contained in:
@@ -62,6 +62,7 @@ class CreateContainerLogic extends AbstractControllerLogic
|
||||
$request->input('container_number'),
|
||||
$request->input('seal_reference'),
|
||||
$request->input('container_type'),
|
||||
$request->input('loading_date'),
|
||||
$request->input('status')
|
||||
);
|
||||
|
||||
|
||||
+5
-2
@@ -52,7 +52,9 @@ class UpdateContainerLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
@@ -64,7 +66,8 @@ class UpdateContainerLogic extends AbstractControllerLogic
|
||||
$container->container_number,
|
||||
$request->input('container_type'),
|
||||
$request->input('seal_reference'),
|
||||
$container->status,
|
||||
$request->input('loading_date'),
|
||||
$container->status,
|
||||
);
|
||||
|
||||
$this->canUpdateContainer->passes($object);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Classes\Modules\PackingLists\DataTransferObjects;
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ContainerObject implements DataTransferObject
|
||||
{
|
||||
@@ -19,6 +20,9 @@ class ContainerObject implements DataTransferObject
|
||||
/** @var int */
|
||||
private $containerType;
|
||||
|
||||
/** @var Carbon */
|
||||
private $loadingDate;
|
||||
|
||||
/** @var int */
|
||||
private $status;
|
||||
|
||||
@@ -28,14 +32,16 @@ class ContainerObject implements DataTransferObject
|
||||
* @param string $containerNumber
|
||||
* @param string $sealReference
|
||||
* @param int $containerType
|
||||
* @param Carbon $loadingDate
|
||||
* @param int $status
|
||||
*/
|
||||
public function __construct(string $reference, string $containerNumber, string $sealReference, int $containerType, int $status)
|
||||
public function __construct(string $reference, string $containerNumber, string $sealReference, int $containerType, Carbon $loadingDate, int $status)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$this->containerNumber = $containerNumber;
|
||||
$this->sealReference = $sealReference;
|
||||
$this->containerType = $containerType;
|
||||
$this->loadingDate = $loadingDate;
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
@@ -71,6 +77,14 @@ class ContainerObject implements DataTransferObject
|
||||
return $this->containerType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getLoadingDate(): Carbon
|
||||
{
|
||||
return $this->loadingDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
@@ -79,4 +93,5 @@ class ContainerObject implements DataTransferObject
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -6,7 +6,6 @@ use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
|
||||
use App\Classes\Modules\Orders\Services\FetchesDataFromVTPortal;
|
||||
use App\Classes\Modules\Orders\Services\FetchesOrder;
|
||||
use App\Classes\Modules\PackingList\Processors\GenerateShippingOrderStepsProcessor;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\ContainerObject;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
||||
@@ -124,9 +123,9 @@ class FetchLoadedContainersFromVTPortalProcessor
|
||||
*/
|
||||
public function execute(?Carbon $start = null, ?Carbon $end = null){
|
||||
|
||||
DB::beginTransaction();
|
||||
// DB::beginTransaction();
|
||||
try {
|
||||
$start = $start ? $start : Carbon::now()->subMonth();
|
||||
$start = $start ? $start : Carbon::now()->subDays(5);
|
||||
|
||||
$startLimit = Carbon::parse('11-08-2021');
|
||||
|
||||
@@ -148,7 +147,7 @@ class FetchLoadedContainersFromVTPortalProcessor
|
||||
|
||||
$containerDetail = $this->fetchesDataFRomVTPortal->getResponseBody($containerDetailRequest);
|
||||
|
||||
$containerObject = new ContainerObject($container[0], str_replace(' ', '', $container[24]), str_replace(' ', '', $container[15]), ContainerTypes::FORTY_FEET_DRY_CONTAINER, ApprovalStatus::PENDING_VERIFICATION);
|
||||
$containerObject = new ContainerObject($container[0], str_replace(' ', '', $container[24]), str_replace(' ', '', $container[15]), ContainerTypes::FORTY_FEET_DRY_CONTAINER, Carbon::parse($container[5]), ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
try {
|
||||
$container = $this->fetchesContainer->execute(['reference' => $containerObject->getReference()]);
|
||||
@@ -217,6 +216,7 @@ class FetchLoadedContainersFromVTPortalProcessor
|
||||
}
|
||||
|
||||
}
|
||||
dd('inserted');
|
||||
|
||||
}
|
||||
} catch (\Exception $exception){
|
||||
@@ -224,7 +224,7 @@ class FetchLoadedContainersFromVTPortalProcessor
|
||||
}
|
||||
|
||||
|
||||
DB::commit();
|
||||
// DB::commit();
|
||||
return [];
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ class CreatesContainer extends AbstractUpdateRelationshipRecord
|
||||
$model->container_number = $object->getContainerNumber();
|
||||
$model->container_type = $object->getContainerType();
|
||||
$model->seal_reference = $object->getSealReference();
|
||||
$model->loading_date = $object->getLoadingDate();
|
||||
$model->status = $object->getStatus();
|
||||
|
||||
return $this->handler($owner->containers(), $model);
|
||||
|
||||
@@ -22,6 +22,7 @@ class CreateContainersTable extends Migration
|
||||
$table->string('container_number')->nullable();
|
||||
$table->integer('container_type')->default(ContainerTypes::FORTY_FEET_DRY_CONTAINER);
|
||||
$table->string('seal_reference')->nullable();
|
||||
$table->timestamp('loading_date')->nullable();
|
||||
$table->integer('status')->default(ApprovalStatus::PENDING_SUBMISSION);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
Reference in New Issue
Block a user