|
|
@@ -148,22 +148,22 @@ class OrderPackageReceivedSyncService
|
|
|
foreach ($logisticResponses as $logisticResponse) {
|
|
|
if (empty($logisticResponse)) continue;
|
|
|
$orderPackage = OrderPackage::query()->where('logistic_number', $logisticResponse['logistic_number'])->first();
|
|
|
- if(empty($orderPackage)) continue;
|
|
|
+ if (empty($orderPackage)) continue;
|
|
|
//如果已经收货,状态改为已签收
|
|
|
if ($logisticResponse['received_at'] ?? false) {
|
|
|
$logisticResponse['status'] = '已签收';
|
|
|
}
|
|
|
+ //设置异常信息
|
|
|
+ $logisticResponse = $this->setExceptionStatus($logisticResponse);
|
|
|
//标记为手动更新的 status不更新
|
|
|
if ($orderPackage->is_manual_update) {
|
|
|
//异常状态不更新
|
|
|
- unset($logisticResponse['exception_status']);
|
|
|
+ if (isset($logisticResponse['exception_status'])) unset($logisticResponse['exception_status']);
|
|
|
//状态允许向后更新
|
|
|
if (OrderPackage::switchStatus($orderPackage->status) > OrderPackage::switchStatus($logisticResponse['status'] ?? '生成订单')) {
|
|
|
unset($logisticResponse['status']);
|
|
|
}
|
|
|
}
|
|
|
- //设置异常信息
|
|
|
- $logisticResponse = $this->setExceptionStatus($logisticResponse);
|
|
|
//标记为单号异常
|
|
|
if (Str::contains($orderPackage->logistic_number, ['SO', '#', '-'])) {
|
|
|
$logisticResponse['exception_status'] = '单号异常';
|
|
|
@@ -183,7 +183,7 @@ class OrderPackageReceivedSyncService
|
|
|
if (isset($logisticResponse['exception_status'])) $logisticResponse['exception_status'] = OrderPackage::switchExceptionStatus($logisticResponse['exception_status']);
|
|
|
if (isset($logisticResponse['status'])) $logisticResponse['status'] = OrderPackage::switchStatus($logisticResponse['status']);
|
|
|
if (isset($logisticResponse['routes_length'])) unset($logisticResponse['routes_length']);
|
|
|
- if(empty($logisticResponse['transfer_status'])) unset($logisticResponse['transfer_status']);
|
|
|
+ if (empty($logisticResponse['transfer_status'])) unset($logisticResponse['transfer_status']);
|
|
|
OrderPackage::query()->where('logistic_number', $logisticResponse['logistic_number'])
|
|
|
->update($logisticResponse);
|
|
|
}
|