@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,41 @@
|
|
|
1
|
+
# UpdateStorageLocation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
updateStorageLocation modifies the mutable fields of a storage location, including name, code, storageCondition, and capacity. The warehouseId, parentId, and locationType are immutable after creation.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Storage location must exist
|
|
10
|
+
- Name and code must remain unique within the warehouse if changed
|
|
11
|
+
- warehouseId, parentId, and locationType are immutable after creation
|
|
12
|
+
|
|
13
|
+
## Process Flow
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
flowchart TD
|
|
17
|
+
A[Receive update request] --> B{Location exists?}
|
|
18
|
+
B -->|No| C[Return error: STORAGE_LOCATION_NOT_FOUND]
|
|
19
|
+
B -->|Yes| D{Name or code changed?}
|
|
20
|
+
D -->|Yes| E{New name/code unique in warehouse?}
|
|
21
|
+
E -->|No| F[Return error: DUPLICATE_LOCATION_NAME]
|
|
22
|
+
E -->|Yes| G[Update location record]
|
|
23
|
+
D -->|No| G
|
|
24
|
+
G --> H[Return updated location]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## External Dependencies
|
|
28
|
+
|
|
29
|
+
- None
|
|
30
|
+
|
|
31
|
+
## Error Scenarios
|
|
32
|
+
|
|
33
|
+
- **STORAGE_LOCATION_NOT_FOUND**: Referenced storage location does not exist
|
|
34
|
+
- **DUPLICATE_LOCATION_NAME**: A location with the new name or code already exists in the warehouse
|
|
35
|
+
|
|
36
|
+
## Test Cases
|
|
37
|
+
|
|
38
|
+
- returns error when location not found
|
|
39
|
+
- returns error when new name conflicts
|
|
40
|
+
- updates location name
|
|
41
|
+
- updates storage condition
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# UpdateValuationPolicy
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
updateValuationPolicy updates an existing valuation policy. When the standardCostRate is changed for a STANDARD_COST policy, a revaluation event is emitted to trigger recalculation of inventory values for all items using this policy.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Valuation policy must exist
|
|
10
|
+
- standardCostRate is required if costingMethod is STANDARD_COST
|
|
11
|
+
- Updating the standard cost rate emits a revaluation event
|
|
12
|
+
|
|
13
|
+
## Process Flow
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
flowchart TD
|
|
17
|
+
A[Receive update request] --> B{Policy exists?}
|
|
18
|
+
B -->|No| C[Return error: VALUATION_POLICY_NOT_FOUND]
|
|
19
|
+
B -->|Yes| D{costingMethod is STANDARD_COST?}
|
|
20
|
+
D -->|Yes| E{standardCostRate provided?}
|
|
21
|
+
E -->|No| F[Return error: STANDARD_COST_RATE_REQUIRED]
|
|
22
|
+
E -->|Yes| G[Update policy]
|
|
23
|
+
D -->|No| G
|
|
24
|
+
G --> H{Standard cost rate changed?}
|
|
25
|
+
H -->|Yes| I[Emit revaluation event]
|
|
26
|
+
I --> J[Return updated policy]
|
|
27
|
+
H -->|No| J
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## External Dependencies
|
|
31
|
+
|
|
32
|
+
- None
|
|
33
|
+
|
|
34
|
+
## Error Scenarios
|
|
35
|
+
|
|
36
|
+
- **VALUATION_POLICY_NOT_FOUND**: Referenced valuation policy does not exist
|
|
37
|
+
- **STANDARD_COST_RATE_REQUIRED**: costingMethod is STANDARD_COST but no standardCostRate was provided
|
|
38
|
+
|
|
39
|
+
## Test Cases
|
|
40
|
+
|
|
41
|
+
- returns error when not found
|
|
42
|
+
- returns error when standard cost rate required
|
|
43
|
+
- updates policy name
|
|
44
|
+
- updates standard cost rate and emits revaluation event
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# UpdateWarehouse
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
updateWarehouse modifies the mutable fields of an existing warehouse, including name, storageCondition, and capacity. The siteId is immutable and cannot be changed after creation.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Warehouse must exist
|
|
10
|
+
- Name must remain unique within the same site if changed
|
|
11
|
+
- siteId is immutable after creation
|
|
12
|
+
|
|
13
|
+
## Process Flow
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
flowchart TD
|
|
17
|
+
A[Receive update request] --> B{Warehouse exists?}
|
|
18
|
+
B -->|No| C[Return error: WAREHOUSE_NOT_FOUND]
|
|
19
|
+
B -->|Yes| D{Name changed?}
|
|
20
|
+
D -->|Yes| E{New name unique within site?}
|
|
21
|
+
E -->|No| F[Return error: DUPLICATE_WAREHOUSE_NAME]
|
|
22
|
+
E -->|Yes| G[Update warehouse record]
|
|
23
|
+
D -->|No| G
|
|
24
|
+
G --> H[Return updated warehouse]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## External Dependencies
|
|
28
|
+
|
|
29
|
+
- None
|
|
30
|
+
|
|
31
|
+
## Error Scenarios
|
|
32
|
+
|
|
33
|
+
- **WAREHOUSE_NOT_FOUND**: Referenced warehouse does not exist
|
|
34
|
+
- **DUPLICATE_WAREHOUSE_NAME**: A warehouse with the new name already exists at the same site
|
|
35
|
+
|
|
36
|
+
## Test Cases
|
|
37
|
+
|
|
38
|
+
- returns error when warehouse not found
|
|
39
|
+
- returns error when new name conflicts
|
|
40
|
+
- updates warehouse name
|
|
41
|
+
- updates storage condition
|
|
42
|
+
- updates capacity
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Inventory Adjustment
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Inventory adjustments are manual corrections to on-hand stock quantities that reconcile system records with physical reality. Discrepancies arise from damage, theft, counting errors, receiving mistakes, or production variances. Each adjustment specifies a reason code, the affected item and location, and the quantity delta (positive or negative). When confirmed, the adjustment generates a stock movement to or from a virtual "adjustment" location, updating the on-hand balance and impacting inventory valuation.
|
|
6
|
+
|
|
7
|
+
Adjustments may originate from a standalone correction (e.g., a warehouse worker discovers damaged goods) or as a follow-up to an inventory count that reveals a variance. Organizations can optionally enforce an approval workflow for adjustments that exceed a configurable quantity or value threshold.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- **Accuracy**: Corrects system stock levels to match actual physical inventory, preventing downstream issues in order fulfillment and purchasing
|
|
12
|
+
- **Traceability**: Every adjustment records a reason code and creates an auditable stock movement, satisfying regulatory and internal audit requirements
|
|
13
|
+
- **Valuation integrity**: Adjustments flow through to inventory valuation so that financial reports reflect the true cost of goods on hand
|
|
14
|
+
- **Loss visibility**: Categorizing adjustments by reason code (damage, shrinkage, counting error) enables analysis of inventory loss patterns and root-cause investigation
|
|
15
|
+
- **Integration with inventory counts**: Provides the mechanism to act on count variances discovered during cycle counts or full physical inventories
|
|
16
|
+
|
|
17
|
+
## Process Flow
|
|
18
|
+
|
|
19
|
+
```mermaid
|
|
20
|
+
flowchart TD
|
|
21
|
+
A[Identify Discrepancy] --> B[Create Adjustment Record]
|
|
22
|
+
B --> C[Select Item, Location, Quantity Delta]
|
|
23
|
+
C --> D[Assign Reason Code]
|
|
24
|
+
D --> E{Approval Required?}
|
|
25
|
+
E -- No --> G[Confirm Adjustment]
|
|
26
|
+
E -- Yes --> F[Submit for Approval]
|
|
27
|
+
F --> F1{Approved?}
|
|
28
|
+
F1 -- Yes --> G
|
|
29
|
+
F1 -- No --> H[Reject Adjustment]
|
|
30
|
+
H --> I[Return to Draft / Cancel]
|
|
31
|
+
G --> J[Generate Stock Movement]
|
|
32
|
+
J --> K[Update On-Hand Quantity]
|
|
33
|
+
K --> L[Update Inventory Valuation]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Scenario Patterns
|
|
37
|
+
|
|
38
|
+
- **Damage write-down**: A warehouse inspection reveals physically damaged units. A negative adjustment with reason code "Damage" removes the affected quantity from on-hand stock.
|
|
39
|
+
- **Shrinkage / theft**: Periodic checks or count results show missing inventory with no corresponding shipment. A negative adjustment with reason code "Shrinkage" records the loss.
|
|
40
|
+
- **Counting error correction**: A cycle count reveals more units on the shelf than the system shows. A positive adjustment with reason code "Counting Error" increases the on-hand balance.
|
|
41
|
+
- **Receiving error correction**: Goods receipt recorded the wrong quantity. A positive or negative adjustment with reason code "Receiving Error" corrects the discrepancy.
|
|
42
|
+
- **Production variance**: Actual yield differs from the expected output of a manufacturing process. An adjustment with reason code "Production Variance" reconciles the difference.
|
|
43
|
+
- **Threshold-based approval**: An adjustment exceeding a configured quantity or value limit is routed to a supervisor for approval before confirmation.
|
|
44
|
+
- **Bulk post-count adjustment**: After a full physical inventory count, the system generates one adjustment record per variance line, allowing batch review, reason-code assignment, and confirmation.
|
|
45
|
+
|
|
46
|
+
## Test Cases
|
|
47
|
+
|
|
48
|
+
- A positive adjustment increases on-hand quantity by the specified amount at the given location
|
|
49
|
+
- A negative adjustment decreases on-hand quantity by the specified amount at the given location
|
|
50
|
+
- A negative adjustment cannot reduce on-hand quantity below zero (unless the organization permits negative stock)
|
|
51
|
+
- Every confirmed adjustment creates exactly one stock movement record with the correct source/destination (virtual adjustment location)
|
|
52
|
+
- A reason code is required on every adjustment; confirmation without a reason code is rejected
|
|
53
|
+
- Adjustments in draft status do not affect on-hand quantity or valuation until confirmed
|
|
54
|
+
- When approval workflow is enabled, adjustments above the threshold remain pending until approved
|
|
55
|
+
- A rejected adjustment does not generate a stock movement or change on-hand quantity
|
|
56
|
+
- Adjustments originating from an inventory count link back to the count session for traceability
|
|
57
|
+
- Confirmed adjustments update inventory valuation consistent with the organization's costing method
|
|
58
|
+
- Adjustments are immutable after confirmation; corrections require a new, offsetting adjustment
|
|
59
|
+
|
|
60
|
+
## Reference Links
|
|
61
|
+
|
|
62
|
+
- [SAP Goods Movement - Adjustment Posting (Movement Types 501/502)](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/f42e93de3a7c4de2abb5ffb817785bef/4023cff7ddba1d65e10000000a174cb4.html)
|
|
63
|
+
- [Oracle Inventory Adjustments](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25a/famoh/inventory-adjustments.html)
|
|
64
|
+
- [NetSuite Inventory Adjustment](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N1624498.html)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Inventory Count
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Inventory Count manages the process of verifying physical stock against system records through full physical inventories and cycle counts. A full physical inventory counts every item at a location, while a cycle count targets a subset of items on a rolling schedule — typically driven by ABC classification, location zone, or product group.
|
|
6
|
+
|
|
7
|
+
The count workflow follows a structured lifecycle: plan the count, optionally freeze stock movements, execute the physical count, review variances (counted quantity minus system quantity), approve results, and automatically generate inventory adjustments for approved variances. Cycle counts can be scheduled to run continuously, ensuring stock accuracy is maintained without the disruption of a full physical inventory.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- **Regulatory compliance**: Periodic physical verification is required by accounting standards and auditors to validate inventory balances on the balance sheet
|
|
12
|
+
- **Stock accuracy**: Identifies and corrects discrepancies between system records and actual physical quantities, improving fulfillment reliability
|
|
13
|
+
- **Loss detection**: Surfaces shrinkage, damage, misplacement, and theft through systematic variance analysis
|
|
14
|
+
- **Continuous improvement**: Cycle counts enable rolling accuracy checks without halting warehouse operations, unlike full physical inventories that may require a stock freeze
|
|
15
|
+
- **Downstream reliability**: Accurate inventory feeds into purchasing (reorder points), sales (available-to-promise), and finance (inventory valuation)
|
|
16
|
+
- **Root cause analysis**: Variance data collected over time reveals patterns in stock discrepancies, enabling process improvements
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Create Count Document] --> B[Select Location / Warehouse]
|
|
23
|
+
B --> C{Freeze Stock?}
|
|
24
|
+
C -- Yes --> D[Block Inbound/Outbound Movements]
|
|
25
|
+
C -- No --> E[Snapshot System Quantities]
|
|
26
|
+
D --> E
|
|
27
|
+
E --> F[Distribute Count Sheets]
|
|
28
|
+
F --> G[Execute Physical Count]
|
|
29
|
+
G --> H[Enter Counted Quantities]
|
|
30
|
+
H --> I[Calculate Variances]
|
|
31
|
+
I --> J{Variances Within Tolerance?}
|
|
32
|
+
J -- Yes --> K[Auto-Approve]
|
|
33
|
+
J -- No --> L[Manager Reviews Variances]
|
|
34
|
+
L --> M{Recount Required?}
|
|
35
|
+
M -- Yes --> G
|
|
36
|
+
M -- No --> N[Approve / Reject Line Items]
|
|
37
|
+
K --> O[Generate Inventory Adjustments]
|
|
38
|
+
N --> O
|
|
39
|
+
O --> P[Post Adjustments]
|
|
40
|
+
P --> Q{Stock Frozen?}
|
|
41
|
+
Q -- Yes --> R[Unfreeze Stock Movements]
|
|
42
|
+
Q -- No --> S[Count Completed]
|
|
43
|
+
R --> S
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Scenario Patterns
|
|
47
|
+
|
|
48
|
+
- **Annual full physical inventory**: All items at a warehouse are counted at fiscal year-end with stock movements frozen to ensure an accurate snapshot for financial reporting
|
|
49
|
+
- **ABC cycle count**: High-value A-items are counted weekly, B-items monthly, and C-items quarterly, distributing count workload evenly across the year
|
|
50
|
+
- **Location-based cycle count**: A specific warehouse zone or bin range is counted on a rotating schedule, ensuring every location is verified within a defined period
|
|
51
|
+
- **Blind count**: Counters are not shown system quantities during counting to prevent bias; variances are calculated only after all counts are entered
|
|
52
|
+
- **Recount on high variance**: When a counted quantity deviates beyond a configured tolerance threshold, a mandatory recount is triggered before the variance can be approved
|
|
53
|
+
- **Multi-counter reconciliation**: Two independent counters verify the same items; discrepancies between their counts trigger a third-party recount before variance approval
|
|
54
|
+
- **Post-count adjustment**: Approved variances automatically generate inventory adjustment records that update on-hand quantities and post corresponding financial entries
|
|
55
|
+
|
|
56
|
+
## Test Cases
|
|
57
|
+
|
|
58
|
+
- Creating a count document captures the target location, count type (full or cycle), and planned date
|
|
59
|
+
- Snapshot records the system on-hand quantity for each item at the moment the count is initiated
|
|
60
|
+
- Variance is calculated as counted quantity minus system quantity for each count line
|
|
61
|
+
- Variances within the configured tolerance are auto-approved without manager review
|
|
62
|
+
- Variances exceeding tolerance require explicit approval or rejection by an authorized user
|
|
63
|
+
- Rejecting a variance line triggers a recount for that item without affecting other approved lines
|
|
64
|
+
- Approved variances generate corresponding inventory adjustment records with reason code "inventory-count"
|
|
65
|
+
- Generated adjustments update on-hand stock quantities and post to the inventory valuation ledger
|
|
66
|
+
- Freezing stock blocks new inbound and outbound movements for the counted location until the count is completed
|
|
67
|
+
- Unfreezing stock resumes normal movement processing after count completion
|
|
68
|
+
- Cycle count policies can be configured by ABC classification, location, or product group with independent frequencies
|
|
69
|
+
- Scheduled cycle counts automatically generate count documents on their configured frequency
|
|
70
|
+
- A count document cannot be finalized until all lines are either approved, rejected, or marked for recount
|
|
71
|
+
- Blind count mode hides system quantities from the count entry interface
|
|
72
|
+
- Count documents maintain a complete audit trail of who counted, when, and what values were entered
|
|
73
|
+
|
|
74
|
+
## Reference Links
|
|
75
|
+
|
|
76
|
+
- [SAP Physical Inventory (MI01/MI04/MI07)](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/f42e4a8abfc34ed6b11ab15478b79e78/4e2dd7c6b24e3857e10000000a174cb4.html)
|
|
77
|
+
- [Oracle Cycle Counting](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25a/famie/cycle-counting.html)
|
|
78
|
+
- [Odoo Inventory Adjustments](https://www.odoo.com/documentation/17.0/applications/inventory_and_mrp/inventory/warehouses_storage/inventory_management/count_products.html)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Inventory Valuation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Inventory Valuation calculates and tracks the monetary value of on-hand stock using configurable costing methods: FIFO (First In, First Out), Weighted Average Cost (AVCO), and Standard Cost. Each stock movement — goods receipt, goods issue, transfer, or adjustment — triggers a recalculation of cost-per-unit and total inventory value for the affected item.
|
|
6
|
+
|
|
7
|
+
The valuation method is configured through ValuationPolicy — an entity owned by the inventory module that defines the costing strategy (FIFO, AVCO, or Standard Cost) and related parameters such as standard cost rate. Each item is associated with a ValuationPolicy, allowing operators to assign different costing strategies per item or group items under a shared policy by convention. When a valuation change occurs, the module emits events that downstream systems (such as accounting) can consume to create journal entries. The inventory module owns cost tracking, valuation configuration, and valuation calculation; general ledger posting is explicitly out of scope.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- **Financial reporting accuracy**: Maintain up-to-date inventory asset values for balance sheet reporting
|
|
12
|
+
- **Cost of Goods Sold (COGS) calculation**: Determine the cost assigned to goods issued or sold, using the configured costing method
|
|
13
|
+
- **Costing method flexibility**: Support multiple valuation strategies (FIFO, AVCO, Standard Cost) to meet different industry and regulatory requirements
|
|
14
|
+
- **Movement-driven updates**: Automatically recalculate valuations on every stock movement, eliminating manual revaluation effort
|
|
15
|
+
- **Audit trail**: Record cost-per-unit at the time of each movement for traceability and variance analysis
|
|
16
|
+
- **Downstream integration**: Emit valuation events so accounting or other modules can create corresponding financial entries without tight coupling
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Stock Movement Occurs] --> B{Movement Type?}
|
|
23
|
+
B -->|Goods Receipt| C[Record unit cost from receipt]
|
|
24
|
+
B -->|Goods Issue| D[Calculate issue cost using costing method]
|
|
25
|
+
B -->|Adjustment| E[Apply cost impact based on adjustment type]
|
|
26
|
+
B -->|Transfer| F[Carry existing cost-per-unit to destination]
|
|
27
|
+
|
|
28
|
+
C --> G{Costing Method?}
|
|
29
|
+
G -->|FIFO| H[Add receipt as new cost layer]
|
|
30
|
+
G -->|AVCO| I[Recalculate weighted average cost]
|
|
31
|
+
G -->|Standard Cost| J[Record at standard rate, capture variance]
|
|
32
|
+
|
|
33
|
+
D --> K{Costing Method?}
|
|
34
|
+
K -->|FIFO| L[Consume oldest cost layer first]
|
|
35
|
+
K -->|AVCO| M[Issue at current average cost]
|
|
36
|
+
K -->|Standard Cost| N[Issue at standard rate]
|
|
37
|
+
|
|
38
|
+
H --> O[Update total valuation]
|
|
39
|
+
I --> O
|
|
40
|
+
J --> O
|
|
41
|
+
L --> O
|
|
42
|
+
M --> O
|
|
43
|
+
N --> O
|
|
44
|
+
E --> O
|
|
45
|
+
F --> O
|
|
46
|
+
|
|
47
|
+
O --> P[Emit valuation change event]
|
|
48
|
+
P --> Q[Downstream systems consume event]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Scenario Patterns
|
|
52
|
+
|
|
53
|
+
- **FIFO receipt and issue**: A goods receipt creates a new cost layer with the purchase unit cost and quantity. A subsequent goods issue consumes the oldest cost layer first; if that layer is exhausted, the next layer is used. This produces accurate COGS that reflects actual purchase prices in chronological order.
|
|
54
|
+
- **Weighted average receipt**: A goods receipt recalculates the average cost by combining the existing on-hand value with the new receipt value, then dividing by the total quantity. All subsequent issues use this updated average cost until the next receipt.
|
|
55
|
+
- **Standard cost with variance capture**: Goods are received and issued at a predefined standard cost. Any difference between the actual purchase price and the standard cost is recorded as a purchase price variance. Periodic revaluation can update the standard rate, producing a revaluation variance.
|
|
56
|
+
- **Inventory adjustment impact**: A positive adjustment (e.g., found stock) increases on-hand quantity at the current cost-per-unit. A negative adjustment (e.g., shrinkage) removes quantity and reduces total valuation, using the current costing method to determine the cost removed.
|
|
57
|
+
- **Internal transfer**: Transfers between warehouses or storage locations carry the existing cost-per-unit to the destination. No valuation change occurs at the item level; only the location-level valuation splits are updated.
|
|
58
|
+
- **Scrap disposal**: Scrapped items are issued at their current cost-per-unit, reducing total inventory valuation. The valuation event includes the scrapped cost for downstream write-off accounting.
|
|
59
|
+
|
|
60
|
+
## Test Cases
|
|
61
|
+
|
|
62
|
+
- Given an item configured with FIFO costing, when 10 units are received at 100 currency and then 5 units at 120 currency, then issuing 12 units should consume all 10 units at 100 and 2 units at 120, producing a COGS of 1240
|
|
63
|
+
- Given an item configured with AVCO costing, when 10 units are received at 100 currency (total value 1000) and then 10 units are received at 200 currency, the average cost-per-unit should be 150
|
|
64
|
+
- Given an item configured with AVCO costing with an average cost of 150 per unit and 20 units on hand, when 5 units are issued, the issue cost should be 750 and remaining valuation should be 2250
|
|
65
|
+
- Given an item configured with standard cost of 50 per unit, when 10 units are received at an actual cost of 55 per unit, the inventory should be valued at 500 and a purchase price variance of 50 should be recorded
|
|
66
|
+
- Given a standard cost item, when the standard cost is updated from 50 to 60 with 100 units on hand, a revaluation event should be emitted with a variance of 1000
|
|
67
|
+
- Given any costing method, when a stock movement updates the valuation, a valuation change event should be emitted containing the item identifier, old and new cost-per-unit, old and new total valuation, and the originating movement reference
|
|
68
|
+
- Given an internal transfer of 10 units with a cost-per-unit of 80, the total item-level valuation should remain unchanged after the transfer completes
|
|
69
|
+
- Given a negative inventory adjustment of 3 units for an AVCO item with a current average cost of 120, the total valuation should decrease by 360
|
|
70
|
+
- Given a FIFO item with two cost layers (5 units at 100, 5 units at 110), when all 10 units are scrapped, the total valuation removal should be 1050
|
|
71
|
+
|
|
72
|
+
## Reference Links
|
|
73
|
+
|
|
74
|
+
- [Inventory Module README](../../README.md) — module scope and dependency overview
|
|
75
|
+
- [Stock Movement](./stock-movement.md) — movement types that trigger valuation updates
|
|
76
|
+
- [Inventory Adjustment](./inventory-adjustment.md) — adjustment scenarios with valuation impact
|
|
77
|
+
- [Scrap Management](./scrap-management.md) — scrap disposal and valuation write-off
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Lot and Batch Tracking
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Lot and Batch Tracking assigns lot or batch identifiers to groups of identical products that were produced or received together, enabling full traceability through the supply chain. Each lot carries key attributes such as lot number, manufacture date, expiration date, and supplier lot reference, allowing organizations to trace products forward (from lot to which customers received it) and backward (from lot to which supplier provided it).
|
|
6
|
+
|
|
7
|
+
Stock quantities are tracked at the lot level per storage location, providing granular visibility into which specific batches are on hand, where they are stored, and when they expire. This lot-level granularity supports expiration alerting, First Expired First Out (FEFO) picking strategies, and regulatory compliance for industries such as food, pharmaceuticals, and chemicals.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Enable forward traceability — given a lot, determine which customers, orders, or locations received stock from that lot
|
|
12
|
+
- Enable backward traceability — given a lot, determine which supplier, purchase order, or production run produced it
|
|
13
|
+
- Track expiration dates to prevent shipping or consuming expired stock
|
|
14
|
+
- Support FEFO (First Expired, First Out) strategies by providing expiration-date-sorted lot lists for operator-driven picking decisions
|
|
15
|
+
- Maintain compliance with regulatory requirements including FDA regulations, EU food safety directives, and FSMA Section 204
|
|
16
|
+
- Provide lot-level stock visibility per warehouse and storage location for precise inventory management
|
|
17
|
+
- Record supplier lot references to correlate internal lot numbers with supplier-provided identifiers
|
|
18
|
+
- Support recall workflows by quickly identifying all locations and recipients of an affected lot
|
|
19
|
+
|
|
20
|
+
## Process Flow
|
|
21
|
+
|
|
22
|
+
```mermaid
|
|
23
|
+
flowchart TD
|
|
24
|
+
A[Goods Receipt] --> B{Lot-Tracked Item?}
|
|
25
|
+
B -->|No| C[Standard Stock Update]
|
|
26
|
+
B -->|Yes| D[Create or Select Lot]
|
|
27
|
+
D --> E[Record Lot Attributes]
|
|
28
|
+
E --> F[Assign Lot to Received Quantity]
|
|
29
|
+
F --> G[Update Lot-Level Stock per Location]
|
|
30
|
+
G --> H[Lot In Stock]
|
|
31
|
+
H --> I{Stock Movement?}
|
|
32
|
+
I -->|Transfer| J[Move Lot Quantity Between Locations]
|
|
33
|
+
I -->|Issue / Ship| K[Deduct Lot Quantity]
|
|
34
|
+
I -->|Adjustment| L[Adjust Lot Quantity with Reason]
|
|
35
|
+
J & K & L --> M[Record Movement Against Lot]
|
|
36
|
+
M --> H
|
|
37
|
+
H --> N{Expiration Check}
|
|
38
|
+
N -->|Approaching Expiry| O[Trigger Expiration Alert]
|
|
39
|
+
N -->|Expired| P[Block or Flag Lot]
|
|
40
|
+
O --> Q[Prioritize for FEFO Picking]
|
|
41
|
+
H --> R{Recall or Inquiry?}
|
|
42
|
+
R -->|Forward Trace| S[Lot -> Movements -> Recipients]
|
|
43
|
+
R -->|Backward Trace| T[Lot -> Receipt -> Supplier / PO]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Scenario Patterns
|
|
47
|
+
|
|
48
|
+
- **Goods Receipt with Lot Assignment**: A shipment of 500 units arrives from a supplier. The receiver creates lot "LOT-2026-0312" with manufacture date 2026-03-01, expiration date 2027-03-01, and supplier lot reference "SUP-A-8834". All 500 units are recorded against this lot at the receiving location.
|
|
49
|
+
- **Multi-Lot Receipt**: A single purchase order delivery contains items from two different production runs. The receiver creates two lots, each with distinct manufacture and expiration dates, and splits the received quantity accordingly.
|
|
50
|
+
- **FEFO Picking**: Warehouse has lot A (expires 2026-06-01) and lot B (expires 2026-09-01) for the same item. When a goods issue is requested, the operator refers to the expiration-date-sorted lot list and manually selects lot A first because it expires sooner. Automated FEFO picking assignment is not in scope.
|
|
51
|
+
- **Expiration Alert**: A nightly or periodic check identifies lots expiring within a configurable threshold (e.g., 30 days). Alerts are generated so warehouse staff can prioritize these lots for outbound orders or mark them for review.
|
|
52
|
+
- **Forward Traceability (Recall)**: A quality issue is discovered in lot "LOT-2026-0312". The system traces all outbound movements for that lot, identifying every sales order, customer, and destination location that received units from the affected lot.
|
|
53
|
+
- **Backward Traceability (Root Cause)**: A customer reports a defect. The shipped lot is identified, and the system traces backward to the originating supplier, purchase order, and supplier lot reference to isolate the source.
|
|
54
|
+
- **Lot Transfer Between Locations**: 100 units of lot "LOT-2026-0312" are transferred from Warehouse A, Bin 01 to Warehouse B, Bin 05. Both the source deduction and destination addition are recorded against the same lot.
|
|
55
|
+
- **Lot-Level Inventory Adjustment**: During a physical count, 10 units of a specific lot are found missing. An inventory adjustment is recorded against that lot with a reason code, updating the lot-level stock balance.
|
|
56
|
+
- **Expired Lot Handling**: A lot passes its expiration date. The system flags the lot as expired, preventing it from being selected for outbound shipments. The lot quantity may be routed to scrap management for disposal.
|
|
57
|
+
|
|
58
|
+
## Test Cases
|
|
59
|
+
|
|
60
|
+
- Creating a lot requires a unique lot number within the scope of the item
|
|
61
|
+
- Lot number is immutable after creation
|
|
62
|
+
- Manufacture date, expiration date, and supplier lot reference are recorded at lot creation and can be updated before the lot is fully consumed
|
|
63
|
+
- Goods receipt for a lot-tracked item must specify a lot; receipts without lot assignment should be rejected
|
|
64
|
+
- Stock quantities are tracked per lot per storage location; on-hand balances reflect lot-level granularity
|
|
65
|
+
- A goods issue against a specific lot reduces that lot's quantity at the specified location
|
|
66
|
+
- Issuing more quantity than a lot's on-hand balance at a location should be rejected
|
|
67
|
+
- Internal transfers preserve the lot association — the destination stock record references the same lot
|
|
68
|
+
- Inventory adjustments are recorded at the lot level with a mandatory reason code
|
|
69
|
+
- Forward traceability query for a lot returns all outbound stock movements and their destinations
|
|
70
|
+
- Backward traceability query for a lot returns the originating receipt, supplier, and purchase order reference
|
|
71
|
+
- Expiration alert is triggered when a lot's expiration date is within the configured threshold
|
|
72
|
+
- Expired lots are excluded from FEFO picking recommendations
|
|
73
|
+
- Lots with no remaining on-hand quantity across all locations are marked as fully consumed
|
|
74
|
+
- A single item can have multiple active lots simultaneously at the same storage location
|
|
75
|
+
|
|
76
|
+
## Reference Links
|
|
77
|
+
|
|
78
|
+
- [SAP Batch Management](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/f47f7a5b49084709aac9f60498bab8cd/4517edda2c8c7744e10000000a174cb4.html)
|
|
79
|
+
- [Odoo Lot and Serial Number Tracking](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/inventory/product_management/product_tracking.html)
|
|
80
|
+
- [FDA FSMA Section 204 Traceability Rule](https://www.fda.gov/food/food-safety-modernization-act-fsma/fsma-final-rule-requirements-additional-traceability-records-certain-foods)
|
|
81
|
+
- [Oracle Lot Control](https://docs.oracle.com/en/cloud/saas/supply-chain-management/24d/faims/lot-and-serial-control.html)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Scrap Management
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Scrap management handles the controlled removal of damaged, expired, defective, or obsolete stock from usable inventory. Scrap is modeled as an InventoryAdjustment with `adjustmentType = SCRAP`. When confirmed, the adjustment moves stock from the source storage location to a virtual "scrap" location, effectively removing it from available stock and reducing inventory valuation.
|
|
6
|
+
|
|
7
|
+
Organizations may enforce approval workflows for scrap adjustments that exceed a defined value threshold, ensuring proper oversight of material losses. Scrap adjustments follow the same approval workflow as correction adjustments (DRAFT → PENDING_APPROVAL → CONFIRMED). Once confirmed, the adjustment is immutable — if scrap was created in error, a new CORRECTION adjustment with a positive quantityDelta can restore the stock.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Remove physically damaged, expired, or quality-rejected stock from available inventory so it is not accidentally picked, sold, or consumed
|
|
12
|
+
- Maintain accurate inventory valuation by writing off the cost of scrapped items at the time of disposal
|
|
13
|
+
- Provide an auditable trail of why, when, and by whom stock was disposed, supporting regulatory and internal compliance requirements
|
|
14
|
+
- Enable approval controls for high-value scrap events, preventing unauthorized write-offs
|
|
15
|
+
- Support root-cause analysis by categorizing scrap reasons (damage, expiration, quality failure, obsolescence), feeding continuous improvement initiatives
|
|
16
|
+
- Preserve lot and serial traceability through the scrap process for recall and warranty tracking
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Identify unusable stock] --> B[Create inventory adjustment with type=SCRAP]
|
|
23
|
+
B --> C{Approval required?}
|
|
24
|
+
C -- Yes --> D[Submit for approval]
|
|
25
|
+
D --> E{Approved?}
|
|
26
|
+
E -- Yes --> F[Confirm adjustment]
|
|
27
|
+
E -- No --> G[Reject / return to draft]
|
|
28
|
+
C -- No --> F
|
|
29
|
+
F --> H[Move stock to virtual scrap location]
|
|
30
|
+
H --> I[Adjust inventory valuation]
|
|
31
|
+
I --> J[Scrap completed]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Scenario Patterns
|
|
35
|
+
|
|
36
|
+
- **Damaged goods scrap**: Warehouse staff discover physically damaged items during handling or counting and create a SCRAP adjustment referencing the damage reason and source location
|
|
37
|
+
- **Expired stock disposal**: Items that have passed their expiration date are identified (often via lot tracking) and scrapped to clear them from available inventory
|
|
38
|
+
- **Quality failure scrap**: Items that fail incoming or in-process quality inspection are immediately scrapped, with the quality rejection linked as the scrap reason
|
|
39
|
+
- **Obsolescence write-off**: Slow-moving or discontinued items are scrapped as part of a periodic inventory review to reflect their true recoverable value
|
|
40
|
+
- **High-value approval scrap**: A scrap adjustment exceeds the organization's value threshold, triggering a manager approval step before the stock movement is executed
|
|
41
|
+
- **Scrap error correction**: A scrap adjustment is found to have been created in error; a new CORRECTION adjustment with positive quantityDelta restores the stock to the source location
|
|
42
|
+
- **Lot/serial-tracked scrap**: Specific lots or serial numbers are scrapped, maintaining full traceability from receipt through disposal. Serial numbers transition to SCRAPPED state on confirmation.
|
|
43
|
+
|
|
44
|
+
## Test Cases
|
|
45
|
+
|
|
46
|
+
- Creating a SCRAP adjustment with positive quantityDelta is rejected
|
|
47
|
+
- Confirming a SCRAP adjustment removes the specified quantity from the source location's available stock
|
|
48
|
+
- Scrapped stock appears in the virtual scrap location and is excluded from available-to-promise calculations
|
|
49
|
+
- Inventory valuation decreases by the cost of the scrapped items upon confirmation
|
|
50
|
+
- SCRAP adjustments record the item, quantity, source location, reason, date, and responsible user
|
|
51
|
+
- When lot tracking is enabled, the scrap adjustment must reference a valid lot number with sufficient quantity
|
|
52
|
+
- When serial tracking is enabled, the scrap adjustment must reference specific serial numbers in the source location; serial transitions to SCRAPPED on confirmation
|
|
53
|
+
- SCRAP adjustments exceeding the configured value threshold require approval before confirmation
|
|
54
|
+
- Rejected SCRAP adjustments remain in draft and do not affect stock or valuation
|
|
55
|
+
- Scrapped items cannot re-enter available stock without a new CORRECTION adjustment
|
|
56
|
+
- Scrap reason is mandatory and must be one of the defined reason categories
|
|
57
|
+
- Listing adjustments filtered by `adjustmentType = SCRAP` returns only scrap records
|
|
58
|
+
|
|
59
|
+
## Reference Links
|
|
60
|
+
|
|
61
|
+
- [Odoo Scrap Management](https://www.odoo.com/documentation/17.0/applications/inventory_and_mrp/inventory/warehouses_storage/removal_strategies.html)
|
|
62
|
+
- [SAP Movement Types 551/552 for Scrapping](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/f7fddfe4caca43b4a511ab5e99f65567/e457ae2bbbf71014bfc0e6eee74504ce.html)
|
|
63
|
+
- [Oracle Inventory Scrap Transactions](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25a/fammi/inventory-transactions.html)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Serial Number Tracking
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Serial number tracking enables individual unit-level traceability within the inventory module. Each serialized item is assigned a unique serial number that follows it through its inventory lifecycle — from goods receipt or production through to goods issue, return, or disposal. A serialized item always represents exactly one unit of stock, distinguishing it from lot/batch tracking where a single identifier covers multiple units.
|
|
6
|
+
|
|
7
|
+
Serial numbers are unique per item type: the same serial number cannot exist twice for the same item, ensuring unambiguous identification of every individual unit. The item-management module defers all serial number management to the inventory module, which owns assignment, state transitions, and history.
|
|
8
|
+
|
|
9
|
+
The inventory module tracks serial numbers only through inventory-relevant states (AVAILABLE, ISSUED, RETURNED, SCRAPPED). Reservation for sales orders and shipment tracking are the responsibility of the sales module, which references serial numbers but does not own their state. This separation aligns with SAP/Oracle approaches and avoids coupling inventory to sales lifecycle concerns.
|
|
10
|
+
|
|
11
|
+
## Business Purpose
|
|
12
|
+
|
|
13
|
+
- **Individual unit traceability**: Know exactly which specific unit was shipped to which customer, enabling precise after-sales support
|
|
14
|
+
- **Warranty tracking**: Link warranty claims to the exact unit by serial number, with full visibility into manufacture date, shipment date, and transaction history
|
|
15
|
+
- **Recall management**: Identify and locate every affected unit by serial number when a product recall is issued
|
|
16
|
+
- **Regulatory compliance**: Meet traceability requirements such as DSCSA (Drug Supply Chain Security Act) for pharmaceuticals and similar regulations in electronics, medical devices, and aerospace
|
|
17
|
+
- **Return and repair tracking**: Match returned units to their original shipment and trace repair history across service events
|
|
18
|
+
- **Fraud prevention**: Detect duplicate or counterfeit serial numbers entering the supply chain
|
|
19
|
+
|
|
20
|
+
## Process Flow
|
|
21
|
+
|
|
22
|
+
The following diagram shows the lifecycle states of a serialized item from initial assignment through terminal states.
|
|
23
|
+
|
|
24
|
+
```mermaid
|
|
25
|
+
flowchart TD
|
|
26
|
+
A[Goods Receipt / Production] -->|Assign serial number| B(AVAILABLE)
|
|
27
|
+
B -->|Goods issue| C(ISSUED)
|
|
28
|
+
C -->|Customer returns unit| D(RETURNED)
|
|
29
|
+
D -->|Inspect and restock| B
|
|
30
|
+
D -->|Unit is defective| E(SCRAPPED)
|
|
31
|
+
B -->|Unit damaged in warehouse| E(SCRAPPED)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Serial numbers are assigned at the point of goods receipt (for purchased items) or at the end of production (for manufactured items). Once assigned, a serial number is immutable and permanently associated with that specific physical unit. A serial number is always associated with a StorageLocation — its location changes through stock movements.
|
|
35
|
+
|
|
36
|
+
## Scenario Patterns
|
|
37
|
+
|
|
38
|
+
- **Goods receipt serialization**: A purchase order is received and each individual unit is assigned a unique serial number during the inbound inspection or put-away process
|
|
39
|
+
- **Production serialization**: A manufacturing work order completes and each finished unit is assigned a serial number before being admitted to inventory
|
|
40
|
+
- **Goods issue**: A stock movement issues a serialized unit from inventory, transitioning it from AVAILABLE to ISSUED. The sales module may reference the serial number for shipment and customer tracking
|
|
41
|
+
- **Customer return**: An issued unit is returned by the customer, transitioning to RETURNED for inspection and disposition
|
|
42
|
+
- **Restock after return**: An inspected returned unit passes quality checks and is restocked as AVAILABLE at a StorageLocation
|
|
43
|
+
- **Scrap disposition**: A returned or warehouse-damaged unit is deemed unfit for sale and transitioned to SCRAPPED, removing it from inventory
|
|
44
|
+
- **Warranty lookup**: A customer contacts support with a serial number; the system retrieves the full transaction history including receipt date, issue date, and any prior returns
|
|
45
|
+
- **Recall execution**: A product recall is initiated; the system queries all serial numbers for the affected item and identifies their current state and location (warehouse or issued)
|
|
46
|
+
|
|
47
|
+
## Test Cases
|
|
48
|
+
|
|
49
|
+
- Each serialized item has a quantity of exactly 1; the system rejects any transaction that would result in a fractional or multi-unit quantity for a serial number
|
|
50
|
+
- Serial numbers are unique per item type; assigning a duplicate serial number for the same item is rejected
|
|
51
|
+
- Serial numbers for different item types may overlap (e.g., item A serial "001" and item B serial "001" can coexist)
|
|
52
|
+
- A serial number can only be assigned during goods receipt or production completion
|
|
53
|
+
- Once assigned, a serial number cannot be changed or reassigned to a different physical unit
|
|
54
|
+
- State transitions follow the defined lifecycle: AVAILABLE -> ISSUED, ISSUED -> RETURNED, RETURNED -> AVAILABLE or SCRAPPED, AVAILABLE -> SCRAPPED
|
|
55
|
+
- An AVAILABLE serial can transition directly to SCRAPPED (e.g., warehouse damage)
|
|
56
|
+
- An ISSUED serial cannot transition directly to AVAILABLE; it must pass through RETURNED first
|
|
57
|
+
- A SCRAPPED serial is terminal and cannot transition to any other state
|
|
58
|
+
- The full transaction history for a serial number is queryable, including all state transitions with timestamps, related stock movements, and StorageLocation changes
|
|
59
|
+
- Inventory counts for serialized items reconcile as the sum of individual serial numbers in AVAILABLE state at the counted StorageLocation
|
|
60
|
+
|
|
61
|
+
## Reference Links
|
|
62
|
+
|
|
63
|
+
- [Stock Tracking](./stock-tracking.md) — serial numbers are associated with a StorageLocation; for serialized items, on-hand count equals the number of serials in AVAILABLE state
|
|
64
|
+
- [Stock Movement](./stock-movement.md) — serial state transitions are driven by stock movements (goods receipt assigns, goods issue transitions to ISSUED)
|
|
65
|
+
- [Warehouse Management](./warehouse-management.md) — StorageLocation provides the spatial axis for serial number location
|
|
66
|
+
- [Oracle Serial Number Management](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25a/fammi/manage-serial-numbers.html)
|
|
67
|
+
- [SAP Serial Number Management](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/f42e19a0e7404ebdbf6ec38ca93c1498/e54d9e616e2b1014b3fc9daa49709e5e.html)
|
|
68
|
+
- [DSCSA — FDA Drug Supply Chain Security Act](https://www.fda.gov/drugs/drug-supply-chain-integrity/drug-supply-chain-security-act-dscsa)
|