This commit is contained in:
Your Name
2026-06-04 09:57:14 +08:00
parent 26b2cde699
commit 32f8e19bf1
4 changed files with 15 additions and 8 deletions
@@ -873,7 +873,7 @@ class ExpressTrackingService
}
/**
* 按处方订单履约核对:已发货(5)/已签收(6) 时符合条件的订单调用 applyAssistantReleaseForShippedPrescriptionOrder。
* 按处方订单履约核对:已发货(5) 时符合条件的订单调用 applyAssistantReleaseForShippedPrescriptionOrder(已完成/已签收不再扫描)
* 与快递 100 / 甘草来自哪个物流渠道无关;是否清空医助以该方法为准(**二中心豁免看业务单创建人**参见 apply;已 shipped 释放且 assistant_id=0 视为已处理)。
*
* @return array{scanned: int, cleared: int, lines: list<string>}
@@ -888,7 +888,7 @@ class ExpressTrackingService
->whereNull('po.delete_time')
->whereNull('d.delete_time')
->whereRaw('(IFNULL(d.shipped_non_er_assistant_cleared_at, 0) = 0 OR d.assistant_id > 0)')
->whereIn('po.fulfillment_status', [5, 6])
->where('po.fulfillment_status', 5)
->where('po.diagnosis_id', '>', 0)
->where(function ($w) {
$w->where('d.assistant_id', '>', 0)
@@ -435,7 +435,7 @@ final class GancaoLogisticsRouteService
}
/**
* 批量同步:选取候选订单(已上传甘草、且未签收/未取消的)
* 批量同步:选取候选订单(已上传甘草、且未完成/未签收/未取消的)
*
* @return array{total:int, success:int, failed:int, skipped:int, assistant_cleared:int, assistant_skipped_assign_log:int, assistant_lines:list<string>, details:array<int, array<string,mixed>>}
*/
@@ -464,8 +464,8 @@ final class GancaoLogisticsRouteService
$w->whereIn('gancao_order_state', [110, 20, 30, 90])
->whereOr('tracking_number', '<>', '');
});
// 排除已取消(4)、已签收(6);已完成(3)仍跑一次以补齐路由
$q->whereNotIn('fulfillment_status', [4, 6]);
// 排除已完成(3)、已取消(4)、已签收(6)
$q->whereNotIn('fulfillment_status', [3, 4, 6]);
}
$orders = $q->order('id', 'desc')->limit($limit)->select();
@@ -481,6 +481,12 @@ final class GancaoLogisticsRouteService
*/
private static function appendSyncOneResult(array &$stats, PrescriptionOrder $order): void
{
$fs = (int) ($order->fulfillment_status ?? 0);
if (in_array($fs, [3, 6], true)) {
$stats['skipped']++;
return;
}
$stats['total']++;
try {
$r = self::syncOne($order);