mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
minor changes to dummy data seeder comments
This commit is contained in:
@@ -301,22 +301,33 @@ class DummyDataSeeder extends Seeder
|
|||||||
// =============================================== //
|
// =============================================== //
|
||||||
// 1. create user
|
// 1. create user
|
||||||
// 2. create company
|
// 2. create company
|
||||||
|
|
||||||
// 3. create Company Module
|
// 3. create Company Module
|
||||||
// 4. Attach Employee
|
// 4. Declare Company Relationship with CIEF
|
||||||
// 5. create contact
|
|
||||||
// 6. create Address
|
// 5. Attach Employee
|
||||||
// 7. Declare Company Relationship with CIEF
|
// 6. create contact
|
||||||
|
// 7. create Address
|
||||||
|
|
||||||
// 8. identification verification
|
// 8. identification verification
|
||||||
|
|
||||||
|
// =============================================== //
|
||||||
|
// Order Workflow //
|
||||||
|
// =============================================== //
|
||||||
|
|
||||||
// 9. Create Shipping Label
|
// 9. Create Shipping Label
|
||||||
// 10. Receive Goods at warehouse
|
// 10. Receive Goods at warehouse (our record match supplier record + detect any problems)
|
||||||
// 11. Load into container for shipping
|
// 11. Load into container for shipping (our record match supplier record + detect any problems)
|
||||||
// 12. Un-stuffing Container
|
// 12. generate invoice (add billing address + double check price)
|
||||||
// 13. last mile delivery
|
// 13. additional charges
|
||||||
|
// 12. Un-stuffing Container (our record match supplier record + detect any problems)
|
||||||
|
// 13. last mile delivery (our record match supplier record + on hold)
|
||||||
|
|
||||||
// generate random number of users
|
// generate random number of users
|
||||||
for($userLoop=1; $userLoop <= rand(20, 50); $userLoop++) {
|
for($userLoop=1; $userLoop <= rand(20, 50); $userLoop++) {
|
||||||
|
|
||||||
// ================= //
|
// === //
|
||||||
|
// 1 // ========== //
|
||||||
// Create user //
|
// Create user //
|
||||||
// ================= //
|
// ================= //
|
||||||
$customerName = $this->faker->name;
|
$customerName = $this->faker->name;
|
||||||
@@ -325,7 +336,8 @@ class DummyDataSeeder extends Seeder
|
|||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = $this->createsUser->execute($userObject);
|
$user = $this->createsUser->execute($userObject);
|
||||||
|
|
||||||
// ================= //
|
// === //
|
||||||
|
// 2 // ========== //
|
||||||
// Create Company //
|
// Create Company //
|
||||||
// ================= //
|
// ================= //
|
||||||
|
|
||||||
@@ -348,7 +360,8 @@ class DummyDataSeeder extends Seeder
|
|||||||
/** @var Company $company */
|
/** @var Company $company */
|
||||||
$company = $this->createsCompany->execute($company_object);
|
$company = $this->createsCompany->execute($company_object);
|
||||||
|
|
||||||
// ========================//
|
// === //
|
||||||
|
// 3 // =================//
|
||||||
// Create Company Module //
|
// Create Company Module //
|
||||||
// ========================//
|
// ========================//
|
||||||
// Company Module are sub entities of the company, and is used to declare what kind of business role this sub entity is in "Like Departments"
|
// Company Module are sub entities of the company, and is used to declare what kind of business role this sub entity is in "Like Departments"
|
||||||
@@ -360,21 +373,34 @@ class DummyDataSeeder extends Seeder
|
|||||||
/** @var CompanyModule $companyModule */
|
/** @var CompanyModule $companyModule */
|
||||||
$companyModule = $this->createsCompanyModule->execute($company, $companyModuleObject);
|
$companyModule = $this->createsCompanyModule->execute($company, $companyModuleObject);
|
||||||
|
|
||||||
// ==================//
|
// === //
|
||||||
|
// 4 // ================================== //
|
||||||
|
// Declare Company Relationship with CIEF //
|
||||||
|
// ========================================= //
|
||||||
|
// In order for 2 entities to work together they must both agree to the relationship "Like facebook friend requests".
|
||||||
|
// But at the moment since CIEF is the only Entity that has a direct relationship with importers we just declare this relationship by default.
|
||||||
|
$connectionObject = new CompanyConnectionObject($companyModule, $CIEF, mt_rand(1000, 9999) . (new GeneratesInitials())->name($companyName)->length(3)->generate(), 'CIEF');
|
||||||
|
$connection = $this->createsCompanyConnection->execute($connectionObject);
|
||||||
|
$this->approvesCompanyConnection->execute($connection);
|
||||||
|
|
||||||
|
// === //
|
||||||
|
// 5 // ===========//
|
||||||
// Attach Employee //
|
// Attach Employee //
|
||||||
// ==================//
|
// ==================//
|
||||||
// employees are attached to company modules not companies, because an employee maybe working for one or many "Departments".
|
// employees are attached to company modules not companies, because an employee maybe working for one or many "Departments".
|
||||||
$Object = new EmploymentObject($companyModule, $user);
|
$Object = new EmploymentObject($companyModule, $user);
|
||||||
$this->assignEmployeeProcessor->execute($Object);
|
$this->assignEmployeeProcessor->execute($Object);
|
||||||
|
|
||||||
// ================= //
|
// === //
|
||||||
|
// 6 // =========== //
|
||||||
// Create Contact //
|
// Create Contact //
|
||||||
// ================= //
|
// ================= //
|
||||||
// Contacts uses eloquent polymorphic relationship to declare its owner. and for this use case it will be attached to the company not the company module.
|
// Contacts uses eloquent polymorphic relationship to declare its owner. and for this use case it will be attached to the company not the company module.
|
||||||
$contactObject = new ContactObject($customerName, $this->faker->phoneNumber, $customerEmail, null);
|
$contactObject = new ContactObject($customerName, $this->faker->phoneNumber, $customerEmail, null);
|
||||||
$this->createsContact->execute($company, $contactObject);
|
$this->createsContact->execute($company, $contactObject);
|
||||||
|
|
||||||
// ================= //
|
// === //
|
||||||
|
// 7 // ========== //
|
||||||
// Create Address //
|
// Create Address //
|
||||||
// ================= //
|
// ================= //
|
||||||
// Addresses uses eloquent polymorphic relationship to declare its owner. and for this use case it will be attached to the company module.
|
// Addresses uses eloquent polymorphic relationship to declare its owner. and for this use case it will be attached to the company module.
|
||||||
@@ -395,17 +421,9 @@ class DummyDataSeeder extends Seeder
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================= //
|
|
||||||
// Declare Company Relationship with CIEF //
|
|
||||||
// ========================================= //
|
|
||||||
// In order for 2 entities to work together they must both agree to the relationship "Like facebook friend requests".
|
|
||||||
// But at the moment since CIEF is the only Entity that has a direct relationship with importers we just declare this relationship by default.
|
|
||||||
$connectionObject = new CompanyConnectionObject($companyModule, $CIEF, mt_rand(1000, 9999) . (new GeneratesInitials())->name($companyName)->length(3)->generate(), 'CIEF');
|
|
||||||
$connection = $this->createsCompanyConnection->execute($connectionObject);
|
|
||||||
$this->approvesCompanyConnection->execute($connection);
|
|
||||||
|
|
||||||
|
// === //
|
||||||
// ============================== //
|
// 8 // ======================= //
|
||||||
// identification verification //
|
// identification verification //
|
||||||
// ============================== //
|
// ============================== //
|
||||||
// please refer to company types section for more insight
|
// please refer to company types section for more insight
|
||||||
@@ -417,7 +435,9 @@ class DummyDataSeeder extends Seeder
|
|||||||
|
|
||||||
// generate random number of shipping labels
|
// generate random number of shipping labels
|
||||||
for($orderLoop=1; $orderLoop <= rand(1, 30); $orderLoop++) {
|
for($orderLoop=1; $orderLoop <= rand(1, 30); $orderLoop++) {
|
||||||
// ======================== //
|
|
||||||
|
// === //
|
||||||
|
// 9 // ================= //
|
||||||
// Create Shipping Label //
|
// Create Shipping Label //
|
||||||
// ======================== //
|
// ======================== //
|
||||||
// The shipping label is stored in the warehouse as an order entity.
|
// The shipping label is stored in the warehouse as an order entity.
|
||||||
@@ -446,7 +466,9 @@ class DummyDataSeeder extends Seeder
|
|||||||
if($orderLoop !== 1) {
|
if($orderLoop !== 1) {
|
||||||
// generate random number of packing lists
|
// generate random number of packing lists
|
||||||
for($packingListLoop=1; $packingListLoop <= rand(2, 4); $packingListLoop++) {
|
for($packingListLoop=1; $packingListLoop <= rand(2, 4); $packingListLoop++) {
|
||||||
// ============================= //
|
|
||||||
|
// ==== //
|
||||||
|
// 10 // ===================== //
|
||||||
// Receive Goods at warehouse //
|
// Receive Goods at warehouse //
|
||||||
// WAREHOUSE_RECEIVE_LIST //
|
// WAREHOUSE_RECEIVE_LIST //
|
||||||
// ============================= //
|
// ============================= //
|
||||||
@@ -454,6 +476,7 @@ class DummyDataSeeder extends Seeder
|
|||||||
// A transport arrangement is attached to WAREHOUSE_RECEIVE_LIST packing list to represent the trip
|
// A transport arrangement is attached to WAREHOUSE_RECEIVE_LIST packing list to represent the trip
|
||||||
// from supplier to the warehouse and is used to record the arrival date.
|
// from supplier to the warehouse and is used to record the arrival date.
|
||||||
|
|
||||||
|
|
||||||
// create random packages
|
// create random packages
|
||||||
$packages = [];
|
$packages = [];
|
||||||
for ($packagesLoop = 1; $packagesLoop <= rand(2, 5); $packagesLoop++) {
|
for ($packagesLoop = 1; $packagesLoop <= rand(2, 5); $packagesLoop++) {
|
||||||
@@ -463,34 +486,40 @@ class DummyDataSeeder extends Seeder
|
|||||||
$packingListReference = $this->faker->bothify('???#########');
|
$packingListReference = $this->faker->bothify('???#########');
|
||||||
|
|
||||||
$warehouseReceiveObject = new PackingListObject($packingListReference, $originWarehouse->id, PackingListType::WAREHOUSE_RECEIVE_LIST, ApprovalStatus::APPROVED);
|
$warehouseReceiveObject = new PackingListObject($packingListReference, $originWarehouse->id, PackingListType::WAREHOUSE_RECEIVE_LIST, ApprovalStatus::APPROVED);
|
||||||
|
|
||||||
|
// Creates WAREHOUSE_RECEIVE_LIST & WAREHOUSE_RECEIVE_LIST_REPLICA
|
||||||
/** @var PackingList $warehouseReceiveList */
|
/** @var PackingList $warehouseReceiveList */
|
||||||
$warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order);
|
$warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order);
|
||||||
|
|
||||||
// attach packages to packing list
|
// attach packages to packing list
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
|
// Attach packages to both WAREHOUSE_RECEIVE_LIST & WAREHOUSE_RECEIVE_LIST_REPLICA
|
||||||
$this->createPackageProcessor->execute($package, $warehouseReceiveList);
|
$this->createPackageProcessor->execute($package, $warehouseReceiveList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// random arrival date in the last 30 days
|
// random arrival date in the last 30 days
|
||||||
$receiveDate = Carbon::today()->subDays(rand(10, 45));
|
$receiveDate = Carbon::today()->subDays(rand(10, 45));
|
||||||
|
|
||||||
// create transport arrangement for the trip from manufacturer to warehouse (to record drop off date)
|
// create transport arrangement for the trip from manufacturer to warehouse (to record drop off/ receive date)
|
||||||
$transportObject = new TransportObject(TransportType::LAND, null, $this->faker->bothify('??#########'), $receiveDate, $receiveDate, ApprovalStatus::APPROVED);
|
$transportObject = new TransportObject(TransportType::LAND, null, $this->faker->bothify('??#########'), $receiveDate, $receiveDate, ApprovalStatus::APPROVED);
|
||||||
$this->createsTransport->execute($transportObject, $warehouseReceiveList);
|
$this->createsTransport->execute($transportObject, $warehouseReceiveList);
|
||||||
|
|
||||||
|
// ==== //
|
||||||
// =================================== //
|
// 11 // =========================== //
|
||||||
// Load into container for shipping //
|
// Load into container for shipping //
|
||||||
// SHIPPING_PACKING_LIST //
|
// SHIPPING_PACKING_LIST //
|
||||||
// =================================== //
|
// =================================== //
|
||||||
// When a batch of goods is loaded in a container to prepare for shipping a SHIPPING_PACKING_LIST packing list is created.
|
// When a batch of goods is loaded in a container to prepare for shipping a SHIPPING_PACKING_LIST packing list is created.
|
||||||
|
// A SHIPPING_PACKING_LIST is a copy of the WAREHOUSE_RECEIVE_LIST in most cases.
|
||||||
|
|
||||||
$shippingPackingListObject = new PackingListObject($packingListReference, $originWarehouse->id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::APPROVED);
|
$shippingPackingListObject = new PackingListObject($packingListReference, $originWarehouse->id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::APPROVED);
|
||||||
|
// Creates SHIPPING_PACKING_LIST & SHIPPING_PACKING_LIST_REPLICA
|
||||||
/** @var PackingList $warehouseReceiveList */
|
/** @var PackingList $warehouseReceiveList */
|
||||||
$shippingPackingList = $this->createPackingListProcessor->execute($shippingPackingListObject, $order);
|
$shippingPackingList = $this->createPackingListProcessor->execute($shippingPackingListObject, $order);
|
||||||
|
|
||||||
// attach packages to packing list
|
// attach packages to packing list
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
|
// Attach packages to both SHIPPING_PACKING_LIST & SHIPPING_PACKING_LIST_REPLICA
|
||||||
$this->createPackageProcessor->execute($package, $shippingPackingList);
|
$this->createPackageProcessor->execute($package, $shippingPackingList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,7 +530,8 @@ class DummyDataSeeder extends Seeder
|
|||||||
$container->packingLists()->attach($shippingPackingList);
|
$container->packingLists()->attach($shippingPackingList);
|
||||||
|
|
||||||
if ($container->status !== ApprovalStatus::COMPLETED) {
|
if ($container->status !== ApprovalStatus::COMPLETED) {
|
||||||
// ========================================= //
|
// ==== //
|
||||||
|
// 12 // ================================= //
|
||||||
// Un-stuffing Container //
|
// Un-stuffing Container //
|
||||||
// container arrived to malaysia warehouse //
|
// container arrived to malaysia warehouse //
|
||||||
// ========================================= //
|
// ========================================= //
|
||||||
@@ -521,7 +551,8 @@ class DummyDataSeeder extends Seeder
|
|||||||
$container->status = ApprovalStatus::COMPLETED;
|
$container->status = ApprovalStatus::COMPLETED;
|
||||||
$container->save();
|
$container->save();
|
||||||
|
|
||||||
// ======================== //
|
// ==== //
|
||||||
|
// 13 // ================ //
|
||||||
// Last Mile Delivery //
|
// Last Mile Delivery //
|
||||||
// ======================== //
|
// ======================== //
|
||||||
// after the container is un-stuffed, the malaysian warehouse will arrange for delivery.
|
// after the container is un-stuffed, the malaysian warehouse will arrange for delivery.
|
||||||
|
|||||||
Reference in New Issue
Block a user