feat(raw-materials): wax and propolis lots consumed by production batches

- RawMaterialLot (beeswax, propolis) in grams with origin (apiary,
  harvest); stock in the same movement ledger: withdrawals, inventory
  counts, and the new movement type CONSUMPTION.
- Production batches take inputs (raw lot + grams); batch and consumption
  are one transaction, never more than a lot has left. Deleting a
  mistaken batch gives the material back as its own movement.
- Traceability both ways: batch -> inputs, raw lot -> usedIn.
- Movement belongs to exactly one of bottling / production / raw lot
  (CHECK); raw material changes do not trigger the shop webhook.
- Permissions raw-material:*, granted to roles that maintain production
  batches.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-10-05 23:54:43 +02:00
1 parent 41c2af7284
commit e73c8b2cb4
15 files changed
+986 -32

No files matched your search

+2
View File
@@ -28,6 +28,7 @@ import { QrModule } from './qr/qr.module';
import { ProductsModule } from './products/products.module';
import { BottlingModule } from './bottling/bottling.module';
import { ProductionBatchesModule } from './production-batches/production-batches.module';
import { RawMaterialsModule } from './raw-materials/raw-materials.module';
import { EquipmentModule } from './equipment/equipment.module';
import { CalendarModule } from './calendar/calendar.module';
import { CalendarSyncModule } from './calendar-sync/calendar-sync.module';
@@ -85,6 +86,7 @@ import { IdempotencyCleanupService } from './common/idempotency/idempotency-clea
ProductsModule,
BottlingModule,
ProductionBatchesModule,
RawMaterialsModule,
EquipmentModule,
CalendarModule,
CalendarSyncModule,