master
lion 2 days ago
parent 2aa62ff31e
commit 7e20f2cffd

@ -195,12 +195,16 @@ 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();
}
if ((int)$all['type'] === 1 && $todayLastLog && (int)$todayLastLog->action === 1) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '今日已进厂,请先离厂后再进厂']);
}
if ((int)$all['type'] === 2 && (!$todayLastLog || (int)$todayLastLog->action !== 1)) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '今日无有效进厂记录,无法离厂']);
return $this->fail([ResponseCode::ERROR_BUSINESS, '今日无有效进厂记录,无法离厂。请以当日为准先核销进厂(若昨日仅有进厂或昨日未离,今日也需先核销进厂)。']);
}
}
$remark = '进厂';

@ -162,7 +162,7 @@ class VisitController extends CommonController
'action' => $item->action,
'action_text' => $item->action_text,
'remark' => $item->remark,
'created_at' => $item->created_at,
'created_at' => $item->created_at ? $item->created_at->format('Y-m-d H:i:s') : null,
'admin_name' => $item->admin->name ?? '',
'person_no' => $item->person_no ?? [],
'car_no' => $item->car_no ?? [],

Loading…
Cancel
Save