@flowselections/logistiek-engine 1.0.203 → 1.0.206
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/db/schema/logistiek-engine.sql +569 -0
- package/dist-lib/components/BeladingIndelingCard.d.ts.map +1 -1
- package/dist-lib/components/BeladingIndelingCard.js +14 -2
- package/dist-lib/components/LadingdragersPage.d.ts.map +1 -1
- package/dist-lib/components/LadingdragersPage.js +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +240 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/floridayPush.server.d.ts.map +1 -1
- package/dist-lib/lib/floridayPush.server.js +3 -2
- package/dist-lib/lib/loadCarrierPlanner.d.ts +68 -1
- package/dist-lib/lib/loadCarrierPlanner.d.ts.map +1 -1
- package/dist-lib/lib/loadCarrierPlanner.js +293 -280
- package/dist-lib/lib/loadCarrierPlanning.server.d.ts.map +1 -1
- package/dist-lib/lib/loadCarrierPlanning.server.js +16 -3
- package/dist-lib/lib/moduleVersion.d.ts +1 -1
- package/dist-lib/lib/moduleVersion.js +1 -1
- package/dist-lib/lib/quarantaine.d.ts +9 -0
- package/dist-lib/lib/quarantaine.d.ts.map +1 -0
- package/dist-lib/lib/quarantaine.js +13 -0
- package/package.json +1 -1
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
// draait de pure planner per ladingdragertype en schrijft het resultaat weg
|
|
6
6
|
// naar order_carts / order_cart_items.
|
|
7
7
|
// ============================================================================
|
|
8
|
-
import { planLoadUnits, LOAD_CARRIER_PLANNER_VERSION, } from "./loadCarrierPlanner.js";
|
|
8
|
+
import { planLoadUnits, LOAD_CARRIER_PLANNER_VERSION, bepaalLaagMenging, } from "./loadCarrierPlanner.js";
|
|
9
9
|
import { traceBatch } from "./trace.server.js";
|
|
10
|
+
import { zonderQuarantaine } from "./quarantaine.js";
|
|
10
11
|
import { MODULE_VERSION } from "./moduleVersion.js";
|
|
11
12
|
import { fallbackCarrierProfile } from "./loadCarrierTypes.js";
|
|
12
13
|
import { WAAR_INVULLEN, gewichtOnbekendTekst, ladingdragerNietInBeheerTekst } from "./invoerTeksten.js";
|
|
@@ -639,6 +640,7 @@ export function applyRulesToProfile(profile, rules) {
|
|
|
639
640
|
layers_per_carrier: rules.maxLayers != null
|
|
640
641
|
? Math.max(1, Math.min(profile.layers_per_carrier || 1, rules.maxLayers))
|
|
641
642
|
: profile.layers_per_carrier,
|
|
643
|
+
werkwijze_max_lagen: rules.maxLayers ?? null,
|
|
642
644
|
max_boxes: rules.maxBoxes != null
|
|
643
645
|
? Math.min(profile.max_boxes ?? Number.MAX_SAFE_INTEGER, rules.maxBoxes)
|
|
644
646
|
: profile.max_boxes ?? null,
|
|
@@ -1150,14 +1152,16 @@ async function replanBufferUnlocked(sb, bufferId, options = {}) {
|
|
|
1150
1152
|
}
|
|
1151
1153
|
}
|
|
1152
1154
|
const idList = orderIds.length > 0 ? orderIds : ["00000000-0000-0000-0000-000000000000"];
|
|
1153
|
-
const { data:
|
|
1155
|
+
const { data: rawItemsDb } = await sb
|
|
1154
1156
|
.from("order_items")
|
|
1155
1157
|
.select("id, order_id, product_id, product_name, quantity, unit, plants_per_crate, crates_per_layer, layers_per_cart, " +
|
|
1156
|
-
"packing_locked_at, packing_locked_by, source_line_key, load_carrier_type, " +
|
|
1158
|
+
"packing_locked_at, packing_locked_by, source_line_key, load_carrier_type, quarantined_at, " +
|
|
1157
1159
|
"products(plants_per_crate, crates_per_layer, layers_per_cart, weight, floriday_trade_item_id, fust_type_id)")
|
|
1158
1160
|
.in("order_id", idList)
|
|
1159
1161
|
// Regels in quarantaine (Verkoop-herstel) nooit inplannen.
|
|
1160
1162
|
.is("quarantined_at", null);
|
|
1163
|
+
// 1.0.205: dubbele bescherming — ook na het lezen nooit regels in quarantaine plannen.
|
|
1164
|
+
const rawItems = zonderQuarantaine((rawItemsDb ?? []));
|
|
1161
1165
|
// 1.0.166: regels die in Floriday zijn afgehandeld nooit inplannen. Onleesbaar = niet plannen (fail closed).
|
|
1162
1166
|
const { data: extern, error: externError } = await sb
|
|
1163
1167
|
.from("logistics_external_fulfillment")
|
|
@@ -1819,7 +1823,16 @@ async function replanBufferUnlocked(sb, bufferId, options = {}) {
|
|
|
1819
1823
|
}
|
|
1820
1824
|
for (const [code, list] of groups) {
|
|
1821
1825
|
const profile = applyRulesToProfile(profileFor(profiles, code), rules);
|
|
1826
|
+
const maxBelPerLaag = rules && !rules.optimalFill ? 1 : (settings?.max_beladingen_per_layer ?? 2);
|
|
1827
|
+
const mengregels = bepaalLaagMenging({
|
|
1828
|
+
optimalFill: rules?.optimalFill ?? null,
|
|
1829
|
+
maxBeladingenPerLayer: maxBelPerLaag,
|
|
1830
|
+
maxCustomersPerLayer: rules?.maxCustomersPerLayer ?? null,
|
|
1831
|
+
oneCustomerPerLayer: Boolean(settings?.max_one_customer_per_layer),
|
|
1832
|
+
});
|
|
1822
1833
|
const result = planLoadUnits(list, {
|
|
1834
|
+
laagMenging: mengregels.menging,
|
|
1835
|
+
laagGroepen: mengregels.groepen,
|
|
1823
1836
|
carrier: profile,
|
|
1824
1837
|
maxPartySharePerLayerPct: settings?.max_party_share_per_layer_pct ?? 50,
|
|
1825
1838
|
// Zonder optimale vulling wordt er niet bijgemengd in een laag.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MODULE_VERSION = "1.0.
|
|
1
|
+
export declare const MODULE_VERSION = "1.0.206";
|
|
2
2
|
//# sourceMappingURL=moduleVersion.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatisch gegenereerd door prebuild:lib; niet handmatig aanpassen.
|
|
2
|
-
export const MODULE_VERSION = "1.0.
|
|
2
|
+
export const MODULE_VERSION = "1.0.206";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Is deze orderregel in quarantaine? */
|
|
2
|
+
export declare function inQuarantaine(row: {
|
|
3
|
+
quarantined_at?: unknown;
|
|
4
|
+
} | null | undefined): boolean;
|
|
5
|
+
/** Alleen regels die niet in quarantaine staan. */
|
|
6
|
+
export declare function zonderQuarantaine<T extends {
|
|
7
|
+
quarantined_at?: unknown;
|
|
8
|
+
}>(rows: T[] | null | undefined): T[];
|
|
9
|
+
//# sourceMappingURL=quarantaine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quarantaine.d.ts","sourceRoot":"","sources":["../../src/lib/quarantaine.ts"],"names":[],"mappings":"AAKA,yCAAyC;AACzC,wBAAgB,aAAa,CAAC,GAAG,EAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAG3F;AAED,mDAAmD;AACnD,wBAAgB,iBAAiB,CAAC,CAAC,SAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,EAAE,CAE3G"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// 1.0.205: orderregels in quarantaine (Verkoop-herstel, order_items.quarantined_at gevuld)
|
|
2
|
+
// worden nergens in de Engine ingedeeld, geteld of verstuurd. Eén regel voor alle plekken:
|
|
3
|
+
// planner, dekking, pakbonplan en Floriday-belading (SQL-kant: logistics_active.order_items
|
|
4
|
+
// en filters op oi.quarantined_at IS NULL).
|
|
5
|
+
/** Is deze orderregel in quarantaine? */
|
|
6
|
+
export function inQuarantaine(row) {
|
|
7
|
+
const v = row?.quarantined_at;
|
|
8
|
+
return v !== null && v !== undefined && String(v).trim() !== "";
|
|
9
|
+
}
|
|
10
|
+
/** Alleen regels die niet in quarantaine staan. */
|
|
11
|
+
export function zonderQuarantaine(rows) {
|
|
12
|
+
return (Array.isArray(rows) ? rows : []).filter((r) => !inQuarantaine(r));
|
|
13
|
+
}
|