@flowselections/floriday-afhandeling-module 1.0.48 → 1.0.52
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/components/afhandeling/AutoProcessStatus.d.ts.map +1 -1
- package/dist-lib/components/afhandeling/AutoProcessStatus.js +4 -1
- package/dist-lib/components/afhandeling/DagDetailDialog.d.ts.map +1 -1
- package/dist-lib/components/afhandeling/DagDetailDialog.js +173 -39
- package/dist-lib/components/afhandeling/NuVersturenButton.d.ts +5 -0
- package/dist-lib/components/afhandeling/NuVersturenButton.d.ts.map +1 -0
- package/dist-lib/components/afhandeling/NuVersturenButton.js +56 -0
- package/dist-lib/hooks/useOrderBuffers.d.ts +6 -0
- package/dist-lib/hooks/useOrderBuffers.d.ts.map +1 -1
- package/dist-lib/hooks/useOrderBuffers.js +21 -0
- package/dist-lib/index.d.ts +0 -2
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +0 -2
- package/dist-lib/integrations/supabase/moduleClient.d.ts +4 -31315
- package/dist-lib/integrations/supabase/moduleClient.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +3553 -87
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/afhandelingSettings.functions.d.ts.map +1 -1
- package/dist-lib/lib/afhandelingSettings.functions.js +2 -1
- package/dist-lib/lib/authGateway.server.d.ts +2 -0
- package/dist-lib/lib/authGateway.server.d.ts.map +1 -1
- package/dist-lib/lib/authGateway.server.js +2 -2
- package/dist-lib/lib/cartAssignments.functions.d.ts +39 -3
- package/dist-lib/lib/cartAssignments.functions.d.ts.map +1 -1
- package/dist-lib/lib/cartAssignments.functions.js +91 -33
- package/dist-lib/lib/floridayAutoProcess.d.ts +1 -1
- package/dist-lib/lib/floridayAutoProcess.d.ts.map +1 -1
- package/dist-lib/lib/floridayFulfillmentSend.server.d.ts +31 -0
- package/dist-lib/lib/floridayFulfillmentSend.server.d.ts.map +1 -0
- package/dist-lib/lib/floridayFulfillmentSend.server.js +83 -0
- package/dist-lib/lib/floridayLoading.functions.d.ts +93 -0
- package/dist-lib/lib/floridayLoading.functions.d.ts.map +1 -0
- package/dist-lib/lib/floridayLoading.functions.js +339 -0
- package/dist-lib/lib/orderFulfilment.functions.d.ts.map +1 -1
- package/dist-lib/lib/orderFulfilment.functions.js +17 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afhandelingSettings.functions.d.ts","sourceRoot":"","sources":["../../src/lib/afhandelingSettings.functions.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,uBAAuB,EAAE,MAAM,CAAC;IAChC,2BAA2B,EAAE,MAAM,CAAC;IACpC,uBAAuB,EAAE,OAAO,CAAC;IACjC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iEAAiE;IACjE,yBAAyB,EAAE,MAAM,CAAC;IAClC,iGAAiG;IACjG,iBAAiB,EAAE,OAAO,CAAC;IAC3B,8EAA8E;IAC9E,qBAAqB,EAAE,OAAO,CAAC;CAChC;
|
|
1
|
+
{"version":3,"file":"afhandelingSettings.functions.d.ts","sourceRoot":"","sources":["../../src/lib/afhandelingSettings.functions.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,uBAAuB,EAAE,MAAM,CAAC;IAChC,2BAA2B,EAAE,MAAM,CAAC;IACpC,uBAAuB,EAAE,OAAO,CAAC;IACjC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iEAAiE;IACjE,yBAAyB,EAAE,MAAM,CAAC;IAClC,iGAAiG;IACjG,iBAAiB,EAAE,OAAO,CAAC;IAC3B,8EAA8E;IAC9E,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAgCD,eAAO,MAAM,sBAAsB;;;;8EAmC/B,CAAC;AAEL,eAAO,MAAM,yBAAyB;;;;6CAEb;IACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;;;;;;;;;;;;gCAqGC,CAAC"}
|
|
@@ -10,7 +10,8 @@ const DEFAULTS = {
|
|
|
10
10
|
signupMailPurpose: "afhandeling_carrier_signup",
|
|
11
11
|
pickWeekdays: [1, 2, 3, 4, 5],
|
|
12
12
|
extraPickDaysWithStickers: 0,
|
|
13
|
-
|
|
13
|
+
// Een geaccepteerde Floriday-opdracht is niet terug te draaien: standaard uit.
|
|
14
|
+
autoProcessPaused: true,
|
|
14
15
|
autoPrintDeliveryNote: false,
|
|
15
16
|
};
|
|
16
17
|
const SELECT_COLS = "pick_days_before_transport, transport_register_days_before, pick_distribution_enabled, max_workdays_earlier_pick, signup_mail_enabled, signup_mail_lead_minutes, signup_mail_purpose, pick_weekdays, extra_pick_days_with_stickers, auto_process_paused, auto_print_delivery_note";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export declare function getFloridayEnvironment(): Promise<string>;
|
|
1
2
|
/** Batch-variant — geeft per sales-order-id een set delivery-order-ids terug. */
|
|
2
3
|
export declare function resolveDeliveryOrdersBatch(salesOrderIds: string[]): Promise<Map<string, string[]>>;
|
|
4
|
+
export declare function signBody(secret: string, timestamp: string, body: string): Promise<string>;
|
|
3
5
|
/**
|
|
4
6
|
* Haalt de Floriday-afleverbrief PDF op voor een sales-order via de
|
|
5
7
|
* Authenticatie-module gateway. Retourneert null wanneer:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authGateway.server.d.ts","sourceRoot":"","sources":["../../src/lib/authGateway.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authGateway.server.d.ts","sourceRoot":"","sources":["../../src/lib/authGateway.server.ts"],"names":[],"mappings":"AA6BA,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,CAqB9D;AA2BD,iFAAiF;AACjF,wBAAsB,0BAA0B,CAC9C,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CA6BhC;AAED,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgB/F;AA4BD;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAyElD"}
|
|
@@ -23,7 +23,7 @@ function getSupabase() {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
let cachedEnvironment = null;
|
|
26
|
-
async function getFloridayEnvironment() {
|
|
26
|
+
export async function getFloridayEnvironment() {
|
|
27
27
|
if (cachedEnvironment)
|
|
28
28
|
return cachedEnvironment;
|
|
29
29
|
try {
|
|
@@ -96,7 +96,7 @@ export async function resolveDeliveryOrdersBatch(salesOrderIds) {
|
|
|
96
96
|
}
|
|
97
97
|
return out;
|
|
98
98
|
}
|
|
99
|
-
async function signBody(secret, timestamp, body) {
|
|
99
|
+
export async function signBody(secret, timestamp, body) {
|
|
100
100
|
const key = await globalThis.crypto.subtle.importKey("raw", new TextEncoder().encode(secret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
101
101
|
const sig = await globalThis.crypto.subtle.sign("HMAC", key, new TextEncoder().encode(`${timestamp}.${body}`));
|
|
102
102
|
return Array.from(new Uint8Array(sig))
|
|
@@ -82,10 +82,30 @@ export interface DayCartContent {
|
|
|
82
82
|
maxLayers: number | null;
|
|
83
83
|
occupancy: number | null;
|
|
84
84
|
layerUtilization: number | null;
|
|
85
|
-
crates: number;
|
|
86
|
-
|
|
85
|
+
crates: number | null;
|
|
86
|
+
/** Planten worden niet door de Engine-dekking geleverd; null = onbekend. */
|
|
87
|
+
plants: number | null;
|
|
88
|
+
/** Gedeelde bufferkar: alleen de regels van déze order tellen mee. */
|
|
89
|
+
shared: boolean;
|
|
90
|
+
}
|
|
91
|
+
export type CoverageState = "ingedeeld" | "deels" | "geen_indeling" | "geen_regels";
|
|
92
|
+
export type CoveragePickStatus = "geen_pickrij" | "open" | "bezig" | "gepickt";
|
|
93
|
+
export interface DayOrderCoverage {
|
|
94
|
+
orderRef: string;
|
|
95
|
+
state: CoverageState | null;
|
|
96
|
+
label: string | null;
|
|
97
|
+
pickStatus: CoveragePickStatus | null;
|
|
98
|
+
pickedAt: string | null;
|
|
99
|
+
/** Alle karren goedgekeurd op de Scan-controle (logistics_control_scan.approved_at). */
|
|
100
|
+
approvedAll: boolean;
|
|
101
|
+
/** Floriday heeft de belading geaccepteerd (created / already_fulfilled). */
|
|
102
|
+
floridaySent: boolean;
|
|
87
103
|
}
|
|
88
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Karindeling per order via de Engine-leesfunctie `logistics_order_plan_coverage`.
|
|
106
|
+
* Ook karren op een gedeelde bufferkar tellen mee; per kar alleen de regels van deze order.
|
|
107
|
+
* Deze module leest order_carts / order_cart_items niet zelf.
|
|
108
|
+
*/
|
|
89
109
|
export declare const getDayCartContents: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
90
110
|
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
91
111
|
userId: string;
|
|
@@ -96,5 +116,21 @@ export declare const getDayCartContents: import("@tanstack/start-client-core").R
|
|
|
96
116
|
orderRefs: string[];
|
|
97
117
|
}, Promise<{
|
|
98
118
|
carts: DayCartContent[];
|
|
119
|
+
orders: DayOrderCoverage[];
|
|
120
|
+
}>>;
|
|
121
|
+
/** Echte Engine-karren van één order (voor pakbonnen per kar). */
|
|
122
|
+
export declare const getOrderCartIds: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
123
|
+
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
124
|
+
userId: string;
|
|
125
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
126
|
+
}, undefined, undefined, undefined>], (d: {
|
|
127
|
+
orderId: string;
|
|
128
|
+
}) => {
|
|
129
|
+
orderId: string;
|
|
130
|
+
}, Promise<{
|
|
131
|
+
carts: {
|
|
132
|
+
cartId: string;
|
|
133
|
+
cartNumber: number;
|
|
134
|
+
}[];
|
|
99
135
|
}>>;
|
|
100
136
|
//# sourceMappingURL=cartAssignments.functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cartAssignments.functions.d.ts","sourceRoot":"","sources":["../../src/lib/cartAssignments.functions.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,gBAAgB,GAAG,Q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Ac,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACtC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,wFAAwF;IACxF,WAAW,EAAE,OAAO,CAAC;IACrB,6EAA6E;IAC7E,YAAY,EAAE,OAAO,CAAC;CACvB;AAKD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;0CAET;IAAE,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE;;;WAMI,cAAc,EAAE;YAAgB,gBAAgB,EAAE;GAqF/F,CAAC;AAGL,kEAAkE;AAClE,eAAO,MAAM,eAAe;;;;0CAEN;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE;;;WACc;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE;GAQ3F,CAAC"}
|
|
@@ -128,7 +128,13 @@ export const getOrderLines = createServerFn({ method: "GET" })
|
|
|
128
128
|
}
|
|
129
129
|
return { lines };
|
|
130
130
|
});
|
|
131
|
-
|
|
131
|
+
const num = (v) => (v == null || v === "" || !Number.isFinite(Number(v)) ? null : Number(v));
|
|
132
|
+
const arr = (v) => (Array.isArray(v) ? v : []);
|
|
133
|
+
/**
|
|
134
|
+
* Karindeling per order via de Engine-leesfunctie `logistics_order_plan_coverage`.
|
|
135
|
+
* Ook karren op een gedeelde bufferkar tellen mee; per kar alleen de regels van deze order.
|
|
136
|
+
* Deze module leest order_carts / order_cart_items niet zelf.
|
|
137
|
+
*/
|
|
132
138
|
export const getDayCartContents = createServerFn({ method: "POST" })
|
|
133
139
|
.middleware([requireSupabaseAuth])
|
|
134
140
|
.inputValidator((d) => ({
|
|
@@ -138,7 +144,7 @@ export const getDayCartContents = createServerFn({ method: "POST" })
|
|
|
138
144
|
const supabase = context.supabase;
|
|
139
145
|
const refs = data.orderRefs;
|
|
140
146
|
if (refs.length === 0)
|
|
141
|
-
return { carts: [] };
|
|
147
|
+
return { carts: [], orders: [] };
|
|
142
148
|
const uuidRe = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
143
149
|
const orderRefById = new Map();
|
|
144
150
|
const chunk = (a, n) => Array.from({ length: Math.ceil(a.length / n) }, (_, i) => a.slice(i * n, i * n + n));
|
|
@@ -157,43 +163,95 @@ export const getDayCartContents = createServerFn({ method: "POST" })
|
|
|
157
163
|
orderRefById.set(r.id, ref);
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
for (const part of chunk(
|
|
166
|
+
const carts = [];
|
|
167
|
+
const orders = [];
|
|
168
|
+
const cartIdsByRef = new Map();
|
|
169
|
+
for (const part of chunk([...orderRefById.keys()], 6)) {
|
|
164
170
|
await Promise.all(part.map(async (oid) => {
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
171
|
+
const orderRef = orderRefById.get(oid);
|
|
172
|
+
const [cov, slip] = await Promise.all([
|
|
173
|
+
supabase.rpc("logistics_order_plan_coverage", { p_order_id: oid }),
|
|
174
|
+
supabase.rpc("logistics_cart_slip_plan", { p_order_id: oid }),
|
|
175
|
+
]);
|
|
176
|
+
if (cov.error)
|
|
177
|
+
throw new Error(cov.error.message);
|
|
178
|
+
const c = (cov.data ?? {});
|
|
179
|
+
orders.push({
|
|
180
|
+
orderRef,
|
|
181
|
+
state: c.state ?? null,
|
|
182
|
+
label: typeof c.label === "string" ? c.label : null,
|
|
183
|
+
pickStatus: c.pickStatus ?? null,
|
|
184
|
+
pickedAt: typeof c.pickedAt === "string" ? c.pickedAt : null,
|
|
185
|
+
approvedAll: false,
|
|
186
|
+
floridaySent: false,
|
|
187
|
+
});
|
|
188
|
+
cartIdsByRef.set(orderRef, arr(c.carts).map((k) => k?.cartId).filter((x) => typeof x === "string"));
|
|
189
|
+
// Lagen/bezetting alleen als de Engine ze in het karbriefplan levert; anders onbekend.
|
|
190
|
+
const slipByCart = new Map();
|
|
191
|
+
if (!slip.error)
|
|
192
|
+
for (const s of arr(slip.data?.carts))
|
|
193
|
+
if (s?.cartId)
|
|
194
|
+
slipByCart.set(String(s.cartId), s);
|
|
195
|
+
arr(c.carts).forEach((k, idx) => {
|
|
196
|
+
const s = slipByCart.get(String(k?.cartId ?? "")) ?? {};
|
|
197
|
+
const lines = arr(k?.lines);
|
|
198
|
+
carts.push({
|
|
199
|
+
orderRef,
|
|
200
|
+
cartNumber: num(k?.cartNumber) ?? idx + 1,
|
|
201
|
+
layersUsed: num(s.layersUsed ?? s.totalLayersUsed),
|
|
202
|
+
maxLayers: num(s.maxLayers),
|
|
203
|
+
occupancy: num(s.occupancyPct) != null ? Math.round(num(s.occupancyPct)) : null,
|
|
204
|
+
layerUtilization: num(s.layerUtilizationPct),
|
|
205
|
+
crates: lines.length ? lines.reduce((t, l) => t + (num(l?.crates) ?? 0), 0) : null,
|
|
206
|
+
plants: null,
|
|
207
|
+
shared: k?.shared === true,
|
|
208
|
+
});
|
|
209
|
+
});
|
|
173
210
|
}));
|
|
174
211
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
.in("
|
|
212
|
+
// Scanstatus en Floriday-acceptatie per order.
|
|
213
|
+
const allCarts = [...new Set([...cartIdsByRef.values()].flat())];
|
|
214
|
+
const approved = new Set();
|
|
215
|
+
for (const part of chunk(allCarts, 300)) {
|
|
216
|
+
const { data: sc, error } = await supabase
|
|
217
|
+
.from("logistics_control_scan").select("cart_id").in("cart_id", part).not("approved_at", "is", null);
|
|
181
218
|
if (error)
|
|
182
219
|
throw new Error(error.message);
|
|
183
|
-
for (const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
220
|
+
for (const r of sc ?? [])
|
|
221
|
+
approved.add(r.cart_id);
|
|
222
|
+
}
|
|
223
|
+
const sentRefs = new Set();
|
|
224
|
+
const allRefs = orders.map((o) => o.orderRef);
|
|
225
|
+
for (const part of chunk(allRefs, 200)) {
|
|
226
|
+
const { data: at, error } = await supabase
|
|
227
|
+
.from("floriday_loading_attempts").select("order_refs")
|
|
228
|
+
.overlaps("order_refs", part).in("code", ["created", "already_fulfilled"]);
|
|
229
|
+
if (error)
|
|
230
|
+
throw new Error(error.message);
|
|
231
|
+
for (const a of at ?? [])
|
|
232
|
+
for (const r of arr(a.order_refs))
|
|
233
|
+
sentRefs.add(String(r));
|
|
234
|
+
}
|
|
235
|
+
for (const o of orders) {
|
|
236
|
+
const ids = cartIdsByRef.get(o.orderRef) ?? [];
|
|
237
|
+
o.approvedAll = ids.length > 0 && ids.every((id) => approved.has(id));
|
|
238
|
+
o.floridaySent = sentRefs.has(o.orderRef);
|
|
196
239
|
}
|
|
197
240
|
carts.sort((a, b) => a.orderRef.localeCompare(b.orderRef) || a.cartNumber - b.cartNumber);
|
|
241
|
+
return { carts, orders };
|
|
242
|
+
});
|
|
243
|
+
/** Echte Engine-karren van één order (voor pakbonnen per kar). */
|
|
244
|
+
export const getOrderCartIds = createServerFn({ method: "POST" })
|
|
245
|
+
.middleware([requireSupabaseAuth])
|
|
246
|
+
.inputValidator((d) => ({ orderId: String(d?.orderId ?? "").trim() }))
|
|
247
|
+
.handler(async ({ data, context }) => {
|
|
248
|
+
if (!data.orderId)
|
|
249
|
+
throw new Error("Geen order opgegeven.");
|
|
250
|
+
const { data: cov, error } = await context.supabase.rpc("logistics_order_plan_coverage", { p_order_id: data.orderId });
|
|
251
|
+
if (error)
|
|
252
|
+
throw new Error(error.message);
|
|
253
|
+
const carts = arr(cov?.carts)
|
|
254
|
+
.map((k, i) => ({ cartId: typeof k?.cartId === "string" ? k.cartId : "", cartNumber: num(k?.cartNumber) ?? i + 1 }))
|
|
255
|
+
.filter((k) => k.cartId);
|
|
198
256
|
return { carts };
|
|
199
257
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type AutoProcessStep = "waiting" | "waiting_for_commit" | "waiting_for_delivery_order" | "ready_to_fulfill" | "acknowledging" | "creating_delivery_order" | "sending_fulfillment" | "generating_delivery_note" | "done" | "error";
|
|
1
|
+
export type AutoProcessStep = "waiting" | "waiting_for_commit" | "waiting_for_delivery_order" | "ready_to_fulfill" | "waiting_for_afhandeling" | "acknowledging" | "creating_delivery_order" | "sending_fulfillment" | "generating_delivery_note" | "done" | "error";
|
|
2
2
|
export interface AutoProcessStatusRow {
|
|
3
3
|
salesOrderId: string;
|
|
4
4
|
status: AutoProcessStep;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floridayAutoProcess.d.ts","sourceRoot":"","sources":["../../src/lib/floridayAutoProcess.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,oBAAoB,GACpB,4BAA4B,GAC5B,kBAAkB,GAClB,eAAe,GACf,yBAAyB,GACzB,qBAAqB,GACrB,0BAA0B,GAC1B,MAAM,GACN,OAAO,CAAC;AAEZ,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,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AC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AASD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,mBAAmB,CAAC,CAsB9B;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAqC5C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface GatewayResult {
|
|
2
|
+
httpStatus: number;
|
|
3
|
+
body: any;
|
|
4
|
+
}
|
|
5
|
+
export interface FulfillmentRequestStatus {
|
|
6
|
+
fulfillmentRequestId: string;
|
|
7
|
+
deliveryOrderId: string | null;
|
|
8
|
+
fulfillmentOrderIds: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface FulfillmentOrderStatus {
|
|
11
|
+
fulfillmentOrderId: string;
|
|
12
|
+
status: string | null;
|
|
13
|
+
deliveryNoteReady: boolean | null;
|
|
14
|
+
}
|
|
15
|
+
export interface SalesOrderStatus {
|
|
16
|
+
salesOrderId: string;
|
|
17
|
+
found: boolean;
|
|
18
|
+
salesOrderStatus: string | null;
|
|
19
|
+
floridayStage: string | null;
|
|
20
|
+
fulfillmentRequests: FulfillmentRequestStatus[];
|
|
21
|
+
fulfillmentOrders: FulfillmentOrderStatus[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Statusoverzicht (Floriday-authenticatie 1.0.64), in porties van maximaal 100.
|
|
25
|
+
* Exact contract per order: salesOrderId, found, salesOrderStatus, floridayStage,
|
|
26
|
+
* fulfillmentRequests[] { fulfillmentRequestId, deliveryOrderId, fulfillmentOrderIds },
|
|
27
|
+
* fulfillmentOrders[] { fulfillmentOrderId, status, deliveryNoteReady }.
|
|
28
|
+
*/
|
|
29
|
+
export declare function fetchFulfillmentStatus(salesOrderIds: string[], fulfillmentOrderIds?: string[]): Promise<Map<string, SalesOrderStatus>>;
|
|
30
|
+
export declare function sendFulfillmentOrder(payload: Record<string, unknown>): Promise<GatewayResult>;
|
|
31
|
+
//# sourceMappingURL=floridayFulfillmentSend.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floridayFulfillmentSend.server.d.ts","sourceRoot":"","sources":["../../src/lib/floridayFulfillmentSend.server.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,GAAG,CAAC;CACX;AA4BD,MAAM,WAAW,wBAAwB;IACvC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AACD,MAAM,WAAW,sBAAsB;IACrC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iBAAiB,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC;AACD,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mBAAmB,EAAE,wBAAwB,EAAE,CAAC;IAChD,iBAAiB,EAAE,sBAAsB,EAAE,CAAC;CAC7C;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EAAE,EACvB,mBAAmB,GAAE,MAAM,EAAO,GACjC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAwCxC;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAEnG"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Server-only: getekende aanroepen naar Floriday-authenticatie (>= 1.0.64) voor stap 3.
|
|
2
|
+
// - fulfillment-order/status { salesOrderIds } → fulfillmentRequestId + deliveryOrderId per order
|
|
3
|
+
// - fulfillment-order/send { deliveryOrderId, ... } → belading (enige route voor belading)
|
|
4
|
+
// Adres en geheim komen uit de omgeving; ontbreken ze, dan volgt een fout (fail closed).
|
|
5
|
+
import { resolveGatewayBaseServer } from "./gatewayBase.server";
|
|
6
|
+
import { getFloridayGatewaySecret } from "./centralSecrets.server";
|
|
7
|
+
import { signBody } from "./authGateway.server";
|
|
8
|
+
async function signedPost(path, payload) {
|
|
9
|
+
const secret = await getFloridayGatewaySecret(); // throws als het ontbreekt
|
|
10
|
+
const base = await resolveGatewayBaseServer(); // throws als het ontbreekt
|
|
11
|
+
const bodyStr = JSON.stringify(payload);
|
|
12
|
+
const timestamp = new Date().toISOString();
|
|
13
|
+
const signature = await signBody(secret, timestamp, bodyStr);
|
|
14
|
+
const res = await fetch(`${base}/api/public/gateway/${path}`, {
|
|
15
|
+
method: "POST",
|
|
16
|
+
headers: {
|
|
17
|
+
"Content-Type": "application/json",
|
|
18
|
+
"x-floriday-timestamp": timestamp,
|
|
19
|
+
"x-floriday-signature": signature,
|
|
20
|
+
// Zelfde handtekening onder de oudere kopnamen, voor de bestaande gateway-routes.
|
|
21
|
+
"X-Timestamp": timestamp,
|
|
22
|
+
"X-Signature": signature,
|
|
23
|
+
},
|
|
24
|
+
body: bodyStr,
|
|
25
|
+
});
|
|
26
|
+
const ct = res.headers.get("content-type") ?? "";
|
|
27
|
+
const body = ct.includes("application/json") ? await res.json().catch(() => null) : null;
|
|
28
|
+
return { httpStatus: res.status, body };
|
|
29
|
+
}
|
|
30
|
+
const arr = (v) => (Array.isArray(v) ? v : []);
|
|
31
|
+
const str = (v) => (typeof v === "string" && v ? v : null);
|
|
32
|
+
/**
|
|
33
|
+
* Statusoverzicht (Floriday-authenticatie 1.0.64), in porties van maximaal 100.
|
|
34
|
+
* Exact contract per order: salesOrderId, found, salesOrderStatus, floridayStage,
|
|
35
|
+
* fulfillmentRequests[] { fulfillmentRequestId, deliveryOrderId, fulfillmentOrderIds },
|
|
36
|
+
* fulfillmentOrders[] { fulfillmentOrderId, status, deliveryNoteReady }.
|
|
37
|
+
*/
|
|
38
|
+
export async function fetchFulfillmentStatus(salesOrderIds, fulfillmentOrderIds = []) {
|
|
39
|
+
const out = new Map();
|
|
40
|
+
const ids = [...new Set(salesOrderIds.filter(Boolean))];
|
|
41
|
+
const foIds = [...new Set(fulfillmentOrderIds.filter(Boolean))];
|
|
42
|
+
for (let i = 0; i < ids.length; i += 100) {
|
|
43
|
+
// Vaste kenmerken van Afhandeling meesturen: oudere gateway-versies weigeren het
|
|
44
|
+
// statusoverzicht zonder fulfillmentOrderId (HTTP 400).
|
|
45
|
+
const r = await signedPost("fulfillment-order/status", {
|
|
46
|
+
salesOrderIds: ids.slice(i, i + 100),
|
|
47
|
+
...(foIds.length ? { fulfillmentOrderIds: foIds, fulfillmentOrderId: foIds[0] } : {}),
|
|
48
|
+
});
|
|
49
|
+
if (r.httpStatus >= 400 || !r.body) {
|
|
50
|
+
const detail = [r.body?.code, r.body?.message, ...arr(r.body?.errors).map((e) => (typeof e === "string" ? e : e?.message))]
|
|
51
|
+
.filter((x) => typeof x === "string" && x).join(" — ");
|
|
52
|
+
throw new Error(`Statusoverzicht van Floriday-authenticatie mislukt (HTTP ${r.httpStatus}${detail ? `: ${detail}` : ""}).`);
|
|
53
|
+
}
|
|
54
|
+
const rows = Array.isArray(r.body) ? r.body : r.body.orders;
|
|
55
|
+
if (!Array.isArray(rows))
|
|
56
|
+
throw new Error("Statusoverzicht heeft geen lijst met orders.");
|
|
57
|
+
for (const row of rows) {
|
|
58
|
+
const so = str(row?.salesOrderId);
|
|
59
|
+
if (!so)
|
|
60
|
+
continue;
|
|
61
|
+
out.set(so, {
|
|
62
|
+
salesOrderId: so,
|
|
63
|
+
found: row.found === true,
|
|
64
|
+
salesOrderStatus: str(row.salesOrderStatus),
|
|
65
|
+
floridayStage: str(row.floridayStage),
|
|
66
|
+
fulfillmentRequests: arr(row.fulfillmentRequests).map((x) => ({
|
|
67
|
+
fulfillmentRequestId: str(x?.fulfillmentRequestId) ?? "",
|
|
68
|
+
deliveryOrderId: str(x?.deliveryOrderId),
|
|
69
|
+
fulfillmentOrderIds: arr(x?.fulfillmentOrderIds).map(str).filter((y) => !!y),
|
|
70
|
+
})).filter((x) => x.fulfillmentRequestId),
|
|
71
|
+
fulfillmentOrders: arr(row.fulfillmentOrders).map((x) => ({
|
|
72
|
+
fulfillmentOrderId: str(x?.fulfillmentOrderId) ?? "",
|
|
73
|
+
status: str(x?.status),
|
|
74
|
+
deliveryNoteReady: typeof x?.deliveryNoteReady === "boolean" ? x.deliveryNoteReady : null,
|
|
75
|
+
})).filter((x) => x.fulfillmentOrderId),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
export async function sendFulfillmentOrder(payload) {
|
|
82
|
+
return signedPost("fulfillment-order/send", payload);
|
|
83
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export interface LoadingItem {
|
|
2
|
+
loadCarrierItemId: string;
|
|
3
|
+
orderRef: string;
|
|
4
|
+
salesOrderId: string | null;
|
|
5
|
+
fulfillmentRequestId: string | null;
|
|
6
|
+
numberOfPackages: number;
|
|
7
|
+
sortIndex: number;
|
|
8
|
+
}
|
|
9
|
+
export interface LoadingCarrier {
|
|
10
|
+
loadCarrierReference: string;
|
|
11
|
+
cartLabel: string;
|
|
12
|
+
sortIndex: number;
|
|
13
|
+
shared: boolean;
|
|
14
|
+
/** Extra lagen volgens de Engine; null = onbekend (niet meegestuurd). */
|
|
15
|
+
additionalLayers: number | null;
|
|
16
|
+
items: LoadingItem[];
|
|
17
|
+
}
|
|
18
|
+
export interface OrderCheck {
|
|
19
|
+
orderRef: string;
|
|
20
|
+
salesOrderId: string | null;
|
|
21
|
+
pickStatus: string | null;
|
|
22
|
+
controlled: boolean;
|
|
23
|
+
cartsTotal: number;
|
|
24
|
+
cartsControlled: number;
|
|
25
|
+
deliveryOrderId: string | null;
|
|
26
|
+
autoStatus: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface LoadingShipment {
|
|
29
|
+
fulfillmentOrderId: string;
|
|
30
|
+
deliveryOrderId: string | null;
|
|
31
|
+
orderRefs: string[];
|
|
32
|
+
salesOrderIds: string[];
|
|
33
|
+
carriers: LoadingCarrier[];
|
|
34
|
+
/** Uit fulfillmentOrders[] van het statusoverzicht; null = nog niet bekend. */
|
|
35
|
+
floridayStatus: string | null;
|
|
36
|
+
deliveryNoteReady: boolean | null;
|
|
37
|
+
}
|
|
38
|
+
export interface LoadingAttempt {
|
|
39
|
+
fulfillmentOrderId: string;
|
|
40
|
+
step: string;
|
|
41
|
+
code: string | null;
|
|
42
|
+
message: string | null;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
}
|
|
45
|
+
export interface LoadingPreview {
|
|
46
|
+
fulfillmentOrderId: string | null;
|
|
47
|
+
orderRefs: string[];
|
|
48
|
+
carriers: LoadingCarrier[];
|
|
49
|
+
cartCount: number;
|
|
50
|
+
lineCount: number;
|
|
51
|
+
orders: OrderCheck[];
|
|
52
|
+
shipments: LoadingShipment[];
|
|
53
|
+
lastAttempts: LoadingAttempt[];
|
|
54
|
+
/** Redenen waarom nog niet verstuurd mag worden; leeg = klaar. */
|
|
55
|
+
blockers: string[];
|
|
56
|
+
canSend: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface SendResult {
|
|
59
|
+
ok: boolean;
|
|
60
|
+
results: {
|
|
61
|
+
fulfillmentOrderId: string;
|
|
62
|
+
code: string;
|
|
63
|
+
httpStatus: number | null;
|
|
64
|
+
message: string;
|
|
65
|
+
deliveryNote: string;
|
|
66
|
+
}[];
|
|
67
|
+
}
|
|
68
|
+
/** Stelt de belading samen en toont de controles. Verstuurt niets. */
|
|
69
|
+
export declare const prepareFloridayLoading: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
70
|
+
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
71
|
+
userId: string;
|
|
72
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
73
|
+
}, undefined, undefined, undefined>], (d: {
|
|
74
|
+
orderRef: string;
|
|
75
|
+
}) => {
|
|
76
|
+
orderRef: string;
|
|
77
|
+
}, Promise<LoadingPreview>>;
|
|
78
|
+
/**
|
|
79
|
+
* "Nu versturen": bouwt de belading opnieuw op (zelfde vaste kenmerken), controleert
|
|
80
|
+
* alles nogmaals op de server en verstuurt via fulfillment-order/send. Na acceptatie
|
|
81
|
+
* (created / already_fulfilled) volgt de verzendbrief via de Logistieke Engine. Elke poging komt in
|
|
82
|
+
* floriday_loading_attempts. Herhalen gebruikt altijd dezelfde fulfillmentOrderId.
|
|
83
|
+
*/
|
|
84
|
+
export declare const sendFloridayLoading: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
85
|
+
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
86
|
+
userId: string;
|
|
87
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
88
|
+
}, undefined, undefined, undefined>], (d: {
|
|
89
|
+
orderRef: string;
|
|
90
|
+
}) => {
|
|
91
|
+
orderRef: string;
|
|
92
|
+
}, Promise<SendResult>>;
|
|
93
|
+
//# sourceMappingURL=floridayLoading.functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floridayLoading.functions.d.ts","sourceRoot":"","sources":["../../src/lib/floridayLoading.functions.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,WAAW;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,cAAc;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,yEAAyE;IACzE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AACD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AACD,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,cAAc,EAAE,MAAM,GAAG,IAAI,CAA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