From 9f42c381b0b0e945ac0c92ee50782259872b3228 Mon Sep 17 00:00:00 2001 From: mzl Date: Sat, 11 Oct 2025 10:03:44 +0000 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=88=E7=89=88=E5=A4=87?= =?UTF-8?q?=E8=B4=A7=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/crm/service/StockOrdersService.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/crm/service/StockOrdersService.php b/app/crm/service/StockOrdersService.php index dd7d570..9a98e6f 100644 --- a/app/crm/service/StockOrdersService.php +++ b/app/crm/service/StockOrdersService.php @@ -72,11 +72,21 @@ class StockOrdersService extends \app\common\service\StockOrdersService { $config = $this->buildQueryConfig($request, 'detail'); $item = $this->logicShow($config); + + // 检查是否至少有一个车辆填写了vin + $hasVin = false; foreach ($item->items as $k => $v) { - if ($v->vin === '') { - throw new BusinessException('存在未填写vin的车辆,无法完成提交审核'); + if ($v->vin !== '') { + $hasVin = true; + break; } } + + // 如果没有任何车辆填写vin,则抛出异常 + if (!$hasVin) { + throw new BusinessException('至少需要为一辆车辆填写vin,才能提交审核'); + } + $this->logicUpdateBy($config, [ 'approval_status' => 1 ]);