SPA_AfterTemperRejection/src/data/sample.ts
Erik 10aac9ac5f @
feat(temper_rejects): "Maschinen" filter label + brighter entry-card meta

- Rename left filter heading Pressen → Maschinen (de.ts)
- Bump entry-card meta info one step in size and brightness
  (article, WAGEN/ETIKETT labels+values, count labels, "getempert vor …")
- Ship rebuilt dist bundle

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
2026-07-02 20:16:39 +02:00

61 lines
3.0 KiB
TypeScript

// Bundled sample data — powers `npm run dev` (no gateway backend) and acts as a
// graceful fallback if the API is unreachable. Mirrors ../../api/routes.py.
import type { StationPayload, RejectEntry, Reason, WindowCode, FlowDistribution } from '@/types/station'
const WINDOW_MINUTES: Record<WindowCode, number> = { '12h': 720, '1T': 1440, '7T': 10080, '14T': 20160, '30T': 43200 }
const PRESSES = ['P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8', 'P9']
// Includes the two "Temperprozess …" reasons so the dev/demo build exercises the
// popover's default-preselect ("Temperprozess nach Ofen") and the reason filter
// (typing "Ofen" narrows to both). Live reasons come from settings.reject_reasons.
export const SAMPLE_REASONS: Reason[] = [
{ id: 1, reason_de: 'Temperprozess vor Ofen', reason_en: 'Temper process before oven' },
{ id: 2, reason_de: 'Temperprozess nach Ofen', reason_en: 'Temper process after oven' },
{ id: 3, reason_de: 'Maßabweichung', reason_en: 'Dimensional deviation' },
{ id: 4, reason_de: 'Lunker', reason_en: 'Voids' },
{ id: 5, reason_de: 'Bindenaht', reason_en: 'Weld line' },
{ id: 6, reason_de: 'Verbrennung', reason_en: 'Burn mark' },
{ id: 7, reason_de: 'Verzug', reason_en: 'Warping' },
{ id: 8, reason_de: 'Sonstiges', reason_en: 'Other' },
]
const flow = (notYetSent: number, wagen: number, unterwegs: number, ofen: number, fertig: number): FlowDistribution => ({
notYetSent,
wagen,
unterwegs,
ofen,
fertig,
})
// [ttId, cartId, press, orderNo, article, partsGood, scrap, ageMin, flow]
const RAW: [number, string, string, string, string, number, number, number, FlowDistribution][] = [
[10231, '00A17226', 'P5', 'O-4455', 'Gehäuse 12 mm', 60, 2, 90, flow(120, 60, 40, 72, 260)],
[10230, '00917226', 'P8', 'O-4489', 'Halter Typ A', 80, 1, 150, flow(40, 30, 36, 80, 210)],
[10229, '00817226', 'P3', 'O-4471', 'Deckel rund', 54, 4, 320, flow(180, 54, 30, 88, 300)],
[10228, '00717226', 'P1', 'O-4471', 'Deckel rund', 64, 0, 500, flow(180, 54, 30, 88, 300)],
[10227, '00617226', 'P2', 'O-4460', 'Klammer klein', 50, 3, 900, flow(90, 42, 0, 60, 190)],
[10226, '00517226', 'P5', 'O-4455', 'Gehäuse 12 mm', 72, 5, 1400, flow(120, 60, 40, 72, 260)],
[10225, '00417226', 'P6', 'O-4460', 'Klammer klein', 44, 1, 3000, flow(90, 42, 0, 60, 190)],
[10224, '00317226', 'P8', 'O-4489', 'Halter Typ A', 58, 2, 8000, flow(40, 30, 36, 80, 210)],
[10223, '00217226', 'P9', 'O-4471', 'Deckel rund', 40, 0, 22000, flow(180, 54, 30, 88, 300)],
]
export function sampleStation(window: WindowCode = '7T'): StationPayload {
const limit = WINDOW_MINUTES[window] ?? WINDOW_MINUTES['7T']
const now = Date.now()
const entries: RejectEntry[] = RAW.filter((r) => r[7] <= limit).map((r) => ({
ttId: r[0],
cartId: r[1],
press: r[2],
orderNo: r[3],
article: r[4],
partsGood: r[5],
scrap: r[6],
doneAt: new Date(now - r[7] * 60_000).toISOString(),
flow: r[8],
}))
return { window, generatedAt: new Date().toISOString(), sample: true, presses: PRESSES, entries }
}