Implement department wash count service and refactor related reporting functions
This commit is contained in:
@@ -440,6 +440,8 @@ class selfserve_wash_flow implements selfserve_wash_flow_i
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->fillMissingWashStartedAtFromLaneRuntime($session, $laneId);
|
||||
|
||||
if (!$session->markCompletedIfOpen($orderId)) {
|
||||
return $this->getSessionSummary((int)$session->id);
|
||||
}
|
||||
@@ -456,6 +458,25 @@ class selfserve_wash_flow implements selfserve_wash_flow_i
|
||||
return $this->getSessionSummary((int)$session->id);
|
||||
}
|
||||
|
||||
protected function fillMissingWashStartedAtFromLaneRuntime(selfserve_wash_sessions_o $session, int $laneId): void
|
||||
{
|
||||
try {
|
||||
if ($session->wash_started_at->value() !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$lane = (new selfserve())->lane($laneId);
|
||||
$washStartedAt = (int)$lane->getWashStartTime();
|
||||
if ($washStartedAt <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$session->wash_started_at->set(date('Y-m-d H:i:s', $washStartedAt));
|
||||
} catch (\Throwable) {
|
||||
// Session timestamp enrichment must not block STOP completion.
|
||||
}
|
||||
}
|
||||
|
||||
public function forceStopLane(int $laneId, ?int $sessionId = null, bool $bill = false, ?string $reason = null, ?int $userId = null): array
|
||||
{
|
||||
$lane = (new selfserve())->lane($laneId);
|
||||
|
||||
Reference in New Issue
Block a user