fix yd order number bug

This commit is contained in:
omair saleh
2022-01-19 13:29:26 +08:00
parent d93e6ea25e
commit 1854ca24de
@@ -153,7 +153,6 @@ class FetchOrderListsFromYdPortalProcessor
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
foreach($rows->data as $row){
$containerReference = null;
@@ -166,6 +165,7 @@ class FetchOrderListsFromYdPortalProcessor
'trakingno' => $row->expressno
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
foreach ($rows->data as $trackingRow) {
if($trackingRow->tracking === '货物已送达仓库准备入库中'){
$receiveDate = Carbon::parse($trackingRow->trackingtime);
@@ -186,20 +186,16 @@ class FetchOrderListsFromYdPortalProcessor
$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];
$orderNumber = $customerno[array_key_last($customerno)];
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
} catch (ResourceNotFoundException $exception) {
continue;
try {
$order = $this->fetchesOrder->execute(['reference' => substr($orderNumber, -9)]);
} catch (ResourceNotFoundException $exception) {
continue;
}
}
$packingListReference = $row->expressno;