Merge remote-tracking branch 'origin/development' into development

This commit is contained in:
omair saleh
2022-02-09 19:29:06 +08:00
31 changed files with 828 additions and 259 deletions
@@ -0,0 +1,92 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Container;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithMapping;
use Illuminate\Http\Request;
class ExportsContainerPackingList implements FromQuery, WithHeadingRow, WithMapping
{
use Exportable;
protected $id;
public function headings(): array
{
return [
'Marking',
'Refrence',
'Quantity',
'CBM',
'Status',
'Delivery Phone',
'Delivery Refrence',
'Delivery Address',
'Remark',
'Delivery Date'
];
}
public function setId($id)
{
$this->id = $id;
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
return Container::find($this->id)->packingLists();
}
/**
* @param Company $container
*
* @return array
*/
public function map($packing_list): array
{
$order = $packing_list->owner()->first();
$address = $order->addresses()->first();
$company = $order->companyModule()->first();
$connection = $company->inviters()->withPivot('invitee_reference')->first();
$marking = $connection ? $connection->pivot->invitee_reference:'';
$quantity = 0;
$cbm = 0;
foreach ($packing_list->packages()->get() as $key => $row) {
$quantity += $row->quantity;
$cbm += (($row->width / 100) * ($row->height / 100) * ($row->length / 100)) * $row->quantity;
}
$status = '';
if ($packing_list->transports()->count() > 0) {
$status = 'Delivery';
}
elseif ($packing_list->status == ApprovalStatus::SUSPENDED) {
$status = 'On Hold';
}
elseif ($packing_list->status != ApprovalStatus::SUSPENDED) {
$status = 'Release';
}
return [
$marking,
$order->reference,
$quantity,
$cbm,
$status,
$address->contacts()->first() ? $address->contacts()->first()->phone : 'n/a',
$address->contacts()->first() ? $address->contacts()->first()->reference : 'n/a',
$address->street_one . ' ' . $address->street_two . ' ' . $address->district->name . ' ' . $address->post_code . ' ' . $address->state->name . ' ' . $address->country->name,
$address->remarks()->first() ? $address->remarks()->first()->content : 'n/a',
$packing_list->transports()->first() ? $packing_list->transports()->current_schedule->eta : 'n/a'
];
}
}
@@ -6,7 +6,9 @@ use App\Classes\Modules\Addresses\Services\FetchesAddress;
use App\Classes\Modules\Orders\Standards\Rules\CanApproveChangeOrderAddress;
use App\Classes\Modules\Orders\Services\UpdatesOrdersAddress;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use Illuminate\Http\Request;
@@ -27,12 +29,13 @@ class ApproveChangeOrderAddressProcessor
* @param FetchesAddress $fetchesAddress
* @param UpdatesOrdersAddress $updatesOrdersAddress
*/
public function __construct(CanApproveChangeOrderAddress $canApproveChangeOrderAddress, FetchesAddress $fetchesAddress, UpdatesOrdersAddress $updatesOrdersAddress, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor)
public function __construct(CanApproveChangeOrderAddress $canApproveChangeOrderAddress, FetchesAddress $fetchesAddress, UpdatesOrdersAddress $updatesOrdersAddress, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
{
$this->canApproveChangeOrderAddress = $canApproveChangeOrderAddress;
$this->fetchesAddress = $fetchesAddress;
$this->updatesOrdersAddress = $updatesOrdersAddress;
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
}
@@ -55,7 +58,14 @@ class ApproveChangeOrderAddressProcessor
if($status === ApprovalStatus::APPROVED){
$address->owner->addresses()->update(['status' => ApprovalStatus::EXPIRED]);
$this->updateDoFromVTPortalProcessor->execute($address);
$appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
if ($appointee == 2 ) {
$this->updateDoFromYDPortalProcessor->execute($address);
}
elseif ($appointee == 2302 ) {
$this->updateDoFromVTPortalProcessor->execute($address);
}
}
$address = $this->updatesOrdersAddress->execute($address, $status);
@@ -0,0 +1,85 @@
<?php
namespace App\Classes\Modules\Orders\Processors;
use App\Classes\Exceptions\InternalServerErrorException;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
use App\Classes\Modules\Addresses\Services\FetchesAddress;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\Modules\Unity\Services\UpdatesContractObligation;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Models\PackingList;
use App\Models\Transport;
use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;
class UpdateDoFromYDPortalProcessor
{
/** @var FetchesDataFromYDPortal */
private $fetchesDataFRomYDPortal;
/** @var FetchesAddress */
private $fetchesAddress;
/**
* FetchDeliveryListFromVTPortalProcessor constructor.
* @param FetchesDataFromYDPortal $fetchesDataFRomYDPortal
* @param FetchesAddress $fetchesAddress
*/
public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, FetchesAddress $fetchesAddress)
{
$this->fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal;
$this->fetchesAddress = $fetchesAddress;
}
/**
* @param $address
* @return array
* @throws GuzzleException
* @throws InternalServerErrorException
*/
public function execute($address) {
try {
$order = $address->owner()->orderBy('id', 'desc')->first();
$packing_list = $order->packingLists()
->where('type', PackingListType::SHIPPING_PACKING_LIST)
->where('status', '!=', ApprovalStatus::SUSPENDED)
->orderBy('id', 'desc')->get();
foreach ($packing_list as $key => $row) {
$contact = $address->contacts()->first();
$remark = $address->remarks()->first();
$remark = $remark ? $remark->content : 'URGENT!!! PLEASE CALL BEFORE ONE DAY DELIVERY.';
$phone = $contact ? $contact->phone : null;
$reference = $contact ? $contact->reference : null;
$yd_do_update = $this->fetchesDataFRomYDPortal->clientRequest(
'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
'POST',
[
'expressno' => $row->reference,
'customers_name' => $reference,
'cellphone' => $phone,
'postcode' => $address->postcode,
'streetAddress' => $address->street_one . ' ' . $address->street_two . ' '. $address->district->name.' '. $address->post_code.' '.$address->state->name.' '.$address->country->name
], '');
$yd_do_update = $this->fetchesDataFRomYDPortal->getResponseBody($yd_do_update);
}
} catch (\Exception $exception){
throw new InternalServerErrorException('failed to approve address due to an error related to VT portal');
}
}
}
@@ -0,0 +1,147 @@
<?php
namespace App\Classes\Modules\PackingLists\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Classes\Modules\PackingLists\Services\UpdatesPackingListOwner;
use App\Classes\Modules\Transports\Services\UpdatesTransportStatus;
use App\Classes\Modules\Unity\Services\CreatesContract;
use App\Classes\Modules\Unity\Processors\ActivateContractProcessor;
use App\Classes\Modules\Unity\Processors\CreateContractEntityProcessor;
use App\Classes\Modules\Unity\Processors\AssignContractEntityProcessor;
use App\Classes\Modules\PackingLists\Services\UpdatesPackingListContractReference;
use App\Classes\Modules\Steps\Services\CreatesStep;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
use App\Http\Resources\PackingListResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class AssignPackingListOrderLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Assign Packing List Order',
'message' => 'You have successfully created a Packing List Order'
];
}
/** @var FetchesPackingList */
private $fetchesPackingList;
/** @var FetchesOrder */
private $fetchesOrder;
/** @var UpdatesPackingListOwner */
private $updatesPackingListOwner;
/** @var UpdatesTransportStatus */
private $updatesTransportStatus;
/** @var CreatesContract */
private $unityCreateContract;
/** @var ActivateContractProcessor */
private $unityActivateContract;
/** @var CreateContractEntityProcessor */
private $unityCreateContractEntity;
/** @var AssignContractEntityProcessor */
private $unityAssignContractEntity;
/** @var UpdatesPackingListContractReference */
private $updatesPackingListContractReference;
/** @var CreatesStep */
private $createsStep;
/**
* CreateRemarkLogic constructor.
* @param CanCreateRemark $canCreateRemark
* @param CreatesPackingListRemark $createsPackingListRemark
*/
public function __construct(FetchesPackingList $fetchesPackingList, FetchesOrder $fetchesOrder, UpdatesPackingListOwner $updatesPackingListOwner, UpdatesTransportStatus $updatesTransportStatus, CreatesContract $unityCreateContract, ActivateContractProcessor $unityActivateContract, CreateContractEntityProcessor $unityCreateContractEntity, AssignContractEntityProcessor $unityAssignContractEntity, UpdatesPackingListContractReference $updatesPackingListContractReference, CreatesStep $createsStep)
{
$this->fetchesPackingList = $fetchesPackingList;
$this->fetchesOrder = $fetchesOrder;
$this->updatesPackingListOwner = $updatesPackingListOwner;
$this->updatesTransportStatus = $updatesTransportStatus;
$this->unityCreateContract = $unityCreateContract;
$this->unityActivateContract = $unityActivateContract;
$this->unityCreateContractEntity = $unityCreateContractEntity;
$this->unityAssignContractEntity = $unityAssignContractEntity;
$this->updatesPackingListContractReference = $updatesPackingListContractReference;
$this->createsStep = $createsStep;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function logic(Request $request) : JsonResponse
{
$warehouse_packing_list = $this->fetchesPackingList->execute([
'id' => $request->route('id'),
'type' => PackingListType::WAREHOUSE_RECEIVE_LIST,
'status' => ApprovalStatus::REJECTED
]);
$order = $this->fetchesOrder->execute(['id' => $request->input('order_id')]);
$warehouse_packing_list = $this->updatesPackingListOwner->execute($warehouse_packing_list, $order);
$transport = $warehouse_packing_list->transports()->first();
$transport = $this->updatesTransportStatus->execute($transport, ApprovalStatus::APPROVED);
$contract = $this->unityCreateContract->execute();
$contractReference = $contract->hash_id;
$contractObligations = $contract->contract_obligation_list;
$this->unityActivateContract->execute($contractReference);
$supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id;
$supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId);
$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]);
$this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
$packing_list = $this->fetchesPackingList->execute([
'reference' => $warehouse_packing_list->reference,
'type' => PackingListType::SHIPPING_PACKING_LIST,
'status' => ApprovalStatus::PENDING_VERIFICATION
]);
$packing_list = $this->updatesPackingListContractReference->execute($packing_list, $contractReference);
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($packing_list, $stepObject);
}
return $this->resourceResponse(new PackingListResource($warehouse_packing_list));
}
}
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\PackingLists\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\PackingLists\Services\ListsPackingLists;
use App\Classes\Modules\PackingLists\Standards\Rules\CanListPackingLists;
use App\Http\Resources\PackingListNullOrderResource;
use App\Http\Resources\PackingListResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
@@ -55,7 +56,12 @@ class ListPackingListsLogic extends AbstractControllerLogic
$query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters')));
return $this->collectionResponse(PackingListResource::collection($query));
if ($request->input('null_order')) {
return $this->collectionResponse(PackingListNullOrderResource::collection($query));
}
else {
return $this->collectionResponse(PackingListResource::collection($query));
}
} catch (\Exception $exception){
throw new ErrorException($exception->getMessage(), $exception->getCode());
@@ -10,6 +10,7 @@ use App\Classes\Modules\PackingLists\Services\UpdatesPackingListStatus;
use App\Classes\Modules\PackingLists\Standards\Rules\CanUpdatePackingList;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use App\Http\Resources\PackingListResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
@@ -38,16 +39,20 @@ class UpdatePackingListStatusLogic extends AbstractControllerLogic
/** @var UpdateDoFromVTPortalProcessor */
private $updateDoFromVTPortalProcessor;
/** @var UpdateDoFromYDPortalProcessor */
private $updateDoFromYDPortalProcessor;
/**
* UpdatePackingListStatusLogic constructor.
* @param FetchesPackingList $fetchesPackingList
* @param UpdatesPackingListStatus $updatesPackingListStatus
*/
public function __construct(FetchesPackingList $fetchesPackingList, UpdatesPackingListStatus $updatesPackingListStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor)
public function __construct(FetchesPackingList $fetchesPackingList, UpdatesPackingListStatus $updatesPackingListStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
{
$this->fetchesPackingList = $fetchesPackingList;
$this->updatesPackingListStatus = $updatesPackingListStatus;
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
}
/**
@@ -64,7 +69,14 @@ class UpdatePackingListStatusLogic extends AbstractControllerLogic
$packing_list = $this->updatesPackingListStatus->execute($packingList, $request->route('status'));
$address = $packing_list->owner()->first()->addresses()->first();
$this->updateDoFromVTPortalProcessor->execute($address);
$appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
if ($appointee == 2 ) {
$this->updateDoFromYDPortalProcessor->execute($address);
}
elseif ($appointee == 2302 ) {
$this->updateDoFromVTPortalProcessor->execute($address);
}
return $this->resourceResponse(new PackingListResource($packing_list));
}
@@ -49,7 +49,7 @@ class CreatePackageProcessor
if($replica) {
$modificationValue = 1;
$packageObject = new PackageObject($object->getType(), $object->getDescription(), $object->getWidth() + $modificationValue, $object->getHeight() + $modificationValue, $object->getLength() + $modificationValue, $object->getWeight(), $object->getQuantity(), $object->getStatus());
$this->createsPackage->execute($packageObject, $replica);
$package = $this->createsPackage->execute($packageObject, $replica);
}
return ;
@@ -48,11 +48,13 @@ class CreatePackingListProcessor
/** @var PackingList $packingList */
$packingList = $this->createsPackingList->execute($object, $packable);
$appointee_id = $packingList->owner_id == 1 ? 2037 : $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
$type = $object->getType() === PackingListType::SHIPPING_PACKING_LIST ? PackingListType::SHIPPING_PACKING_LIST_REPLICA : PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA;
/** create packing list replica */
$object = new PackingListObject($object->getReference().'_01', $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id, $type, ApprovalStatus::PENDING_SUBMISSION);
$object = new PackingListObject($object->getReference().'_01', $appointee_id, $type, ApprovalStatus::PENDING_SUBMISSION);
$this->createsPackingList->execute($object, $packingList);
return $packingList;
}
@@ -83,6 +83,7 @@ class FetchContainersStatusUpdateFromVTPortalProcessor
if(!$containerDetails->Rows){
continue;
}
$containerDetails = $containerDetails->Rows[0];
if(!$eta = $containerDetails[3]){
@@ -7,6 +7,7 @@ use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Classes\Modules\PackingLists\DataTransferObjects\ContainerObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
@@ -30,11 +31,11 @@ use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Models\Container;
use App\Models\Order;
use App\Models\PackingList;
use App\Models\Transport;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class FetchOrderListsFromYdPortalProcessor
{
@@ -130,172 +131,198 @@ class FetchOrderListsFromYdPortalProcessor
* @param Carbon|null $start
* @param Carbon|null $end
* @return void
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function execute(?Carbon $start = null, ?Carbon $end = null)
{
db::beginTransaction();
try {
$start = $start ? $start : Carbon::now()->subMonths(2);
$start = $start ? $start : Carbon::now()->subMonths(2);
$startLimit = Carbon::parse('01-12-2021');
$startLimit = Carbon::parse('01-12-2021');
if($start->isBefore($startLimit)){
$start = $startLimit;
}
if($start->isBefore($startLimit)){
$start = $startLimit;
}
$end = $end ? $end : Carbon::now();
$end = $end ? $end : Carbon::now();
$orderRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/GetOrderList.ashx', 'GET', [
'begintime' => $start->timestamp,
'endtime' => $end->timestamp,
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
foreach($rows->data as $row){
$containerReference = null;
$loadingDate = null;
$unstuffingDate = null;
$etd = null;
$eta = null;
$trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [
'trakingno' => $row->expressno
$orderRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/GetOrderList.ashx', 'GET', [
'begintime' => $start->timestamp,
'endtime' => $end->timestamp,
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
foreach ($rows->data as $trackingRow) {
if($trackingRow->tracking === '货物已送达仓库准备入库中'){
$receiveDate = Carbon::parse($trackingRow->trackingtime);
}
if (strpos($trackingRow->tracking, '货物装柜完成。') !== false) {
$tracking = explode(':', $trackingRow->tracking);
$containerReference = explode('预计到港时间', $tracking[1])[0];
$loadingDate = Carbon::parse($trackingRow->trackingtime);
$etd = Carbon::parse($tracking[2])->subDays(5);
$eta = Carbon::parse($tracking[2]);
}
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
foreach($rows->data as $row){
DB::beginTransaction();
if($trackingRow->tracking === '货物已进目的港仓库'){
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
}
}
$containerReference = null;
$loadingDate = null;
$unstuffingDate = null;
$etd = null;
$eta = null;
$customerno = preg_split('/(-|\/)/', $row->customerno);
$trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [
'trakingno' => $row->expressno
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
foreach ($rows->data as $trackingRow) {
if($trackingRow->tracking === '货物已送达仓库准备入库中'){
$receiveDate = Carbon::parse($trackingRow->trackingtime);
}
if (!array_key_exists(2, $customerno)){
if (!array_key_exists(1, $customerno)){
continue;
}
$customerno[2] = substr($customerno[1], -9);
}
if (strpos($trackingRow->tracking, '货物装柜完成。') !== false) {
$tracking = explode(':', $trackingRow->tracking);
$containerReference = explode('预计到港时间', $tracking[1])[0];
$loadingDate = Carbon::parse($trackingRow->trackingtime);
$etd = Carbon::parse($tracking[2])->subDays(5);
$eta = Carbon::parse($tracking[2]);
}
$orderNumber = $customerno[2];
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
} catch (ResourceNotFoundException $exception) {
continue;
}
$packingListReference = $row->expressno;
try{
$packingList = $this->fetchesPackingList->execute(['reference' => $row->expressno]);
} catch (ResourceNotFoundException $exception){
$warehouseReceiveObject = new PackingListObject($packingListReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id, PackingListType::WAREHOUSE_RECEIVE_LIST, ApprovalStatus::APPROVED);
/** @var PackingList $warehouseReceiveList */
$warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order);
$transportObject = new TransportObject(TransportType::LAND, null, $row->kuaidilist, Carbon::parse($receiveDate), Carbon::parse($receiveDate), ApprovalStatus::APPROVED);
$this->createsTransport->execute($transportObject, $warehouseReceiveList);
$contract = $this->unityCreateContract->execute();
$contractReference = $contract->hash_id;
$contractObligations = $contract->contract_obligation_list;
$this->unityActivateContract->execute($contractReference);
$supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id;
$supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId);
$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]);
$this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
$packingListObject = new PackingListObject($packingListReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::PENDING_VERIFICATION , $contractReference);
/** @var PackingList $packingList */
$packingList = $this->createPackingListProcessor->execute($packingListObject, $order);
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);
}
foreach($row->deliverysize as $package) {
$packageObject = new PackageObject(PackageType::CARTON, $row->goodname, (float) $package->width, (float) $package->height, (float) $package->length, 0, (float) $package->num, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $warehouseReceiveList);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
}
if($containerReference) {
try {
$container = $this->fetchesContainer->execute(['reference' => $containerReference]);
} catch (ResourceNotFoundException $exception){
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id]);
$containerObject = new ContainerObject($containerReference, '', '', ContainerTypes::FORTY_FEET_DRY_CONTAINER, $loadingDate, ApprovalStatus::PENDING_VERIFICATION);
/** @var Container $container */
$container = $this->createContainerProcessor->execute($containerObject, $originWarehouse);
$container->packingLists()->attach($packingList);
$transport = $container->transports()->first();
if(!$transport){
$transportObject = new TransportObject(TransportType::SEA, null, null, $etd, null, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $container);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $eta, ApprovalStatus::APPROVED));
if($trackingRow->tracking === '货物已进目的港仓库'){
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
}
}
if($unstuffingDate && $container->status !== ApprovalStatus::COMPLETED){
$container->update(['status' => ApprovalStatus::COMPLETED]);
$container->transports()->first()->update(['drop_date' => $unstuffingDate, 'status' => ApprovalStatus::COMPLETED]);
$customerno = preg_split('/(-|\/)/', $row->customerno);
if (!array_key_exists(2, $customerno)){
if (!array_key_exists(1, $customerno)){
continue;
}
$customerno[2] = substr($customerno[1], -9);
}
$orderNumber = $customerno[2];
$allow_contract = true;
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
} catch (ResourceNotFoundException $exception) {
$order = $this->fetchesCompanyModule->execute(['id' => 1]);
$allow_contract = false;
}
$packingListReference = $row->expressno;
try{
$packingList = $this->fetchesPackingList->execute(['reference' => $row->expressno]);
} catch (ResourceNotFoundException $exception){
if (!$allow_contract) {
$appointee_id = 2037;
}
else {
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
}
$warehouseReceiveObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::WAREHOUSE_RECEIVE_LIST, $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
/** @var PackingList $warehouseReceiveList */
$warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order);
$transportObject = new TransportObject(TransportType::LAND, null, $row->kuaidilist, Carbon::parse($receiveDate), Carbon::parse($receiveDate), $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
$transport = $this->createsTransport->execute($transportObject, $warehouseReceiveList);
if ($allow_contract) {
$contract = $this->unityCreateContract->execute();
$contractReference = $contract->hash_id;
$contractObligations = $contract->contract_obligation_list;
$this->unityActivateContract->execute($contractReference);
$supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id;
$supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId);
$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]);
$this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
}
$packingListObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::PENDING_VERIFICATION , !$allow_contract ? null : $contractReference);
/** @var PackingList $packingList */
foreach($container->packingLists as $packingList){
$packingList = $this->createPackingListProcessor->execute($packingListObject, $order);
if($packingList->status === ApprovalStatus::PENDING_VERIFICATION){
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
if ($allow_contract) {
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);
}
}
foreach($row->deliverysize as $package) {
$packageObject = new PackageObject(PackageType::CARTON, $row->goodname, (float) $package->width, (float) $package->height, (float) $package->length, 0, (float) $package->num, ApprovalStatus::APPROVED);
$package = $this->createPackageProcessor->execute($packageObject, $warehouseReceiveList);
$package = $this->createPackageProcessor->execute($packageObject, $packingList);
}
}
if($containerReference) {
try {
$container = $this->fetchesContainer->execute(['reference' => $containerReference]);
} catch (ResourceNotFoundException $exception){
if (!$allow_contract) {
$appointee_id = 2037;
}
else {
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id;
}
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
foreach($packingList->steps()->where('reference', '!=', 'DELIVERY')->get() as $step){
$this->updatesContractObligations->execute($signature, $step->obligation_hash_id);
$step->update(['status' => ApprovalStatus::COMPLETED]);
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $appointee_id]);
$containerObject = new ContainerObject($containerReference, '', '', ContainerTypes::FORTY_FEET_DRY_CONTAINER, $loadingDate, ApprovalStatus::PENDING_VERIFICATION);
/** @var Container $container */
$container = $this->createContainerProcessor->execute($containerObject, $originWarehouse);
$container->packingLists()->attach($packingList);
$transport = $container->transports()->first();
if(!$transport){
$transportObject = new TransportObject(TransportType::SEA, null, null, $etd, null, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $container);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $eta, ApprovalStatus::APPROVED));
}
}
if($unstuffingDate && $container->status !== ApprovalStatus::COMPLETED){
$container->update(['status' => ApprovalStatus::COMPLETED]);
$container->transports()->first()->update(['drop_date' => $unstuffingDate, 'status' => ApprovalStatus::COMPLETED]);
/** @var PackingList $packingList */
foreach($container->packingLists as $packingList){
if($packingList->status === ApprovalStatus::PENDING_VERIFICATION){
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
}
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
foreach($packingList->steps()->where('reference', '!=', 'DELIVERY')->get() as $step){
$this->updatesContractObligations->execute($signature, $step->obligation_hash_id);
$step->update(['status' => ApprovalStatus::COMPLETED]);
}
}
}
}
DB::commit();
dump('added');
}
} catch (\Exception $exception) {
Log::debug($exception);
}
db::commit();
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Classes\Modules\PackingLists\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\General\Interfaces\Packable;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Models\PackingList;
class CreatesNullOrderPackingList extends AbstractUpdateRecord
{
/**
* @param PackingListObject $object
* @param Packable $packable
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(PackingListObject $object) {
$model = new PackingList();
$model->reference = $object->getReference();
$model->claimant_id = $object->getClaimantId();
$model->type = $object->getType();
$model->status = $object->getStatus();
$model->reference_contract = $object->getContractReference();
$model->owner_type = 'App\Models\Order';
$model->owner_id = 1;
return $this->handler($model);
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Classes\Modules\PackingLists\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Models\PackingList;
class UpdatesPackingListContractReference extends AbstractUpdateRecord
{
/**
* @param PackingList $model
* @param int $status
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(PackingList $model, string $reference_contract) {
$model->reference_contract = $reference_contract;
return $this->handler($model);
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Classes\Modules\PackingLists\Services;
use App\Classes\General\Interfaces\Packable;
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
use App\Models\PackingList;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
class UpdatesPackingListOwner extends AbstractUpdateRelationshipRecord
{
/**
* @param PackingList $model
* @param int $status
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(PackingList $model, Packable $packable) {
$model->status = ApprovalStatus::APPROVED;
return $this->handler($packable->packingLists(), $model);
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Classes\Modules\Transports\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Models\Transport;
class updatesTransportStatus extends AbstractUpdateRecord
{
/**
* @param Transport $model
* @param int $status
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Transport $model, int $status) {
$model->status = $status;
return $this->handler($model);
}
}
@@ -2,11 +2,10 @@
namespace App\Console\Commands;
use App\Models\State;
use App\Classes\Jobs\FetchOrdersFromYDPortalJob;
use App\Http\Helpers\General;
use Illuminate\Console\Command;
use App\Jobs\CurlYdOrderListJob;
class CurlYdOrderListCommand extends Command
{
@@ -42,6 +41,6 @@ class CurlYdOrderListCommand extends Command
*/
public function handle()
{
return CurlYdOrderListJob::dispatch();
return FetchOrdersFromYDPortalJob::dispatch();
}
}
+22 -2
View File
@@ -27,6 +27,16 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('command:curlVTCommand')
->dailyAt('09:00')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlvt.log');
$schedule->command('command:curlYdOrderListCommand')
->dailyAt('09:00')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlyd.log');
$schedule->command('command:curlVTCommand')
->dailyAt('11:00')
->withoutOverlapping()
@@ -48,12 +58,22 @@ class Kernel extends ConsoleKernel
->appendOutputTo (storage_path().'/logs/curlyd.log');
$schedule->command('command:curlVTCommand')
->dailyAt('17:00')
->dailyAt('16:00')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlvt.log');
$schedule->command('command:curlYdOrderListCommand')
->dailyAt('17:00')
->dailyAt('16:00')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlyd.log');
$schedule->command('command:curlVTCommand')
->dailyAt('18:00')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlvt.log');
$schedule->command('command:curlYdOrderListCommand')
->dailyAt('18:00')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlyd.log');
}
@@ -0,0 +1,19 @@
<?php
namespace App\Http\Controllers\Exports;
use App\Classes\Modules\Exports\Services\ExportsContainerPackingList;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Excel;
class ExportContainerPackingListController
{
public function export(ExportsContainerPackingList $exportsContainerPackingList, Request $request) {
$token = Auth::fromUser(User::find(1));
$request->headers->set('Authorization', 'Bearer '.$token);
$exportsContainerPackingList->setId($request->route('id'));
return $exportsContainerPackingList->download('customer-container-packing-list.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
}
}
@@ -16,4 +16,4 @@ class ExportCustomersToExcelController
$request->headers->set('Authorization', 'Bearer '.$token);
return $exportsCustomers->download('customer-latest-order-date.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
}
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\PackingLists;
use App\Classes\Modules\PackingLists\ControllersLogic\AssignPackingListOrderLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class AssignPackingListOrderController
{
/**
* @param Request $request
* @param AssignPackingListOrderLogic $logic
* @return JsonResponse
*/
public function assign(Request $request, AssignPackingListOrderLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ class OrderResource extends JsonResource
'delivered_packages' => PackingListResource::collection(
$this->deliveredPackages()->get()
),
'received_packages' => PackingListResource::collection($this->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->get()),
'received_packages' => PackingListResource::collection($this->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('packages')->get()),
];
}),
'remarks' => RemarkResource::collection($this->remarks),
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Models\Order;
use Illuminate\Http\Resources\Json\JsonResource;
class PackingListNullOrderResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$replica = $this->packingLists()->first();
return [
'id' => $this->id,
'claimant_id' => $this->claimant_id,
'reference' => $this->reference,
'status' => $this->status,
'type' => $this->type,
];
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ class PackingListResource extends JsonResource
$packages = $replica ? $replica->packages : $this->packages;
if(Auth()->user()->type === RoleTypes::SHADOW_ADMIN) {
if(in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]) || in_array(Auth()->user()->id, [1914, 1919])) {
$packages = $this->packages;
}
+5
View File
@@ -3,6 +3,7 @@
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
use Carbon\Carbon;
class ScheduleResource extends JsonResource
{
@@ -18,6 +19,10 @@ class ScheduleResource extends JsonResource
'id' => $this->id,
'etd' => $this->etd ? $this->etd->format('d-m-Y') : 'n/a',
'eta' => $this->eta ? $this->eta->format('d-m-Y') : 'n/a',
'billing_days_left' => [
'value' => (Carbon::parse($this->eta)->subDays(7)->gt(Carbon::now())) ? '+' : '-' ,
'duration' => Carbon::parse($this->eta)->subDays(7)->diffInDays(Carbon::now()),
],
'status' => $this->status,
];
}
-38
View File
@@ -1,38 +0,0 @@
<?php
namespace App\Jobs;
use App\Classes\Modules\PackingLists\Processors\FetchOrderListsFromYdPortalProcessor;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class CurlYdOrderListJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
}
/**
* Execute the job.
*
* @return void
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function handle()
{
(App()->make(FetchOrderListsFromYdPortalProcessor::class))->execute();
}
}
+3 -3
View File
@@ -107,7 +107,7 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable
return $schedule->dispatched()
->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
}
);
)->whereHas('packages');
}
public function inTransitPackages()
@@ -122,7 +122,7 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable
->whereDoesntHave('containers', function($container) {
return $container->where('containers.status', ApprovalStatus::COMPLETED);
}
);
)->whereHas('packages');
}
public function destinationWarehousePackages()
@@ -137,7 +137,7 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable
function($schedule) {
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
}
);
)->whereHas('packages');
}
public function deliveredPackages()
@@ -22,10 +22,22 @@
<p class="no-margin fs-10 all-caps">ETD</p>
<p class="no-margin">{{item.transport ? item.transport.current_schedule.etd : 'n/a'}}</p>
</div>
<div class="col">
<div class="col-auto">
<p class="no-margin fs-10 all-caps">ETA</p>
<p class="no-margin">{{item.transport ? item.transport.current_schedule.eta : 'n/a'}}</p>
</div>
<div class="col">
<div class="row" v-if="item.transport">
<div class="col">
<p class="no-margin fs-10 all-caps">Days Ago</p>
<p class="no-margin" :class="[{'text-success': item.transport.current_schedule.billing_days_left.value === '+'}, {'text-danger': item.transport.current_schedule.billing_days_left.value === '-'}]">
{{item.transport.current_schedule.billing_days_left.value}}
{{item.transport.current_schedule.billing_days_left.duration}}
days
</p>
</div>
</div>
</div>
<div class="col-auto">
<p class="no-margin fs-10 all-caps">Packages</p>
<p class="no-margin">{{ item.packing_lists.reduce((total, obj) => total + obj.packages.reduce((total, obj) => obj.quantity + total, 0), 0) }}</p>
@@ -60,6 +72,11 @@
<div class="col-1 text-center">status</div>
<div class="col-3">Delivery Details</div>
<div class="col">Delivery Date</div>
<div class="col">
<div class="text-right">
<a :href="route('container.packaging_list.export', item.id)" target="_blank" class="btn btn-xs btn-primary pointer"><i class="fa fa-file-export m-r-5"></i>Export</a>
</div>
</div>
</div>
</div>
</div>
@@ -119,6 +136,12 @@
},
errorHandler(){
this.index = null;
},
exportContainer(id) {
console.log(id);
window.location.href = (this.route('container.export', $id));
}
},
mixins: [componentHandler]
@@ -62,15 +62,15 @@
<div class="row text-center">
<div class="col b-r b-grey text-info p-t-5 p-b-10">
<small class="fs-10 all-caps bold">Received</small>
<h6 class="bold no-margin text-info">{{item.parcels.received_packages.reduce((total, obj) => obj.quantity + total, 0)}}</h6>
<h6 class="bold no-margin text-info">{{item.parcels.received_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.quantity + total, 0)}}</h6>
</div>
<div class="col b-r b-grey text-primary p-t-5 p-b-10">
<small class="fs-10 all-caps bold">In Transit</small>
<h6 class="bold no-margin text-primary">{{item.parcels.in_transit_packages.reduce((total, obj) => obj.quantity + total, 0)}}</h6>
<h6 class="bold no-margin text-primary">{{item.parcels.in_transit_packages.flatMap(packing_list => packing_list.packages).concat(item.parcels.destination_warehouse_packages.flatMap(packing_list => packing_list.packages)).reduce((total, obj) => obj.quantity + total, 0)}}</h6>
</div>
<div class="col text-success p-t-5 p-b-10">
<small class="fs-10 all-caps bold">Delivered</small>
<h6 class="bold no-margin text-success">{{item.parcels.delivered_packages.reduce((total, obj) => obj.quantity + total, 0)}}</h6>
<h6 class="bold no-margin text-success">{{item.parcels.delivered_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.quantity + total, 0)}}</h6>
</div>
</div>
</div>
@@ -90,7 +90,7 @@
</div>
<div class="col-auto text-right">
<small class="fs-10 all-caps muted">Total CBM</small>
<h6 class="no-margin semi-bold">{{(Math.ceil((item.parcels.origin_warehouse_packages.reduce((total, obj) => obj.cbm + total, 0) + item.parcels.in_transit_packages.reduce((total, obj) => obj.cbm + total, 0) + item.parcels.delivered_packages.reduce((total, obj) => obj.cbm + total, 0)) * 10000) / 10000).toFixed(3)}}</h6>
<h6 class="no-margin semi-bold">{{(Math.ceil((item.parcels.origin_warehouse_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + item.parcels.in_transit_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + item.parcels.destination_warehouse_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + item.parcels.delivered_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0)) * 10000) / 10000).toFixed(3)}}</h6>
</div>
</div>
</div>
@@ -70,71 +70,75 @@
</div>
</div>
<div class="row p-t-10 p-b-10" v-if="item.container">
<div class="col-auto p-r-0 p-t-10">
<div class="row" v-for="schedule in item.container.transport.schedule_history" :key="schedule.id">
<div class="col">
<div class="row justify-content-center">
<div class="col-auto">
<i class="fa fa-times fs-15 text-danger"></i>
<div class="col">
<div class="row" v-if="item.container.transport">
<div class="col-auto p-r-0 p-t-10">
<div class="row" v-for="schedule in item.container.transport.schedule_history" :key="schedule.id">
<div class="col">
<div class="row justify-content-center">
<div class="col-auto">
<i class="fa fa-times fs-15 text-danger"></i>
</div>
</div>
<div class="row justify-content-center">
<div class="col-auto">
<div class="b-l b-dashed b-danger" style="height: 35px;"></div>
</div>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-auto">
<div class="b-l b-dashed b-danger" style="height: 35px;"></div>
<i class="fa fa-check fs-15" :class="{'text-primary': status !== 'Ready To Ship', 'muted': status === 'Ready To Ship'}"></i>
</div>
</div>
<div class="row justify-content-center">
<div class="col-auto">
<div class="b-l b-dashed " style="height: 35px;" :class="{'b-primary': status === 'Preparing Delivery' || status === 'Delivered', 'b-grey': status !== 'Preparing Delivery' || status !== 'Delivered'}"></div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-auto">
<i class="fa fa-check fs-15" :class="{'text-primary': item.transport, 'muted': !item.transport}"></i>
</div>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-auto">
<i class="fa fa-check fs-15" :class="{'text-primary': status !== 'Ready To Ship', 'muted': status === 'Ready To Ship'}"></i>
</div>
</div>
<div class="row justify-content-center">
<div class="col-auto">
<div class="b-l b-dashed " style="height: 35px;" :class="{'b-primary': status === 'Preparing Delivery' || status === 'Delivered', 'b-grey': status !== 'Preparing Delivery' || status !== 'Delivered'}"></div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-auto">
<i class="fa fa-check fs-15" :class="{'text-primary': item.transport, 'muted': !item.transport}"></i>
</div>
</div>
</div>
<div class="col p-l-0">
<div class="row m-b-15" v-for="schedule in item.container.transport.schedule_history" :key="schedule.id">
<div class="col">
<div class="row no-margin">
<div class="col-auto">
<small class="fs-10 all-caps muted">Etd</small>
<h6 class="no-margin small">{{schedule.etd}}</h6>
</div>
<div class="col-auto">
<small class="fs-10 all-caps muted">Eta</small>
<h6 class="no-margin small">{{schedule.eta}}</h6>
<div class="col p-l-0">
<div class="row m-b-15" v-for="schedule in item.container.transport.schedule_history" :key="schedule.id">
<div class="col">
<div class="row no-margin">
<div class="col-auto">
<small class="fs-10 all-caps muted">Etd</small>
<h6 class="no-margin small">{{schedule.etd}}</h6>
</div>
<div class="col-auto">
<small class="fs-10 all-caps muted">Eta</small>
<h6 class="no-margin small">{{schedule.eta}}</h6>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<div class="row no-margin">
<div class="col-auto" v-if="!item.container.transport.schedule_history.length">
<small class="fs-10 all-caps muted">Etd</small>
<h6 class="no-margin small">{{item.container ? item.container.transport.current_schedule.etd : 'n/a'}}</h6>
</div>
<div class="col-auto">
<small class="fs-10 all-caps muted">{{!item.container.transport.schedule_history.length ? 'Eta' : 'Rescheduled Eta' }}</small>
<h6 class="no-margin small">{{item.container ? item.container.transport.current_schedule.eta : 'n/a'}}</h6>
<div class="row m-b-15">
<div class="col">
<div class="row no-margin">
<div class="col-auto" v-if="!item.container.transport.schedule_history.length">
<small class="fs-10 all-caps muted">Etd</small>
<h6 class="no-margin small">{{item.container ? item.container.transport.current_schedule.etd : 'n/a'}}</h6>
</div>
<div class="col-auto">
<small class="fs-10 all-caps muted">{{!item.container.transport.schedule_history.length ? 'Eta' : 'Rescheduled Eta' }}</small>
<h6 class="no-margin small">{{item.container ? item.container.transport.current_schedule.eta : 'n/a'}}</h6>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="col-auto">
<small class="fs-10 all-caps muted">Delivery Date</small>
<h6 class="no-margin small">{{item.transport ? item.transport.current_schedule.eta : 'n/a'}}</h6>
<div class="row">
<div class="col">
<div class="col-auto">
<small class="fs-10 all-caps muted">Delivery Date</small>
<h6 class="no-margin small">{{item.transport ? item.transport.current_schedule.eta : 'n/a'}}</h6>
</div>
</div>
</div>
</div>
</div>
@@ -1,6 +1,6 @@
<template>
<div class="row">
<div class="col">
<div class="col-6 p-r-0">
<validation-wrapper-component :validator="$v.parameters.content">
<input type="text" class="form-control fs-12" placeholder="Make a remark on this order." v-model.trim="parameters.content">
</validation-wrapper-component>
+2
View File
@@ -17,6 +17,8 @@ Route::group(['namespace' => 'PackingLists', 'as' => 'packing_list.', 'prefix' =
Route::put('/update-drop-date/{id}', 'UpdateDropDatePackingListController@update')->name('update_drop_date');
Route::put('/complete/{id}', 'CompletePackingListController@complete')->name('complete');
Route::put('/assign-remark/{id}', 'AssignPackingListRemarkController@create')->name('assign.remark');
Route::put('/assign-order/{id}', 'AssignPackingListOrderController@assign')->name('assign.order');
Route::group(['namespace' => 'Containers', 'prefix' => 'container', 'as' => 'container.'], function () {
Route::get('/{id}/show', 'FetchContainerController@fetch')->name('show');
+3 -4
View File
@@ -3,7 +3,6 @@
use App\Classes\Jobs\FetchContainersStatusUpdateFromVTPortalJob;
use App\Classes\Jobs\FetchDeliveryListFromVTPortalJob;
use App\Classes\Jobs\FetchLoadedContainersFromVTPortalJob;
use App\Classes\Jobs\FetchOrdersFromYDPortalJob;
use App\Classes\Jobs\FetchPackingListFromVTPortalJob;
use App\Classes\Jobs\FetchWarehouseReceiveListFromVTPortalJob;
use App\Classes\Modules\PackingLists\Processors\FetchOrderListsFromYdPortalProcessor;
@@ -91,8 +90,6 @@ Route::get('/customer/{marking}', function ($marking) {
Route::get('/orders/refresh', function(){
FetchOrdersFromYDPortalJob::dispatch();
FetchWarehouseReceiveListFromVTPortalJob::withChain([
new FetchLoadedContainersFromVTPortalJob,
new FetchPackingListFromVTPortalJob,
@@ -186,4 +183,6 @@ Route::get('/yd', function (){
(App()->make(FetchOrderListsFromYdPortalProcessor::class))->execute();;
});
Route::get('/export/customer-latest-order-date/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');
Route::get('/export/customer-latest-order-date/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');
Route::get('/export/packing-list/{id}', 'Exports\ExportContainerPackingListController@export')->name('container.packaging_list.export');