@flowselections/layout-maker 1.69.40 → 1.69.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/integrations/supabase/types.d.ts +3164 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/printQueue.server.d.ts +5 -0
- package/dist-lib/lib/printQueue.server.d.ts.map +1 -1
- package/dist-lib/lib/printQueue.server.js +41 -1
- package/dist-lib/lib/printService.functions.d.ts +1 -1
- package/dist-lib/lib/printnodeWebhookBeheer.server.d.ts +1 -1
- package/dist-lib/lib/productiebonBuilder.d.ts +6 -0
- package/dist-lib/lib/productiebonBuilder.d.ts.map +1 -1
- package/dist-lib/lib/productiebonBuilder.js +13 -1
- package/dist-lib/lib/productiebonData.d.ts +43 -0
- package/dist-lib/lib/productiebonData.d.ts.map +1 -0
- package/dist-lib/lib/productiebonData.js +92 -0
- package/dist-lib/lib/productiebonData.server.d.ts +15 -0
- package/dist-lib/lib/productiebonData.server.d.ts.map +1 -0
- package/dist-lib/lib/productiebonData.server.js +53 -0
- package/dist-lib/lib/productiebonHtml.d.ts.map +1 -1
- package/dist-lib/lib/productiebonHtml.js +37 -1
- package/dist-lib/lib/standaardLayouts.server.d.ts.map +1 -1
- package/dist-lib/lib/standaardLayouts.server.js +11 -1
- package/dist-lib/lib/standaardenBron.d.ts.map +1 -1
- package/dist-lib/lib/standaardenBron.js +670 -3
- package/dist-lib/lib/versie.generated.d.ts +1 -1
- package/dist-lib/lib/versie.generated.js +1 -1
- package/package.json +5 -2
- package/sql/print-schema.sql +156 -2
- package/sql/print-schema.verslag.md +5 -2
|
@@ -130,6 +130,11 @@ export declare function nietNodig(db: PrintDb, job: Job): Promise<void>;
|
|
|
130
130
|
* opdracht. Gedeeld door polling en webhook, zodat beide hetzelfde doen.
|
|
131
131
|
*/
|
|
132
132
|
export declare function pasPrintNodeStatusToe(db: PrintDb, jobId: string, printnode: string, bericht: string): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* 1.69.42: productiebon echt geprint (PrintNode "done") → Voorraad
|
|
135
|
+
* productie_order_geprint. Fouten worden gelogd, nooit stil genegeerd.
|
|
136
|
+
*/
|
|
137
|
+
export declare function meldProductieorderGeprint(db: PrintDb, jobId: string): Promise<boolean>;
|
|
133
138
|
export declare function mislukGrensMinuten(verlooptNaS: number | null, documenttype: string | null): number;
|
|
134
139
|
export interface WachtrijResultaat {
|
|
135
140
|
opgepakt: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printQueue.server.d.ts","sourceRoot":"","sources":["../../src/lib/printQueue.server.ts"],"names":[],"mappings":"AAQA,OAAO,EAA0C,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGjG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"printQueue.server.d.ts","sourceRoot":"","sources":["../../src/lib/printQueue.server.ts"],"names":[],"mappings":"AAQA,OAAO,EAA0C,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGjG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA4B5D,OAAO,EAA+H,KAAK,gBAAgB,EAAkF,MAAM,mBAAmB,CAAC;AAWvQ,OAAO,EAAsD,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC1G,OAAO,EAAkL,KAAK,YAAY,EAAwB,MAAM,kBAAkB,CAAC;AAO3P,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD;;;;GAIG;AACH,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAO/H;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAGnC,kFAAkF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C3F,eAAO,MAAM,eAAe,QAAS,CAAC;AAyCtC,wBAAsB,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,SAAI,EAAE,MAAM,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAyG/H;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,GAAG,GACP,OAAO,CAAC;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CA6B1D;AAGD;;;;GAIG;AACH,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CAO1H;AAED,qFAAqF;AACrF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CASnF;AAsID,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,SAAS,CAkBrD;AAiDD,+FAA+F;AAC/F,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAKjD"}
|
|
@@ -12,6 +12,7 @@ import { bouwPakbonScanInhoud, bewaarPakbonScanInhoud } from "./pakbonScan.js";
|
|
|
12
12
|
import { bouwPakbonBarcodeVerzoek, geleverdeBarcodeVoorJob, vraagPakbonBarcodeAan, } from "./pakbonBarcodeVerzoek.js";
|
|
13
13
|
import { bepaalVolleKarStand, deelkarRegels, leesAfleverbriefConfig, pakbonLayoutVariant, } from "./pakbonBuilder.js";
|
|
14
14
|
import { renderProductiebonDocument } from "./productiebonHtml.js";
|
|
15
|
+
import { laadProductiebonGegevens, ProductieorderOntbreektFout } from "./productiebonData.server.js";
|
|
15
16
|
import { heeftOrderInhoud, laadOrderVanuitDatabase, laadPakbonData, zoekOrderVerwijzing } from "./orderData.server.js";
|
|
16
17
|
import { profielHeeftInhoud, renderProfielDocument } from "./profielHtml.js";
|
|
17
18
|
import { bouwDocumentHtml, voorbeeldContext } from "./layoutPreview.js";
|
|
@@ -1402,7 +1403,21 @@ export async function bouwHtml(db, job, keuze, uitkomst) {
|
|
|
1402
1403
|
// 2) Productiebon-layouts (blokken onder `productiebon.blokken`).
|
|
1403
1404
|
if (Array.isArray(cfg.productiebon?.blokken) ||
|
|
1404
1405
|
String(layout.documenttype) === "productiebon") {
|
|
1405
|
-
|
|
1406
|
+
// 1.69.42: opdracht voor een productieorder (Voorraad) → echte gegevens,
|
|
1407
|
+
// nooit voorbeeldwaarden. Ontbreekt de order: blijvende fout.
|
|
1408
|
+
const poId = String(p?.productie_order_id ?? "").trim();
|
|
1409
|
+
let pbGegevens = p.data ?? p;
|
|
1410
|
+
if (poId) {
|
|
1411
|
+
try {
|
|
1412
|
+
pbGegevens = await laadProductiebonGegevens(db, poId, new Date().toISOString());
|
|
1413
|
+
}
|
|
1414
|
+
catch (e) {
|
|
1415
|
+
if (e instanceof ProductieorderOntbreektFout)
|
|
1416
|
+
throw new GeenDocumentFout(e.message);
|
|
1417
|
+
throw e;
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
return renderProductiebonDocument(layout.config, pbGegevens, {
|
|
1406
1421
|
breedteMm,
|
|
1407
1422
|
hoogteMm,
|
|
1408
1423
|
margeMm: Number(layout.marge_boven ?? 12),
|
|
@@ -2180,6 +2195,31 @@ export async function pasPrintNodeStatusToe(db, jobId, printnode, bericht) {
|
|
|
2180
2195
|
if (s === "done" || s === "error" || s === "expired") {
|
|
2181
2196
|
await log(db, jobId, s === "done" ? "voltooid" : s === "expired" ? "verlopen" : "mislukt", bericht || undefined);
|
|
2182
2197
|
}
|
|
2198
|
+
if (s === "done")
|
|
2199
|
+
await meldProductieorderGeprint(db, jobId);
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* 1.69.42: productiebon echt geprint (PrintNode "done") → Voorraad
|
|
2203
|
+
* productie_order_geprint. Fouten worden gelogd, nooit stil genegeerd.
|
|
2204
|
+
*/
|
|
2205
|
+
export async function meldProductieorderGeprint(db, jobId) {
|
|
2206
|
+
const { data: j, error } = await db.from("print_jobs").select("documenttype, status, payload").eq("id", jobId).maybeSingle();
|
|
2207
|
+
if (error) {
|
|
2208
|
+
console.error("[productiebon] job lezen mislukt", error.message);
|
|
2209
|
+
return false;
|
|
2210
|
+
}
|
|
2211
|
+
const job = j;
|
|
2212
|
+
const poId = String(job?.payload?.productie_order_id ?? "").trim();
|
|
2213
|
+
if (!job || String(job.documenttype) !== "productiebon" || !poId || job.status !== "voltooid")
|
|
2214
|
+
return false;
|
|
2215
|
+
const { error: rpcFout } = await db.rpc("productie_order_geprint", { p_id: poId });
|
|
2216
|
+
if (rpcFout) {
|
|
2217
|
+
console.error("[productiebon] productie_order_geprint mislukt", rpcFout.message);
|
|
2218
|
+
await log(db, jobId, "productieorder_geprint_mislukt", rpcFout.message.slice(0, 300));
|
|
2219
|
+
return false;
|
|
2220
|
+
}
|
|
2221
|
+
await log(db, jobId, "productieorder_geprint", poId);
|
|
2222
|
+
return true;
|
|
2183
2223
|
}
|
|
2184
2224
|
/** Na deze tijd is een opdracht bij de printdienst niet meer te vertrouwen. */
|
|
2185
2225
|
// "expired" van PrintNode is leidend. Zonder enige status pas na de vervaltijd
|
|
@@ -144,7 +144,7 @@ export declare const webhookStatus: import("@tanstack/start-client-core").Option
|
|
|
144
144
|
niet_gematcht: string[];
|
|
145
145
|
}[];
|
|
146
146
|
aan: boolean;
|
|
147
|
-
weergave: "
|
|
147
|
+
weergave: "onbekend" | "uit" | "aan";
|
|
148
148
|
nietBereikbaar: boolean;
|
|
149
149
|
pnUrl: string | null;
|
|
150
150
|
pnGeslaagd: number | null;
|
|
@@ -63,7 +63,7 @@ export declare function weergaveStatus(k: Koppeling | null): "aan" | "uit" | "on
|
|
|
63
63
|
/** Veilige status voor het scherm: nooit het geheim. */
|
|
64
64
|
export declare function veiligeStatus(k: Koppeling | null): {
|
|
65
65
|
aan: boolean;
|
|
66
|
-
weergave: "
|
|
66
|
+
weergave: "onbekend" | "uit" | "aan";
|
|
67
67
|
nietBereikbaar: boolean;
|
|
68
68
|
pnUrl: string | null;
|
|
69
69
|
pnGeslaagd: number | null;
|
|
@@ -86,6 +86,8 @@ export interface DemoOnderdeel {
|
|
|
86
86
|
leverancier: string;
|
|
87
87
|
productgroep: string;
|
|
88
88
|
stap: string;
|
|
89
|
+
per_stuk?: number;
|
|
90
|
+
totaal?: number;
|
|
89
91
|
}
|
|
90
92
|
export declare const DEMO_PRODUCTIEBON: {
|
|
91
93
|
product: {
|
|
@@ -106,6 +108,10 @@ export declare const DEMO_PRODUCTIEBON: {
|
|
|
106
108
|
barcode: string;
|
|
107
109
|
qrcode: string;
|
|
108
110
|
aantal: number;
|
|
111
|
+
opmerking: string;
|
|
112
|
+
aangemaakt_door: string;
|
|
113
|
+
aangemaakt_op: string;
|
|
114
|
+
printdatum: string;
|
|
109
115
|
};
|
|
110
116
|
onderdelen: DemoOnderdeel[];
|
|
111
117
|
fust: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productiebonBuilder.d.ts","sourceRoot":"","sources":["../../src/lib/productiebonBuilder.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAC5B,aAAa,GACb,cAAc,GACd,eAAe,GACf,aAAa,GACb,kBAAkB,GAClB,gBAAgB,GAChB,UAAU,GACV,eAAe,GACf,YA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
{ key: "qrcode", label: "QR-code" },
|
|
30
|
+
{ key: "opmerking", label: "Opmerking" },
|
|
31
|
+
{ key: "aangemaakt_door", label: "Aangemaakt door" },
|
|
32
|
+
{ key: "aangemaakt_op", label: "Aangemaakt op" },
|
|
33
|
+
{ key: "printdatum", label: "Printdatum" },
|
|
30
34
|
];
|
|
31
35
|
const STANDAARD_PRODUCTINFO = [
|
|
32
36
|
"productfoto_groot",
|
|
@@ -67,6 +71,8 @@ export const SAMENSTELLING_KOLOMMEN = [
|
|
|
67
71
|
{ key: "artikelnaam", label: "Artikelnaam" },
|
|
68
72
|
{ key: "foto", label: "Foto" },
|
|
69
73
|
{ key: "aantal", label: "Aantal" },
|
|
74
|
+
{ key: "per_stuk", label: "Per stuk" },
|
|
75
|
+
{ key: "totaal", label: "Totaal" },
|
|
70
76
|
{ key: "eenheid", label: "Eenheid" },
|
|
71
77
|
{ key: "locatie", label: "Magazijnlocatie" },
|
|
72
78
|
{ key: "barcode", label: "Barcode" },
|
|
@@ -90,7 +96,7 @@ export function pbNieuweKolom(key, bibliotheek = SAMENSTELLING_KOLOMMEN) {
|
|
|
90
96
|
key,
|
|
91
97
|
label: bibliotheek.find((k) => k.key === key)?.label ?? key,
|
|
92
98
|
breedte: 20,
|
|
93
|
-
uitlijning: key === "aantal" || key === "voorraad" ? "right" : "left",
|
|
99
|
+
uitlijning: key === "aantal" || key === "voorraad" || key === "per_stuk" || key === "totaal" ? "right" : "left",
|
|
94
100
|
fontgrootte: 9,
|
|
95
101
|
fontfamilie: "Helvetica",
|
|
96
102
|
kleur: "#111827",
|
|
@@ -467,6 +473,8 @@ const o = (soort, nr, naam, aantal, eenheid, locatie, extra = {}) => ({
|
|
|
467
473
|
artikelnummer: nr,
|
|
468
474
|
artikelnaam: naam,
|
|
469
475
|
aantal,
|
|
476
|
+
per_stuk: aantal,
|
|
477
|
+
totaal: aantal * 240,
|
|
470
478
|
eenheid,
|
|
471
479
|
locatie,
|
|
472
480
|
barcode: `87${nr}`,
|
|
@@ -497,6 +505,10 @@ export const DEMO_PRODUCTIEBON = {
|
|
|
497
505
|
barcode: "8712345409218",
|
|
498
506
|
qrcode: "https://flow.example/po/2026-00871",
|
|
499
507
|
aantal: 240,
|
|
508
|
+
opmerking: "Voorbeeldopmerking",
|
|
509
|
+
aangemaakt_door: "Voorbeeld gebruiker",
|
|
510
|
+
aangemaakt_op: "29-jul 08:15",
|
|
511
|
+
printdatum: "29-jul 09:30",
|
|
500
512
|
},
|
|
501
513
|
onderdelen: [
|
|
502
514
|
o("planten", "PL-1001", "Phalaenopsis wit 2-tak", 1, "st", "A-03-1"),
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type Rij = Record<string, unknown>;
|
|
2
|
+
export interface ProductRij {
|
|
3
|
+
id?: string | null;
|
|
4
|
+
product?: string | null;
|
|
5
|
+
article_number?: string | null;
|
|
6
|
+
image_url?: string | null;
|
|
7
|
+
trade_item_key?: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface ProductieOrderRij {
|
|
10
|
+
id: string;
|
|
11
|
+
nummer?: string | null;
|
|
12
|
+
product_id?: string | null;
|
|
13
|
+
trade_item_key?: string | null;
|
|
14
|
+
aantal?: number | string | null;
|
|
15
|
+
opmerking?: string | null;
|
|
16
|
+
aangemaakt_door?: string | null;
|
|
17
|
+
aangemaakt_op?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface OnderdeelRij {
|
|
20
|
+
product_id?: string | null;
|
|
21
|
+
trade_item_key?: string | null;
|
|
22
|
+
naam?: string | null;
|
|
23
|
+
aantal?: number | string | null;
|
|
24
|
+
}
|
|
25
|
+
/** Nederlands getal zonder onnodige decimalen: 2 → "2", 1.5 → "1,5". */
|
|
26
|
+
export declare function nlAantal(n: number | null): string;
|
|
27
|
+
/** 05-nov 14:05 (ander jaar: 05-nov-2025 14:05), in Europe/Amsterdam. */
|
|
28
|
+
export declare function nlDatumTijd(iso: string | null | undefined, nu?: Date): string;
|
|
29
|
+
/** Bouwt de productiebon-gegevens (product + onderdelen) uit echte rijen. */
|
|
30
|
+
export declare function bouwProductiebonGegevens(invoer: {
|
|
31
|
+
order: ProductieOrderRij;
|
|
32
|
+
onderdelen: OnderdeelRij[];
|
|
33
|
+
producten: ProductRij[];
|
|
34
|
+
aangemaaktDoorNaam?: string | null;
|
|
35
|
+
printMoment: string;
|
|
36
|
+
nu?: Date;
|
|
37
|
+
}): {
|
|
38
|
+
product: Rij;
|
|
39
|
+
onderdelen: Rij[];
|
|
40
|
+
echt: true;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=productiebonData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productiebonData.d.ts","sourceRoot":"","sources":["../../src/lib/productiebonData.ts"],"names":[],"mappings":"AAOA,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnC,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACjC;AAaD,wEAAwE;AACxE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGjD;AAED,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,EAAE,GAAE,IAAiB,GAAG,MAAM,CAezF;AAcD,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,KAAK,EAAE,iBAAiB,CAAC;IACzB,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,SAAS,EAAE,UAAU,EAAE,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,IAAI,CAAC;CACX,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,GAAG,EAAE,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAqClD"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/productiebonData.ts — echte productiebon-gegevens (contract v1).
|
|
3
|
+
// Puur: zet rijen uit productie_orders / productie_order_onderdelen (Voorraad)
|
|
4
|
+
// en products om naar de vorm die renderProductiebonDocument leest.
|
|
5
|
+
// Geen voorbeeldwaarden: wat ontbreekt blijft leeg en de regel valt weg.
|
|
6
|
+
// ============================================================================
|
|
7
|
+
const TZ = "Europe/Amsterdam";
|
|
8
|
+
const MAANDEN = ["jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"];
|
|
9
|
+
const tekst = (v) => (v === null || v === undefined ? "" : String(v).trim());
|
|
10
|
+
function getal(v) {
|
|
11
|
+
if (v === null || v === undefined || v === "")
|
|
12
|
+
return null;
|
|
13
|
+
const n = typeof v === "number" ? v : Number(String(v).replace(",", "."));
|
|
14
|
+
return Number.isFinite(n) ? n : null;
|
|
15
|
+
}
|
|
16
|
+
/** Nederlands getal zonder onnodige decimalen: 2 → "2", 1.5 → "1,5". */
|
|
17
|
+
export function nlAantal(n) {
|
|
18
|
+
if (n === null)
|
|
19
|
+
return "";
|
|
20
|
+
return new Intl.NumberFormat("nl-NL", { maximumFractionDigits: 3, useGrouping: true }).format(n);
|
|
21
|
+
}
|
|
22
|
+
/** 05-nov 14:05 (ander jaar: 05-nov-2025 14:05), in Europe/Amsterdam. */
|
|
23
|
+
export function nlDatumTijd(iso, nu = new Date()) {
|
|
24
|
+
if (!iso)
|
|
25
|
+
return "";
|
|
26
|
+
const d = new Date(iso);
|
|
27
|
+
if (Number.isNaN(d.getTime()))
|
|
28
|
+
return "";
|
|
29
|
+
const delen = (x) => {
|
|
30
|
+
const p = new Intl.DateTimeFormat("nl-NL", {
|
|
31
|
+
timeZone: TZ, year: "numeric", month: "numeric", day: "2-digit", hour: "2-digit", minute: "2-digit", hour12: false,
|
|
32
|
+
}).formatToParts(x);
|
|
33
|
+
const g = (t) => p.find((q) => q.type === t)?.value ?? "";
|
|
34
|
+
return { j: g("year"), m: Number(g("month")), d: g("day"), u: g("hour"), min: g("minute") };
|
|
35
|
+
};
|
|
36
|
+
const a = delen(d);
|
|
37
|
+
const b = delen(nu);
|
|
38
|
+
const datum = `${a.d}-${MAANDEN[a.m - 1]}${a.j !== b.j ? `-${a.j}` : ""}`;
|
|
39
|
+
return `${datum} ${a.u}:${a.min}`;
|
|
40
|
+
}
|
|
41
|
+
function zoekProduct(producten, productId, sleutel) {
|
|
42
|
+
if (productId) {
|
|
43
|
+
const p = producten.find((x) => x.id === productId);
|
|
44
|
+
if (p)
|
|
45
|
+
return p;
|
|
46
|
+
}
|
|
47
|
+
if (sleutel) {
|
|
48
|
+
const p = producten.find((x) => x.trade_item_key === sleutel);
|
|
49
|
+
if (p)
|
|
50
|
+
return p;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
/** Bouwt de productiebon-gegevens (product + onderdelen) uit echte rijen. */
|
|
55
|
+
export function bouwProductiebonGegevens(invoer) {
|
|
56
|
+
const { order } = invoer;
|
|
57
|
+
const producten = Array.isArray(invoer.producten) ? invoer.producten : [];
|
|
58
|
+
const onderdelen = Array.isArray(invoer.onderdelen) ? invoer.onderdelen : [];
|
|
59
|
+
const nu = invoer.nu ?? new Date();
|
|
60
|
+
const hoofd = zoekProduct(producten, order.product_id, order.trade_item_key);
|
|
61
|
+
const aantal = getal(order.aantal);
|
|
62
|
+
const nummer = tekst(order.nummer);
|
|
63
|
+
return {
|
|
64
|
+
echt: true,
|
|
65
|
+
product: {
|
|
66
|
+
productieordernummer: nummer,
|
|
67
|
+
barcode: nummer,
|
|
68
|
+
artikelnaam: tekst(hoofd?.product),
|
|
69
|
+
artikelnummer: tekst(hoofd?.article_number),
|
|
70
|
+
productfoto_groot: tekst(hoofd?.image_url),
|
|
71
|
+
aantal: nlAantal(aantal),
|
|
72
|
+
opmerking: tekst(order.opmerking),
|
|
73
|
+
aangemaakt_door: tekst(invoer.aangemaaktDoorNaam),
|
|
74
|
+
aangemaakt_op: nlDatumTijd(order.aangemaakt_op, nu),
|
|
75
|
+
printdatum: nlDatumTijd(invoer.printMoment, nu),
|
|
76
|
+
},
|
|
77
|
+
onderdelen: onderdelen.map((o) => {
|
|
78
|
+
const p = zoekProduct(producten, o.product_id, o.trade_item_key);
|
|
79
|
+
const perStuk = getal(o.aantal);
|
|
80
|
+
const totaal = perStuk !== null && aantal !== null ? Math.round(perStuk * aantal * 1000) / 1000 : null;
|
|
81
|
+
return {
|
|
82
|
+
soort: "onderdeel",
|
|
83
|
+
artikelnaam: tekst(o.naam) || tekst(p?.product),
|
|
84
|
+
artikelnummer: tekst(p?.article_number),
|
|
85
|
+
foto: tekst(p?.image_url),
|
|
86
|
+
per_stuk: nlAantal(perStuk),
|
|
87
|
+
aantal: nlAantal(perStuk),
|
|
88
|
+
totaal: nlAantal(totaal),
|
|
89
|
+
};
|
|
90
|
+
}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
+
type Db = SupabaseClient<any, any, any>;
|
|
3
|
+
export declare class ProductieorderOntbreektFout extends Error {
|
|
4
|
+
}
|
|
5
|
+
export declare function laadProductiebonGegevens(db: Db, productieOrderId: string, printMoment: string): Promise<{
|
|
6
|
+
product: {
|
|
7
|
+
[x: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
onderdelen: {
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
}[];
|
|
12
|
+
echt: true;
|
|
13
|
+
}>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=productiebonData.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productiebonData.server.d.ts","sourceRoot":"","sources":["../../src/lib/productiebonData.server.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,KAAK,EAAE,GAAG,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAExC,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD,wBAAsB,wBAAwB,CAAC,EAAE,EAAE,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;;;;;;;;GA0CnG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/productiebonData.server.ts — laadt een productieorder (Voorraad)
|
|
3
|
+
// voor de printwachtrij. Alleen lezen. Ontbreekt de order: fout, nooit
|
|
4
|
+
// voorbeeldgegevens.
|
|
5
|
+
// ============================================================================
|
|
6
|
+
import { bouwProductiebonGegevens } from "./productiebonData.js";
|
|
7
|
+
export class ProductieorderOntbreektFout extends Error {
|
|
8
|
+
}
|
|
9
|
+
export async function laadProductiebonGegevens(db, productieOrderId, printMoment) {
|
|
10
|
+
const { data: order, error } = await db
|
|
11
|
+
.from("productie_orders")
|
|
12
|
+
.select("id, nummer, product_id, trade_item_key, aantal, opmerking, aangemaakt_door, aangemaakt_op")
|
|
13
|
+
.eq("id", productieOrderId)
|
|
14
|
+
.maybeSingle();
|
|
15
|
+
if (error)
|
|
16
|
+
throw new Error(`Productieorder lezen mislukt: ${error.message}`);
|
|
17
|
+
if (!order)
|
|
18
|
+
throw new ProductieorderOntbreektFout("Deze productieorder bestaat niet (meer).");
|
|
19
|
+
const { data: ond, error: ondFout } = await db
|
|
20
|
+
.from("productie_order_onderdelen")
|
|
21
|
+
.select("product_id, trade_item_key, naam, aantal, created_at")
|
|
22
|
+
.eq("productie_order_id", productieOrderId)
|
|
23
|
+
.order("created_at", { ascending: true });
|
|
24
|
+
if (ondFout)
|
|
25
|
+
throw new Error(`Onderdelen lezen mislukt: ${ondFout.message}`);
|
|
26
|
+
const onderdelen = (Array.isArray(ond) ? ond : []);
|
|
27
|
+
const o = order;
|
|
28
|
+
const ids = [o.product_id, ...onderdelen.map((x) => x.product_id)].filter((x) => !!x);
|
|
29
|
+
const sleutels = [o.trade_item_key, ...onderdelen.map((x) => x.trade_item_key)].filter((x) => !!x);
|
|
30
|
+
const producten = [];
|
|
31
|
+
if (ids.length) {
|
|
32
|
+
const { data, error: e } = await db.from("products").select("id, product, article_number, image_url, trade_item_key").in("id", [...new Set(ids)]);
|
|
33
|
+
if (e)
|
|
34
|
+
throw new Error(`Artikelen lezen mislukt: ${e.message}`);
|
|
35
|
+
producten.push(...(Array.isArray(data) ? data : []));
|
|
36
|
+
}
|
|
37
|
+
const ontbrekend = [...new Set(sleutels)].filter((s) => !producten.some((p) => p.trade_item_key === s));
|
|
38
|
+
if (ontbrekend.length) {
|
|
39
|
+
const { data, error: e } = await db.from("products").select("id, product, article_number, image_url, trade_item_key").in("trade_item_key", ontbrekend);
|
|
40
|
+
if (e)
|
|
41
|
+
throw new Error(`Artikelen lezen mislukt: ${e.message}`);
|
|
42
|
+
producten.push(...(Array.isArray(data) ? data : []));
|
|
43
|
+
}
|
|
44
|
+
let naam = null;
|
|
45
|
+
if (o.aangemaakt_door) {
|
|
46
|
+
const { data: prof, error: pe } = await db.from("profiles").select("display_name, email").eq("id", o.aangemaakt_door).maybeSingle();
|
|
47
|
+
if (pe)
|
|
48
|
+
console.error("[productiebon] naam aanmaker lezen mislukt", pe.message);
|
|
49
|
+
const p = prof;
|
|
50
|
+
naam = p?.display_name || p?.email || null;
|
|
51
|
+
}
|
|
52
|
+
return bouwProductiebonGegevens({ order: o, onderdelen, producten, aangemaaktDoorNaam: naam, printMoment });
|
|
53
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productiebonHtml.d.ts","sourceRoot":"","sources":["../../src/lib/productiebonHtml.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"productiebonHtml.d.ts","sourceRoot":"","sources":["../../src/lib/productiebonHtml.ts"],"names":[],"mappings":"AA8BA,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAI/B,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,CA6BxD;AAED,gEAAgE;AAChE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAG9D;AA6ID,yDAAyD;AACzD,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,OAAO,EACjB,MAAM,GAAE,wBAA6B,GACpC,MAAM,CAsCR"}
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
// ============================================================================
|
|
8
8
|
import { DEMO_PRODUCTIEBON, ONDERDEEL_LABELS, FUST_LABELS, BELADING_LABELS, EXTRA_LABELS, leesProductiebonConfig, pbBlokZichtbaar, pbConditieContext, splitsLijst, vulPbVeldcodes, } from "./productiebonBuilder.js";
|
|
9
9
|
import { esc } from "./pakbonHtml.js";
|
|
10
|
+
import { code128BarsHtml } from "./code128.js";
|
|
11
|
+
/** Code128-barcode met leesbare tekst eronder (zelfde opbouw als de pakbon). */
|
|
12
|
+
function barcodeHtml(waarde) {
|
|
13
|
+
return `<div class="barcode" style="margin:1mm 0"><div class="barcode-bars" data-barcode="${esc(waarde)}" style="height:12mm;width:60mm;max-width:100%;display:flex;background:#fff;margin:0 auto">${code128BarsHtml(waarde)}</div><div style="text-align:center;font-size:8pt">${esc(waarde)}</div></div>`;
|
|
14
|
+
}
|
|
10
15
|
const arr = (v) => (Array.isArray(v) ? v : []);
|
|
11
16
|
/**
|
|
12
17
|
* Vult ontbrekende onderdelen aan, zodat een module die maar een deel van de
|
|
@@ -14,6 +19,19 @@ const arr = (v) => (Array.isArray(v) ? v : []);
|
|
|
14
19
|
*/
|
|
15
20
|
export function maakProductiebonData(input) {
|
|
16
21
|
const bron = (input && typeof input === "object" ? input : {});
|
|
22
|
+
// 1.69.42: echte productieorder → nooit aanvullen met voorbeeldwaarden.
|
|
23
|
+
if (bron["echt"] === true) {
|
|
24
|
+
const obj = (k) => (bron[k] && typeof bron[k] === "object" ? bron[k] : {});
|
|
25
|
+
return {
|
|
26
|
+
echt: true,
|
|
27
|
+
product: obj("product"),
|
|
28
|
+
fust: obj("fust"),
|
|
29
|
+
belading: obj("belading"),
|
|
30
|
+
instructies: obj("instructies"),
|
|
31
|
+
extra: obj("extra"),
|
|
32
|
+
onderdelen: arr(bron["onderdelen"]),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
17
35
|
const demo = DEMO_PRODUCTIEBON;
|
|
18
36
|
const samen = (naam) => ({
|
|
19
37
|
...demo[naam],
|
|
@@ -66,9 +84,27 @@ function blokHtml(b, data) {
|
|
|
66
84
|
const product = (data["product"] ?? {});
|
|
67
85
|
switch (b.type) {
|
|
68
86
|
case "productinfo": {
|
|
87
|
+
const echt = data["echt"] === true;
|
|
69
88
|
const velden = arr(b.velden).filter((v) => v["tonen"]);
|
|
70
89
|
const regels = velden.length
|
|
71
|
-
? velden
|
|
90
|
+
? velden
|
|
91
|
+
.map((v) => {
|
|
92
|
+
const key = String(v["key"]);
|
|
93
|
+
const w = product[key];
|
|
94
|
+
const leeg = w === undefined || w === null || String(w).trim() === "";
|
|
95
|
+
// Oude opdrachten (zonder productieorder) blijven exact gelijk.
|
|
96
|
+
if (echt && key === "barcode")
|
|
97
|
+
return leeg ? "" : barcodeHtml(String(w));
|
|
98
|
+
if (echt && (key === "productfoto_groot" || key === "productfotos")) {
|
|
99
|
+
return !leeg && /^https:\/\//i.test(String(w))
|
|
100
|
+
? `<div class="foto"><img src="${esc(String(w))}" alt="" style="max-width:100%;max-height:45mm;object-fit:contain" /></div>`
|
|
101
|
+
: "";
|
|
102
|
+
}
|
|
103
|
+
if (echt && leeg)
|
|
104
|
+
return "";
|
|
105
|
+
return kv(String(v["label"] ?? key), w);
|
|
106
|
+
})
|
|
107
|
+
.join("")
|
|
72
108
|
: Object.entries(product)
|
|
73
109
|
.slice(0, 10)
|
|
74
110
|
.map(([k, v]) => kv(k, v))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standaardLayouts.server.d.ts","sourceRoot":"","sources":["../../src/lib/standaardLayouts.server.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uB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BAAiB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC,CAmBrG;AAED,kDAAkD;AAClD,wBAAsB,8BAA8B,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5E;AAED,wBAAsB,iCAAiC,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC,CAgBrH;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAExE;AAED;;;;GAIG;AACH,wBAAsB,2BAA2B,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAK1E"}
|
|
@@ -59,7 +59,17 @@ export async function zorgVoorStandaardLayoutsMetStatus(db) {
|
|
|
59
59
|
const { data, error: rpcFout } = await db.rpc("layout_zorg_systeemlayouts");
|
|
60
60
|
if (rpcFout)
|
|
61
61
|
throw new Error(`Standaardlayouts controleren mislukt: ${rpcFout.message}`);
|
|
62
|
-
|
|
62
|
+
let aantal = Number(data ?? 0) || 0;
|
|
63
|
+
// 1.69.42: productiebon voor de labelprinter (100×150), naast de A4-standaard.
|
|
64
|
+
const { data: label, error: labelFout } = await db.rpc("layouts_zorg_voor_productiebon_label");
|
|
65
|
+
if (labelFout) {
|
|
66
|
+
if (!isSchemaOntbreekt(labelFout))
|
|
67
|
+
throw new Error(`Productiebon-label aanmaken mislukt: ${labelFout.message}`);
|
|
68
|
+
console.error("[layouts] layouts_zorg_voor_productiebon_label ontbreekt; schema-update nodig");
|
|
69
|
+
}
|
|
70
|
+
else if (label?.aangemaakt) {
|
|
71
|
+
aantal += 1;
|
|
72
|
+
}
|
|
63
73
|
return { aantal, schemaOntbreekt: false };
|
|
64
74
|
}
|
|
65
75
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standaardenBron.d.ts","sourceRoot":"","sources":["../../src/lib/standaardenBron.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,gBAAgB,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"standaardenBron.d.ts","sourceRoot":"","sources":["../../src/lib/standaardenBron.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAg+B3C,CAAC;AAMF,8GAA8G;AAC9G,wBAAgB,cAAc,IAAI,MAAM,CAevC"}
|