feat(automation): number formats for raw material and production batches, raw material minimum

- RAW_MATERIAL_LOT_NUMBER_FORMAT / PRODUCTION_BATCH_NUMBER_FORMAT fill in the
  lot number when it is left empty, like honey batches and bottlings.
- RAW_MATERIAL_LOW: task when the total of a raw material kind drops below
  config.minGrams after consumption, withdrawal or inventory count.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-10-07 16:01:33 +02:00
1 parent fc887d8431
commit 5408711b2d
18 files changed
+311 -26

No files matched your search

@@ -0,0 +1,4 @@
-- AlterEnum
ALTER TYPE "AutomationTriggerType" ADD VALUE 'RAW_MATERIAL_LOT_NUMBER_FORMAT';
ALTER TYPE "AutomationTriggerType" ADD VALUE 'PRODUCTION_BATCH_NUMBER_FORMAT';
ALTER TYPE "AutomationTriggerType" ADD VALUE 'RAW_MATERIAL_LOW';
+5 -2
View File
@@ -1346,6 +1346,9 @@ enum AutomationTriggerType {
BOTTLING_LOT_NUMBER_FORMAT
TREATMENT_FOLLOW_UP
FEEDING_FOLLOW_UP
RAW_MATERIAL_LOT_NUMBER_FORMAT
PRODUCTION_BATCH_NUMBER_FORMAT
RAW_MATERIAL_LOW
}
model AutomationRule {
@@ -1354,8 +1357,8 @@ model AutomationRule {
active Boolean @default(true)
config Json?
actionTemplate String?
// Running counter for the number-format rules (HONEY_BATCH_NUMBER_FORMAT /
// BOTTLING_LOT_NUMBER_FORMAT) - unused by the threshold-style rules. Kept as
// Running counter for the number-format rules (*_NUMBER_FORMAT) - unused
// by the threshold-style rules. Kept as
// a dedicated column (not inside `config`) so it can be incremented with a
// single atomic `UPDATE ... SET sequenceValue = sequenceValue + 1`,
// race-safe under concurrent batch/bottling creation.