mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
add new yd Guangzhou warehouse
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
|
||||
use App\Classes\Modules\Orders\Processors\CreateOrderProcessor;
|
||||
use App\Classes\Modules\Orders\Services\GeneratesOrderNumber;
|
||||
use App\Classes\ValueObjects\Constants\WarehouseReferences;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -63,6 +64,13 @@ class CreateOrderLogic extends AbstractControllerLogic
|
||||
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $request->input('warehouse_id')]);
|
||||
|
||||
if($originWarehouse->reference === WarehouseReferences::VT_GUANG_ZHOU){
|
||||
$marking = $company->companyModules()->importers()->first()->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
|
||||
if(in_array($marking, ['2192KAA', '2353GFE', '6866DTR', '1905JYW', '6218MEN'])){
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::YD_GUANG_ZHOU]);
|
||||
}
|
||||
}
|
||||
|
||||
$order = $this->createOrderProcessor->execute($company, $originWarehouse, $address, $this->generatesOrderNumber->execute());
|
||||
|
||||
return $this->resourceResponse(new OrderResource($order));
|
||||
|
||||
@@ -53,7 +53,7 @@ class CreateOrderRolesProcessor
|
||||
$importer = $order->companyModule;
|
||||
|
||||
/** @var CompanyModule $destinationWarehouse */
|
||||
$destinationWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::DESTINATION_WAREHOUSE[$address->state_id ]]);
|
||||
$destinationWarehouse = $this->fetchesCompanyModule->execute(['reference' => $originWarehouse->reference === WarehouseReferences::YD_GUANG_ZHOU ? WarehouseReferences::YD_DESTINATION_WAREHOUSE : WarehouseReferences::VT_DESTINATION_WAREHOUSE[$address->state_id]]);
|
||||
|
||||
/** @var CompanyModule $freightForwarder */
|
||||
$freightForwarder = $originWarehouse->company->companyModules()->freightForwarders()->first();
|
||||
@@ -84,28 +84,5 @@ class CreateOrderRolesProcessor
|
||||
$this->createsOrderRole->execute($roleObject);
|
||||
|
||||
return true;
|
||||
|
||||
$companies = $this->fetchesCompany->getRepository()->whereIn('id',[1, $request->get('warehouse_id')])->get();
|
||||
|
||||
$cief_company = $companies[0]->id == 1 ? $companies[0] : $companies[1];
|
||||
$warehouse_company = $companies[0]->id != 1 ? $companies[0] : $companies[1];
|
||||
|
||||
$cief_company_module = $cief_company->companyModule()->first();
|
||||
$contractEntities[] = $this->unityCreateContractEntity->execute( $contract_reference_no, [$cief_company_module->unity_hash_id]);
|
||||
$contractEntities[0]->{"company_module_id"} = $cief_company_module->id;
|
||||
|
||||
$warehouse_company_module = $warehouse_company->companyModule()->first();
|
||||
$contractEntities[] = $this->unityCreateContractEntity->execute( $contract_reference_no, [$warehouse_company_module->unity_hash_id]);
|
||||
$contractEntities[1]->{"company_module_id"} = $warehouse_company_module->id;
|
||||
|
||||
foreach($contractEntities as $entity){
|
||||
$order_role_object = new OrderRoleObject($orderId, $entity->company_module_id, $entity->hash_id, $entity->entity_signature_hash_id);
|
||||
|
||||
$this->canCreateOrderRole->passes($order_role_object);
|
||||
|
||||
$this->createsOrderRole->execute($order_role_object);
|
||||
}
|
||||
|
||||
return $contractEntities;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ final class BusinessType {
|
||||
|
||||
public const DRIVER = 5;
|
||||
|
||||
public const CURRENCY_VENDOR = 5;
|
||||
public const CURRENCY_VENDOR = 6;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,34 +4,40 @@ namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class WarehouseReferences {
|
||||
|
||||
public const GUANG_ZHOU = 'GZ-V01';
|
||||
public const VT_GUANG_ZHOU = 'GZ-V01';
|
||||
|
||||
public const YIWU = 'YW-V01';
|
||||
public const YD_GUANG_ZHOU = 'GZ-V02';
|
||||
|
||||
public const KLANG = 'KL-V01';
|
||||
public const VT_YIWU = 'YW-V01';
|
||||
|
||||
public const SABAH = 'SB-V01';
|
||||
public const VT_KLANG = 'KL-V01';
|
||||
|
||||
public const SARAWAK = 'SRW-V01';
|
||||
public const YD_KLANG = 'KL-V02';
|
||||
|
||||
public const DESTINATION_WAREHOUSE = [
|
||||
1 => self::KLANG,
|
||||
2 => self::KLANG,
|
||||
3 => self::KLANG,
|
||||
4 => self::KLANG,
|
||||
5 => self::SABAH,
|
||||
6 => self::KLANG,
|
||||
7 => self::KLANG,
|
||||
8 => self::KLANG,
|
||||
9 => self::KLANG,
|
||||
10 => self::KLANG,
|
||||
11 => self::KLANG,
|
||||
12 => self::KLANG,
|
||||
13 => self::SABAH,
|
||||
14 => self::KLANG,
|
||||
15 => self::KLANG,
|
||||
16 => self::KLANG,
|
||||
public const VT_SABAH = 'SB-V01';
|
||||
|
||||
public const VT_SARAWAK = 'SRW-V01';
|
||||
|
||||
public const VT_DESTINATION_WAREHOUSE = [
|
||||
1 => self::VT_KLANG,
|
||||
2 => self::VT_KLANG,
|
||||
3 => self::VT_KLANG,
|
||||
4 => self::VT_KLANG,
|
||||
5 => self::VT_SABAH,
|
||||
6 => self::VT_KLANG,
|
||||
7 => self::VT_KLANG,
|
||||
8 => self::VT_KLANG,
|
||||
9 => self::VT_KLANG,
|
||||
10 => self::VT_KLANG,
|
||||
11 => self::VT_KLANG,
|
||||
12 => self::VT_KLANG,
|
||||
13 => self::VT_SABAH,
|
||||
14 => self::VT_KLANG,
|
||||
15 => self::VT_KLANG,
|
||||
16 => self::VT_KLANG,
|
||||
];
|
||||
|
||||
public const YD_DESTINATION_WAREHOUSE = self::YD_KLANG;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ class CompanyModuleResource extends JsonResource
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'name' => $this->name,
|
||||
'reference' => $this->reference,
|
||||
'address' => new AddressResource($defaultAddress),
|
||||
'company' => new CompanyResource($this->whenLoaded('company')),
|
||||
'marking' => $marking
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\Modules\Addresses\Processors\CreateAddressFromOldAddressProcessor;
|
||||
use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
|
||||
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompany;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\OldCompany;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Company;
|
||||
|
||||
class ModernWarehouseTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/** @var CreateCompanyProcessor */
|
||||
private $createCompanyProcessor;
|
||||
|
||||
/** @var UpdatesCompanyStatus*/
|
||||
private $updatesCompanyStatus;
|
||||
|
||||
/** @var CreateCompanyModuleProcessor */
|
||||
private $createCompanyModuleProcessor;
|
||||
|
||||
/** @var CreateContactProcessor */
|
||||
private $createContactProcessor;
|
||||
|
||||
/** @var CreatesCompanyConnection */
|
||||
private $createsCompanyConnection;
|
||||
|
||||
/** @var ApprovesCompanyConnection */
|
||||
private $approvesCompanyConnection;
|
||||
|
||||
/** @var CreateAddressFromOldAddressProcessor */
|
||||
private $createAddressFromOldAddressProcessor;
|
||||
|
||||
/** @var CreatesAddress */
|
||||
private $createsAddress;
|
||||
|
||||
/** @var CreatesCompany */
|
||||
private $createsCompany;
|
||||
|
||||
/** @var CreatesContact */
|
||||
private $createsContact;
|
||||
|
||||
/**
|
||||
* CompaniesTableSeeder constructor.
|
||||
* @param CreateCompanyProcessor $createCompanyProcessor
|
||||
* @param UpdatesCompanyStatus $updatesCompanyStatus
|
||||
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
|
||||
* @param CreateContactProcessor $createContactProcessor
|
||||
* @param CreatesCompanyConnection $createsCompanyConnection
|
||||
* @param ApprovesCompanyConnection $approvesCompanyConnection
|
||||
* @param CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor
|
||||
* @param CreatesAddress $createsAddress
|
||||
* @param CreatesCompany $createsCompany
|
||||
* @param CreatesContact $createsContact
|
||||
*/
|
||||
public function __construct(CreateCompanyProcessor $createCompanyProcessor, UpdatesCompanyStatus $updatesCompanyStatus, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor, CreatesAddress $createsAddress, CreatesCompany $createsCompany, CreatesContact $createsContact)
|
||||
{
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
$this->updatesCompanyStatus = $updatesCompanyStatus;
|
||||
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
|
||||
$this->createContactProcessor = $createContactProcessor;
|
||||
$this->createsCompanyConnection = $createsCompanyConnection;
|
||||
$this->approvesCompanyConnection = $approvesCompanyConnection;
|
||||
$this->createAddressFromOldAddressProcessor = $createAddressFromOldAddressProcessor;
|
||||
$this->createsAddress = $createsAddress;
|
||||
$this->createsCompany = $createsCompany;
|
||||
$this->createsContact = $createsContact;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
/** @var Company $company */
|
||||
$company = $this->createsCompany->execute(new CompanyObject('Modern', 'MODERN', CompanyType::COMPANY_BUSINESS, ApprovalStatus::APPROVED));
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$this->createCompanyModuleProcessor->execute($company, BusinessType::FREIGHT_FORWARDER);
|
||||
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
|
||||
|
||||
$companyModule->update(['name' => 'Guangzhou', 'reference' => 'GZ-V02']);
|
||||
$address = new AddressObject('白云区,大朗北路', '大朗生活区523A公交车总站对面', 2, 35, 633, 510000);
|
||||
$contact = new ContactObject('郑学钟', '18665696389', '', '');
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
$this->createsContact->execute($companyModule, $contact);
|
||||
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
|
||||
$companyModule->update(['name' => 'Klang', 'reference' => 'KL-V02']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
<div class="row m-b-5">
|
||||
<div class="col">
|
||||
<small class="fs-10 all-caps muted">Warehouse</small>
|
||||
<h6 class="no-margin small">{{item.warehouse.id === 3 ? 'Guang Zhou' : 'Yiwu'}}</h6>
|
||||
<h6 class="no-margin small">{{item.warehouse.name}}</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-5">
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<h6 class="no-margin"><b>Order Date:</b> {{order.created_at}}</h6>
|
||||
</div>
|
||||
<div class="col-12 col-sm-auto">
|
||||
<h6 class="no-margin"><b>Warehouse:</b> {{order.warehouse.id === 3 ? 'Guang Zhou' : 'Yiwu'}}</h6>
|
||||
<h6 class="no-margin"><b>Warehouse:</b> {{order.warehouse.name}}</h6>
|
||||
</div>
|
||||
<div class="col col-sm" v-if="$store.getters.isAdmin">
|
||||
<a :href="route('customer.profile', order.company_module.marking)">
|
||||
|
||||
Reference in New Issue
Block a user