Compliance for hazardous materials (Hazmat) usually relies on warehouse staff manually checking labels. They have to remember that lithium batteries can't go with flammables, or that certain perfumes need special boxes.
BinSolver's constraint engine moves this logic into code. It ensures dangerous goods are never packed in non-compliant containers or mixed with incompatible items.
Segregation of Duties
Manual compliance is error-prone. Common constraints include:
- Incompatible Classes: Oxidizers must be separated from Flammables.
- Designated Packaging: Specific UN numbers require reinforced 4G fiberboard boxes.
The `hazmat` Flag
The primary layer of protection is the `hazmat` boolean.
- Items: Mark SKUs (perfumes, batteries, aerosols) with `packaging: { hazmat: true }`.
- Bins: Set `allowHazmat: false` for standard cartons and `allowHazmat: true` for reinforced boxes.
The solver will reject any solution that places a hazardous item into a non-compliant bin.
Isolation with `groupMode: separate`
Some items, like liquids or high-value electronics, require total isolation.
Assigning a `group` ID and setting `groupMode: "separate"` forces BinSolver to pack these items in their own bins, ensuring they are not mixed with other inventory.
TypeScript Implementation
The following example demonstrates a safety-first packing strategy using the TypeScript SDK.
import { BinSolver } from "binsolver";
const client = new BinSolver(process.env.BINSOLVER_API_KEY);
// 1. Define distinct groups of items
const items = [
// Standard items
{ id: "shirt", w: 10, h: 10, d: 2, quantity: 5 },
// Hazardous materials (e.g., Lithium Batteries)
{
id: "battery-pack",
w: 5, h: 3, d: 2,
quantity: 10,
packaging: {
hazmat: true, // Requires a bin with allowHazmat: true
group: "batteries",
groupMode: "separate" // Isolate this group from others
}
}
];
// 2. Define bins with safety capabilities
const bins = [
// Standard cardboard box (No Hazmat)
{ id: "standard-box", w: 12, h: 12, d: 12, allowHazmat: false },
// Reinforced container (Hazmat Safe)
{ id: "hazmat-safe", w: 12, h: 12, d: 12, allowHazmat: true }
];
const result = await client.pack({ items, bins });
// The solver will automatically place the batteries
// into 'hazmat-safe' bins and keep them isolated
// if 'groupMode: separate' logic dictates. Automating Safety
Embedding safety constraints into the packing request moves compliance from human memory to system logic, reducing the risk of fines and accidents.