@cristiancosano/pallet-builder 0.1.2 → 0.1.4

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.
@@ -1,4 +1,4 @@
1
- import type { PlacedBox } from '@/core/entities/PlacedBox';
1
+ import type { PlacedBox } from "@/core/entities/PlacedBox";
2
2
  export interface BoxProps {
3
3
  placedBox: PlacedBox;
4
4
  selected?: boolean;
@@ -5,6 +5,8 @@ export interface Box {
5
5
  weight: number;
6
6
  sku?: string;
7
7
  type?: string;
8
+ product?: string;
9
+ materialWeight?: number;
8
10
  fragile: boolean;
9
11
  fragilityMaxWeight?: number;
10
12
  stackable: boolean;
@@ -0,0 +1,28 @@
1
+ import type { Box } from "../entities/Box";
2
+ import type { Pallet } from "../entities/Pallet";
3
+ import type { PackingStrategy, PackingResult } from "./PackingStrategy";
4
+ export declare class MaterialGroupingStrategy implements PackingStrategy {
5
+ readonly id = "material-grouping";
6
+ readonly name = "Material & Product Grouping";
7
+ pack(boxes: Box[], pallet: Pallet): PackingResult;
8
+ private sortBoxes;
9
+ private groupByMaterialWeight;
10
+ private buildLayers;
11
+ private buildNextLayer;
12
+ private tryUniformHeightLayer;
13
+ private tryMixedHeightLayer;
14
+ private placeBoxesInLayer;
15
+ private findBestRectangle;
16
+ private calculateSupportArea;
17
+ private calculateRectangleIntersection;
18
+ private boxExtendsBeyondLowerLayer;
19
+ private scoreRectangle;
20
+ private updateFreeRectangles;
21
+ private rectanglesIntersect;
22
+ private removeContainedRectangles;
23
+ private updateOccupiedColumns;
24
+ private groupByProduct;
25
+ private emptyLayer;
26
+ private emptyResult;
27
+ private calculateMetrics;
28
+ }
@@ -2,4 +2,5 @@ export type { PackingStrategy, PackingResult } from './PackingStrategy';
2
2
  export { ColumnStrategy } from './ColumnStrategy';
3
3
  export { BinPacking3DStrategy } from './BinPacking3D';
4
4
  export { TypeGroupStrategy } from './TypeGroupStrategy';
5
+ export { MaterialGroupingStrategy } from './MaterialGroupingStrategy';
5
6
  export { PackingRegistry, defaultRegistry } from './registry';
@@ -1,18 +1,18 @@
1
- import type { Box } from '@/core/entities/Box';
2
- import type { Pallet } from '@/core/entities/Pallet';
3
- import type { StackedPallet } from '@/core/entities/StackedPallet';
4
- import type { Truck } from '@/core/entities/Truck';
5
- import type { Room } from '@/core/entities/Room';
6
- import type { PlacedBox } from '@/core/entities/PlacedBox';
7
- import type { PalletFloor } from '@/core/entities/PalletFloor';
8
- import type { Position3D } from '@/core/types';
1
+ import type { Box } from "@/core/entities/Box";
2
+ import type { Pallet } from "@/core/entities/Pallet";
3
+ import type { StackedPallet } from "@/core/entities/StackedPallet";
4
+ import type { Truck } from "@/core/entities/Truck";
5
+ import type { Room } from "@/core/entities/Room";
6
+ import type { PlacedBox } from "@/core/entities/PlacedBox";
7
+ import type { PalletFloor } from "@/core/entities/PalletFloor";
8
+ import type { Position3D } from "@/core/types";
9
9
  export interface BoxTemplate {
10
10
  id: string;
11
11
  name: string;
12
12
  box: Box;
13
13
  quantity: number;
14
14
  }
15
- export type ExampleView = 'pallet-builder' | 'truck-viewer' | 'warehouse-viewer';
15
+ export type ExampleView = "pallet-builder" | "truck-viewer" | "warehouse-viewer";
16
16
  export interface ExampleState {
17
17
  activeView: ExampleView;
18
18
  boxTemplates: BoxTemplate[];
@@ -28,7 +28,7 @@ export interface ExampleState {
28
28
  }
29
29
  export interface ExampleActions {
30
30
  setActiveView: (view: ExampleView) => void;
31
- addBoxTemplate: (template: Omit<BoxTemplate, 'id'>) => void;
31
+ addBoxTemplate: (template: Omit<BoxTemplate, "id">) => void;
32
32
  updateBoxTemplate: (id: string, updates: Partial<BoxTemplate>) => void;
33
33
  removeBoxTemplate: (id: string) => void;
34
34
  setSelectedPalletType: (type: string) => void;