mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 09:58:12 +00:00
- New UNLOADED inventory status (train-arrival landing state) + transitions + unloaded_at column
(idempotent migration 1791000000003) + INVENTORY_UNLOADED activity type
- POST /warehouse-inventory/import/auto-unload-arrived-bookings { scheduleId }: validates ARRIVED
IMPORT train, unloads all eligible assigned bookings (IN_TRANSIT/ARRIVED_AT_*) into UNLOADED,
records unloadedAt + activity. Does NOT store and does NOT inspect. Reuses allocation + inventory
plumbing. Returns { unloadedCount, skippedCount, failedCount, results }.
- Arrive Queue "Auto Unload Arrived Bookings" button now calls the new endpoint (was per-booking loop)
- Import → Unloaded Queue tab: lists UNLOADED items via InventoryWorkbench (existing actions preserved:
Inspect/Store/Move/History) + a Last Mile action shown ONLY when booking requested door delivery
- Batch8TestDataSeeder: sets seed import train bookings to IN_TRANSIT (unload-eligible)
- Verified: auto-unload → 1 UNLOADED (unloadedAt set, not stored, not inspected); ineligible skipped;
idempotent re-run skips already-unloaded
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { BaseEntity } from '@edr/api-common';
|
|
import { Column, Entity, Index } from 'typeorm';
|
|
|
|
export const WAREHOUSE_ACTIVITY_TYPES = [
|
|
'INVENTORY_RECEIVED',
|
|
'INVENTORY_UNLOADED',
|
|
'INVENTORY_STORED',
|
|
'INVENTORY_MOVED',
|
|
'INVENTORY_RESERVED',
|
|
'READY_FOR_LOADING',
|
|
'INVENTORY_LOADED',
|
|
'INVENTORY_DISPATCHED',
|
|
'READY_FOR_PICKUP',
|
|
'INVENTORY_RELEASED',
|
|
'INVENTORY_DELIVERED',
|
|
] as const;
|
|
export type WarehouseActivityType = (typeof WAREHOUSE_ACTIVITY_TYPES)[number];
|
|
|
|
@Entity({ schema: 'freight', name: 'warehouse_activity_log' })
|
|
@Index(['inventoryId'])
|
|
@Index(['warehouseId'])
|
|
@Index(['activityType'])
|
|
export class WarehouseActivityLog extends BaseEntity {
|
|
@Column({ name: 'inventory_id', type: 'uuid', nullable: true })
|
|
inventoryId?: string | null;
|
|
|
|
@Column({ name: 'warehouse_id', type: 'uuid', nullable: true })
|
|
warehouseId?: string | null;
|
|
|
|
@Column({ name: 'activity_type', type: 'varchar', length: 40 })
|
|
activityType!: WarehouseActivityType;
|
|
|
|
@Column({ name: 'description', type: 'text', nullable: true })
|
|
description?: string | null;
|
|
|
|
@Column({ name: 'performed_by', type: 'varchar', length: 120, nullable: true })
|
|
performedBy?: string | null;
|
|
}
|