@tailor-platform/erp-kit 0.4.1 → 0.5.1
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.
- package/CHANGELOG.md +36 -0
- package/README.md +12 -12
- package/dist/cli.mjs +503 -32
- package/package.json +2 -11
- package/skills/erp-kit-app-2-requirements-review/SKILL.md +2 -2
- package/skills/erp-kit-app-2-requirements-review/references/best-practices-check.md +1 -1
- package/skills/erp-kit-app-3-plan/references/resolver-extraction.md +6 -3
- package/skills/erp-kit-app-4-plan-review/SKILL.md +5 -3
- package/skills/erp-kit-app-4-plan-review/references/orphan-detection.md +3 -0
- package/skills/erp-kit-app-4-plan-review/references/story-resolver-parity.md +21 -3
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +15 -4
- package/skills/erp-kit-app-6-impl-frontend/SKILL.md +8 -4
- package/skills/erp-kit-app-7-impl-review/SKILL.md +1 -1
- package/skills/erp-kit-app-shared/references/resolver-classification.md +3 -0
- package/skills/erp-kit-module-2-requirements-review/SKILL.md +3 -30
- package/skills/erp-kit-module-3-update-plan/SKILL.md +132 -0
- package/skills/erp-kit-module-3-update-plan/references/command-extraction.md +87 -0
- package/skills/erp-kit-module-3-update-plan/references/model-extraction.md +72 -0
- package/skills/erp-kit-module-3-update-plan/references/naming.md +73 -0
- package/skills/erp-kit-module-3-update-plan/references/query-extraction.md +59 -0
- package/skills/erp-kit-module-4-plan-review/SKILL.md +3 -69
- package/skills/erp-kit-module-5-impl/SKILL.md +1 -0
- package/skills/erp-kit-module-6-impl-review/SKILL.md +42 -120
- package/skills/erp-kit-module-6-impl-review/references/command-doc-test-parity.md +1 -1
- package/skills/erp-kit-module-6-impl-review/references/{error-implementation-parity.md → command-error-implementation-parity.md} +3 -3
- package/skills/erp-kit-module-6-impl-review/references/impl-parity-report-format.md +1 -1
- package/skills/erp-kit-module-6-impl-review/references/query-doc-code-parity.md +110 -0
- package/skills/erp-kit-module-6-impl-review/references/query-doc-test-parity.md +108 -0
- package/skills/erp-kit-module-6-impl-review/references/query-error-implementation-parity.md +100 -0
- package/src/commands/app/index.ts +18 -3
- package/src/commands/check.test.ts +1 -1
- package/src/commands/doc/module.ts +2 -3
- package/src/commands/doc/modules.test.ts +0 -7
- package/src/commands/doc/modules.ts +1 -2
- package/src/commands/doc/search.ts +1 -2
- package/src/commands/init-module.test.ts +17 -3
- package/src/commands/init-module.ts +0 -12
- package/src/commands/init.ts +4 -0
- package/src/commands/lib/distribute.test.ts +32 -1
- package/src/commands/lib/distribute.ts +47 -5
- package/src/commands/lib/sync-check-source.test.ts +1 -1
- package/src/commands/update.test.ts +16 -0
- package/src/commands/update.ts +4 -1
- package/src/generator/generate-code-boilerplate.test.ts +9 -1
- package/src/generator/generate-seed.ts +69 -0
- package/src/generator/scaffold.ts +6 -2
- package/src/mdschema.ts +39 -3
- package/src/module.ts +56 -0
- package/src/modules/business-partner/README.md +2 -2
- package/src/modules/inventory/README.md +65 -0
- package/src/modules/inventory/command/approveCountLine.generated.ts +6 -0
- package/src/modules/inventory/command/approveCountLine.test.ts +89 -0
- package/src/modules/inventory/command/approveCountLine.ts +68 -0
- package/src/modules/inventory/command/approveInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/approveInventoryAdjustment.test.ts +56 -0
- package/src/modules/inventory/command/approveInventoryAdjustment.ts +50 -0
- package/src/modules/inventory/command/assignSerialNumber.generated.ts +6 -0
- package/src/modules/inventory/command/assignSerialNumber.test.ts +133 -0
- package/src/modules/inventory/command/assignSerialNumber.ts +83 -0
- package/src/modules/inventory/command/cancelInventoryCount.generated.ts +6 -0
- package/src/modules/inventory/command/cancelInventoryCount.test.ts +114 -0
- package/src/modules/inventory/command/cancelInventoryCount.ts +62 -0
- package/src/modules/inventory/command/cancelStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/cancelStockMovement.test.ts +102 -0
- package/src/modules/inventory/command/cancelStockMovement.ts +56 -0
- package/src/modules/inventory/command/completeInventoryCount.generated.ts +6 -0
- package/src/modules/inventory/command/completeInventoryCount.test.ts +99 -0
- package/src/modules/inventory/command/completeInventoryCount.ts +70 -0
- package/src/modules/inventory/command/confirmInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/confirmInventoryAdjustment.test.ts +324 -0
- package/src/modules/inventory/command/confirmInventoryAdjustment.ts +194 -0
- package/src/modules/inventory/command/confirmStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/confirmStockMovement.test.ts +126 -0
- package/src/modules/inventory/command/confirmStockMovement.ts +131 -0
- package/src/modules/inventory/command/createInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/createInventoryAdjustment.test.ts +298 -0
- package/src/modules/inventory/command/createInventoryAdjustment.ts +124 -0
- package/src/modules/inventory/command/createInventoryCount.generated.ts +6 -0
- package/src/modules/inventory/command/createInventoryCount.test.ts +157 -0
- package/src/modules/inventory/command/createInventoryCount.ts +72 -0
- package/src/modules/inventory/command/createLot.generated.ts +6 -0
- package/src/modules/inventory/command/createLot.test.ts +106 -0
- package/src/modules/inventory/command/createLot.ts +72 -0
- package/src/modules/inventory/command/createStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/createStockMovement.test.ts +342 -0
- package/src/modules/inventory/command/createStockMovement.ts +172 -0
- package/src/modules/inventory/command/createStorageLocation.generated.ts +6 -0
- package/src/modules/inventory/command/createStorageLocation.test.ts +246 -0
- package/src/modules/inventory/command/createStorageLocation.ts +126 -0
- package/src/modules/inventory/command/createValuationPolicy.generated.ts +6 -0
- package/src/modules/inventory/command/createValuationPolicy.test.ts +75 -0
- package/src/modules/inventory/command/createValuationPolicy.ts +52 -0
- package/src/modules/inventory/command/createWarehouse.generated.ts +6 -0
- package/src/modules/inventory/command/createWarehouse.test.ts +143 -0
- package/src/modules/inventory/command/createWarehouse.ts +76 -0
- package/src/modules/inventory/command/deactivateStorageLocation.generated.ts +6 -0
- package/src/modules/inventory/command/deactivateStorageLocation.test.ts +69 -0
- package/src/modules/inventory/command/deactivateStorageLocation.ts +51 -0
- package/src/modules/inventory/command/deactivateWarehouse.generated.ts +6 -0
- package/src/modules/inventory/command/deactivateWarehouse.test.ts +75 -0
- package/src/modules/inventory/command/deactivateWarehouse.ts +45 -0
- package/src/modules/inventory/command/executeStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/executeStockMovement.test.ts +502 -0
- package/src/modules/inventory/command/executeStockMovement.ts +303 -0
- package/src/modules/inventory/command/reactivateStorageLocation.generated.ts +6 -0
- package/src/modules/inventory/command/reactivateStorageLocation.test.ts +78 -0
- package/src/modules/inventory/command/reactivateStorageLocation.ts +63 -0
- package/src/modules/inventory/command/reactivateWarehouse.generated.ts +6 -0
- package/src/modules/inventory/command/reactivateWarehouse.test.ts +87 -0
- package/src/modules/inventory/command/reactivateWarehouse.ts +65 -0
- package/src/modules/inventory/command/recordCountLine.generated.ts +6 -0
- package/src/modules/inventory/command/recordCountLine.test.ts +211 -0
- package/src/modules/inventory/command/recordCountLine.ts +81 -0
- package/src/modules/inventory/command/rejectCountLine.generated.ts +6 -0
- package/src/modules/inventory/command/rejectCountLine.test.ts +66 -0
- package/src/modules/inventory/command/rejectCountLine.ts +50 -0
- package/src/modules/inventory/command/rejectInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/rejectInventoryAdjustment.test.ts +69 -0
- package/src/modules/inventory/command/rejectInventoryAdjustment.ts +50 -0
- package/src/modules/inventory/command/releaseReservation.generated.ts +6 -0
- package/src/modules/inventory/command/releaseReservation.test.ts +65 -0
- package/src/modules/inventory/command/releaseReservation.ts +50 -0
- package/src/modules/inventory/command/reserveStock.generated.ts +6 -0
- package/src/modules/inventory/command/reserveStock.test.ts +141 -0
- package/src/modules/inventory/command/reserveStock.ts +88 -0
- package/src/modules/inventory/command/reviseInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/reviseInventoryAdjustment.test.ts +68 -0
- package/src/modules/inventory/command/reviseInventoryAdjustment.ts +48 -0
- package/src/modules/inventory/command/startInventoryCount.generated.ts +6 -0
- package/src/modules/inventory/command/startInventoryCount.test.ts +100 -0
- package/src/modules/inventory/command/startInventoryCount.ts +90 -0
- package/src/modules/inventory/command/submitInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/submitInventoryAdjustment.test.ts +53 -0
- package/src/modules/inventory/command/submitInventoryAdjustment.ts +47 -0
- package/src/modules/inventory/command/updateLot.generated.ts +6 -0
- package/src/modules/inventory/command/updateLot.test.ts +88 -0
- package/src/modules/inventory/command/updateLot.ts +52 -0
- package/src/modules/inventory/command/updateStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/updateStockMovement.test.ts +250 -0
- package/src/modules/inventory/command/updateStockMovement.ts +164 -0
- package/src/modules/inventory/command/updateStorageLocation.generated.ts +6 -0
- package/src/modules/inventory/command/updateStorageLocation.test.ts +72 -0
- package/src/modules/inventory/command/updateStorageLocation.ts +77 -0
- package/src/modules/inventory/command/updateValuationPolicy.generated.ts +6 -0
- package/src/modules/inventory/command/updateValuationPolicy.test.ts +68 -0
- package/src/modules/inventory/command/updateValuationPolicy.ts +74 -0
- package/src/modules/inventory/command/updateWarehouse.generated.ts +6 -0
- package/src/modules/inventory/command/updateWarehouse.test.ts +88 -0
- package/src/modules/inventory/command/updateWarehouse.ts +64 -0
- package/src/modules/inventory/db/costLayer.ts +54 -0
- package/src/modules/inventory/db/inventoryAdjustment.ts +88 -0
- package/src/modules/inventory/db/inventoryCount.ts +58 -0
- package/src/modules/inventory/db/inventoryCountLine.ts +61 -0
- package/src/modules/inventory/db/itemValuation.ts +50 -0
- package/src/modules/inventory/db/lot.ts +51 -0
- package/src/modules/inventory/db/lotStockLevel.ts +48 -0
- package/src/modules/inventory/db/serialNumber.ts +53 -0
- package/src/modules/inventory/db/stockLevel.ts +51 -0
- package/src/modules/inventory/db/stockMoveLine.ts +78 -0
- package/src/modules/inventory/db/stockMovement.ts +48 -0
- package/src/modules/inventory/db/storageLocation.ts +56 -0
- package/src/modules/inventory/db/valuationPolicy.ts +33 -0
- package/src/modules/inventory/db/warehouse.ts +45 -0
- package/src/modules/inventory/docs/commands/ApproveCountLine.md +44 -0
- package/src/modules/inventory/docs/commands/ApproveInventoryAdjustment.md +37 -0
- package/src/modules/inventory/docs/commands/AssignSerialNumber.md +46 -0
- package/src/modules/inventory/docs/commands/CancelInventoryCount.md +49 -0
- package/src/modules/inventory/docs/commands/CancelStockMovement.md +44 -0
- package/src/modules/inventory/docs/commands/CompleteInventoryCount.md +47 -0
- package/src/modules/inventory/docs/commands/ConfirmInventoryAdjustment.md +72 -0
- package/src/modules/inventory/docs/commands/ConfirmStockMovement.md +43 -0
- package/src/modules/inventory/docs/commands/CreateInventoryAdjustment.md +75 -0
- package/src/modules/inventory/docs/commands/CreateInventoryCount.md +49 -0
- package/src/modules/inventory/docs/commands/CreateLot.md +40 -0
- package/src/modules/inventory/docs/commands/CreateStockMovement.md +76 -0
- package/src/modules/inventory/docs/commands/CreateStorageLocation.md +66 -0
- package/src/modules/inventory/docs/commands/CreateValuationPolicy.md +45 -0
- package/src/modules/inventory/docs/commands/CreateWarehouse.md +47 -0
- package/src/modules/inventory/docs/commands/DeactivateStorageLocation.md +39 -0
- package/src/modules/inventory/docs/commands/DeactivateWarehouse.md +38 -0
- package/src/modules/inventory/docs/commands/ExecuteStockMovement.md +82 -0
- package/src/modules/inventory/docs/commands/ReactivateStorageLocation.md +42 -0
- package/src/modules/inventory/docs/commands/ReactivateWarehouse.md +42 -0
- package/src/modules/inventory/docs/commands/RecordCountLine.md +52 -0
- package/src/modules/inventory/docs/commands/RejectCountLine.md +42 -0
- package/src/modules/inventory/docs/commands/RejectInventoryAdjustment.md +38 -0
- package/src/modules/inventory/docs/commands/ReleaseReservation.md +37 -0
- package/src/modules/inventory/docs/commands/ReserveStock.md +49 -0
- package/src/modules/inventory/docs/commands/ReviseInventoryAdjustment.md +38 -0
- package/src/modules/inventory/docs/commands/StartInventoryCount.md +47 -0
- package/src/modules/inventory/docs/commands/SubmitInventoryAdjustment.md +37 -0
- package/src/modules/inventory/docs/commands/UpdateLot.md +41 -0
- package/src/modules/inventory/docs/commands/UpdateStockMovement.md +45 -0
- package/src/modules/inventory/docs/commands/UpdateStorageLocation.md +41 -0
- package/src/modules/inventory/docs/commands/UpdateValuationPolicy.md +44 -0
- package/src/modules/inventory/docs/commands/UpdateWarehouse.md +42 -0
- package/src/modules/inventory/docs/features/inventory-adjustment.md +64 -0
- package/src/modules/inventory/docs/features/inventory-count.md +78 -0
- package/src/modules/inventory/docs/features/inventory-valuation.md +77 -0
- package/src/modules/inventory/docs/features/lot-and-batch-tracking.md +81 -0
- package/src/modules/inventory/docs/features/scrap-management.md +63 -0
- package/src/modules/inventory/docs/features/serial-number-tracking.md +68 -0
- package/src/modules/inventory/docs/features/stock-movement.md +72 -0
- package/src/modules/inventory/docs/features/stock-tracking.md +78 -0
- package/src/modules/inventory/docs/features/warehouse-management.md +97 -0
- package/src/modules/inventory/docs/models/CostLayer.md +37 -0
- package/src/modules/inventory/docs/models/InventoryAdjustment.md +69 -0
- package/src/modules/inventory/docs/models/InventoryCount.md +53 -0
- package/src/modules/inventory/docs/models/InventoryCountLine.md +53 -0
- package/src/modules/inventory/docs/models/ItemValuation.md +38 -0
- package/src/modules/inventory/docs/models/Lot.md +45 -0
- package/src/modules/inventory/docs/models/LotStockLevel.md +34 -0
- package/src/modules/inventory/docs/models/SerialNumber.md +53 -0
- package/src/modules/inventory/docs/models/StockLevel.md +41 -0
- package/src/modules/inventory/docs/models/StockMoveLine.md +44 -0
- package/src/modules/inventory/docs/models/StockMovement.md +52 -0
- package/src/modules/inventory/docs/models/StorageLocation.md +55 -0
- package/src/modules/inventory/docs/models/ValuationPolicy.md +38 -0
- package/src/modules/inventory/docs/models/Warehouse.md +50 -0
- package/src/modules/inventory/docs/queries/GetInventoryAdjustment.md +40 -0
- package/src/modules/inventory/docs/queries/GetInventoryCount.md +43 -0
- package/src/modules/inventory/docs/queries/GetItemValuation.md +42 -0
- package/src/modules/inventory/docs/queries/GetLot.md +42 -0
- package/src/modules/inventory/docs/queries/GetSerialNumber.md +43 -0
- package/src/modules/inventory/docs/queries/GetSerialNumberHistory.md +50 -0
- package/src/modules/inventory/docs/queries/GetStockLevel.md +42 -0
- package/src/modules/inventory/docs/queries/GetStockMovement.md +41 -0
- package/src/modules/inventory/docs/queries/GetStorageLocation.md +40 -0
- package/src/modules/inventory/docs/queries/GetValuationPolicy.md +38 -0
- package/src/modules/inventory/docs/queries/GetWarehouse.md +40 -0
- package/src/modules/inventory/docs/queries/GetWarehouseStockSummary.md +50 -0
- package/src/modules/inventory/docs/queries/ListCostLayers.md +49 -0
- package/src/modules/inventory/docs/queries/ListExpiringLots.md +51 -0
- package/src/modules/inventory/docs/queries/ListInventoryAdjustments.md +47 -0
- package/src/modules/inventory/docs/queries/ListInventoryCounts.md +57 -0
- package/src/modules/inventory/docs/queries/ListItemValuations.md +44 -0
- package/src/modules/inventory/docs/queries/ListLots.md +57 -0
- package/src/modules/inventory/docs/queries/ListSerialNumbers.md +44 -0
- package/src/modules/inventory/docs/queries/ListStockLevels.md +49 -0
- package/src/modules/inventory/docs/queries/ListStockMovements.md +47 -0
- package/src/modules/inventory/docs/queries/ListStorageLocations.md +47 -0
- package/src/modules/inventory/docs/queries/ListValuationPolicies.md +38 -0
- package/src/modules/inventory/docs/queries/ListWarehouses.md +42 -0
- package/src/modules/inventory/docs/queries/TraceLotBackward.md +46 -0
- package/src/modules/inventory/docs/queries/TraceLotForward.md +46 -0
- package/src/modules/inventory/executor/.gitkeep +0 -0
- package/src/modules/inventory/generated/.gitkeep +0 -0
- package/src/modules/inventory/generated/enums.ts +131 -0
- package/src/modules/inventory/generated/kysely-tailordb.ts +201 -0
- package/src/modules/inventory/index.ts +2 -0
- package/src/modules/inventory/lib/_db_deps.ts +17 -0
- package/src/modules/inventory/lib/errors.generated.ts +317 -0
- package/src/modules/inventory/lib/permissions.generated.ts +38 -0
- package/src/modules/inventory/lib/types.ts +92 -0
- package/src/modules/inventory/module.ts +202 -0
- package/src/modules/inventory/permissions.ts +3 -0
- package/src/modules/inventory/query/.gitkeep +0 -0
- package/src/modules/inventory/query/getInventoryAdjustment.generated.ts +5 -0
- package/src/modules/inventory/query/getInventoryAdjustment.test.ts +58 -0
- package/src/modules/inventory/query/getInventoryAdjustment.ts +16 -0
- package/src/modules/inventory/query/getInventoryCount.generated.ts +5 -0
- package/src/modules/inventory/query/getInventoryCount.test.ts +65 -0
- package/src/modules/inventory/query/getInventoryCount.ts +27 -0
- package/src/modules/inventory/query/getItemValuation.generated.ts +5 -0
- package/src/modules/inventory/query/getItemValuation.test.ts +72 -0
- package/src/modules/inventory/query/getItemValuation.ts +29 -0
- package/src/modules/inventory/query/getLot.generated.ts +5 -0
- package/src/modules/inventory/query/getLot.test.ts +62 -0
- package/src/modules/inventory/query/getLot.ts +28 -0
- package/src/modules/inventory/query/getSerialNumber.generated.ts +5 -0
- package/src/modules/inventory/query/getSerialNumber.test.ts +59 -0
- package/src/modules/inventory/query/getSerialNumber.ts +18 -0
- package/src/modules/inventory/query/getSerialNumberHistory.generated.ts +5 -0
- package/src/modules/inventory/query/getSerialNumberHistory.test.ts +80 -0
- package/src/modules/inventory/query/getSerialNumberHistory.ts +30 -0
- package/src/modules/inventory/query/getStockLevel.generated.ts +5 -0
- package/src/modules/inventory/query/getStockLevel.test.ts +70 -0
- package/src/modules/inventory/query/getStockLevel.ts +24 -0
- package/src/modules/inventory/query/getStockMovement.generated.ts +5 -0
- package/src/modules/inventory/query/getStockMovement.test.ts +62 -0
- package/src/modules/inventory/query/getStockMovement.ts +26 -0
- package/src/modules/inventory/query/getStorageLocation.generated.ts +5 -0
- package/src/modules/inventory/query/getStorageLocation.test.ts +54 -0
- package/src/modules/inventory/query/getStorageLocation.ts +26 -0
- package/src/modules/inventory/query/getValuationPolicy.generated.ts +5 -0
- package/src/modules/inventory/query/getValuationPolicy.test.ts +42 -0
- package/src/modules/inventory/query/getValuationPolicy.ts +16 -0
- package/src/modules/inventory/query/getWarehouse.generated.ts +5 -0
- package/src/modules/inventory/query/getWarehouse.test.ts +61 -0
- package/src/modules/inventory/query/getWarehouse.ts +26 -0
- package/src/modules/inventory/query/getWarehouseStockSummary.generated.ts +5 -0
- package/src/modules/inventory/query/getWarehouseStockSummary.test.ts +97 -0
- package/src/modules/inventory/query/getWarehouseStockSummary.ts +82 -0
- package/src/modules/inventory/query/listCostLayers.generated.ts +5 -0
- package/src/modules/inventory/query/listCostLayers.test.ts +58 -0
- package/src/modules/inventory/query/listCostLayers.ts +45 -0
- package/src/modules/inventory/query/listExpiringLots.generated.ts +5 -0
- package/src/modules/inventory/query/listExpiringLots.test.ts +70 -0
- package/src/modules/inventory/query/listExpiringLots.ts +74 -0
- package/src/modules/inventory/query/listInventoryAdjustments.generated.ts +5 -0
- package/src/modules/inventory/query/listInventoryAdjustments.test.ts +89 -0
- package/src/modules/inventory/query/listInventoryAdjustments.ts +59 -0
- package/src/modules/inventory/query/listInventoryCounts.generated.ts +5 -0
- package/src/modules/inventory/query/listInventoryCounts.test.ts +78 -0
- package/src/modules/inventory/query/listInventoryCounts.ts +55 -0
- package/src/modules/inventory/query/listItemValuations.generated.ts +5 -0
- package/src/modules/inventory/query/listItemValuations.test.ts +54 -0
- package/src/modules/inventory/query/listItemValuations.ts +39 -0
- package/src/modules/inventory/query/listLots.generated.ts +5 -0
- package/src/modules/inventory/query/listLots.test.ts +120 -0
- package/src/modules/inventory/query/listLots.ts +68 -0
- package/src/modules/inventory/query/listSerialNumbers.generated.ts +5 -0
- package/src/modules/inventory/query/listSerialNumbers.test.ts +58 -0
- package/src/modules/inventory/query/listSerialNumbers.ts +53 -0
- package/src/modules/inventory/query/listStockLevels.generated.ts +5 -0
- package/src/modules/inventory/query/listStockLevels.test.ts +73 -0
- package/src/modules/inventory/query/listStockLevels.ts +79 -0
- package/src/modules/inventory/query/listStockMovements.generated.ts +5 -0
- package/src/modules/inventory/query/listStockMovements.test.ts +98 -0
- package/src/modules/inventory/query/listStockMovements.ts +105 -0
- package/src/modules/inventory/query/listStorageLocations.generated.ts +5 -0
- package/src/modules/inventory/query/listStorageLocations.test.ts +70 -0
- package/src/modules/inventory/query/listStorageLocations.ts +53 -0
- package/src/modules/inventory/query/listValuationPolicies.generated.ts +5 -0
- package/src/modules/inventory/query/listValuationPolicies.test.ts +38 -0
- package/src/modules/inventory/query/listValuationPolicies.ts +39 -0
- package/src/modules/inventory/query/listWarehouses.generated.ts +5 -0
- package/src/modules/inventory/query/listWarehouses.test.ts +60 -0
- package/src/modules/inventory/query/listWarehouses.ts +39 -0
- package/src/modules/inventory/query/traceLotBackward.generated.ts +5 -0
- package/src/modules/inventory/query/traceLotBackward.test.ts +63 -0
- package/src/modules/inventory/query/traceLotBackward.ts +36 -0
- package/src/modules/inventory/query/traceLotForward.generated.ts +5 -0
- package/src/modules/inventory/query/traceLotForward.test.ts +63 -0
- package/src/modules/inventory/query/traceLotForward.ts +36 -0
- package/src/modules/inventory/tailor.config.ts +13 -0
- package/src/modules/inventory/tailor.d.ts +13 -0
- package/src/modules/inventory/testing/commandTestUtils.ts +29 -0
- package/src/modules/inventory/testing/fixtures.ts +412 -0
- package/src/modules/item-management/docs/models/{item.md → Item.md} +1 -1
- package/src/modules/primitives/seed/currencies.ts +22 -0
- package/src/modules/primitives/seed/exchangeRates.ts +22 -0
- package/src/modules/primitives/seed/index.ts +4 -0
- package/src/modules/primitives/seed/seed.test.ts +80 -0
- package/src/modules/primitives/seed/units.ts +62 -0
- package/src/modules/primitives/seed/uomCategories.ts +24 -0
- package/src/modules/purchase/README.md +63 -0
- package/src/modules/purchase/command/.gitkeep +0 -0
- package/src/modules/purchase/command/activatePurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/activatePurchasePaymentTerm.test.ts +53 -0
- package/src/modules/purchase/command/activatePurchasePaymentTerm.ts +39 -0
- package/src/modules/purchase/command/activatePurchasePriceList.generated.ts +6 -0
- package/src/modules/purchase/command/activatePurchasePriceList.test.ts +39 -0
- package/src/modules/purchase/command/activatePurchasePriceList.ts +32 -0
- package/src/modules/purchase/command/activatePurchasePriceRule.generated.ts +6 -0
- package/src/modules/purchase/command/activatePurchasePriceRule.test.ts +133 -0
- package/src/modules/purchase/command/activatePurchasePriceRule.ts +75 -0
- package/src/modules/purchase/command/approvePurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/approvePurchaseOrder.test.ts +161 -0
- package/src/modules/purchase/command/approvePurchaseOrder.ts +89 -0
- package/src/modules/purchase/command/cancelGoodsReceipt.generated.ts +6 -0
- package/src/modules/purchase/command/cancelGoodsReceipt.test.ts +37 -0
- package/src/modules/purchase/command/cancelGoodsReceipt.ts +29 -0
- package/src/modules/purchase/command/cancelPurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/cancelPurchaseBill.test.ts +101 -0
- package/src/modules/purchase/command/cancelPurchaseBill.ts +84 -0
- package/src/modules/purchase/command/cancelPurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/cancelPurchaseOrder.test.ts +119 -0
- package/src/modules/purchase/command/cancelPurchaseOrder.ts +65 -0
- package/src/modules/purchase/command/closePurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/closePurchaseOrder.test.ts +128 -0
- package/src/modules/purchase/command/closePurchaseOrder.ts +58 -0
- package/src/modules/purchase/command/createGoodsReceipt.generated.ts +6 -0
- package/src/modules/purchase/command/createGoodsReceipt.test.ts +233 -0
- package/src/modules/purchase/command/createGoodsReceipt.ts +93 -0
- package/src/modules/purchase/command/createPurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchaseBill.test.ts +277 -0
- package/src/modules/purchase/command/createPurchaseBill.ts +107 -0
- package/src/modules/purchase/command/createPurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchaseOrder.test.ts +291 -0
- package/src/modules/purchase/command/createPurchaseOrder.ts +131 -0
- package/src/modules/purchase/command/createPurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchasePaymentTerm.test.ts +140 -0
- package/src/modules/purchase/command/createPurchasePaymentTerm.ts +66 -0
- package/src/modules/purchase/command/createPurchasePriceList.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchasePriceList.test.ts +108 -0
- package/src/modules/purchase/command/createPurchasePriceList.ts +63 -0
- package/src/modules/purchase/command/createPurchasePriceRule.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchasePriceRule.test.ts +139 -0
- package/src/modules/purchase/command/createPurchasePriceRule.ts +95 -0
- package/src/modules/purchase/command/deactivatePurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/deactivatePurchasePaymentTerm.test.ts +49 -0
- package/src/modules/purchase/command/deactivatePurchasePaymentTerm.ts +41 -0
- package/src/modules/purchase/command/deactivatePurchasePriceList.generated.ts +6 -0
- package/src/modules/purchase/command/deactivatePurchasePriceList.test.ts +50 -0
- package/src/modules/purchase/command/deactivatePurchasePriceList.ts +32 -0
- package/src/modules/purchase/command/deactivatePurchasePriceRule.generated.ts +6 -0
- package/src/modules/purchase/command/deactivatePurchasePriceRule.test.ts +50 -0
- package/src/modules/purchase/command/deactivatePurchasePriceRule.ts +32 -0
- package/src/modules/purchase/command/matchPurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/matchPurchaseBill.test.ts +188 -0
- package/src/modules/purchase/command/matchPurchaseBill.ts +146 -0
- package/src/modules/purchase/command/postGoodsReceipt.generated.ts +6 -0
- package/src/modules/purchase/command/postGoodsReceipt.test.ts +210 -0
- package/src/modules/purchase/command/postGoodsReceipt.ts +143 -0
- package/src/modules/purchase/command/rejectPurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/rejectPurchaseOrder.test.ts +79 -0
- package/src/modules/purchase/command/rejectPurchaseOrder.ts +41 -0
- package/src/modules/purchase/command/releasePurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/releasePurchaseBill.test.ts +94 -0
- package/src/modules/purchase/command/releasePurchaseBill.ts +111 -0
- package/src/modules/purchase/command/setSupplierDefaultPurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/setSupplierDefaultPurchasePaymentTerm.test.ts +171 -0
- package/src/modules/purchase/command/setSupplierDefaultPurchasePaymentTerm.ts +90 -0
- package/src/modules/purchase/command/submitPurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/submitPurchaseOrder.test.ts +98 -0
- package/src/modules/purchase/command/submitPurchaseOrder.ts +73 -0
- package/src/modules/purchase/command/updateGoodsReceipt.generated.ts +6 -0
- package/src/modules/purchase/command/updateGoodsReceipt.test.ts +115 -0
- package/src/modules/purchase/command/updateGoodsReceipt.ts +73 -0
- package/src/modules/purchase/command/updatePurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchaseBill.test.ts +137 -0
- package/src/modules/purchase/command/updatePurchaseBill.ts +89 -0
- package/src/modules/purchase/command/updatePurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchaseOrder.test.ts +195 -0
- package/src/modules/purchase/command/updatePurchaseOrder.ts +121 -0
- package/src/modules/purchase/command/updatePurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchasePaymentTerm.test.ts +154 -0
- package/src/modules/purchase/command/updatePurchasePaymentTerm.ts +73 -0
- package/src/modules/purchase/command/updatePurchasePriceList.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchasePriceList.test.ts +73 -0
- package/src/modules/purchase/command/updatePurchasePriceList.ts +55 -0
- package/src/modules/purchase/command/updatePurchasePriceRule.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchasePriceRule.test.ts +191 -0
- package/src/modules/purchase/command/updatePurchasePriceRule.ts +104 -0
- package/src/modules/purchase/db/.gitkeep +0 -0
- package/src/modules/purchase/db/goodsReceipt.ts +62 -0
- package/src/modules/purchase/db/purchaseBill.ts +74 -0
- package/src/modules/purchase/db/purchaseOrder.ts +100 -0
- package/src/modules/purchase/db/purchasePaymentTerm.ts +46 -0
- package/src/modules/purchase/db/purchasePriceList.ts +53 -0
- package/src/modules/purchase/db/purchasePriceRule.ts +74 -0
- package/src/modules/purchase/db/supplierProfile.ts +59 -0
- package/src/modules/purchase/docs/commands/ActivatePurchasePaymentTerm.md +39 -0
- package/src/modules/purchase/docs/commands/ActivatePurchasePriceList.md +37 -0
- package/src/modules/purchase/docs/commands/ActivatePurchasePriceRule.md +47 -0
- package/src/modules/purchase/docs/commands/ApprovePurchaseOrder.md +55 -0
- package/src/modules/purchase/docs/commands/CancelGoodsReceipt.md +39 -0
- package/src/modules/purchase/docs/commands/CancelPurchaseBill.md +49 -0
- package/src/modules/purchase/docs/commands/CancelPurchaseOrder.md +47 -0
- package/src/modules/purchase/docs/commands/ClosePurchaseOrder.md +49 -0
- package/src/modules/purchase/docs/commands/CreateGoodsReceipt.md +54 -0
- package/src/modules/purchase/docs/commands/CreatePurchaseBill.md +59 -0
- package/src/modules/purchase/docs/commands/CreatePurchaseOrder.md +66 -0
- package/src/modules/purchase/docs/commands/CreatePurchasePaymentTerm.md +52 -0
- package/src/modules/purchase/docs/commands/CreatePurchasePriceList.md +48 -0
- package/src/modules/purchase/docs/commands/CreatePurchasePriceRule.md +62 -0
- package/src/modules/purchase/docs/commands/DeactivatePurchasePaymentTerm.md +42 -0
- package/src/modules/purchase/docs/commands/DeactivatePurchasePriceList.md +39 -0
- package/src/modules/purchase/docs/commands/DeactivatePurchasePriceRule.md +39 -0
- package/src/modules/purchase/docs/commands/MatchPurchaseBill.md +63 -0
- package/src/modules/purchase/docs/commands/PostGoodsReceipt.md +61 -0
- package/src/modules/purchase/docs/commands/RejectPurchaseOrder.md +44 -0
- package/src/modules/purchase/docs/commands/ReleasePurchaseBill.md +48 -0
- package/src/modules/purchase/docs/commands/SetSupplierDefaultPurchasePaymentTerm.md +50 -0
- package/src/modules/purchase/docs/commands/SubmitPurchaseOrder.md +51 -0
- package/src/modules/purchase/docs/commands/UpdateGoodsReceipt.md +48 -0
- package/src/modules/purchase/docs/commands/UpdatePurchaseBill.md +51 -0
- package/src/modules/purchase/docs/commands/UpdatePurchaseOrder.md +59 -0
- package/src/modules/purchase/docs/commands/UpdatePurchasePaymentTerm.md +51 -0
- package/src/modules/purchase/docs/commands/UpdatePurchasePriceList.md +43 -0
- package/src/modules/purchase/docs/commands/UpdatePurchasePriceRule.md +60 -0
- package/src/modules/purchase/docs/features/goods-receipt-matching.md +71 -0
- package/src/modules/purchase/docs/features/purchase-order-lifecycle.md +87 -0
- package/src/modules/purchase/docs/features/purchase-payment-terms.md +67 -0
- package/src/modules/purchase/docs/features/supplier-bill-matching.md +79 -0
- package/src/modules/purchase/docs/features/supplier-purchase-pricing.md +72 -0
- package/src/modules/purchase/docs/models/GoodsReceipt.md +58 -0
- package/src/modules/purchase/docs/models/PurchaseBill.md +68 -0
- package/src/modules/purchase/docs/models/PurchaseOrder.md +88 -0
- package/src/modules/purchase/docs/models/PurchasePaymentTerm.md +59 -0
- package/src/modules/purchase/docs/models/PurchasePriceList.md +53 -0
- package/src/modules/purchase/docs/models/PurchasePriceRule.md +58 -0
- package/src/modules/purchase/docs/models/SupplierProfile.md +37 -0
- package/src/modules/purchase/docs/queries/CalculatePurchaseBillDueSchedule.md +47 -0
- package/src/modules/purchase/docs/queries/CalculatePurchasePrice.md +53 -0
- package/src/modules/purchase/docs/queries/GetGoodsReceipt.md +36 -0
- package/src/modules/purchase/docs/queries/GetPurchaseBill.md +41 -0
- package/src/modules/purchase/docs/queries/GetPurchaseOrder.md +42 -0
- package/src/modules/purchase/docs/queries/GetPurchasePaymentTerm.md +36 -0
- package/src/modules/purchase/docs/queries/GetPurchasePriceList.md +36 -0
- package/src/modules/purchase/docs/queries/GetSupplierProfile.md +36 -0
- package/src/modules/purchase/executor/.gitkeep +0 -0
- package/src/modules/purchase/generated/.gitkeep +0 -0
- package/src/modules/purchase/generated/enums.ts +63 -0
- package/src/modules/purchase/generated/kysely-tailordb.ts +186 -0
- package/src/modules/purchase/index.ts +2 -0
- package/src/modules/purchase/lib/_db_deps.ts +77 -0
- package/src/modules/purchase/lib/domain.ts +467 -0
- package/src/modules/purchase/lib/errors.generated.ts +367 -0
- package/src/modules/purchase/lib/permissions.generated.ts +34 -0
- package/src/modules/purchase/lib/types.ts +65 -0
- package/src/modules/purchase/module.ts +218 -0
- package/src/modules/purchase/permissions.ts +1 -0
- package/src/modules/purchase/query/.gitkeep +0 -0
- package/src/modules/purchase/query/calculatePurchaseBillDueSchedule.generated.ts +5 -0
- package/src/modules/purchase/query/calculatePurchaseBillDueSchedule.test.ts +183 -0
- package/src/modules/purchase/query/calculatePurchaseBillDueSchedule.ts +41 -0
- package/src/modules/purchase/query/calculatePurchasePrice.generated.ts +5 -0
- package/src/modules/purchase/query/calculatePurchasePrice.test.ts +143 -0
- package/src/modules/purchase/query/calculatePurchasePrice.ts +113 -0
- package/src/modules/purchase/query/getGoodsReceipt.generated.ts +5 -0
- package/src/modules/purchase/query/getGoodsReceipt.test.ts +42 -0
- package/src/modules/purchase/query/getGoodsReceipt.ts +27 -0
- package/src/modules/purchase/query/getPurchaseBill.generated.ts +5 -0
- package/src/modules/purchase/query/getPurchaseBill.test.ts +69 -0
- package/src/modules/purchase/query/getPurchaseBill.ts +35 -0
- package/src/modules/purchase/query/getPurchaseOrder.generated.ts +5 -0
- package/src/modules/purchase/query/getPurchaseOrder.test.ts +65 -0
- package/src/modules/purchase/query/getPurchaseOrder.ts +33 -0
- package/src/modules/purchase/query/getPurchasePaymentTerm.generated.ts +5 -0
- package/src/modules/purchase/query/getPurchasePaymentTerm.test.ts +44 -0
- package/src/modules/purchase/query/getPurchasePaymentTerm.ts +30 -0
- package/src/modules/purchase/query/getPurchasePriceList.generated.ts +5 -0
- package/src/modules/purchase/query/getPurchasePriceList.test.ts +48 -0
- package/src/modules/purchase/query/getPurchasePriceList.ts +30 -0
- package/src/modules/purchase/query/getSupplierProfile.generated.ts +5 -0
- package/src/modules/purchase/query/getSupplierProfile.test.ts +50 -0
- package/src/modules/purchase/query/getSupplierProfile.ts +18 -0
- package/src/modules/purchase/tailor.config.ts +13 -0
- package/src/modules/purchase/tailor.d.ts +13 -0
- package/src/modules/purchase/testing/commandTestUtils.ts +35 -0
- package/src/modules/purchase/testing/fixtures.ts +317 -0
- package/src/modules/sales/README.md +69 -0
- package/src/modules/sales/command/.gitkeep +0 -0
- package/src/modules/sales/command/activateChannel.generated.ts +6 -0
- package/src/modules/sales/command/activateChannel.test.ts +70 -0
- package/src/modules/sales/command/activateChannel.ts +48 -0
- package/src/modules/sales/command/activateListing.generated.ts +6 -0
- package/src/modules/sales/command/activateListing.test.ts +87 -0
- package/src/modules/sales/command/activateListing.ts +49 -0
- package/src/modules/sales/command/activateSalesPaymentTerm.generated.ts +6 -0
- package/src/modules/sales/command/activateSalesPaymentTerm.test.ts +58 -0
- package/src/modules/sales/command/activateSalesPaymentTerm.ts +50 -0
- package/src/modules/sales/command/activateSalesPriceList.generated.ts +6 -0
- package/src/modules/sales/command/activateSalesPriceList.test.ts +55 -0
- package/src/modules/sales/command/activateSalesPriceList.ts +46 -0
- package/src/modules/sales/command/activateSalesPriceRule.generated.ts +6 -0
- package/src/modules/sales/command/activateSalesPriceRule.test.ts +83 -0
- package/src/modules/sales/command/activateSalesPriceRule.ts +58 -0
- package/src/modules/sales/command/cancelChannelOrder.generated.ts +6 -0
- package/src/modules/sales/command/cancelChannelOrder.test.ts +47 -0
- package/src/modules/sales/command/cancelChannelOrder.ts +30 -0
- package/src/modules/sales/command/cancelSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/cancelSalesInvoice.test.ts +47 -0
- package/src/modules/sales/command/cancelSalesInvoice.ts +37 -0
- package/src/modules/sales/command/cancelSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/cancelSalesOrder.test.ts +70 -0
- package/src/modules/sales/command/cancelSalesOrder.ts +48 -0
- package/src/modules/sales/command/cancelSyncJob.generated.ts +6 -0
- package/src/modules/sales/command/cancelSyncJob.test.ts +58 -0
- package/src/modules/sales/command/cancelSyncJob.ts +30 -0
- package/src/modules/sales/command/closeSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/closeSalesOrder.test.ts +41 -0
- package/src/modules/sales/command/closeSalesOrder.ts +51 -0
- package/src/modules/sales/command/confirmSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/confirmSalesOrder.test.ts +68 -0
- package/src/modules/sales/command/confirmSalesOrder.ts +67 -0
- package/src/modules/sales/command/convertChannelOrder.generated.ts +6 -0
- package/src/modules/sales/command/convertChannelOrder.test.ts +118 -0
- package/src/modules/sales/command/convertChannelOrder.ts +151 -0
- package/src/modules/sales/command/createChannel.generated.ts +6 -0
- package/src/modules/sales/command/createChannel.test.ts +100 -0
- package/src/modules/sales/command/createChannel.ts +58 -0
- package/src/modules/sales/command/createListing.generated.ts +6 -0
- package/src/modules/sales/command/createListing.test.ts +88 -0
- package/src/modules/sales/command/createListing.ts +76 -0
- package/src/modules/sales/command/createSalesCreditNote.generated.ts +6 -0
- package/src/modules/sales/command/createSalesCreditNote.test.ts +56 -0
- package/src/modules/sales/command/createSalesCreditNote.ts +75 -0
- package/src/modules/sales/command/createSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/createSalesInvoice.test.ts +85 -0
- package/src/modules/sales/command/createSalesInvoice.ts +94 -0
- package/src/modules/sales/command/createSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/createSalesOrder.test.ts +134 -0
- package/src/modules/sales/command/createSalesOrder.ts +140 -0
- package/src/modules/sales/command/createSalesPaymentTerm.generated.ts +6 -0
- package/src/modules/sales/command/createSalesPaymentTerm.test.ts +59 -0
- package/src/modules/sales/command/createSalesPaymentTerm.ts +50 -0
- package/src/modules/sales/command/createSalesPriceList.generated.ts +6 -0
- package/src/modules/sales/command/createSalesPriceList.test.ts +67 -0
- package/src/modules/sales/command/createSalesPriceList.ts +45 -0
- package/src/modules/sales/command/createSalesPriceRule.generated.ts +6 -0
- package/src/modules/sales/command/createSalesPriceRule.test.ts +137 -0
- package/src/modules/sales/command/createSalesPriceRule.ts +66 -0
- package/src/modules/sales/command/createShipment.generated.ts +6 -0
- package/src/modules/sales/command/createShipment.test.ts +75 -0
- package/src/modules/sales/command/createShipment.ts +86 -0
- package/src/modules/sales/command/deactivateChannel.generated.ts +6 -0
- package/src/modules/sales/command/deactivateChannel.test.ts +29 -0
- package/src/modules/sales/command/deactivateChannel.ts +30 -0
- package/src/modules/sales/command/deactivateSalesPaymentTerm.generated.ts +6 -0
- package/src/modules/sales/command/deactivateSalesPaymentTerm.test.ts +29 -0
- package/src/modules/sales/command/deactivateSalesPaymentTerm.ts +37 -0
- package/src/modules/sales/command/deactivateSalesPriceList.generated.ts +6 -0
- package/src/modules/sales/command/deactivateSalesPriceList.test.ts +33 -0
- package/src/modules/sales/command/deactivateSalesPriceList.ts +37 -0
- package/src/modules/sales/command/deactivateSalesPriceRule.generated.ts +6 -0
- package/src/modules/sales/command/deactivateSalesPriceRule.test.ts +33 -0
- package/src/modules/sales/command/deactivateSalesPriceRule.ts +37 -0
- package/src/modules/sales/command/issueSalesCreditNote.generated.ts +6 -0
- package/src/modules/sales/command/issueSalesCreditNote.test.ts +62 -0
- package/src/modules/sales/command/issueSalesCreditNote.ts +71 -0
- package/src/modules/sales/command/issueSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/issueSalesInvoice.test.ts +88 -0
- package/src/modules/sales/command/issueSalesInvoice.ts +115 -0
- package/src/modules/sales/command/markChannelOrderException.generated.ts +6 -0
- package/src/modules/sales/command/markChannelOrderException.test.ts +59 -0
- package/src/modules/sales/command/markChannelOrderException.ts +49 -0
- package/src/modules/sales/command/pauseListing.generated.ts +6 -0
- package/src/modules/sales/command/pauseListing.test.ts +40 -0
- package/src/modules/sales/command/pauseListing.ts +30 -0
- package/src/modules/sales/command/placeSalesOrderOnCreditHold.generated.ts +6 -0
- package/src/modules/sales/command/placeSalesOrderOnCreditHold.test.ts +74 -0
- package/src/modules/sales/command/placeSalesOrderOnCreditHold.ts +46 -0
- package/src/modules/sales/command/postShipment.generated.ts +6 -0
- package/src/modules/sales/command/postShipment.test.ts +97 -0
- package/src/modules/sales/command/postShipment.ts +89 -0
- package/src/modules/sales/command/recordChannelOrder.generated.ts +6 -0
- package/src/modules/sales/command/recordChannelOrder.test.ts +124 -0
- package/src/modules/sales/command/recordChannelOrder.ts +93 -0
- package/src/modules/sales/command/rejectSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/rejectSalesOrder.test.ts +78 -0
- package/src/modules/sales/command/rejectSalesOrder.ts +42 -0
- package/src/modules/sales/command/releaseSalesOrderCreditHold.generated.ts +6 -0
- package/src/modules/sales/command/releaseSalesOrderCreditHold.test.ts +50 -0
- package/src/modules/sales/command/releaseSalesOrderCreditHold.ts +51 -0
- package/src/modules/sales/command/retireListing.generated.ts +6 -0
- package/src/modules/sales/command/retireListing.test.ts +42 -0
- package/src/modules/sales/command/retireListing.ts +30 -0
- package/src/modules/sales/command/retrySyncJob.generated.ts +6 -0
- package/src/modules/sales/command/retrySyncJob.test.ts +54 -0
- package/src/modules/sales/command/retrySyncJob.ts +44 -0
- package/src/modules/sales/command/sendSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/sendSalesInvoice.test.ts +50 -0
- package/src/modules/sales/command/sendSalesInvoice.ts +43 -0
- package/src/modules/sales/command/startSyncJob.generated.ts +6 -0
- package/src/modules/sales/command/startSyncJob.test.ts +65 -0
- package/src/modules/sales/command/startSyncJob.ts +54 -0
- package/src/modules/sales/command/submitSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/submitSalesOrder.test.ts +58 -0
- package/src/modules/sales/command/submitSalesOrder.ts +49 -0
- package/src/modules/sales/command/updateChannel.generated.ts +6 -0
- package/src/modules/sales/command/updateChannel.test.ts +71 -0
- package/src/modules/sales/command/updateChannel.ts +68 -0
- package/src/modules/sales/command/updateListing.generated.ts +6 -0
- package/src/modules/sales/command/updateListing.test.ts +56 -0
- package/src/modules/sales/command/updateListing.ts +60 -0
- package/src/modules/sales/command/updateSalesCreditNote.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesCreditNote.test.ts +68 -0
- package/src/modules/sales/command/updateSalesCreditNote.ts +68 -0
- package/src/modules/sales/command/updateSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesInvoice.test.ts +73 -0
- package/src/modules/sales/command/updateSalesInvoice.ts +80 -0
- package/src/modules/sales/command/updateSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesOrder.test.ts +93 -0
- package/src/modules/sales/command/updateSalesOrder.ts +121 -0
- package/src/modules/sales/command/updateSalesPaymentTerm.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesPaymentTerm.test.ts +66 -0
- package/src/modules/sales/command/updateSalesPaymentTerm.ts +59 -0
- package/src/modules/sales/command/updateSalesPriceList.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesPriceList.test.ts +71 -0
- package/src/modules/sales/command/updateSalesPriceList.ts +52 -0
- package/src/modules/sales/command/updateSalesPriceRule.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesPriceRule.test.ts +95 -0
- package/src/modules/sales/command/updateSalesPriceRule.ts +81 -0
- package/src/modules/sales/command/updateShipment.generated.ts +6 -0
- package/src/modules/sales/command/updateShipment.test.ts +78 -0
- package/src/modules/sales/command/updateShipment.ts +84 -0
- package/src/modules/sales/db/.gitkeep +0 -0
- package/src/modules/sales/db/channel.ts +43 -0
- package/src/modules/sales/db/channelOrder.ts +109 -0
- package/src/modules/sales/db/channelOrderLine.ts +84 -0
- package/src/modules/sales/db/listing.ts +81 -0
- package/src/modules/sales/db/salesCreditNote.ts +63 -0
- package/src/modules/sales/db/salesCreditNoteLine.ts +49 -0
- package/src/modules/sales/db/salesInvoice.ts +95 -0
- package/src/modules/sales/db/salesInvoiceLine.ts +64 -0
- package/src/modules/sales/db/salesOrder.ts +103 -0
- package/src/modules/sales/db/salesOrderLine.ts +82 -0
- package/src/modules/sales/db/salesPaymentTerm.ts +46 -0
- package/src/modules/sales/db/salesPriceList.ts +61 -0
- package/src/modules/sales/db/salesPriceRule.ts +96 -0
- package/src/modules/sales/db/shipment.ts +78 -0
- package/src/modules/sales/db/shipmentLine.ts +58 -0
- package/src/modules/sales/db/syncJob.ts +70 -0
- package/src/modules/sales/docs/commands/ActivateChannel.md +42 -0
- package/src/modules/sales/docs/commands/ActivateListing.md +46 -0
- package/src/modules/sales/docs/commands/ActivateSalesPaymentTerm.md +41 -0
- package/src/modules/sales/docs/commands/ActivateSalesPriceList.md +39 -0
- package/src/modules/sales/docs/commands/ActivateSalesPriceRule.md +48 -0
- package/src/modules/sales/docs/commands/CancelChannelOrder.md +37 -0
- package/src/modules/sales/docs/commands/CancelSalesInvoice.md +39 -0
- package/src/modules/sales/docs/commands/CancelSalesOrder.md +40 -0
- package/src/modules/sales/docs/commands/CancelSyncJob.md +36 -0
- package/src/modules/sales/docs/commands/CloseSalesOrder.md +39 -0
- package/src/modules/sales/docs/commands/ConfirmSalesOrder.md +43 -0
- package/src/modules/sales/docs/commands/ConvertChannelOrder.md +44 -0
- package/src/modules/sales/docs/commands/CreateChannel.md +40 -0
- package/src/modules/sales/docs/commands/CreateListing.md +40 -0
- package/src/modules/sales/docs/commands/CreateSalesCreditNote.md +37 -0
- package/src/modules/sales/docs/commands/CreateSalesInvoice.md +39 -0
- package/src/modules/sales/docs/commands/CreateSalesOrder.md +51 -0
- package/src/modules/sales/docs/commands/CreateSalesPaymentTerm.md +38 -0
- package/src/modules/sales/docs/commands/CreateSalesPriceList.md +37 -0
- package/src/modules/sales/docs/commands/CreateSalesPriceRule.md +46 -0
- package/src/modules/sales/docs/commands/CreateShipment.md +38 -0
- package/src/modules/sales/docs/commands/DeactivateChannel.md +35 -0
- package/src/modules/sales/docs/commands/DeactivateSalesPaymentTerm.md +35 -0
- package/src/modules/sales/docs/commands/DeactivateSalesPriceList.md +35 -0
- package/src/modules/sales/docs/commands/DeactivateSalesPriceRule.md +35 -0
- package/src/modules/sales/docs/commands/IssueSalesCreditNote.md +38 -0
- package/src/modules/sales/docs/commands/IssueSalesInvoice.md +43 -0
- package/src/modules/sales/docs/commands/MarkChannelOrderException.md +37 -0
- package/src/modules/sales/docs/commands/PauseListing.md +36 -0
- package/src/modules/sales/docs/commands/PlaceSalesOrderOnCreditHold.md +41 -0
- package/src/modules/sales/docs/commands/PostShipment.md +41 -0
- package/src/modules/sales/docs/commands/RecordChannelOrder.md +45 -0
- package/src/modules/sales/docs/commands/RejectSalesOrder.md +41 -0
- package/src/modules/sales/docs/commands/ReleaseSalesOrderCreditHold.md +36 -0
- package/src/modules/sales/docs/commands/RetireListing.md +36 -0
- package/src/modules/sales/docs/commands/RetrySyncJob.md +39 -0
- package/src/modules/sales/docs/commands/SendSalesInvoice.md +38 -0
- package/src/modules/sales/docs/commands/StartSyncJob.md +39 -0
- package/src/modules/sales/docs/commands/SubmitSalesOrder.md +43 -0
- package/src/modules/sales/docs/commands/UpdateChannel.md +43 -0
- package/src/modules/sales/docs/commands/UpdateListing.md +38 -0
- package/src/modules/sales/docs/commands/UpdateSalesCreditNote.md +38 -0
- package/src/modules/sales/docs/commands/UpdateSalesInvoice.md +38 -0
- package/src/modules/sales/docs/commands/UpdateSalesOrder.md +45 -0
- package/src/modules/sales/docs/commands/UpdateSalesPaymentTerm.md +41 -0
- package/src/modules/sales/docs/commands/UpdateSalesPriceList.md +40 -0
- package/src/modules/sales/docs/commands/UpdateSalesPriceRule.md +49 -0
- package/src/modules/sales/docs/commands/UpdateShipment.md +38 -0
- package/src/modules/sales/docs/commands/bin/rm.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/bin/codex.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/bin/ps2ps2.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/bin/rg.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/bin/sha384sum.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/opt/libpq/bin/pg_combinebackup.md +52 -0
- package/src/modules/sales/docs/commands/sbin/mount_msdos.md +52 -0
- package/src/modules/sales/docs/commands/sbin/mount_nfs.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/cupstestppd.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/enc2xs.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/hash.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/jarsigner.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/mpsgraphtool.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/nano.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/pod2html5.34.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/ri.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/rs.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/trustcachectl.md +52 -0
- package/src/modules/sales/docs/commands/usr/sbin/htpasswd.md +52 -0
- package/src/modules/sales/docs/commands/usr/sbin/lpadmin.md +52 -0
- package/src/modules/sales/docs/commands/usr/sbin/setkey.md +52 -0
- package/src/modules/sales/docs/features/channel-listing-management.md +68 -0
- package/src/modules/sales/docs/features/channel-order-sync.md +78 -0
- package/src/modules/sales/docs/features/customer-invoicing.md +89 -0
- package/src/modules/sales/docs/features/customer-sales-pricing.md +72 -0
- package/src/modules/sales/docs/features/sales-order-lifecycle.md +96 -0
- package/src/modules/sales/docs/features/sales-payment-terms.md +67 -0
- package/src/modules/sales/docs/features/shipment-fulfillment.md +71 -0
- package/src/modules/sales/docs/models/Channel.md +48 -0
- package/src/modules/sales/docs/models/ChannelOrder.md +56 -0
- package/src/modules/sales/docs/models/ChannelOrderLine.md +39 -0
- package/src/modules/sales/docs/models/Listing.md +56 -0
- package/src/modules/sales/docs/models/SalesCreditNote.md +47 -0
- package/src/modules/sales/docs/models/SalesCreditNoteLine.md +37 -0
- package/src/modules/sales/docs/models/SalesInvoice.md +55 -0
- package/src/modules/sales/docs/models/SalesInvoiceLine.md +39 -0
- package/src/modules/sales/docs/models/SalesOrder.md +79 -0
- package/src/modules/sales/docs/models/SalesOrderLine.md +42 -0
- package/src/modules/sales/docs/models/SalesPaymentTerm.md +53 -0
- package/src/modules/sales/docs/models/SalesPriceList.md +50 -0
- package/src/modules/sales/docs/models/SalesPriceRule.md +51 -0
- package/src/modules/sales/docs/models/Shipment.md +49 -0
- package/src/modules/sales/docs/models/ShipmentLine.md +38 -0
- package/src/modules/sales/docs/models/SyncJob.md +53 -0
- package/src/modules/sales/docs/queries/CalculateInvoiceDueSchedule.md +37 -0
- package/src/modules/sales/docs/queries/GetApplicableSalesPrice.md +38 -0
- package/src/modules/sales/docs/queries/GetChannel.md +34 -0
- package/src/modules/sales/docs/queries/GetChannelOrder.md +34 -0
- package/src/modules/sales/docs/queries/GetListing.md +34 -0
- package/src/modules/sales/docs/queries/GetListingByExternalIdentifier.md +35 -0
- package/src/modules/sales/docs/queries/GetSalesCreditNote.md +34 -0
- package/src/modules/sales/docs/queries/GetSalesInvoice.md +34 -0
- package/src/modules/sales/docs/queries/GetSalesOrder.md +36 -0
- package/src/modules/sales/docs/queries/GetSalesPaymentTerm.md +34 -0
- package/src/modules/sales/docs/queries/GetSalesPriceList.md +34 -0
- package/src/modules/sales/docs/queries/GetShipment.md +34 -0
- package/src/modules/sales/docs/queries/GetSyncJob.md +34 -0
- package/src/modules/sales/docs/queries/ListChannelOrdersByStatus.md +34 -0
- package/src/modules/sales/docs/queries/ListChannels.md +33 -0
- package/src/modules/sales/docs/queries/ListListingsByChannel.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesCreditNotesByInvoice.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesInvoicesBySalesOrder.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesOrders.md +36 -0
- package/src/modules/sales/docs/queries/ListSalesPaymentTerms.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesPriceLists.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesPriceRulesByPriceList.md +33 -0
- package/src/modules/sales/docs/queries/ListShipmentsBySalesOrder.md +33 -0
- package/src/modules/sales/docs/queries/ListSyncJobs.md +34 -0
- package/src/modules/sales/executor/.gitkeep +0 -0
- package/src/modules/sales/generated/.gitkeep +0 -0
- package/src/modules/sales/generated/enums.ts +119 -0
- package/src/modules/sales/generated/kysely-tailordb.ts +332 -0
- package/src/modules/sales/index.ts +2 -0
- package/src/modules/sales/lib/_db_deps.ts +67 -0
- package/src/modules/sales/lib/domain.ts +354 -0
- package/src/modules/sales/lib/errors.generated.ts +417 -0
- package/src/modules/sales/lib/permissions.generated.ts +53 -0
- package/src/modules/sales/lib/repository.ts +137 -0
- package/src/modules/sales/lib/types.ts +105 -0
- package/src/modules/sales/module.ts +418 -0
- package/src/modules/sales/permissions.ts +3 -0
- package/src/modules/sales/query/.gitkeep +0 -0
- package/src/modules/sales/query/calculateInvoiceDueSchedule.generated.ts +5 -0
- package/src/modules/sales/query/calculateInvoiceDueSchedule.test.ts +107 -0
- package/src/modules/sales/query/calculateInvoiceDueSchedule.ts +35 -0
- package/src/modules/sales/query/getApplicableSalesPrice.generated.ts +5 -0
- package/src/modules/sales/query/getApplicableSalesPrice.test.ts +110 -0
- package/src/modules/sales/query/getApplicableSalesPrice.ts +81 -0
- package/src/modules/sales/query/getChannel.generated.ts +5 -0
- package/src/modules/sales/query/getChannel.test.ts +39 -0
- package/src/modules/sales/query/getChannel.ts +15 -0
- package/src/modules/sales/query/getChannelOrder.generated.ts +5 -0
- package/src/modules/sales/query/getChannelOrder.test.ts +50 -0
- package/src/modules/sales/query/getChannelOrder.ts +29 -0
- package/src/modules/sales/query/getListing.generated.ts +5 -0
- package/src/modules/sales/query/getListing.test.ts +39 -0
- package/src/modules/sales/query/getListing.ts +15 -0
- package/src/modules/sales/query/getListingByExternalIdentifier.generated.ts +5 -0
- package/src/modules/sales/query/getListingByExternalIdentifier.test.ts +61 -0
- package/src/modules/sales/query/getListingByExternalIdentifier.ts +23 -0
- package/src/modules/sales/query/getSalesCreditNote.generated.ts +5 -0
- package/src/modules/sales/query/getSalesCreditNote.test.ts +44 -0
- package/src/modules/sales/query/getSalesCreditNote.ts +14 -0
- package/src/modules/sales/query/getSalesInvoice.generated.ts +5 -0
- package/src/modules/sales/query/getSalesInvoice.test.ts +44 -0
- package/src/modules/sales/query/getSalesInvoice.ts +14 -0
- package/src/modules/sales/query/getSalesOrder.generated.ts +5 -0
- package/src/modules/sales/query/getSalesOrder.test.ts +57 -0
- package/src/modules/sales/query/getSalesOrder.ts +20 -0
- package/src/modules/sales/query/getSalesPaymentTerm.generated.ts +5 -0
- package/src/modules/sales/query/getSalesPaymentTerm.test.ts +44 -0
- package/src/modules/sales/query/getSalesPaymentTerm.ts +24 -0
- package/src/modules/sales/query/getSalesPriceList.generated.ts +5 -0
- package/src/modules/sales/query/getSalesPriceList.test.ts +39 -0
- package/src/modules/sales/query/getSalesPriceList.ts +15 -0
- package/src/modules/sales/query/getShipment.generated.ts +5 -0
- package/src/modules/sales/query/getShipment.test.ts +44 -0
- package/src/modules/sales/query/getShipment.ts +12 -0
- package/src/modules/sales/query/getSyncJob.generated.ts +5 -0
- package/src/modules/sales/query/getSyncJob.test.ts +43 -0
- package/src/modules/sales/query/getSyncJob.ts +24 -0
- package/src/modules/sales/query/listChannelOrdersByStatus.generated.ts +5 -0
- package/src/modules/sales/query/listChannelOrdersByStatus.test.ts +58 -0
- package/src/modules/sales/query/listChannelOrdersByStatus.ts +53 -0
- package/src/modules/sales/query/listChannels.generated.ts +5 -0
- package/src/modules/sales/query/listChannels.test.ts +36 -0
- package/src/modules/sales/query/listChannels.ts +39 -0
- package/src/modules/sales/query/listListingsByChannel.generated.ts +5 -0
- package/src/modules/sales/query/listListingsByChannel.test.ts +36 -0
- package/src/modules/sales/query/listListingsByChannel.ts +39 -0
- package/src/modules/sales/query/listSalesCreditNotesByInvoice.generated.ts +5 -0
- package/src/modules/sales/query/listSalesCreditNotesByInvoice.test.ts +36 -0
- package/src/modules/sales/query/listSalesCreditNotesByInvoice.ts +42 -0
- package/src/modules/sales/query/listSalesInvoicesBySalesOrder.generated.ts +5 -0
- package/src/modules/sales/query/listSalesInvoicesBySalesOrder.test.ts +36 -0
- package/src/modules/sales/query/listSalesInvoicesBySalesOrder.ts +42 -0
- package/src/modules/sales/query/listSalesOrders.generated.ts +5 -0
- package/src/modules/sales/query/listSalesOrders.test.ts +79 -0
- package/src/modules/sales/query/listSalesOrders.ts +67 -0
- package/src/modules/sales/query/listSalesPaymentTerms.generated.ts +5 -0
- package/src/modules/sales/query/listSalesPaymentTerms.test.ts +36 -0
- package/src/modules/sales/query/listSalesPaymentTerms.ts +42 -0
- package/src/modules/sales/query/listSalesPriceLists.generated.ts +5 -0
- package/src/modules/sales/query/listSalesPriceLists.test.ts +36 -0
- package/src/modules/sales/query/listSalesPriceLists.ts +39 -0
- package/src/modules/sales/query/listSalesPriceRulesByPriceList.generated.ts +5 -0
- package/src/modules/sales/query/listSalesPriceRulesByPriceList.test.ts +39 -0
- package/src/modules/sales/query/listSalesPriceRulesByPriceList.ts +47 -0
- package/src/modules/sales/query/listShipmentsBySalesOrder.generated.ts +5 -0
- package/src/modules/sales/query/listShipmentsBySalesOrder.test.ts +36 -0
- package/src/modules/sales/query/listShipmentsBySalesOrder.ts +36 -0
- package/src/modules/sales/query/listSyncJobs.generated.ts +5 -0
- package/src/modules/sales/query/listSyncJobs.test.ts +50 -0
- package/src/modules/sales/query/listSyncJobs.ts +47 -0
- package/src/modules/sales/tailor.config.ts +13 -0
- package/src/modules/sales/tailor.d.ts +13 -0
- package/src/modules/sales/testing/commandTestUtils.ts +35 -0
- package/src/modules/sales/testing/fixtures.ts +520 -0
- package/src/modules/user-management/command/.gitkeep +0 -0
- package/src/modules/user-management/db/.gitkeep +0 -0
- package/src/modules/user-management/executor/.gitkeep +0 -0
- package/src/modules/user-management/generated/.gitkeep +0 -0
- package/src/modules/user-management/lib/errors.generated.ts +0 -5
- package/src/modules/user-management/lib/recomputeUserPermissions.ts +4 -2
- package/src/modules/user-management/permissions.ts +3 -0
- package/src/modules/user-management/query/.gitkeep +0 -0
- package/src/modules/user-management/query/listRolePermissionsByRole.generated.ts +5 -0
- package/src/modules/user-management/query/listRolePermissionsByRole.test.ts +20 -0
- package/src/modules/user-management/query/listRolePermissionsByRole.ts +28 -0
- package/src/modules/user-management/query/listUserRolesByUser.generated.ts +5 -0
- package/src/modules/user-management/query/listUserRolesByUser.test.ts +20 -0
- package/src/modules/user-management/query/listUserRolesByUser.ts +28 -0
- package/src/schemas.ts +6 -6
- package/src/shared/defineCommand.ts +1 -1
- package/src/shared/entityTypes.ts +1 -1
- package/src/shared/uuidv5.test.ts +18 -0
- package/src/shared/uuidv5.ts +23 -0
- package/src/testing/index.ts +1 -1
- package/templates/scaffold/app/backend/package.json +1 -3
- package/templates/scaffold/app/backend/seed/exec.mjs +7 -5
- package/templates/scaffold/app/backend/src/generated/kysely-tailordb.ts +0 -11
- package/templates/scaffold/module/__dot__gitignore +3 -0
- package/templates/scaffold/module/eslint.config.js +31 -0
- package/templates/scaffold/module/generated/kysely-tailordb.ts +3 -0
- package/templates/scaffold/module/lib/types.ts +1 -6
- package/templates/scaffold/module/package.json +26 -0
- package/templates/scaffold/module/seed/index.ts +19 -0
- package/templates/scaffold/module/tsconfig.json +16 -0
- /package/schemas/{app-compose → app}/actors.yml +0 -0
- /package/schemas/{app-compose → app}/business-flow.yml +0 -0
- /package/schemas/{app-compose → app}/requirements.yml +0 -0
- /package/schemas/{app-compose → app}/resolver.yml +0 -0
- /package/schemas/{app-compose → app}/screen.yml +0 -0
- /package/schemas/{app-compose → app}/story.yml +0 -0
- /package/src/modules/{purchase → inventory/command}/.gitkeep +0 -0
- /package/{templates/scaffold/module/generated → src/modules/inventory/db}/.gitkeep +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Stock Movement
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Stock movements record the physical flow of goods across locations in the warehouse system. Every time inventory enters, leaves, or moves within the organization, a stock move record is created to capture the transaction. There are three movement types: goods receipts (inbound from suppliers), goods issues (outbound to customers or scrap), and internal transfers (between internal locations). Additionally, block and unblock operations shift stock between available and blocked states without physically moving it.
|
|
6
|
+
|
|
7
|
+
Each movement follows a DRAFT to CONFIRMED to DONE state machine, ensuring that moves are reviewed before execution. When a movement reaches the DONE state, it automatically updates stock levels at both the source and destination locations via the stock-tracking feature. Virtual locations (supplier, customer, scrap) serve as logical endpoints for receipts and issues where no physical stock is tracked.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Provide a complete audit trail of all inventory changes with who, what, when, where, and why
|
|
12
|
+
- Enable goods receipt processing to increase on-hand stock when items arrive from suppliers
|
|
13
|
+
- Enable goods issue processing to decrease on-hand stock when items are shipped to customers or scrapped
|
|
14
|
+
- Support internal transfers to rebalance stock across warehouses, zones, or bin locations
|
|
15
|
+
- Enforce a confirmation workflow so movements can be reviewed before stock levels are affected
|
|
16
|
+
- Feed downstream processes such as inventory valuation, lot/batch tracking, and serial number tracking with movement data
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Create Movement] --> B[DRAFT]
|
|
23
|
+
B --> C{Action?}
|
|
24
|
+
C -->|Confirm| D[CONFIRMED]
|
|
25
|
+
C -->|Cancel| E[CANCELLED]
|
|
26
|
+
D --> F{Action?}
|
|
27
|
+
F -->|Execute| G[DONE]
|
|
28
|
+
F -->|Cancel| E
|
|
29
|
+
G --> H{Movement Type?}
|
|
30
|
+
H -->|Goods Receipt| I[Supplier Location *virtual*] --> I2[Warehouse Location]
|
|
31
|
+
H -->|Goods Issue| J[Warehouse Location] --> J2[Customer / Scrap Location *virtual*]
|
|
32
|
+
H -->|Internal Transfer| K[Source Location] --> K2[Destination Location]
|
|
33
|
+
I2 --> L[Update Stock Levels]
|
|
34
|
+
J2 --> L
|
|
35
|
+
K2 --> L
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Scenario Patterns
|
|
39
|
+
|
|
40
|
+
- **Goods Receipt**: Items arrive from a supplier. A movement is created from the virtual supplier location to a warehouse receiving location, increasing on-hand stock at the destination once executed.
|
|
41
|
+
- **Goods Issue (Sales)**: Items are shipped to a customer. A movement is created from a warehouse location to the virtual customer location, decreasing on-hand stock at the source once executed.
|
|
42
|
+
- **Goods Issue (Scrap)**: Damaged or expired items are written off. A movement is created from a warehouse location to the virtual scrap location.
|
|
43
|
+
- **Internal Transfer**: Items are relocated between warehouses or between zones within the same warehouse. Stock decreases at the source location and increases at the destination location.
|
|
44
|
+
- **Draft Correction**: A movement in DRAFT status is found to have incorrect quantities or locations. The user updates the draft before confirming it.
|
|
45
|
+
- **Stock Block**: Damaged or suspect items are blocked at a warehouse location. A block movement increases the blocked quantity and reduces available stock without physically moving the items. Requires a reason (e.g., damage, recall, quality hold).
|
|
46
|
+
- **Stock Unblock**: After investigation, previously blocked items are released. An unblock movement decreases the blocked quantity and restores available stock.
|
|
47
|
+
- **Cancellation Before Execution**: A confirmed movement is no longer needed (e.g., supplier shipment was rejected). The movement is cancelled before reaching DONE, so no stock levels are affected.
|
|
48
|
+
- **Multi-line Movement**: A single receipt or shipment contains multiple items. Each item-location combination is recorded as a separate stock move line within the movement.
|
|
49
|
+
|
|
50
|
+
## Test Cases
|
|
51
|
+
|
|
52
|
+
- Stock movement follows DRAFT -> CONFIRMED -> DONE state machine
|
|
53
|
+
- Movements in DRAFT or CONFIRMED state can be cancelled; DONE movements cannot be cancelled
|
|
54
|
+
- Goods receipt creates a move from a virtual supplier location to a physical warehouse location
|
|
55
|
+
- Goods issue creates a move from a physical warehouse location to a virtual customer or scrap location
|
|
56
|
+
- Internal transfer creates a move between two physical warehouse locations
|
|
57
|
+
- Executing a movement (transition to DONE) triggers stock level updates at both source and destination locations
|
|
58
|
+
- Cancelling a movement does not affect stock levels
|
|
59
|
+
- Each move line records item, quantity, unit of measure, source location, destination location, movement date, and reference
|
|
60
|
+
- Quantity on a move line must be greater than zero
|
|
61
|
+
- Source and destination locations must be different
|
|
62
|
+
- Only items in ACTIVE status can be referenced in a stock movement
|
|
63
|
+
- A goods issue cannot be executed if the source location has insufficient available (non-blocked) stock for the item
|
|
64
|
+
- Block movement increases blocked quantity and is rejected if the requested quantity exceeds available stock
|
|
65
|
+
- Unblock movement decreases blocked quantity and is rejected if the requested quantity exceeds currently blocked stock
|
|
66
|
+
- Block and unblock movements require a reason code
|
|
67
|
+
|
|
68
|
+
## Reference Links
|
|
69
|
+
|
|
70
|
+
- [SAP Goods Movements (Material Documents)](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/f47baaae096c4cf58ad427a8f68493f6/4a28f2e8456c3040e10000000a42189e.html)
|
|
71
|
+
- [Odoo Stock Move Model](https://www.odoo.com/documentation/17.0/developer/reference/backend/orm.html)
|
|
72
|
+
- [Oracle Inventory Transactions](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25a/fammi/inventory-transactions.html)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Stock Tracking
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Stock Tracking provides real-time visibility into inventory quantities for every item at every storage location. The system maintains four core quantity types per item-location pair: on-hand (physically present), reserved (committed to outbound orders), incoming (expected from inbound orders), and blocked (unusable due to damage, recall, or other holds). Available quantity is derived as on-hand minus reserved minus blocked, giving an accurate picture of what can be promised to new demand.
|
|
6
|
+
|
|
7
|
+
Quantities are updated automatically as stock movements are processed — goods receipts increase on-hand and clear incoming, goods issues decrease on-hand, reservations shift quantity between available and reserved, and block/unblock operations shift quantity between available and blocked. Each stock level record is scoped to a specific item and storage location, enabling granular tracking down to the bin level within a warehouse.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Provides a single source of truth for current inventory positions across all warehouses and locations
|
|
12
|
+
- Enables accurate available-to-promise calculations by separating on-hand from reserved and blocked quantities
|
|
13
|
+
- Tracks incoming quantities so planners can see expected future supply without manual lookups
|
|
14
|
+
- Supports multi-location visibility, allowing businesses to locate stock across warehouses, zones, and bins
|
|
15
|
+
- Drives downstream decisions in sales (order promising), purchasing (reorder triggers), and manufacturing (material availability)
|
|
16
|
+
- Maintains quantity accuracy through automatic updates from stock movements, eliminating manual ledger maintenance
|
|
17
|
+
- Supports multi-unit-of-measure scenarios via UoM conversions from the primitives module
|
|
18
|
+
|
|
19
|
+
## Process Flow
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
flowchart TD
|
|
23
|
+
A[Stock Movement Executed] --> B{Movement Type}
|
|
24
|
+
B -->|Goods Receipt| C[Increase On-Hand at Destination]
|
|
25
|
+
C --> C2[Decrease Incoming]
|
|
26
|
+
B -->|Goods Issue| D[Decrease On-Hand at Source]
|
|
27
|
+
B -->|Transfer| E[Decrease On-Hand at Source]
|
|
28
|
+
E --> F[Increase On-Hand at Destination]
|
|
29
|
+
B -->|Reservation| G[Increase Reserved]
|
|
30
|
+
B -->|Reservation Release| H[Decrease Reserved]
|
|
31
|
+
B -->|Block| BL[Increase Blocked]
|
|
32
|
+
B -->|Unblock| UB[Decrease Blocked]
|
|
33
|
+
C2 --> I[Recalculate Available Qty]
|
|
34
|
+
D --> I
|
|
35
|
+
F --> I
|
|
36
|
+
G --> I
|
|
37
|
+
H --> I
|
|
38
|
+
BL --> I
|
|
39
|
+
UB --> I
|
|
40
|
+
I --> J[Available = On-Hand - Reserved - Blocked]
|
|
41
|
+
J --> K[Stock Level Updated]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Scenario Patterns
|
|
45
|
+
|
|
46
|
+
- **Basic Stock Inquiry**: A warehouse operator checks the on-hand and available quantity of an item at a specific bin location before picking
|
|
47
|
+
- **Available-to-Promise Check**: Sales checks available quantity (on-hand minus reserved minus blocked) across all locations to determine if a new order can be fulfilled
|
|
48
|
+
- **Incoming Visibility**: A planner reviews incoming quantities to understand when expected purchase orders will replenish stock at a given warehouse
|
|
49
|
+
- **Reservation Lifecycle**: A sales order reserves quantity, reducing available stock; upon shipment the reservation is released and on-hand is decremented via goods issue
|
|
50
|
+
- **Multi-Location Lookup**: A transfer planner queries stock levels across multiple warehouses to identify the best source location for an internal transfer
|
|
51
|
+
- **Stock Blocking**: A quality inspector or warehouse manager blocks a quantity of stock at a location due to damage, recall, or suspected defect; the blocked quantity is excluded from available stock and cannot be reserved or issued
|
|
52
|
+
- **Stock Unblocking**: After investigation, blocked stock is released back to available inventory via an unblock operation
|
|
53
|
+
- **Zero-Stock Detection**: The system identifies item-location pairs where available quantity has dropped to zero, signaling potential stockout risk
|
|
54
|
+
- **UoM-Aware Tracking**: Stock is tracked in the item's base UoM; queries can request quantities converted to alternative UoMs using primitives module conversions
|
|
55
|
+
|
|
56
|
+
## Test Cases
|
|
57
|
+
|
|
58
|
+
- Stock level record is created per unique item-location pair on first movement
|
|
59
|
+
- On-hand quantity increases when a goods receipt is processed for the item-location
|
|
60
|
+
- On-hand quantity decreases when a goods issue is processed for the item-location
|
|
61
|
+
- Incoming quantity increases when an inbound order is confirmed and decreases when the corresponding goods receipt is processed
|
|
62
|
+
- Reserved quantity increases when stock is reserved and decreases when the reservation is released or fulfilled
|
|
63
|
+
- Blocked quantity increases when stock is blocked and decreases when stock is unblocked
|
|
64
|
+
- Available quantity always equals on-hand minus reserved minus blocked
|
|
65
|
+
- Available quantity cannot go negative — reservation must be rejected if it would exceed available (on-hand minus reserved minus blocked)
|
|
66
|
+
- Block operation must be rejected if the requested quantity would exceed available (on-hand minus reserved minus currently blocked)
|
|
67
|
+
- Stock levels are tracked independently per storage location; a transfer decreases one location and increases another
|
|
68
|
+
- Warehouse-level aggregation correctly sums quantities across all storage locations within the warehouse
|
|
69
|
+
- Cross-warehouse query correctly sums quantities across all warehouses
|
|
70
|
+
- Stock level quantities are stored in the item's base unit of measure
|
|
71
|
+
- Concurrent stock movements to the same item-location produce correct final quantities (no lost updates)
|
|
72
|
+
- Stock level record persists with zero quantities rather than being deleted, preserving location history
|
|
73
|
+
|
|
74
|
+
## Reference Links
|
|
75
|
+
|
|
76
|
+
- [SAP Inventory Management — Stock Overview](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/f18f0acdc5f04a35badc70e96e8d4549/4f36a7addfae4f32e10000000a11466f.html)
|
|
77
|
+
- [Oracle Inventory — On-Hand Quantity](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25a/famoh/inventory-on-hand-balances.html)
|
|
78
|
+
- [NetSuite Inventory Management](https://www.netsuite.com/portal/resource/articles/inventory-management/inventory-management.shtml)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Warehouse Management
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Warehouse Management defines the operational storage structure within an organization's physical facilities. A Warehouse represents a logical storage facility linked to an organizational Site, while StorageLocations (zones and bins) describe the internal layout within that warehouse. The organization module owns the Site entity (physical facility identity and address); the inventory module owns Warehouse and StorageLocation entities that layer operational storage concerns on top of a Site.
|
|
6
|
+
|
|
7
|
+
Each warehouse tracks storage-relevant attributes such as storage conditions, capacity constraints, and operational status. StorageLocations form a tree hierarchy within a warehouse with a maximum depth of three levels: Warehouse → Zone → Bin. Zones group related areas (e.g., cold storage, bulk storage) and are direct children of the warehouse (parentId is null). Bins identify individual addressable slots where stock is placed and must reference a parent zone. Each StorageLocation carries a locationType of either 'zone' or 'bin'.
|
|
8
|
+
|
|
9
|
+
Zone/bin management is optional. When granular location tracking is not needed, a warehouse with a single zone (and no bins) is sufficient for flat inventory operations. All other inventory features (stock tracking, stock movement, lot tracking, serial number tracking) reference StorageLocation.id as the spatial axis — stock quantities, lots, and serial numbers are always associated with a StorageLocation, never directly with a Warehouse.
|
|
10
|
+
|
|
11
|
+
## Business Purpose
|
|
12
|
+
|
|
13
|
+
Warehouses and storage locations serve as the spatial backbone for all inventory operations:
|
|
14
|
+
|
|
15
|
+
- Map operational storage structures onto company-owned Sites, separating facility identity (organization) from storage layout (inventory)
|
|
16
|
+
- Enable multi-warehouse operations across sites, supporting distributed inventory strategies
|
|
17
|
+
- Provide granular bin-level addressing for stock placement and retrieval
|
|
18
|
+
- Classify storage zones by condition (ambient, cold, hazardous) to enforce proper item placement
|
|
19
|
+
- Track capacity at the warehouse and bin level to prevent over-storage and guide putaway decisions
|
|
20
|
+
- Support stock movement routing by providing source and destination locations for transfers, receipts, and issues
|
|
21
|
+
- Enable inventory counts and cycle counts scoped to specific zones or bins
|
|
22
|
+
|
|
23
|
+
The lifecycle ensures:
|
|
24
|
+
|
|
25
|
+
- Warehouses and storage locations are either ACTIVE (available for inventory operations) or INACTIVE (closed to new movements but preserved for historical records)
|
|
26
|
+
- Deactivating a warehouse prevents new stock movements while retaining all historical transaction data
|
|
27
|
+
- Storage locations can be individually deactivated without affecting the parent warehouse
|
|
28
|
+
|
|
29
|
+
## Process Flow
|
|
30
|
+
|
|
31
|
+
Warehouse and storage location setup follows a top-down configuration pattern:
|
|
32
|
+
|
|
33
|
+
```mermaid
|
|
34
|
+
flowchart TD
|
|
35
|
+
A[Select Organizational Site] --> B[Create Warehouse]
|
|
36
|
+
B --> C[Define Warehouse Attributes]
|
|
37
|
+
C --> D[Create Zones within Warehouse]
|
|
38
|
+
D --> E[Create Bins within Zones]
|
|
39
|
+
E --> F[Warehouse Ready for Operations]
|
|
40
|
+
F --> G{Zone/Bin no longer needed?}
|
|
41
|
+
G -->|Yes| H[Deactivate StorageLocation]
|
|
42
|
+
G -->|No| I[Continue Operations]
|
|
43
|
+
H --> J{Reopen location?}
|
|
44
|
+
J -->|Yes| K[Reactivate StorageLocation]
|
|
45
|
+
J -->|No| L[Location remains INACTIVE]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Warehouse lifecycle management:
|
|
49
|
+
|
|
50
|
+
```mermaid
|
|
51
|
+
stateDiagram-v2
|
|
52
|
+
[*] --> Active: createWarehouse
|
|
53
|
+
Active --> Inactive: deactivateWarehouse
|
|
54
|
+
Inactive --> Active: reactivateWarehouse
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Scenario Patterns
|
|
58
|
+
|
|
59
|
+
- **Flat Warehouse Setup**: A small business creates a warehouse with a single zone and no bins. All stock movements and inventory tracking reference this single zone as the location. This is sufficient when granular bin-level tracking is not needed
|
|
60
|
+
- **New Distribution Center Setup**: A company opens a new distribution site and creates a warehouse linked to that site. Zones are defined for receiving, bulk storage, picking, and shipping. Bins are created within each zone to provide addressable storage slots for inventory placement
|
|
61
|
+
- **Cold Chain Warehouse**: A food distributor creates a warehouse with cold-storage zones maintained at specific temperature conditions. Items requiring refrigeration are directed to bins within these zones, ensuring compliance with storage requirements
|
|
62
|
+
- **Multi-Warehouse Site**: A large manufacturing site operates multiple warehouses — one for raw materials, one for finished goods, and one for spare parts. Each warehouse is linked to the same site but has distinct zones and bin structures tailored to its purpose
|
|
63
|
+
- **Warehouse Consolidation**: A company closes a regional warehouse by deactivating it after transferring all remaining stock to another facility. Historical movement records at the deactivated warehouse remain intact for audit purposes
|
|
64
|
+
- **Zone Expansion**: An existing warehouse adds a new storage zone to accommodate increased inventory volume. New bins are created within the zone and immediately become available for stock placement
|
|
65
|
+
- **Bin Deactivation for Maintenance**: A bin or zone is temporarily deactivated for maintenance or reconfiguration. No new stock can be placed there, but existing records and historical movements are preserved. Once maintenance completes, the location is reactivated
|
|
66
|
+
- **Hazardous Materials Segregation**: A warehouse designates a specific zone for hazardous materials with appropriate storage condition classification, ensuring regulated items are stored separately from general inventory
|
|
67
|
+
|
|
68
|
+
## Test Cases
|
|
69
|
+
|
|
70
|
+
- A warehouse must reference an existing, ACTIVE site via siteId
|
|
71
|
+
- A warehouse name is required and unique within the same site
|
|
72
|
+
- Warehouse lifecycle follows ACTIVE <-> INACTIVE state machine
|
|
73
|
+
- Deactivating a warehouse prevents new stock movements to/from that warehouse
|
|
74
|
+
- Deactivating a warehouse does not delete or modify historical stock movement records
|
|
75
|
+
- A storage location must reference an existing, ACTIVE warehouse via warehouseId
|
|
76
|
+
- Each storage location has a locationType of 'zone' or 'bin'
|
|
77
|
+
- A zone must be a direct child of the warehouse (parentId is null)
|
|
78
|
+
- A bin must reference a parent zone within the same warehouse (parentId is a zone's id)
|
|
79
|
+
- A bin cannot be a direct child of the warehouse; it must belong to a zone
|
|
80
|
+
- Storage location name or code is required and unique within the same warehouse
|
|
81
|
+
- Storage location lifecycle follows ACTIVE <-> INACTIVE state machine independently of its parent warehouse
|
|
82
|
+
- Deactivating a zone does not automatically deactivate its child bins (explicit deactivation required)
|
|
83
|
+
- Reactivating a storage location is only permitted if its parent warehouse is ACTIVE
|
|
84
|
+
- A warehouse cannot be created under an INACTIVE or non-existent site
|
|
85
|
+
- Multiple warehouses can exist for the same site
|
|
86
|
+
- Storage condition classification (e.g., ambient, cold, hazardous) can be assigned to a warehouse or zone
|
|
87
|
+
- Capacity attributes can be set on a warehouse or bin to track storage limits
|
|
88
|
+
- Attempting to place stock into an INACTIVE storage location is rejected
|
|
89
|
+
|
|
90
|
+
## Reference Links
|
|
91
|
+
|
|
92
|
+
- [Stock Tracking](./stock-tracking.md) — tracks quantities per item per StorageLocation
|
|
93
|
+
- [Stock Movement](./stock-movement.md) — uses StorageLocations as source and destination for goods flow
|
|
94
|
+
- [Odoo Warehouses and Locations](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/inventory/warehouses_storage.html)
|
|
95
|
+
- [SAP Warehouse Structure](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/f1a0da84007f4621a36cf73cd38ee3d0/c4a850def48411d1a7020000e829fd11.html)
|
|
96
|
+
- [Oracle Warehouse Management](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25a/famwm/warehouse-management.html)
|
|
97
|
+
- [Dynamics 365 Warehouse Configuration](https://learn.microsoft.com/en-us/dynamics365/supply-chain/warehousing/warehouse-configuration)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# CostLayer
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
CostLayer represents an append-only record of inventory cost for FIFO (First In, First Out) valuation. Each cost layer is created when a goods receipt is executed for an item under a FIFO valuation policy, capturing the quantity received and its unit cost. When goods are issued, cost layers are consumed in oldest-first order, with the remainingQuantity field tracking the unconsumed portion.
|
|
6
|
+
|
|
7
|
+
Cost layers are never modified after creation — only the remainingQuantity is decremented as stock is consumed.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
AppendOnly
|
|
14
|
+
|
|
15
|
+
### Command Definitions
|
|
16
|
+
|
|
17
|
+
- Cost layers are created internally by goods receipt execution under a FIFO valuation policy and consumed by goods issue execution
|
|
18
|
+
|
|
19
|
+
### Query Definitions
|
|
20
|
+
|
|
21
|
+
- [listCostLayers](../queries/ListCostLayers.md) - List cost layers by item or valuation policy for FIFO auditing
|
|
22
|
+
|
|
23
|
+
### Models
|
|
24
|
+
|
|
25
|
+
- CostLayer
|
|
26
|
+
|
|
27
|
+
### Invariants
|
|
28
|
+
|
|
29
|
+
- Created on goods receipt for items under a FIFO valuation policy
|
|
30
|
+
- Consumed in oldest-first order on goods issue
|
|
31
|
+
- Remaining quantity tracks the unconsumed portion of the original layer
|
|
32
|
+
|
|
33
|
+
### Relationships
|
|
34
|
+
|
|
35
|
+
- **References Item**: Each cost layer belongs to an Item from the item-management module
|
|
36
|
+
- **References ValuationPolicy**: Each cost layer is associated with a FIFO valuation policy
|
|
37
|
+
- **References StockMovement**: Each cost layer is linked to the stock movement that created it
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# InventoryAdjustment
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
InventoryAdjustment represents a correction to on-hand stock quantities at a specific storage location. Each adjustment has an `adjustmentType` that determines its behavior:
|
|
6
|
+
|
|
7
|
+
- **CORRECTION**: Manual corrections to reconcile system records with physical reality — discrepancies from damage, theft, counting errors, receiving mistakes, or production variances. Confirmation generates a stock movement to/from a virtual "adjustment" location.
|
|
8
|
+
- **SCRAP**: Controlled disposal of damaged, expired, defective, or obsolete stock. Confirmation moves stock to a virtual "scrap" location, reducing inventory valuation. For serial-tracked items, the serial number transitions to SCRAPPED state.
|
|
9
|
+
|
|
10
|
+
Both types follow the same approval workflow: DRAFT → optionally PENDING_APPROVAL → APPROVED → CONFIRMED. Rejected adjustments can be revised back to DRAFT. Once confirmed, an adjustment is immutable — corrections require a new offsetting adjustment.
|
|
11
|
+
|
|
12
|
+
## Domain Model Definitions
|
|
13
|
+
|
|
14
|
+
### Model type
|
|
15
|
+
|
|
16
|
+
Stateful
|
|
17
|
+
|
|
18
|
+
#### State Transitions
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
stateDiagram-v2
|
|
22
|
+
[*] --> Draft: createInventoryAdjustment
|
|
23
|
+
Draft --> PendingApproval: submitInventoryAdjustment
|
|
24
|
+
Draft --> Confirmed: confirmInventoryAdjustment (no approval needed)
|
|
25
|
+
PendingApproval --> Approved: approveInventoryAdjustment
|
|
26
|
+
PendingApproval --> Rejected: rejectInventoryAdjustment
|
|
27
|
+
Rejected --> Draft: reviseInventoryAdjustment
|
|
28
|
+
Approved --> Confirmed: confirmInventoryAdjustment
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Command Definitions
|
|
32
|
+
|
|
33
|
+
- [createInventoryAdjustment](../commands/CreateInventoryAdjustment.md) - Create a new inventory adjustment in DRAFT status
|
|
34
|
+
- [submitInventoryAdjustment](../commands/SubmitInventoryAdjustment.md) - Submit a draft adjustment for approval
|
|
35
|
+
- [approveInventoryAdjustment](../commands/ApproveInventoryAdjustment.md) - Approve a pending adjustment
|
|
36
|
+
- [rejectInventoryAdjustment](../commands/RejectInventoryAdjustment.md) - Reject a pending adjustment
|
|
37
|
+
- [reviseInventoryAdjustment](../commands/ReviseInventoryAdjustment.md) - Return a rejected adjustment to draft for revision
|
|
38
|
+
- [confirmInventoryAdjustment](../commands/ConfirmInventoryAdjustment.md) - Confirm an approved or draft adjustment, applying the quantity change
|
|
39
|
+
|
|
40
|
+
### Query Definitions
|
|
41
|
+
|
|
42
|
+
- [getInventoryAdjustment](../queries/GetInventoryAdjustment.md) - Retrieve an inventory adjustment by id
|
|
43
|
+
- [listInventoryAdjustments](../queries/ListInventoryAdjustments.md) - List inventory adjustments with optional filters
|
|
44
|
+
|
|
45
|
+
### Models
|
|
46
|
+
|
|
47
|
+
- InventoryAdjustment
|
|
48
|
+
|
|
49
|
+
### Invariants
|
|
50
|
+
|
|
51
|
+
- Reason code is required
|
|
52
|
+
- adjustmentType is required (CORRECTION or SCRAP)
|
|
53
|
+
- Draft adjustments do not affect on-hand quantities
|
|
54
|
+
- Confirmation generates a stock movement to update stock levels
|
|
55
|
+
- CORRECTION: stock movement to/from virtual adjustment location
|
|
56
|
+
- SCRAP: stock movement to virtual scrap location; quantityDelta must be negative
|
|
57
|
+
- SCRAP with serial number: serial transitions to SCRAPPED state on confirmation
|
|
58
|
+
- Negative adjustment cannot reduce on-hand below zero (unless the organization permits negative stock)
|
|
59
|
+
- Immutable after confirmation — corrections require a new offsetting adjustment
|
|
60
|
+
- Rejected adjustments do not affect stock levels or valuation
|
|
61
|
+
- Adjustments originating from a count session link back to the InventoryCount
|
|
62
|
+
|
|
63
|
+
### Relationships
|
|
64
|
+
|
|
65
|
+
- **References Item**: Each adjustment targets an Item from the item-management module
|
|
66
|
+
- **References StorageLocation**: Each adjustment targets a specific storage location
|
|
67
|
+
- **References InventoryCount (optional)**: Adjustments may be linked to an inventory count session (CORRECTION type only)
|
|
68
|
+
- **References Lot (optional)**: For lot-tracked items, the specific lot being adjusted
|
|
69
|
+
- **References SerialNumber (optional)**: For serial-tracked items, the specific serial number being adjusted
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# InventoryCount
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
InventoryCount represents a physical inventory counting session used to verify system stock quantities against actual quantities on hand. Counts can be full (entire warehouse) or cycle (specific locations). The count follows a lifecycle from PLANNED through IN_PROGRESS to COMPLETED, with the option to cancel from either PLANNED or IN_PROGRESS states.
|
|
6
|
+
|
|
7
|
+
Starting a count captures a snapshot of system quantities and optionally freezes stock movements for the counted locations. Completion unfreezes movements and finalizes the session.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Planned: createInventoryCount
|
|
20
|
+
Planned --> InProgress: startInventoryCount
|
|
21
|
+
InProgress --> Completed: completeInventoryCount
|
|
22
|
+
Planned --> Cancelled: cancelInventoryCount
|
|
23
|
+
InProgress --> Cancelled: cancelInventoryCount
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Command Definitions
|
|
27
|
+
|
|
28
|
+
- [createInventoryCount](../commands/CreateInventoryCount.md) - Create a new inventory count session in PLANNED status
|
|
29
|
+
- [startInventoryCount](../commands/StartInventoryCount.md) - Start the count, capturing system quantity snapshots and optionally freezing stock
|
|
30
|
+
- [completeInventoryCount](../commands/CompleteInventoryCount.md) - Complete the count session after all lines are resolved
|
|
31
|
+
- [cancelInventoryCount](../commands/CancelInventoryCount.md) - Cancel a planned or in-progress count session
|
|
32
|
+
|
|
33
|
+
### Query Definitions
|
|
34
|
+
|
|
35
|
+
- [getInventoryCount](../queries/GetInventoryCount.md) - Retrieve an inventory count session by id
|
|
36
|
+
- [listInventoryCounts](../queries/ListInventoryCounts.md) - List inventory count sessions with optional filters
|
|
37
|
+
|
|
38
|
+
### Models
|
|
39
|
+
|
|
40
|
+
- InventoryCount
|
|
41
|
+
|
|
42
|
+
### Invariants
|
|
43
|
+
|
|
44
|
+
- Cannot be finalized until all count lines are in a terminal status (APPROVED or REJECTED)
|
|
45
|
+
- Freezing stock blocks movements for the counted locations during the count
|
|
46
|
+
- Unfreezing resumes movements after completion
|
|
47
|
+
- A snapshot captures system quantities at the start of the count
|
|
48
|
+
|
|
49
|
+
### Relationships
|
|
50
|
+
|
|
51
|
+
- **Has many InventoryCountLine**: Each count session contains lines for individual item-location combinations
|
|
52
|
+
- **References Warehouse (optional)**: A full count may target an entire warehouse
|
|
53
|
+
- **References StorageLocation (optional)**: A cycle count may target specific storage locations
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# InventoryCountLine
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
InventoryCountLine represents a single item-location combination within an inventory count session. Each line captures the system quantity (snapshot at count start) and the counted quantity (entered by the counter), with the variance computed as the difference. Lines follow a review workflow: PENDING → APPROVED/REJECTED/RECOUNT.
|
|
6
|
+
|
|
7
|
+
Within-tolerance variances are auto-approved. Exceeding-tolerance variances require explicit approval. Approved variances generate inventory adjustments with the reason "inventory-count". Blind count mode hides system quantities from counters.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Pending: startInventoryCount (creates lines)
|
|
20
|
+
Pending --> Approved: approveCountLine (or auto-approve within tolerance)
|
|
21
|
+
Pending --> Rejected: rejectCountLine
|
|
22
|
+
Pending --> Recount: rejectCountLine (with recount)
|
|
23
|
+
Recount --> Pending: recordCountLine (re-enters count)
|
|
24
|
+
Rejected --> Pending: recordCountLine (re-counted)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Command Definitions
|
|
28
|
+
|
|
29
|
+
- [recordCountLine](../commands/RecordCountLine.md) - Record or re-record the counted quantity for a count line
|
|
30
|
+
- [approveCountLine](../commands/ApproveCountLine.md) - Approve a count line variance
|
|
31
|
+
- [rejectCountLine](../commands/RejectCountLine.md) - Reject a count line or request a recount
|
|
32
|
+
|
|
33
|
+
### Query Definitions
|
|
34
|
+
|
|
35
|
+
- Inventory count lines are included in inventory count queries
|
|
36
|
+
|
|
37
|
+
### Models
|
|
38
|
+
|
|
39
|
+
- InventoryCountLine
|
|
40
|
+
|
|
41
|
+
### Invariants
|
|
42
|
+
|
|
43
|
+
- Variance = countedQuantity - systemQuantity
|
|
44
|
+
- Within-tolerance variances are auto-approved
|
|
45
|
+
- Exceeding-tolerance variances require explicit approval
|
|
46
|
+
- Approved variances generate inventory adjustments with reason "inventory-count"
|
|
47
|
+
- Blind count mode hides system quantities from counters
|
|
48
|
+
|
|
49
|
+
### Relationships
|
|
50
|
+
|
|
51
|
+
- **Belongs to InventoryCount**: Each count line belongs to a single inventory count session
|
|
52
|
+
- **References Item**: Each count line references an Item from the item-management module
|
|
53
|
+
- **References StorageLocation**: Each count line targets a specific storage location
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# ItemValuation
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
ItemValuation tracks the aggregate inventory value for a specific item under a specific valuation policy. It maintains the total quantity, total value, and a computed cost per unit (totalValue / totalQuantity). Item valuations are updated internally when stock movements are executed.
|
|
6
|
+
|
|
7
|
+
Internal transfers do not change item-level valuation since stock remains within the same inventory system. Valuation changes emit events for downstream consumption by accounting and reporting modules.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Standard
|
|
14
|
+
|
|
15
|
+
### Command Definitions
|
|
16
|
+
|
|
17
|
+
- Item valuations are updated internally by stock movement execution
|
|
18
|
+
|
|
19
|
+
### Query Definitions
|
|
20
|
+
|
|
21
|
+
- [getItemValuation](../queries/GetItemValuation.md) - Retrieve the valuation for a specific item under a specific policy
|
|
22
|
+
- [listItemValuations](../queries/ListItemValuations.md) - List item valuations with optional filters
|
|
23
|
+
|
|
24
|
+
### Models
|
|
25
|
+
|
|
26
|
+
- ItemValuation
|
|
27
|
+
|
|
28
|
+
### Invariants
|
|
29
|
+
|
|
30
|
+
- Unique per item-valuationPolicy pair
|
|
31
|
+
- Cost per unit = totalValue / totalQuantity
|
|
32
|
+
- Internal transfers do not change item-level valuation
|
|
33
|
+
- Valuation changes emit events for downstream consumption
|
|
34
|
+
|
|
35
|
+
### Relationships
|
|
36
|
+
|
|
37
|
+
- **References Item**: Each item valuation belongs to an Item from the item-management module
|
|
38
|
+
- **References ValuationPolicy**: Each item valuation is associated with a valuation policy
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Lot
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Lot (also known as batch) represents a production or procurement batch of an item, enabling forward and backward traceability. Each lot has a unique lot number per item and may carry manufacture date, expiration date, and supplier lot reference metadata. Lots track their consumption status: ACTIVE when stock remains, FULLY_CONSUMED when on-hand reaches zero across all locations.
|
|
6
|
+
|
|
7
|
+
Goods receipts for lot-tracked items must specify a lot. Expired lots are excluded from picking operations.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Standard
|
|
14
|
+
|
|
15
|
+
### Command Definitions
|
|
16
|
+
|
|
17
|
+
- [createLot](../commands/CreateLot.md) - Create a new lot for a specific item
|
|
18
|
+
- [updateLot](../commands/UpdateLot.md) - Update mutable fields (manufactureDate, expirationDate, supplierLotReference) before fully consumed
|
|
19
|
+
|
|
20
|
+
### Query Definitions
|
|
21
|
+
|
|
22
|
+
- [getLot](../queries/GetLot.md) - Retrieve a lot by id or lot number
|
|
23
|
+
- [listLots](../queries/ListLots.md) - List lots with optional filtering by item, warehouse, and status
|
|
24
|
+
- [listExpiringLots](../queries/ListExpiringLots.md) - List lots approaching or past their expiration date
|
|
25
|
+
- [traceLotForward](../queries/TraceLotForward.md) - Trace a lot forward through downstream movements
|
|
26
|
+
- [traceLotBackward](../queries/TraceLotBackward.md) - Trace a lot backward to its origin movements
|
|
27
|
+
|
|
28
|
+
### Models
|
|
29
|
+
|
|
30
|
+
- Lot
|
|
31
|
+
|
|
32
|
+
### Invariants
|
|
33
|
+
|
|
34
|
+
- Lot number must be unique per item
|
|
35
|
+
- Lot number is immutable after creation
|
|
36
|
+
- Manufacture date, expiration date, and supplier lot reference are updatable before fully consumed
|
|
37
|
+
- Goods receipt for a lot-tracked item must specify a lot
|
|
38
|
+
- Expired lots are excluded from picking
|
|
39
|
+
- Lots with zero on-hand across all locations are marked FULLY_CONSUMED
|
|
40
|
+
- Multiple active lots for the same item at the same location are allowed
|
|
41
|
+
|
|
42
|
+
### Relationships
|
|
43
|
+
|
|
44
|
+
- **References Item**: Each lot belongs to an Item from the item-management module
|
|
45
|
+
- **Has many LotStockLevel**: A lot tracks stock levels across multiple storage locations
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# LotStockLevel
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
LotStockLevel tracks the on-hand quantity of a specific lot at a specific storage location. It provides the lot-level granularity needed for traceability and FEFO (First Expired, First Out) picking strategies. Lot stock levels are updated internally when stock movements referencing a lot are executed.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- Lot stock levels are updated internally by stock movement execution
|
|
16
|
+
|
|
17
|
+
### Query Definitions
|
|
18
|
+
|
|
19
|
+
- Lot stock levels are included in lot queries
|
|
20
|
+
|
|
21
|
+
### Models
|
|
22
|
+
|
|
23
|
+
- LotStockLevel
|
|
24
|
+
|
|
25
|
+
### Invariants
|
|
26
|
+
|
|
27
|
+
- Unique per lot-storageLocation pair
|
|
28
|
+
- Goods issue cannot exceed the lot's on-hand quantity at the specified location
|
|
29
|
+
- Internal transfer preserves the lot association
|
|
30
|
+
|
|
31
|
+
### Relationships
|
|
32
|
+
|
|
33
|
+
- **Belongs to Lot**: Each lot stock level belongs to a single lot
|
|
34
|
+
- **References StorageLocation**: Each lot stock level tracks quantity at a specific storage location
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# SerialNumber
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
SerialNumber represents a unique identifier assigned to an individual unit of an item, enabling unit-level traceability throughout the item's lifecycle. Serial numbers follow a state machine: AVAILABLE (in stock) → ISSUED (dispatched) → RETURNED (received back) → AVAILABLE (restocked) or SCRAPPED (disposed). SCRAPPED is a terminal state.
|
|
6
|
+
|
|
7
|
+
Serial-tracked items always have a quantity of exactly 1 per serial number. State transitions are driven by stock movements rather than direct commands.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Available: assignSerialNumber
|
|
20
|
+
Available --> Issued: executeStockMovement (goods issue)
|
|
21
|
+
Issued --> Returned: executeStockMovement (return)
|
|
22
|
+
Returned --> Available: restock
|
|
23
|
+
Returned --> Scrapped: scrap
|
|
24
|
+
Available --> Scrapped: scrap
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Command Definitions
|
|
28
|
+
|
|
29
|
+
- [assignSerialNumber](../commands/AssignSerialNumber.md) - Assign a serial number to an item at a storage location
|
|
30
|
+
|
|
31
|
+
### Query Definitions
|
|
32
|
+
|
|
33
|
+
- [getSerialNumber](../queries/GetSerialNumber.md) - Retrieve a serial number by id or serial number value
|
|
34
|
+
- [listSerialNumbers](../queries/ListSerialNumbers.md) - List serial numbers by item, storage location, or status
|
|
35
|
+
- [getSerialNumberHistory](../queries/GetSerialNumberHistory.md) - Retrieve the full movement history of a serial number
|
|
36
|
+
|
|
37
|
+
### Models
|
|
38
|
+
|
|
39
|
+
- SerialNumber
|
|
40
|
+
|
|
41
|
+
### Invariants
|
|
42
|
+
|
|
43
|
+
- Quantity is always exactly 1
|
|
44
|
+
- Serial number must be unique per item type (different items may share the same serial number)
|
|
45
|
+
- Serial number is immutable after assignment
|
|
46
|
+
- SCRAPPED is a terminal state
|
|
47
|
+
- ISSUED cannot transition directly to AVAILABLE — must pass through RETURNED
|
|
48
|
+
- State transitions are driven by stock movements
|
|
49
|
+
|
|
50
|
+
### Relationships
|
|
51
|
+
|
|
52
|
+
- **References Item**: Each serial number belongs to an Item from the item-management module
|
|
53
|
+
- **References StorageLocation**: Each serial number tracks its current storage location
|