add over weight cbm to yd

This commit is contained in:
omair saleh
2022-01-28 11:37:54 +08:00
parent a892656725
commit 7f7101cce5
2 changed files with 11 additions and 0 deletions
@@ -262,6 +262,15 @@ class FetchOrderListsFromYdPortalProcessor
$this->createPackageProcessor->execute($packageObject, $packingList);
}
$weightCbm = $row->weight / 500;
$overWeightCbm = $weightCbm - $packingList->packages()->sum(DB::raw('(width/100) * (height/100) * (length/100) * quantity'));
if($overWeightCbm > 0){
$measurement = round($overWeightCbm ** (1/3) * 100, 2);
$packageObject = new PackageObject(PackageType::OVER_WEIGHT, 'Over Weight CBM', (float) $measurement, (float) $measurement, (float) $measurement, 0, 1, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
DB::commit();
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
@@ -8,4 +8,6 @@ final class PackageType {
public const PALLET = 1;
public const OVER_WEIGHT = 2;
}