From d1b78f1408d6ee0cc2602614c98d629bc17140de Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Fri, 22 May 2026 17:51:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B8=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/GateController.php | 18 ++++++++++-------- public/admin/index.html | 2 +- .../static/css/chunk-053cb896.9ef7d375.css | 1 - .../static/css/chunk-698f6f63.195a1ac5.css | 1 + .../js/{app.88b2b57d.js => app.a8fd346e.js} | 2 +- .../admin/static/js/chunk-053cb896.b6880b84.js | 1 - .../admin/static/js/chunk-698f6f63.d3208d6c.js | 1 + 7 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 public/admin/static/css/chunk-053cb896.9ef7d375.css create mode 100644 public/admin/static/css/chunk-698f6f63.195a1ac5.css rename public/admin/static/js/{app.88b2b57d.js => app.a8fd346e.js} (99%) delete mode 100644 public/admin/static/js/chunk-053cb896.b6880b84.js create mode 100644 public/admin/static/js/chunk-698f6f63.d3208d6c.js diff --git a/app/Http/Controllers/Admin/GateController.php b/app/Http/Controllers/Admin/GateController.php index 4f211d3..9fb9d2a 100755 --- a/app/Http/Controllers/Admin/GateController.php +++ b/app/Http/Controllers/Admin/GateController.php @@ -195,16 +195,18 @@ class GateController extends CommonController if ($today < $check->start_date || $today > $check->end_date) { return $this->fail([ResponseCode::ERROR_BUSINESS, '当前不在长期访客有效周期内']); } - // 按自然日 biz_date:每日独立先进后离;昨日仅进或未核销等,不影响今日也需当日先「进厂」再「离厂」 - $todayLastLog = GateLog::where('visit_id', $check->id)->where('biz_date', $today)->orderByDesc('id')->first(); - if (!$todayLastLog && !empty($check->code)) { - $todayLastLog = GateLog::where('code', $check->code)->where('biz_date', $today)->orderByDesc('id')->first(); + // 进/离异以整条预约「最新一条门岗流水」为主:与会话 audit_status「已进厂」一致; + // 昨日进今日离:最后一条仍为进厂时允许核销离厂(biz_date 仍记当日); + // 当日可先离再进——离后最新为离厂,仍可再核销进厂。 + $latestGateLog = GateLog::where('visit_id', $check->id)->orderByDesc('id')->first(); + if (!$latestGateLog && !empty($check->code)) { + $latestGateLog = GateLog::where('code', $check->code)->orderByDesc('id')->first(); } - if ((int)$all['type'] === 1 && $todayLastLog && (int)$todayLastLog->action === 1) { - return $this->fail([ResponseCode::ERROR_BUSINESS, '今日已进厂,请先离厂后再进厂']); + if ((int)$all['type'] === 1 && $latestGateLog && (int)$latestGateLog->action === 1) { + return $this->fail([ResponseCode::ERROR_BUSINESS, '上次进厂尚未离厂,请先核销离厂后再进厂']); } - if ((int)$all['type'] === 2 && (!$todayLastLog || (int)$todayLastLog->action !== 1)) { - return $this->fail([ResponseCode::ERROR_BUSINESS, '今日暂无有效进厂记录,无法离厂。请以当日为准先核销进厂(若昨日仅有进厂或昨日未离,今日也需先核销进厂)。']); + if ((int)$all['type'] === 2 && (!$latestGateLog || (int)$latestGateLog->action !== 1)) { + return $this->fail([ResponseCode::ERROR_BUSINESS, '无有效未离厂的进厂记录,无法核销离厂。请先核销进厂后再离厂']); } } $remark = '进厂'; diff --git a/public/admin/index.html b/public/admin/index.html index 5c769fd..d1cb64c 100644 --- a/public/admin/index.html +++ b/public/admin/index.html @@ -1,3 +1,3 @@