Update rejection messages to use battery name and model vs SKUs #800
This commit is contained in:
parent
22683e1edf
commit
b53aacb840
1 changed files with 14 additions and 3 deletions
|
|
@ -11,6 +11,7 @@ use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
|||
|
||||
use App\Entity\Hub;
|
||||
use App\Entity\JobOrder;
|
||||
use App\Entity\Battery;
|
||||
|
||||
use App\Service\HubDistributor;
|
||||
use App\Service\InventoryManager;
|
||||
|
|
@ -343,6 +344,14 @@ class HubSelector
|
|||
}
|
||||
}
|
||||
|
||||
// get battery models for each requested SKU
|
||||
$batteries = [];
|
||||
foreach ($skus as $sku) {
|
||||
$bobj = $this->em->getRepository(Battery::class)->findOneBy(['sap_code' => $sku]);
|
||||
$batteries[] = implode(" ", [$bobj->getModel()->getName(), $bobj->getSize()->getName()]);
|
||||
}
|
||||
$battery_string = implode(", ", $batteries);
|
||||
|
||||
// remove filtered hubs from list
|
||||
foreach ($hubs as $hub_data) {
|
||||
$hub_obj = $hub_data['hub'];
|
||||
|
|
@ -354,8 +363,8 @@ class HubSelector
|
|||
$robj = $this->createRejectionEntry(
|
||||
$jo,
|
||||
$hub_obj,
|
||||
"SKU(s): " . implode(", ", $skus)
|
||||
);
|
||||
"SKU(s): " . $battery_string
|
||||
);
|
||||
|
||||
// build SMS message
|
||||
$this->sendSMSMessage(
|
||||
|
|
@ -363,7 +372,7 @@ class HubSelector
|
|||
$jo,
|
||||
$robj,
|
||||
JORejectionReason::getName(JORejectionReason::NO_STOCK_SALES),
|
||||
"Requested SKU(s) - " . implode(", ", $skus)
|
||||
"Requested SKU(s) - " . $battery_string
|
||||
);
|
||||
|
||||
// log this filter
|
||||
|
|
@ -624,6 +633,8 @@ class HubSelector
|
|||
'Remarks: ' . $remarks . "\n" .
|
||||
'Type of Service: ' . ServiceType::getName($jo->getServiceType());
|
||||
|
||||
error_log("SENDING SMS MESsAGE:\r\n" . $message);
|
||||
|
||||
// send SMS message to hub
|
||||
$this->rt->sendSMS(
|
||||
$hub->getNotifNumber(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue