diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-024-iteration-04-wireframes-test-models.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-024-iteration-04-wireframes-test-models.md new file mode 100644 index 0000000..4361da2 --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-024-iteration-04-wireframes-test-models.md @@ -0,0 +1,42 @@ +# Checkpoint 024 — Stage 11 Wireframes & Stage 12 Test Models Complete for Iteration 04 + +- **Checkpoint ID:** `CKPT-024` +- **Date:** 2026-10-12 +- **Active Stage:** Stage 11 (Wireframes & Screen Specifications) & Stage 12 (Test Models & QA Artifacts) Complete; Stage 13 (Code Generation) Ready +- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB) +- **Active Skills:** `up-wireframe-spec`, `up-test-model-generate` +- **Governed Standard:** UP-AI v1.5 Standard + +## Completed +1. **Stage 11 Wireframes & Field-Level Screen Specifications:** + - Authored 7 comprehensive screen specifications under `04_generated_documentation/06_wireframes/screen_specs/`: + - [`SCREEN-WH-001_stock_ledger.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-WH-001_stock_ledger.md): Multi-godown dual-unit stock ledger, balance cards, physical count audit reconciliation & adjustment modal (`FR-WAREHOUSEINVENTORY-001`). + - [`SCREEN-WH-002_capacity_transfers.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-WH-002_capacity_transfers.md): Warehouse capacity utilization meter (85% warning threshold) & inter-godown transfer workflow (`FR-WAREHOUSEINVENTORY-002`, `003`). + - [`SCREEN-SALES-001_sales_order_booking.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-SALES-001_sales_order_booking.md): Customer sales contract booking form & real-time credit exposure guard (80% warning, 100% block, Partner override) (`FR-SALESCONTRACTS-001`, `002`). + - [`SCREEN-SALES-002_lot_allocation.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-SALES-002_lot_allocation.md): Released-lot inventory allocation console matching sales orders to warehouse stacks, enforcing `RELEASED` invariant (`FR-SALESCONTRACTS-003`). + - [`SCREEN-DISP-001_dispatch_board_weighbridge.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DISP-001_dispatch_board_weighbridge.md): Outbound dispatch console, outward weighbridge capture (Tare & Gross, $\pm 1.0\%$ order tolerance), transport Bilty/manifest generator with e-Way bill (`FR-DISPATCHDELIVERY-001`, `002`). + - [`SCREEN-DISP-002_pod_shortage_settlement.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DISP-002_pod_shortage_settlement.md): In-transit delivery confirmation, destination weighment logging, POD upload reference, automated invoice triggering, consignee shortage note & compensating credit note modal (`FR-DISPATCHDELIVERY-003`). + - [`SCREEN-FLEET-001_fleet_registry.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-FLEET-001_fleet_registry.md): Transport fleet & carrier registry (payload capacity, ownership type, fitness expiry, maintenance gating) (`FR-FLEETREGISTRY-001`). + - Updated and reconciled [`wireframe_index.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/wireframe_index.md). + +2. **Stage 12 Multi-Path Test Models & QA Deliverables:** + - Authored 4 multi-path functional test models under `04_generated_documentation/07_test_design/functional_test_cases/` covering all 4 dimensions (Happy Path, Boundary/Edge, Negative/Security, FSM Invariant & Concurrency): + - [`TC-007_warehouse_stock_ledger.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/functional_test_cases/TC-007_warehouse_stock_ledger.md) + - [`TC-008_sales_contracts_credit_allocation.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/functional_test_cases/TC-008_sales_contracts_credit_allocation.md) + - [`TC-009_outbound_dispatch_delivery.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/functional_test_cases/TC-009_outbound_dispatch_delivery.md) + - [`TC-010_transport_fleet_registry.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/functional_test_cases/TC-010_transport_fleet_registry.md) + - Created git-versioned Bruno collections under `docs/api/bruno/inventory/`, `docs/api/bruno/sales/`, `docs/api/bruno/dispatch/`, `docs/api/bruno/fleet/`. + - Authored comprehensive Markdown walkthrough guide: [`MANUAL_TESTING_GUIDE.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/manual_qa/iteration-04/MANUAL_TESTING_GUIDE.md). + - Compiled 21-sheet, 30-column Excel Manual QA Workbook: [`Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx) densely populated with 32 test cases ($\ge 20$ required threshold). + - Updated [`test_traceability_matrix.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/test_traceability_matrix.md) and [`regression_test_cases.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/regression_test_cases.md). + +3. **Quality Gates Verification:** + - Ran `scripts/verify_traceability_gates.py --iteration iteration-04`: Gate 5.1 (PASS), Gate 9.1 (PASS), Gate 14.1 referential integrity & density checks (PASS with 0 Critical, 0 Major, 0 Minor). + +## Open Items +- Proceeding to Stage 13 Code Generation (`/up-code-generate`) across the 3 scheduled parallel lanes. +- Ambiguities `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` remain tracked. + +## Exact Next Action +Proceed to **Stage 13 Code Generation (`/up-code-generate`)** for Iteration 04. + diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md index e36a79f..56e65d5 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -46,5 +46,6 @@ | `CKPT-021` | 2026-10-12 | Stage 14 (Construction E2E Verification & Gate 14.1 Pass) | Live container infrastructure verified: PostgreSQL 17 Alembic migrations 001–004 applied, live PostgreSQL RLS integration tests pass (4/4), live containerized FastAPI endpoints pass (8/8) covering all 7 Bruno collections. Total 64 unit tests passing with 98.1% coverage. Quality Gates 5.1, 9.1, and 14.1 all PASSED. Requirements for Iteration 01 and 02 advanced to Delivered (E2E Verified). | None for Iterations 01 & 02; ready for Iteration 03 planning. | Proceed to Stage 10 Iteration 03 Planning (`/up-iteration-plan`) for Mandi Market Desk & Procurement. | `checkpoint-021-live-container-verification-iteration-01-02.md` | | `CKPT-022` | 2026-10-12 | Stage 14 (Construction E2E Verification & Gate 14.1 Exit) | Iteration 03 Delivered (E2E Verified): UC-002, UC-004, UC-005, UC-006 (16 FRs, 52 pts) across all 11 delivery surfaces. Alembic migrations 005–008 applied with live PostgreSQL 17 RLS. 92 multi-path automated tests passing with 95.4% coverage. Live E2E lifecycle suite verified (13/13). Quality Gates 5.1, 9.1, and 14.1 (all iterations) PASSED. | None for Iteration 03; ready for Iteration 04 planning. | Proceed to Stage 10 Iteration 04 Planning (`/up-iteration-plan`) for Warehouse Inventory, Stock Ledger & Sales Dispatch. | `checkpoint-022-iteration-03-mandi-pipeline-delivery.md` | | `CKPT-023` | 2026-10-12 | Stage 10 (Iteration 04 Planning Complete) | Selected and scoped Iteration 04 for Warehouse Inventory, Stock Ledger, Customer Sales Contracts, Credit Controls, Lot Allocation, Outbound Dispatch, and Transport Fleet Registry (`UC-007`, `UC-008`, `UC-009`, `UC-010`). Authored `iteration_plan.md`, `iteration_backlog.md` (10 stories, 40 pts), `iteration_surface_matrix.md`, and `parallel_work_plan.md`. Authored Iteration 03 retrospective. | Iteration-04 in construction; Stage 11 screen specs and Stage 12 test models pending; AMB-001/006/008–011 open. | Proceed to Stage 11 (`/up-wireframe-spec`) and Stage 12 (`/up-test-model-generate`) in parallel for iteration-04. | `checkpoint-023-iteration-04-planning.md` | +| `CKPT-024` | 2026-10-12 | Stage 11 (Wireframes) & Stage 12 (Test Models) complete | Authored 7 screen specifications (`SCREEN-WH-001`..`002`, `SCREEN-SALES-001`..`002`, `SCREEN-DISP-001`..`002`, `SCREEN-FLEET-001`), compiled dense 21-sheet QA workbook (32 cases), created Bruno collections, authored `MANUAL_TESTING_GUIDE.md`, and updated test traceability. Gate 14.1 referential integrity passed. | Iteration-04 in construction; implementation awaiting Stage 13 code generation; AMB-001/006/008–011 open. | Proceed to Stage 13 (`/up-code-generate`) for wave-based code generation. | `checkpoint-024-iteration-04-wireframes-test-models.md` | diff --git a/04_generated_documentation/00_process_control/master_context.md b/04_generated_documentation/00_process_control/master_context.md index b2a0883..da464ad 100644 --- a/04_generated_documentation/00_process_control/master_context.md +++ b/04_generated_documentation/00_process_control/master_context.md @@ -8,7 +8,7 @@ | **Active Process** | AI-Native Unified Process (UP-AI v1.5) | | **Governance Tier** | `tier_2_standard_enterprise` | | **Last Updated** | 2026-10-12 | -| **Last Checkpoint** | CKPT-023 | +| **Last Checkpoint** | CKPT-024 | | **Last CR** | CR-001 (Closed) | @@ -87,14 +87,15 @@ stack: ## 4. Active Stage & Next Actions -- **Current Stage:** Stage 10 (Iteration Planning) complete for `iteration-04` ([`CKPT-023`](checkpoints/checkpoint-023-iteration-04-planning.md)). +- **Current Stage:** Stage 11 (Wireframes) & Stage 12 (Test Models) complete for `iteration-04` ([`CKPT-024`](checkpoints/checkpoint-024-iteration-04-wireframes-test-models.md)). - **Delivered Iterations:** - `iteration-01` (AuthN/AuthZ, OIDC PKCE, RBAC 11 roles, Session Revocation): **`Delivered (E2E Verified)`** — Verified over live containerized HTTP endpoints against Keycloak mock and Bruno API collections. - `iteration-02` (Multi-Tenant Control Plane, Tenant Lifecycle FSM, PostgreSQL 17 RLS Policies, Context Resolver, Append-Only Audit Trail): **`Delivered (E2E Verified)`** — Verified with live PostgreSQL 17 Alembic migrations (001–004), live RLS integration tests (4/4 PASS), and live containerized FastAPI endpoints (8/8 PASS). - `iteration-03` (Mandi Market Desk, Sauda Procurement, Gate Inward Weighbridge/Tare, Lab Assay & Lot Control: `UC-002`, `UC-004`, `UC-005`, `UC-006`): **`Delivered (E2E Verified)`** — Verified with live PostgreSQL 17 Alembic migrations (005–008), 92 multi-path automated tests passing (95.4% AST statement coverage), and 13 live container E2E integration tests (13/13 PASS). - **Active Iteration in Construction:** - - `iteration-04` (Warehouse Inventory, Stock Ledger & Sales Dispatch: `UC-007`, `UC-008`, `UC-009`, `UC-010` — 10 stories, 40 SP across 11 delivery surfaces). + - `iteration-04` (Warehouse Inventory, Stock Ledger & Sales Dispatch: `UC-007`, `UC-008`, `UC-009`, `UC-010` — 10 stories, 40 SP across 11 delivery surfaces). Screen specifications, 4-dimension test models, Bruno collections, Manual Testing Guide, and 21-sheet QA Workbook complete. - **Test & Coverage Status:** 92 unit tests passing (95.4% statement coverage across all domain packages) + 4 live PostgreSQL RLS tests + 13 live container E2E lifecycle tests. Quality Gates 5.1, 9.1, and 14.1 (for all 3 delivered iterations) all PASSED cleanly. -- **Next:** Proceed to **Stage 11 Wireframe Specifications (`/up-wireframe-spec`)** and **Stage 12 Test Model Generation (`/up-test-model-generate`)** in parallel for `iteration-04`. Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward. +- **Next:** Proceed to **Stage 13 Code Generation (`/up-code-generate`)** for `iteration-04`. Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward. + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DISP-001_dispatch_board_weighbridge.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DISP-001_dispatch_board_weighbridge.md new file mode 100644 index 0000000..cea19bc --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DISP-001_dispatch_board_weighbridge.md @@ -0,0 +1,86 @@ +# Screen Specification: SCREEN-DISP-001 — Outbound Dispatch Board & Outward Weighbridge Console + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-DISP-001` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/logistics/dispatch-board`, `/logistics/weighbridge`, `/logistics/dispatches/new` | +| **Owning Use Case** | [`UC-009` (Outbound Dispatch and Delivery)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/use-case.md) | +| **Owning FR** | [`FR-DISPATCHDELIVERY-001` (Outbound Dispatch Board Console)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md#fr-dispatchdelivery-001-outbound-dispatch-board-console), [`FR-DISPATCHDELIVERY-002` (Outbound Weighbridge & Dispatch Bilty/Manifest)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md#fr-dispatchdelivery-002-outbound-weighbridge--dispatch-bilty/manifest) | +| **Auth Role / Scope Claims** | `Logistics Coordinator`, `Yard Supervisor`, `Weighbridge Operator`, `Tenant Admin` | +| **Iteration** | `iteration-04` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Logistics Dispatch Board & Outward Weighbridge Manifest Generator. +- **Visual Design Reference:** Dual-purpose operations view (`blue-600` for dispatch scheduling, `emerald-600` for weighbridge capture, `amber-600` for tolerance alerts). +- **Behavior:** Logistics coordinators schedule dispatches matching confirmed sales orders, allocated lots, and transport vehicles from the fleet registry. Fleet status is verified: vehicles in `Maintenance` cannot be assigned. The yard weighbridge captures outward Tare weight (empty truck before loading) and Gross weight (loaded truck). The system computes Net Loaded MT and verifies that it matches allocated order MT within $\pm 1.0\%$ tolerance. Upon successful verification, an official transport Bilty / manifest is generated with e-Way bill linkage. + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Logistics | Facility: [ WH-01 Neemuch ] | [+ Schedule Dispatch] | [Logistics Coordinator v] | ++------------------------+-------------------------------+-------------------------+-------------------------------------+ +| [Navigation] | Outbound Consignment Dispatch Board & Outward Weighbridge | +| - Dispatch Board (Act)+----------------------------------------------------------------------------------------------+ +| - Fleet Registry | Status Filter: [ All States v ] Search Bilty / Vehicle: [ RJ-09-GA... ] [Live Feed] | +| - Sales Allocation +----------------------------------------------------------------------------------------------+ +| - Stock Ledger | Dispatch ID | Linked Order | Customer | Vehicle No | Target MT | Loaded MT | Status | Action| +| |--------------+--------------+-------------------+---------------+-----------+-----------+------------+-------| +| | DISP-26-0012 | SAL-26-00401 | Patanjali Foods | RJ-09-GA-1234 | 25.000 MT | 24.950 MT | In Transit |[Bilty]| +| | DISP-26-0013 | SAL-26-00401 | Patanjali Foods | MP-14-BB-5678 | 25.000 MT | -- | Loading |[Weigh]| +| | DISP-26-0014 | SAL-26-00402 | Adani Wilmar | RJ-20-CC-9900 | 50.000 MT | -- | Scheduled |[Assign +| +----------------------------------------------------------------------------------------------+ +``` + +### Outward Weighbridge Logging Modal (`/logistics/weighbridge`) + +``` ++-----------------------------------------------------------------------------------+ +| Capture Outward Weighbridge Readings & Generate Bilty [X] | ++-----------------------------------------------------------------------------------+ +| Dispatch ID: DISP-26-0013 | Order: SAL-26-00401 (Patanjali Foods) | +| Assigned Vehicle: MP-14-BB-5678 (Make: Tata Signa 2823, Payload: 28.0 MT) | +| Target Allocated Qty: 25.000 MT | 500 Bags (Soyabean Yellow FAQ) | +| | +| --- Outward Weighbridge Capture ------------------------------------------------ | +| Outward Tare kg*: [ 9,800 ] kg (Empty truck on scale) | +| Outward Gross kg*: [ 34,750 ] kg (Loaded truck on scale) | +| | +| Calculated Net Weight:24,950 kg = 24.950 MT | +| Loaded Bag Count*: [ 499 ] Bags | +| | +| Tolerance Check: Variance: -0.050 MT (-0.20%). Within +/- 1.0% limit. [OK] | +| | +| --- Transport Documentation ---------------------------------------------------- | +| Transporter Bilty No*:[ BLT-2026-90481 ] | +| 12-Digit e-Way Bill*: [ 381049281723 ] | +| | +| [ Cancel ] [ Confirm Weighment & Bilty ]| ++-----------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field Name | UI Component | Data Type | Validation & Invariant | Source FR | Backend Binding | +|---|---|---|---|---|---| +| `dispatch_id` | Text Display | String | Format: `DISP-YYYYMM-xxx` | `FR-DISPATCHDELIVERY-001` | `outbound_dispatches.dispatch_id` | +| `order_id` | Select / Display | String | Confirmed sales order with allocated lot | `FR-DISPATCHDELIVERY-001` | `outbound_dispatches.order_id` | +| `vehicle_reg_no` | Select Dropdown | String | Must be `Available` in fleet; not `Maintenance` | `FR-DISPATCHDELIVERY-001` | `outbound_dispatches.vehicle_reg_no` | +| `dispatch_status`| Status Badge | String | Enum: `SCHEDULED`, `LOADING`, `IN_TRANSIT`, `DELIVERED` | `FR-DISPATCHDELIVERY-001` | `outbound_dispatches.status` | +| `outward_tare_kg`| Numeric Input | Integer | $> 0$ | `FR-DISPATCHDELIVERY-002` | `outbound_weighments.tare_kg` | +| `outward_gross_kg`| Numeric Input | Integer | Must exceed Tare weight (`gross > tare`) | `FR-DISPATCHDELIVERY-002` | `outbound_weighments.gross_kg` | +| `net_loaded_mt` | Computed Display | Decimal(12,3) | `(gross_kg - tare_kg) / 1000.0` | `FR-DISPATCHDELIVERY-002` | `outbound_weighments.net_loaded_mt` | +| `loaded_bags` | Numeric Input | Integer | $> 0$ | `FR-DISPATCHDELIVERY-002` | `outbound_weighments.loaded_bags` | +| `tolerance_variance_pct` | Computed Display | Decimal(5,2) | `((net_loaded_mt - target_mt) / target_mt) * 100` | `FR-DISPATCHDELIVERY-002` | Tolerance limit: $\pm 1.0\%$ | +| `bilty_no` | Text Input | String | Mandatory transporter Bilty number | `FR-DISPATCHDELIVERY-002` | `dispatch_bilty.bilty_no` | +| `eway_bill_no` | Text Input | String | 12-digit numeric e-Way bill code | `FR-DISPATCHDELIVERY-002` | `dispatch_bilty.eway_bill_no` | + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DISP-002_pod_shortage_settlement.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DISP-002_pod_shortage_settlement.md new file mode 100644 index 0000000..7ec5488 --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DISP-002_pod_shortage_settlement.md @@ -0,0 +1,70 @@ +# Screen Specification: SCREEN-DISP-002 — In-Transit Tracking, Proof of Delivery & Shortage Settlement + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-DISP-002` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/logistics/pod`, `/logistics/dispatches/:id/pod` | +| **Owning Use Case** | [`UC-009` (Outbound Dispatch and Delivery)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/use-case.md) | +| **Owning FR** | [`FR-DISPATCHDELIVERY-003` (In-Transit Tracking & Proof of Delivery (POD))](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md#fr-dispatchdelivery-003-in-transit-tracking--proof-of-delivery-pod) | +| **Auth Role / Scope Claims** | `Logistics Coordinator`, `Sales Manager`, `Commercial Accountant`, `Partner`, `Tenant Admin` | +| **Iteration** | `iteration-04` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Consignment Delivery Closeout & Transit Shortage Credit Note Settlement Console. +- **Visual Design Reference:** Document upload and reconciliation view (`emerald-600` for confirmed PODs, `amber-600` for acknowledged shortages, `rose-600` for shortage credit notes requiring approval). +- **Behavior:** The Logistics Coordinator logs destination receipt when the customer takes delivery: actual delivery date/time, destination weighbridge net weight, transit shortage/loss MT, and uploaded signed POD reference. Transitioning to `Delivered` automatically generates the finalized Sales Invoice. If a transit shortage is acknowledged by the customer, the system logs a Consignee Shortage Note and generates a compensating Sales Credit Note against the customer's ledger without altering the immutable outbound dispatch Bilty. If the shortage exceeds 2.0%, mandatory Sales Manager approval is required before the credit note is issued. + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Logistics | Consignment Delivery & POD Settlement | [Logistics Coordinator v] | ++------------------------+-----------------------------------------+-----------------------------------------------------+ +| Dispatch Details: DISP-26-0012 | Bilty: BLT-2026-90481 | Customer: Patanjali Foods | Commodity: Soyabean | ++------------------------------------------------------------------------------------------------------------------------+ +| Outward Dispatched MT: 24.950 MT (499 Bags) | Origin Departure: 2026-10-10 14:00 | Vehicle: RJ-09-GA-1234 | ++------------------------------------------------------------------------------------------------------------------------+ +| Record Consignee Delivery Confirmation & Proof of Delivery (POD) | +| | +| Actual Delivery Date/Time*: [ 2026-10-12 09:30 AM ] | +| Destination Weighbridge Net*:[ 24.550 ] MT | +| Destination Received Bags*: [ 495 ] Bags | +| | +| Computed Transit Loss / Shortage: 0.400 MT (1.60% Shortage) | -4 Bags | +| Threshold Analysis: Shortage is within 2.0% auto-threshold. Standard credit note generated. | +| | +| Consignee Shortage Note / Remarks: [ 4 bags damaged in heavy rain transit. Accepted at factory gate. ] | +| Proof of Delivery (POD) File*: [ signed_pod_patanjali_260012.pdf ] [Browse...] [View Document] | +| | +| --- Financial Settlement Automation --------------------------------------------------------------------------------- | +| [X] Auto-Generate Finalized Sales Invoice: INV-2026-00481 (₹ 11,78,400.00) | +| [X] Generate Compensating Sales Credit Note: CRN-2026-00012 (Amount: ₹ 19,200.00 for 0.400 MT Shortage) | +| | +| [ Close ] [ Confirm Delivery & Post Invoices]| ++------------------------------------------------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field Name | UI Component | Data Type | Validation & Invariant | Source FR | Backend Binding | +|---|---|---|---|---|---| +| `dispatch_id` | Read-only Display | String | Active in-transit dispatch | `FR-DISPATCHDELIVERY-003` | `outbound_dispatches.dispatch_id` | +| `actual_delivery_date` | Date/Time Picker | DateTime | Cannot be before departure date | `FR-DISPATCHDELIVERY-003` | `consignee_shortages.delivery_date` | +| `dest_weighbridge_mt` | Numeric Input | Decimal(12,3) | $> 0.000$ | `FR-DISPATCHDELIVERY-003` | `consignee_shortages.dest_net_mt` | +| `dest_received_bags` | Numeric Input | Integer | $\ge 0$ | `FR-DISPATCHDELIVERY-003` | `consignee_shortages.dest_bags` | +| `transit_loss_mt` | Computed Display | Decimal(12,3) | `dispatched_mt - dest_weighbridge_mt` | `FR-DISPATCHDELIVERY-003` | `consignee_shortages.shortage_mt` | +| `shortage_pct` | Computed Display | Decimal(5,2) | `(transit_loss_mt / dispatched_mt) * 100` | `FR-DISPATCHDELIVERY-003` | Threshold rule: $> 2.0\%$ requires approval | +| `pod_document_ref` | File Upload | String | Non-empty file reference | `FR-DISPATCHDELIVERY-003` | `consignee_shortages.pod_document_ref` | +| `invoice_trigger` | Automated Status | Boolean | Triggered upon `DELIVERED` | `FR-DISPATCHDELIVERY-003` | Automated sales invoice | +| `credit_note_id` | Text Display | String | Generated when `transit_loss_mt > 0` | `FR-DISPATCHDELIVERY-003` | `sales_credit_notes.credit_note_id` | +| `sales_mgr_approval` | Checkbox/Auth | Boolean | Mandatory if `shortage_pct > 2.0%` | `FR-DISPATCHDELIVERY-003` | `sales_credit_notes.approved_by` | + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-FLEET-001_fleet_registry.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-FLEET-001_fleet_registry.md new file mode 100644 index 0000000..ea5a7b2 --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-FLEET-001_fleet_registry.md @@ -0,0 +1,81 @@ +# Screen Specification: SCREEN-FLEET-001 — Transport Fleet & Carrier Registry + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-FLEET-001` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/logistics/fleet`, `/logistics/fleet/new`, `/logistics/fleet/:id` | +| **Owning Use Case** | [`UC-010` (Transport Fleet Registry)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/use-case.md) | +| **Owning FR** | [`FR-FLEETREGISTRY-001` (Transport Fleet Registry)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/functional-reqs.md#fr-fleetregistry-001-transport-fleet-registry) | +| **Auth Role / Scope Claims** | `Fleet Manager`, `Logistics Coordinator`, `Tenant Admin` | +| **Iteration** | `iteration-04` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Transport Asset Master & Operational Availability Directory. +- **Visual Design Reference:** High-density fleet card/table layout (`emerald-600` for `Available`, `blue-600` for `On Route`, `rose-600` for `Maintenance`). +- **Behavior:** Fleet managers and logistics coordinators register and manage transport trucks (owned and contract carriers). Captures registration number (e.g. `RJ-09-GA-5678`), make/model, gross payload capacity in MT, ownership category (`Own` vs `Contract`), transporter name, fitness/insurance expiry dates, and operational status (`Available`, `On Route`, `Maintenance`). Enforces invariant: vehicles in `Maintenance` status cannot be assigned to dispatches. + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Logistics | Fleet Registry | [+ Register Transport Vehicle] | [Fleet Manager v] | ++------------------------+------------------+----------------------------------+-----------------------------------------+ +| [Navigation] | Carrier & Fleet Registry Directory (24 Registered Vehicles) | +| - Dispatch Board +----------------------------------------------------------------------------------------------+ +| - Fleet Registry (Act)| Filter Status: [ All Statuses v ] Ownership: [ All v ] Search Vehicle: [ RJ-09... ] | +| - Sales Allocation +----------------------------------------------------------------------------------------------+ +| - Stock Ledger | Vehicle No | Make / Model | Payload MT | Ownership | Transporter Name | Fitness Exp| Status | Actions | +| |---------------+------------------+------------+-----------+---------------------+------------+-------------+----------| +| | RJ-09-GA-1234 | Tata Signa 2823 | 28.000 MT | Own | ATB Logistics Fleet | 2027-04-15 | [AVAILABLE] | [Edit] | +| | MP-14-BB-5678 | Ashok Leyland 35 | 35.000 MT | Contract | Shreenath Roadways | 2026-12-30 | [ON ROUTE] | [View] | +| | RJ-20-CC-9900 | Eicher Pro 6028 | 20.000 MT | Contract | Mewar Freight Carrier| 2026-11-20| [MAINTENANCE| [Inspect]| +| +----------------------------------------------------------------------------------------------+ +``` + +### Register Vehicle Modal (`/logistics/fleet/new`) + +``` ++-----------------------------------------------------------------------------------+ +| Register Transport Vehicle [X] | ++-----------------------------------------------------------------------------------+ +| Vehicle Registration Number*:[ RJ-09-GA-5678 ] (Format: SS-NN-AA-NNNN) | +| Vehicle Make & Model*: [ Tata Signa 2823.K ] | +| Gross Payload Capacity MT*: [ 28.000 ] MT | +| | +| Ownership Type*: (o) Own Firm Fleet ( ) Contract Carrier | +| Transporter / Agency Name*: [ ATB Logistics Division ]| +| | +| Vehicle Fitness Expiry Date*:[ 2027-08-31 ] | +| Insurance Expiry Date*: [ 2027-08-15 ] | +| | +| Initial Operational Status*: [ Available v]| +| Options: Available, On Route, Maintenance | +| | +| [!] Vehicles marked 'Maintenance' are automatically barred from dispatch boards. | +| | +| [ Cancel ] [ Save Vehicle to Fleet ]| ++-----------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field Name | UI Component | Data Type | Validation & Invariant | Source FR | Backend Binding | +|---|---|---|---|---|---| +| `vehicle_reg_no` | Text Input | String | Indian registration format (e.g. `RJ-09-GA-5678`), uppercase | `FR-FLEETREGISTRY-001` | `transport_fleet.vehicle_reg_no` | +| `make_model` | Text Input | String | Non-empty model description | `FR-FLEETREGISTRY-001` | `transport_fleet.make_model` | +| `payload_capacity_mt` | Numeric Input | Decimal(10,3) | $> 0.000$ | `FR-FLEETREGISTRY-001` | `transport_fleet.payload_capacity_mt` | +| `ownership_type` | Radio Buttons | String | Enum: `OWN`, `CONTRACT` | `FR-FLEETREGISTRY-001` | `transport_fleet.ownership_type` | +| `transporter_name`| Text Input | String | Non-empty transporter/carrier name | `FR-FLEETREGISTRY-001` | `transport_fleet.transporter_name` | +| `fitness_expiry_date` | Date Picker | Date | Must be a valid date; expired triggers warning | `FR-FLEETREGISTRY-001` | `transport_fleet.fitness_expiry_date` | +| `insurance_expiry_date`| Date Picker | Date | Must be a valid date | `FR-FLEETREGISTRY-001` | `transport_fleet.insurance_expiry_date` | +| `fleet_status` | Select Dropdown | String | Enum: `AVAILABLE`, `ON_ROUTE`, `MAINTENANCE` | `FR-FLEETREGISTRY-001` | `transport_fleet.status` | + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-SALES-001_sales_order_booking.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-SALES-001_sales_order_booking.md new file mode 100644 index 0000000..15c2859 --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-SALES-001_sales_order_booking.md @@ -0,0 +1,96 @@ +# Screen Specification: SCREEN-SALES-001 — Customer Sales Order Booking & Pre-Order Credit Exposure Guard + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-SALES-001` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/sales/orders`, `/sales/orders/new`, `/sales/orders/:id` | +| **Owning Use Case** | [`UC-008` (Customer Sales Contract, Credit Check and Allocation)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/use-case.md) | +| **Owning FR** | [`FR-SALESCONTRACTS-001` (Customer Sales Contract Booking)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md#fr-salescontracts-001-customer-sales-contract-booking), [`FR-SALESCONTRACTS-002` (Customer Credit Limit & Pre-Order Exposure Verification)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md#fr-salescontracts-002-customer-credit-limit--pre-order-exposure-verification) | +| **Auth Role / Scope Claims** | `Sales Manager`, `Credit Controller`, `Commercial Head`, `Partner`, `Tenant Admin` | +| **Iteration** | `iteration-04` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Commercial Contract Booking Form with Real-Time Credit Bureau / Exposure Interceptor. +- **Visual Design Reference:** High-clarity commercial entry form following [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`agri-700` primary buttons, `amber-500` credit warning callouts, `rose-600` hard-block credit modals with Partner authorization keys). +- **Behavior:** Sales managers book wholesale customer contracts specifying customer details, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted MT, rate in ₹/Qtl, and delivery schedule. The screen auto-computes Total Sales Value ($\text{MT} \times 10 \times \text{Rate}$). Prior to confirmation, the system interrogates the customer credit ledger: + $$\text{Projected Exposure} = \text{Current Outstanding INR} + \text{New Order Value INR}$$ + $$\text{Projected Exposure Ratio \%} = \frac{\text{Projected Exposure}}{\text{Sanctioned Credit Limit}} \times 100$$ + If Ratio $> 80\%$, an inline warning banner displays. If Ratio $> 100\%$, confirmation is hard-blocked unless a Partner provides an electronic override. + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Sales Desk | Orders Register | [+ New Sales Contract] | [Sales Manager v] | ++-------------------------+-------------------+--------------------------+-----------------------------------------------+ +| [Navigation] | Customer Sales Contracts Register | +| - Sales Orders (Active)+----------------------------------------------------------------------------------------------+ +| - Inventory Allocation | Segment: [ All Segments v ] Customer: [ Search Customer... ] Status: [ All Statuses v ] | +| - Dispatch Console +----------------------------------------------------------------------------------------------+ +| - Fleet Registry | Order ID | Customer Name | Commodity | Qty MT | Rate ₹/Qtl | Total Value | Exposure | Status | +| |--------------+------------------------+-----------+----------+------------+---------------+----------+----------| +| | SAL-26-00401 | Patanjali Foods Ltd | Soyabean | 100.0 MT | ₹4,850/Qtl | ₹48,50,000 | 74.5% OK | Confirmed| +| | SAL-26-00402 | Adani Wilmar Indore | Mustard | 50.0 MT | ₹5,600/Qtl | ₹28,00,000 | 88.2% [!]| Confirmed| +| | SAL-26-00403 | Ruchi Soya Industries | Chana | 150.0 MT | ₹5,400/Qtl | ₹81,00,000 | 115% [X] | Blk/Ovrd | +| +----------------------------------------------------------------------------------------------+ +``` + +### New Sales Contract Booking Form (`/sales/orders/new`) + +``` ++-----------------------------------------------------------------------------------+ +| Book Customer Sales Contract [X] | ++-----------------------------------------------------------------------------------+ +| Customer*: [ CUST-0012 - Adani Wilmar Ltd (Indore) v]| +| Customer Segment: Processor | GSTIN: 23AAACA1234F1Z8 | +| Destination City*: [ Indore, Madhya Pradesh ] | +| | +| Commodity / Variety*: [ Soyabean - Yellow Desi FAQ v]| +| Contracted Qty MT*: [ 50.000 ] MT | +| Contract Rate ₹/Qtl*: [ 4,800.00 ] ₹ per Quintal | +| Total Sales Value*: ₹ 24,00,000.00 (Calculated: 50.000 MT * 10 * ₹4,800) | +| Payment Terms*: [ 15 Days Credit v]| +| | +| --- Credit Risk & Exposure Assessment ------------------------------------------ | +| Sanctioned Credit Limit: ₹ 50,00,000.00 | +| Current Outstanding: ₹ 38,00,000.00 | +| New Order Value: ₹ 24,00,000.00 | +| Projected Exposure: ₹ 62,00,000.00 (Exposure Ratio: 124.0%) | +| | +| [!] CREDIT BREACH WARNING: Projected exposure exceeds 100% of sanctioned limit. | +| Standard confirmation blocked. Partner electronic override required. | +| | +| Partner Electronic Override Key: [ ****************** ] | +| Override Justification*: [ Promissory note deposited in branch ] | +| | +| [ Cancel ] [ Confirm Order & Allocate ] | ++-----------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field Name | UI Component | Data Type | Validation & Invariant | Source FR | Backend Binding | +|---|---|---|---|---|---| +| `order_id` | Text Display | String | Format: `SAL-YYYYMM-xxx` | `FR-SALESCONTRACTS-001` | `customer_sales_orders.order_id` | +| `customer_id` | Select Dropdown | String | Valid customer master code | `FR-SALESCONTRACTS-001` | `customer_sales_orders.customer_id` | +| `customer_segment` | Badge Display | String | Enum: `Wholesale`, `Processor`, `Institutional`, `Distributor` | `FR-SALESCONTRACTS-001` | Master data lookup | +| `commodity_id` | Select Dropdown | String | Valid commodity code | `FR-SALESCONTRACTS-001` | `customer_sales_orders.commodity_id` | +| `contract_qty_mt` | Numeric Input | Decimal(12,3) | $> 0.000$ | `FR-SALESCONTRACTS-001` | `customer_sales_orders.contract_qty_mt` | +| `contract_rate_qtl`| Numeric Input | Decimal(10,2) | $> 0.00$ | `FR-SALESCONTRACTS-001` | `customer_sales_orders.contract_rate_qtl` | +| `total_value_inr` | Computed Display | Decimal(14,2) | Equal to `contract_qty_mt * 10 * contract_rate_qtl` | `FR-SALESCONTRACTS-001` | `customer_sales_orders.total_value_inr` | +| `payment_terms` | Select Dropdown | String | Enum: `ADVANCE`, `CAD`, `15_DAYS`, `30_DAYS` | `FR-SALESCONTRACTS-001` | `customer_sales_orders.payment_terms` | +| `sanctioned_credit_limit` | Numeric Display | Decimal(14,2) | Current customer limit | `FR-SALESCONTRACTS-002` | Counterparty master | +| `current_outstanding` | Numeric Display | Decimal(14,2) | Ledger receivables balance | `FR-SALESCONTRACTS-002` | Receivables ledger | +| `projected_exposure` | Computed Display | Decimal(14,2) | `current_outstanding + total_value_inr` | `FR-SALESCONTRACTS-002` | Credit evaluation engine | +| `exposure_ratio_pct` | Computed Display | Decimal(5,2) | `(projected_exposure / sanctioned_limit) * 100` | `FR-SALESCONTRACTS-002` | Warning if $> 80\%$, Block if $> 100\%$ | +| `partner_override` | Toggle / Auth | Boolean | Required `True` if `exposure_ratio > 100%` | `FR-SALESCONTRACTS-002` | `customer_sales_orders.credit_override` | + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-SALES-002_lot_allocation.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-SALES-002_lot_allocation.md new file mode 100644 index 0000000..a12267a --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-SALES-002_lot_allocation.md @@ -0,0 +1,85 @@ +# Screen Specification: SCREEN-SALES-002 — Sales Order Released-Lot Inventory Allocation Console + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-SALES-002` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/sales/orders/:id/allocations`, `/sales/allocations` | +| **Owning Use Case** | [`UC-008` (Customer Sales Contract, Credit Check and Allocation)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/use-case.md) | +| **Owning FR** | [`FR-SALESCONTRACTS-003` (Sales Order Inventory Allocation)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md#fr-salescontracts-003-sales-order-inventory-allocation) | +| **Auth Role / Scope Claims** | `Sales Manager`, `Yard Supervisor`, `Warehouse Manager`, `Tenant Admin` | +| **Iteration** | `iteration-04` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Inventory Lot Matching & Physical Allocation Workstation. +- **Visual Design Reference:** Split-panel matching view (`slate-800` left panel for sales order contract parameters, right panel for warehouse stack lot browser with `emerald-600` for `Released` lots and red disabled state with lock icon for `QC Hold` / `Under QC` lots). +- **Behavior:** The Sales Manager matches a confirmed sales order to specific warehouse lots. The system interrogates the lot registry: + 1. Only lots with FSM state `RELEASED` are selectable. Any lot in `QC_HOLD` or `UNDER_QC` is hard-disabled with an explanatory tooltip. + 2. The available unreserved balance on the lot must be $\ge$ requested allocation quantity. + 3. Upon allocation, the system creates an allocation record, increments `reserved_qty_mt` on the lot, and updates the sales order fulfillment status (`UNALLOCATED`, `PARTIALLY_ALLOCATED`, `FULLY_ALLOCATED`). + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Sales Desk | Order: SAL-26-00401 (Patanjali Foods - 100.0 MT Soyabean) | [Sales Manager v] | ++-------------------------+-------------------------------------------------------------+--------------------------------+ +| Order Fulfillment Status: [ Partially Allocated: 60.0 MT / 100.0 MT ] Remaining to Allocate: 40.0 MT | ++------------------------------------------------------------------------------------------------------------------------+ +| Existing Order Allocations: | +| - LOT-UNJ-SOY-20261012-001 | WH-01 Stack A1 | 60.000 MT (1,200 Bags) | Allocated at: 10:30 AM | [Deallocate] | ++------------------------------------------------------------------------------------------------------------------------+ +| Available Warehouse Lots (Matching Commodity: Soyabean, Variety: Yellow Desi): | +| Filter Warehouse: [ All Warehouses v ] Filter Status: [ Eligible Released Lots v ] | ++------------------------------------------------------------------------------------------------------------------------+ +| Lot Identity Code | Warehouse | Stack Location | Total MT | Reserved MT | Available MT | QC Status | Action | +|--------------------------+-----------+----------------+-----------+-------------+--------------+------------+-----------| +| LOT-UNJ-SOY-20261012-002 | WH-01 | Stack B2 | 50.00 MT | 0.00 MT | 50.00 MT | [RELEASED] | [+Allocate| +| LOT-UNJ-SOY-20261012-003 | WH-02 | Stack C1 | 45.00 MT | 10.00 MT | 35.00 MT | [RELEASED] | [+Allocate| +| LOT-MDR-SOY-20261012-004 | WH-03 | Stack T1 | 30.00 MT | 0.00 MT | 30.00 MT | [QC_HOLD] | [BLOCKED] | +| LOT-IND-SOY-20261012-005 | WH-04 | Stack D3 | 60.00 MT | 0.00 MT | 60.00 MT | [UNDER_QC] | [BLOCKED] | ++------------------------------------------------------------------------------------------------------------------------+ +``` + +### Allocate Lot Modal + +``` ++-----------------------------------------------------------------------------------+ +| Allocate Lot to Sales Order SAL-26-00401 [X] | ++-----------------------------------------------------------------------------------+ +| Selected Lot: LOT-UNJ-SOY-20261012-002 | +| Warehouse / Stack: WH-01 Neemuch Main Yard (Stack B2) | +| Commodity / Variety: Soyabean (Yellow Desi FAQ) | +| Available Unreserved: 50.000 MT | 1,000 Bags | +| Order Unallocated: 40.000 MT | +| | +| Quantity to Allocate*:[ 40.000 ] MT | +| Bags to Allocate*: [ 800 ] Bags | +| | +| Validation Check: Allocated MT (40.0) <= Available Unreserved MT (50.0) [OK] | +| Quality FSM Check: Lot is in RELEASED state [OK] | +| | +| [ Cancel ] [ Confirm Allocation]| ++-----------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field Name | UI Component | Data Type | Validation & Invariant | Source FR | Backend Binding | +|---|---|---|---|---|---| +| `order_id` | Read-only Display | String | Confirmed sales order ID | `FR-SALESCONTRACTS-003` | `sales_order_allocations.order_id` | +| `lot_id` | Select / Click | String | Must exist in `inventory_lots` | `FR-SALESCONTRACTS-003` | `sales_order_allocations.lot_id` | +| `qc_status` | Badge Display | String | Invariant: Must equal `RELEASED`. `QC_HOLD` and `UNDER_QC` reject | `FR-SALESCONTRACTS-003` | `inventory_lots.qc_status` | +| `available_mt` | Numeric Display | Decimal(12,3) | `lot.total_mt - lot.reserved_mt` | `FR-SALESCONTRACTS-003` | Computed unreserved balance | +| `allocated_qty_mt` | Numeric Input | Decimal(12,3) | $> 0.000$; $\le \text{available\_mt}$; $\le \text{order unallocated}$ | `FR-SALESCONTRACTS-003` | `sales_order_allocations.allocated_qty_mt` | +| `allocated_bags` | Numeric Input | Integer | $> 0$; $\le \text{available\_bags}$ | `FR-SALESCONTRACTS-003` | `sales_order_allocations.allocated_bags` | +| `fulfillment_status`| Status Display | String | Enum: `UNALLOCATED`, `PARTIALLY_ALLOCATED`, `FULLY_ALLOCATED` | `FR-SALESCONTRACTS-003` | `customer_sales_orders.fulfillment_status` | + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-WH-001_stock_ledger.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-WH-001_stock_ledger.md new file mode 100644 index 0000000..2814f72 --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-WH-001_stock_ledger.md @@ -0,0 +1,93 @@ +# Screen Specification: SCREEN-WH-001 — Multi-Godown Dual-Unit Stock Ledger & Physical Audit Adjustment + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-WH-001` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/inventory/ledger`, `/inventory/ledger/adjust` | +| **Owning Use Case** | [`UC-007` (Warehouse Stock, Audit, Capacity and Transfer)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/use-case.md) | +| **Owning FR** | [`FR-WAREHOUSEINVENTORY-001` (Multi-Godown Dual-Unit Stock Ledger)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md#fr-warehouseinventory-001-multi-godown-dual-unit-stock-ledger) | +| **Auth Role / Scope Claims** | `Yard Supervisor`, `Warehouse Manager`, `Commercial Manager`, `Partner`, `Tenant Admin` | +| **Iteration** | `iteration-04` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Dual-Unit Double-Entry Stock Ledger & Physical Inventory Audit Console. +- **Visual Design Reference:** Data-dense tabular layout adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`slate-800` data tables, `emerald-600` positive inward, `amber-600` outward dispatches, `rose-600` shortage/adjustment indicators). +- **Behavior:** Warehouse managers and yard supervisors view real-time balances per warehouse (WH-01 Neemuch Main Yard, WH-02 Neemuch North, WH-03 Mandsaur Transit, WH-04 Indore Buffer), commodity, variety, and grade in both Metric Tonnes and physical Bag counts. Supports logging periodic physical tally audits against system book balances and posting supervisor-authorized Stock Adjustment Vouchers with reason codes (*Ghat / Nami*, Spillage, Bag Burst). Enforces non-negative stock invariant ($\ge 0$) and prompts for mandatory Partner electronic sign-off if variance exceeds $\pm 1.0\%$. + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Inventory | Warehouse: [ WH-01 Neemuch Main Yard v ] | [+ Record Stock Audit] | [Warehouse Manager v]| ++------------------------+--------------------------------------------+--------------------------+-----------------------+ +| [Navigation] | Multi-Godown Dual-Unit Stock Ledger | +| - Stock Ledger (Active)+----------------------------------------------------------------------------------------------+ +| - Capacity & Transfer | Commodity: [ All Commodities v ] Variety: [ All v ] Date Range: [ Oct 01 - Oct 12 v ] | +| - Sales Allocation +----------------------------------------------------------------------------------------------+ +| - Dispatch Console | Summary: Total Stock: 1,745.250 MT | Total Bags: 34,905 Bags | Godowns Active: 4 / 4 | +| - Fleet Registry +----------------------------------------------------------------------------------------------+ +| | Wh ID | Commodity | Variety | Grade | Opening MT | Inward MT | Outward MT | Closing MT | Bags | Actions | +| |-------+-----------+---------+-------+------------+-----------+------------+-------------+--------+------------| +| | WH-01 | Chana | Desi | FAQ | 450.000 MT | 75.500 MT| 25.000 MT | 500.500 MT | 10,010 | [Adjust] | +| | WH-01 | Soyabean | Yellow | FAQ | 600.000 MT | 120.000 MT| 80.000 MT | 640.000 MT | 12,800 | [Adjust] | +| | WH-02 | Mustard | Black | Bold | 300.000 MT | 50.000 MT| 10.000 MT | 340.000 MT | 6,800 | [Adjust] | +| | WH-03 | Wheat | Lokwan | FAQ | 250.000 MT | 40.000 MT| 25.250 MT | 264.750 MT | 5,295 | [Adjust] | +| +----------------------------------------------------------------------------------------------+ +| | Audit Ledger: Showing 4 of 4 active warehouse positions. Invariant: Closing MT >= 0.000. | ++------------------------+----------------------------------------------------------------------------------------------+ +``` + +### Stock Adjustment Voucher Modal (`/inventory/ledger/adjust`) + +``` ++-----------------------------------------------------------------------------------+ +| Record Physical Stock Audit & Adjustment Voucher [X] | ++-----------------------------------------------------------------------------------+ +| Warehouse*: [ WH-01 - Neemuch Main Yard v]| +| Commodity / Variety*:[ Chana - Desi FAQ v]| +| Current Book Stock: 500.500 MT | 10,010 Bags | +| | +| --- Physical Count Tally ------------------------------------------------------- | +| Physical Count MT*: [ 499.850 ] MT | +| Physical Bags Tally*:[ 9,997 ] Bags | +| | +| Computed Variance: -0.650 MT (-0.13%) | -13 Bags | +| Threshold Analysis: Within +/- 1.0% tolerance. Supervisor authorization valid. | +| | +| Variance Reason*: [ Moisture Loss / Ghat v]| +| Options: Moisture Loss / Ghat, Handling Spillage, | +| Bag Burst, Seasonal Humidity Gain | +| Audit Remarks: [ Routine pre-monsoon silo balance inspection ] | +| | +| [Partner Authorization Signature Required if Variance > 1.0%] | +| | +| [ Cancel ] [ Commit Adjustment Voucher]| ++-----------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field Name | UI Component | Data Type | Validation & Invariant | Source FR | Backend Binding | +|---|---|---|---|---|---| +| `warehouse_id` | Select Dropdown | String | Valid active warehouse (`WH-01`..`WH-04`) | `FR-WAREHOUSEINVENTORY-001` | `stock_ledger_entries.warehouse_id` | +| `commodity_id` | Select Dropdown | String | Active commodity master ID | `FR-WAREHOUSEINVENTORY-001` | `stock_ledger_entries.commodity_id` | +| `variety_id` | Select Dropdown | String | Active variety master ID | `FR-WAREHOUSEINVENTORY-001` | `stock_ledger_entries.variety_id` | +| `grade` | Text/Badge | String | Valid grade (`FAQ`, `Bold`, etc.) | `FR-WAREHOUSEINVENTORY-001` | `stock_ledger_entries.grade` | +| `book_closing_mt` | Read-only Display | Decimal(12,3) | $\ge 0.000$; 3 decimal precision | `FR-WAREHOUSEINVENTORY-001` | `stock_ledger_entries.closing_mt` | +| `book_closing_bags` | Read-only Display | Integer | $\ge 0$ | `FR-WAREHOUSEINVENTORY-001` | `stock_ledger_entries.closing_bags` | +| `physical_count_mt` | Numeric Input | Decimal(12,3) | $\ge 0.000$ | `FR-WAREHOUSEINVENTORY-001` | `stock_adjustments.physical_mt` | +| `physical_bags` | Numeric Input | Integer | $\ge 0$ | `FR-WAREHOUSEINVENTORY-001` | `stock_adjustments.physical_bags` | +| `variance_mt` | Computed Display | Decimal(12,3) | `physical_count_mt - book_closing_mt` | `FR-WAREHOUSEINVENTORY-001` | `stock_adjustments.variance_mt` | +| `variance_pct` | Computed Display | Decimal(5,2) | `(variance_mt / book_closing_mt) * 100` | `FR-WAREHOUSEINVENTORY-001` | `stock_adjustments.variance_pct` | +| `reason_code` | Select Dropdown | String | Enum: `GHAT`, `SPILLAGE`, `BAG_BURST`, `HUMIDITY_GAIN` | `FR-WAREHOUSEINVENTORY-001` | `stock_adjustments.reason_code` | +| `partner_sign_off` | Checkbox/Auth | Boolean | Mandatory `True` if `abs(variance_pct) > 1.0%` | `FR-WAREHOUSEINVENTORY-001` | `stock_adjustments.partner_sign_off` | + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-WH-002_capacity_transfers.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-WH-002_capacity_transfers.md new file mode 100644 index 0000000..a3995e6 --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-WH-002_capacity_transfers.md @@ -0,0 +1,87 @@ +# Screen Specification: SCREEN-WH-002 — Godown Capacity Tracking & Internal Stock Transfers + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-WH-002` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/inventory/capacity`, `/inventory/transfers`, `/inventory/transfers/new` | +| **Owning Use Case** | [`UC-007` (Warehouse Stock, Audit, Capacity and Transfer)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/use-case.md) | +| **Owning FR** | [`FR-WAREHOUSEINVENTORY-002` (Godown Capacity & Utilization Tracking)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md#fr-warehouseinventory-002-godown-capacity--volume-utilization-tracking), [`FR-WAREHOUSEINVENTORY-003` (Godown-to-Godown Internal Stock Transfer)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md#fr-warehouseinventory-003-godown-to-godown-internal-stock-transfer) | +| **Auth Role / Scope Claims** | `Yard Supervisor`, `Logistics Coordinator`, `Warehouse Manager`, `Operations Head`, `Tenant Admin` | +| **Iteration** | `iteration-04` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Facility Capacity Monitor & Inter-Godown Transfer Dispatch Board. +- **Visual Design Reference:** Progress-bar visual meters (`amber-500` for $> 85\%$ warning threshold, `emerald-600` for normal operations) and transit timeline cards. +- **Behavior:** Operations heads and yard managers monitor real-time physical capacity utilization in MT across all warehouses: + $$\text{Utilisation \%} = \frac{\text{Current Closing Stock (MT)}}{\text{Storage Capacity (MT)}} \times 100$$ + Triggers inline warning badges when utilization exceeds 85%. Logistics coordinators schedule inter-godown transfers (e.g. Mandsaur Transit Godown to Neemuch Main Yard), logging origin deduction, in-transit state, destination weighbridge capture, and inward credit, reconciling weight within $\pm 0.2\%$ tolerance. + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Inventory | Facility Overview | [+ Initiate Inter-Godown Transfer] | [Operations Head v] | ++------------------------+---------------------+--------------------------------------+----------------------------------+ +| [Navigation] | Warehouse Physical Storage Capacity & Volume Utilization | +| - Stock Ledger +----------------------------------------------------------------------------------------------+ +| - Capacity & Transfer | [!] 1 Warehouse Exceeding 85% Warning Threshold (WH-01 Neemuch: 88.0% Capacity) | +| - Sales Allocation +----------------------------------------------------------------------------------------------+ +| - Dispatch Console | WH-01 Neemuch Main Yard | WH-02 Neemuch North | WH-03 Mandsaur Transit | WH-04 Indore Buffer| +| - Fleet Registry | Capacity: 2,000.000 MT | Capacity: 1,500.000 MT | Capacity: 1,000.000 MT | Capacity: 3,000.000| +| | Stock: 1,760.000 MT | Stock: 900.000 MT | Stock: 420.000 MT | Stock: 1,100.000 | +| | Util: 88.0% [WARNING] | Util: 60.0% [NORMAL] | Util: 42.0% [NORMAL] | Util: 36.7% [OK]| +| | [======88%========> ] | [====60%=======> ] | [===42%====> ] | [==36%===> ]| +| +----------------------------------------------------------------------------------------------+ +| | Active Inter-Godown Stock Transfers | +| | Transfer ID | Origin Wh | Dest Wh | Commodity | Dispatched MT | Received MT | Status | Action| +| |--------------+-----------+---------+-----------+---------------+-------------+------------+-------| +| | TRF-26-00012 | WH-03 | WH-01 | Chana | 20.000 MT | 19.980 MT | Received | [View]| +| | TRF-26-00013 | WH-02 | WH-04 | Soyabean | 35.000 MT | -- | In Transit |[Receive +| +----------------------------------------------------------------------------------------------+ +``` + +### Initiate Stock Transfer Modal (`/inventory/transfers/new`) + +``` ++-----------------------------------------------------------------------------------+ +| Initiate Inter-Godown Internal Stock Transfer [X] | ++-----------------------------------------------------------------------------------+ +| Origin Warehouse*: [ WH-03 - Mandsaur Transit Godown v]| +| Destination Warehouse*: [ WH-01 - Neemuch Main Yard v]| +| Commodity / Variety*: [ Chana - Desi FAQ (Available: 420.00 MT) v]| +| | +| Dispatched Quantity MT*: [ 20.000 ] MT | +| Dispatched Bags*: [ 400 ] Bags | +| Assigned Vehicle Reg No*:[ MP-14-GA-8921 ] Transporter: [ Shreenath Logistics ]| +| | +| Destination Receiving Tolerance: +/- 0.2% (Max allowed shortage: 0.040 MT) | +| | +| [ Cancel ] [ Dispatch Transfer Stock ]| ++-----------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field Name | UI Component | Data Type | Validation & Invariant | Source FR | Backend Binding | +|---|---|---|---|---|---| +| `warehouse_id` | Read-only Display | String | Valid warehouse code | `FR-WAREHOUSEINVENTORY-002` | `warehouse_capacities.warehouse_id` | +| `capacity_mt` | Numeric Display | Decimal(12,3) | $> 0.000$ | `FR-WAREHOUSEINVENTORY-002` | `warehouse_capacities.capacity_mt` | +| `current_stock_mt` | Numeric Display | Decimal(12,3) | $\ge 0.000$ | `FR-WAREHOUSEINVENTORY-002` | Computed from `stock_ledger` | +| `utilization_pct` | Progress Display | Decimal(5,2) | `(current_stock_mt / capacity_mt) * 100` | `FR-WAREHOUSEINVENTORY-002` | Computed; Warning if $> 85.0\%$ | +| `transfer_id` | Text Display | String | Unique transfer ID (`TRF-YY-NNNNN`) | `FR-WAREHOUSEINVENTORY-003` | `stock_transfers.transfer_id` | +| `origin_wh_id` | Select Dropdown | String | Origin warehouse; cannot equal destination | `FR-WAREHOUSEINVENTORY-003` | `stock_transfers.origin_wh_id` | +| `dest_wh_id` | Select Dropdown | String | Destination warehouse; cannot equal origin | `FR-WAREHOUSEINVENTORY-003` | `stock_transfers.dest_wh_id` | +| `dispatched_mt` | Numeric Input | Decimal(12,3) | $> 0.000$; $\le$ origin available stock | `FR-WAREHOUSEINVENTORY-003` | `stock_transfers.dispatched_mt` | +| `received_mt` | Numeric Input | Decimal(12,3) | Recorded upon arrival | `FR-WAREHOUSEINVENTORY-003` | `stock_transfers.received_mt` | +| `transfer_variance_pct`| Computed Display | Decimal(5,2) | `((received_mt - dispatched_mt) / dispatched_mt) * 100` | `FR-WAREHOUSEINVENTORY-003` | Tolerance check: $\pm 0.2\%$ limit | +| `transfer_status` | Status Badge | String | Enum: `SCHEDULED`, `IN_TRANSIT`, `RECEIVED`, `VARIANCE_FLAG` | `FR-WAREHOUSEINVENTORY-003` | `stock_transfers.status` | + diff --git a/04_generated_documentation/06_wireframes/wireframe_index.md b/04_generated_documentation/06_wireframes/wireframe_index.md index 712619b..50155c0 100644 --- a/04_generated_documentation/06_wireframes/wireframe_index.md +++ b/04_generated_documentation/06_wireframes/wireframe_index.md @@ -25,6 +25,13 @@ | `SCREEN-INW-001` | Vehicle Gate Entry Register & Yard Inward | `/receiving/gate-entry` | `UC-005` | `FR-INWARDRECEIVING-001`, `FR-INWARDRECEIVING-004` | `iteration-03` | `atb-web-portal` | `@ui-dev-beta` | `@adversarial-tester` | [`SCREEN-INW-001_gate_entry.md`](screen_specs/SCREEN-INW-001_gate_entry.md) | | `SCREEN-INW-002` | Weighbridge Gross/Tare Logging & GRN Posting | `/receiving/weighbridge`, `/receiving/grn` | `UC-005` | `FR-INWARDRECEIVING-002`..`006` | `iteration-03` | `atb-web-portal` | `@ui-dev-beta` | `@adversarial-tester` | [`SCREEN-INW-002_weighbridge_grn.md`](screen_specs/SCREEN-INW-002_weighbridge_grn.md) | | `SCREEN-QC-001` | Inward Quality Lab Assay & Decision Console | `/quality/inspection`, `/quality/lots/:id` | `UC-006` | `FR-QUALITYANDLOTCONTROL-001`..`004` | `iteration-03` | `atb-web-portal` | `@ui-dev-gamma` | `@adversarial-tester` | [`SCREEN-QC-001_quality_lab.md`](screen_specs/SCREEN-QC-001_quality_lab.md) | +| `SCREEN-WH-001` | Multi-Godown Dual-Unit Stock Ledger & Adjustments | `/inventory/ledger`, `/inventory/ledger/adjust` | `UC-007` | `FR-WAREHOUSEINVENTORY-001` | `iteration-04` | `atb-web-portal` | `@ui-dev-alpha` | `@adversarial-tester` | [`SCREEN-WH-001_stock_ledger.md`](screen_specs/SCREEN-WH-001_stock_ledger.md) | +| `SCREEN-WH-002` | Godown Capacity Tracking & Internal Stock Transfers | `/inventory/capacity`, `/inventory/transfers` | `UC-007` | `FR-WAREHOUSEINVENTORY-002`, `003` | `iteration-04` | `atb-web-portal` | `@ui-dev-alpha` | `@adversarial-tester` | [`SCREEN-WH-002_capacity_transfers.md`](screen_specs/SCREEN-WH-002_capacity_transfers.md) | +| `SCREEN-SALES-001` | Customer Sales Order Booking & Credit Guard | `/sales/orders`, `/sales/orders/new` | `UC-008` | `FR-SALESCONTRACTS-001`, `002` | `iteration-04` | `atb-web-portal` | `@ui-dev-beta` | `@adversarial-tester` | [`SCREEN-SALES-001_sales_order_booking.md`](screen_specs/SCREEN-SALES-001_sales_order_booking.md) | +| `SCREEN-SALES-002` | Sales Order Released-Lot Inventory Allocation Console | `/sales/orders/:id/allocations` | `UC-008` | `FR-SALESCONTRACTS-003` | `iteration-04` | `atb-web-portal` | `@ui-dev-beta` | `@adversarial-tester` | [`SCREEN-SALES-002_lot_allocation.md`](screen_specs/SCREEN-SALES-002_lot_allocation.md) | +| `SCREEN-DISP-001` | Outbound Dispatch Board & Outward Weighbridge | `/logistics/dispatch-board`, `/logistics/weighbridge` | `UC-009` | `FR-DISPATCHDELIVERY-001`, `002` | `iteration-04` | `atb-web-portal` | `@ui-dev-gamma` | `@adversarial-tester` | [`SCREEN-DISP-001_dispatch_board_weighbridge.md`](screen_specs/SCREEN-DISP-001_dispatch_board_weighbridge.md) | +| `SCREEN-DISP-002` | In-Transit Tracking, Proof of Delivery & Shortage Settlement | `/logistics/pod` | `UC-009` | `FR-DISPATCHDELIVERY-003` | `iteration-04` | `atb-web-portal` | `@ui-dev-gamma` | `@adversarial-tester` | [`SCREEN-DISP-002_pod_shortage_settlement.md`](screen_specs/SCREEN-DISP-002_pod_shortage_settlement.md) | +| `SCREEN-FLEET-001` | Transport Fleet & Carrier Registry | `/logistics/fleet` | `UC-010` | `FR-FLEETREGISTRY-001` | `iteration-04` | `atb-web-portal` | `@ui-dev-gamma` | `@adversarial-tester` | [`SCREEN-FLEET-001_fleet_registry.md`](screen_specs/SCREEN-FLEET-001_fleet_registry.md) | --- diff --git a/04_generated_documentation/07_test_design/functional_test_cases/TC-007_warehouse_stock_ledger.md b/04_generated_documentation/07_test_design/functional_test_cases/TC-007_warehouse_stock_ledger.md new file mode 100644 index 0000000..2920484 --- /dev/null +++ b/04_generated_documentation/07_test_design/functional_test_cases/TC-007_warehouse_stock_ledger.md @@ -0,0 +1,85 @@ +# Functional Test Cases: UC-007 Warehouse Stock, Audit, Capacity and Transfer + +| Field | Value | +|---|---| +| **Test Suite** | `TC-007_warehouse_stock_ledger.md` | +| **Parent Use Case** | [`UC-007` (Warehouse Stock, Audit, Capacity and Transfer)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/use-case.md) | +| **Parent FRs** | `FR-WAREHOUSEINVENTORY-001`, `FR-WAREHOUSEINVENTORY-002`, `FR-WAREHOUSEINVENTORY-003` | +| **Status** | Baselined for Construction (Iteration 04) | +| **Version** | 1.0.0 | +| **Iteration** | `iteration-04` | + +--- + +## TC-WH-007-01: Double-Entry Multi-Godown Stock Ledger Position (Happy Path) + +- **ID:** `TC-WH-007-01` +- **Category:** Functional / Happy Path +- **Priority:** P0 +- **Preconditions:** Authenticated user with role `Yard Supervisor` or `Warehouse Manager`. Active tenant `tenant-mandi-01`. Warehouses `WH-01` Neemuch and `WH-02` Neemuch North exist. +- **Steps:** + 1. Post initial inward stock receipt: 50.000 MT (1,000 Bags) of Chana Desi FAQ at `WH-01`. + 2. Query stock ledger via `GET /api/v1/inventory/ledger?warehouse_id=WH-01&commodity_id=chana`. + 3. Verify opening MT, inward MT, outward MT, closing MT (50.000 MT), and closing bag count (1,000 Bags). + 4. Perform physical stock audit with physical tally of 49.800 MT (996 Bags), calculating a variance of -0.200 MT (-0.40%). + 5. Submit stock adjustment voucher with reason code `GHAT` (Moisture Loss). +- **Expected Result:** Stock ledger balances calculate correctly in MT and Bags. Adjustment voucher posts successfully since variance (-0.40%) is within the $\pm 1.0\%$ supervisor authorization threshold. Closing stock updates to 49.800 MT (996 Bags). + +--- + +## TC-WH-007-02: Non-Negative Invariant & Tolerance Boundary Checks (Boundary / Edge Case) + +- **ID:** `TC-WH-007-02` +- **Category:** Boundary / Edge Case +- **Priority:** P0 +- **Preconditions:** Warehouse with current closing balance of 10.000 MT (200 Bags). +- **Steps:** + 1. Attempt an outward dispatch deduction of 10.001 MT (exceeding balance by 0.001 MT). + 2. Attempt a stock deduction that leaves exactly 0.000 MT and 0 bags (zero-boundary test). + 3. Submit physical audit adjustment with exactly +1.00% variance (10.100 MT) without Partner signature. + 4. Submit physical audit adjustment with +1.01% variance (10.101 MT) without Partner signature. +- **Expected Result:** + - Step 1 fails with HTTP 422 / 400 (`INSUFFICIENT_STOCK_BALANCE: Closing stock MT cannot be negative`). + - Step 2 succeeds with closing balance 0.000 MT and 0 bags. + - Step 3 succeeds (boundary $\le 1.0\%$ variance is permitted for supervisor sign-off). + - Step 4 fails with HTTP 403 / 422 (`PARTNER_SIGN_OFF_REQUIRED: Adjustments exceeding 1.0% require Partner electronic sign-off`). + +--- + +## TC-WH-007-03: Unauthorized Inter-Godown Deductions & Negative Quantities (Negative / Security) + +- **ID:** `TC-WH-007-03` +- **Category:** Negative / Security Rejection +- **Priority:** P0 +- **Preconditions:** Authenticated user without warehouse management role (e.g. `Mandi Buyer`). +- **Steps:** + 1. Attempt to post stock adjustment voucher as `Mandi Buyer`. + 2. Submit stock transfer with negative dispatched MT (`-5.000 MT`). + 3. Submit stock transfer where origin warehouse equals destination warehouse (`origin: WH-01`, `dest: WH-01`). + 4. Attempt cross-tenant stock query by requesting `warehouse_id` belonging to a different tenant. +- **Expected Result:** + - Step 1 returns HTTP 403 Forbidden. + - Step 2 returns HTTP 422 Unprocessable Entity (`dispatched_mt must be > 0`). + - Step 3 returns HTTP 422 Unprocessable Entity (`Origin and destination warehouses must be distinct`). + - Step 4 returns HTTP 404 Not Found or HTTP 403 due to PostgreSQL RLS tenant isolation. + +--- + +## TC-WH-007-04: Godown Capacity 85% Warning & Transfer Tolerance Reconciliation (FSM Invariant & Concurrency) + +- **ID:** `TC-WH-007-04` +- **Category:** FSM Invariant & Concurrency +- **Priority:** P0 +- **Preconditions:** `WH-01` capacity is 2,000.000 MT. Current stock is 1,690.000 MT (84.5% utilization). +- **Steps:** + 1. Post an inward receipt of 30.000 MT bringing total to 1,720.000 MT (86.0% utilization). + 2. Query `GET /api/v1/inventory/capacity` for `WH-01`. + 3. Initiate inter-godown stock transfer of 20.000 MT from `WH-03` to `WH-01`. Verify origin stock transitions to `In Transit`. + 4. Complete destination receipt with 19.970 MT (variance = -0.030 MT = -0.15%). + 5. Attempt an alternate transfer completion with 19.900 MT (variance = -0.100 MT = -0.50%, exceeding $\pm 0.2\%$ tolerance). +- **Expected Result:** + - In step 2, response includes `warning: True` and status `CAPACITY_WARNING` since 86.0% $> 85.0\%$. + - In step 3, origin stock is deducted and transfer status transitions to `IN_TRANSIT`. + - In step 4, transfer reconciles within $\pm 0.2\%$ tolerance; status transitions to `RECEIVED`. + - In step 5, system flags transfer with `VARIANCE_TOLERANCE_EXCEEDED` requiring investigation before inward balance posting. + diff --git a/04_generated_documentation/07_test_design/functional_test_cases/TC-008_sales_contracts_credit_allocation.md b/04_generated_documentation/07_test_design/functional_test_cases/TC-008_sales_contracts_credit_allocation.md new file mode 100644 index 0000000..c1bd49c --- /dev/null +++ b/04_generated_documentation/07_test_design/functional_test_cases/TC-008_sales_contracts_credit_allocation.md @@ -0,0 +1,95 @@ +# Functional Test Cases: UC-008 Customer Sales Contract, Credit Check and Allocation + +| Field | Value | +|---|---| +| **Test Suite** | `TC-008_sales_contracts_credit_allocation.md` | +| **Parent Use Case** | [`UC-008` (Customer Sales Contract, Credit Check and Allocation)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/use-case.md) | +| **Parent FRs** | `FR-SALESCONTRACTS-001`, `FR-SALESCONTRACTS-002`, `FR-SALESCONTRACTS-003` | +| **Status** | Baselined for Construction (Iteration 04) | +| **Version** | 1.0.0 | +| **Iteration** | `iteration-04` | + +--- + +## TC-SALES-008-01: Sales Order Contract Booking & Lot Allocation (Happy Path) + +- **ID:** `TC-SALES-008-01` +- **Category:** Functional / Happy Path +- **Priority:** P0 +- **Preconditions:** Authenticated user with role `Sales Manager`. Active customer `CUST-0012` (Adani Wilmar) with sanctioned credit limit ₹50,00,000 and current outstanding ₹10,00,000. Warehouse lot `LOT-UNJ-SOY-001` in `RELEASED` status with 60.000 MT unreserved. +- **Steps:** + 1. Book sales order via `POST /api/v1/sales/orders` with: + - `customer_id`: `CUST-0012` + - `destination_city`: "Indore" + - `customer_segment`: "Processor" + - `commodity_id`: "soyabean" + - `variety`: "Yellow Desi" + - `grade`: "FAQ" + - `contract_qty_mt`: 50.000 + - `contract_rate_qtl`: 4800.00 + - `payment_terms`: "15_DAYS" + 2. Verify Total Sales Value equals ₹ 24,00,000.00 ($50 \times 10 \times 4800$). + 3. Verify projected credit exposure is ₹ 34,00,000.00 (68.0%), order confirms with status `CONFIRMED`. + 4. Allocate 50.000 MT from `LOT-UNJ-SOY-001` via `POST /api/v1/sales/orders/{id}/allocations`. +- **Expected Result:** Order is confirmed. Total sales value verifies arithmetic formula. Lot allocation succeeds because lot is `RELEASED` and unreserved balance is sufficient. Order fulfillment status updates to `FULLY_ALLOCATED`. + +--- + +## TC-SALES-008-02: Credit Exposure 80% Warning & 100% Blocking Gate (Boundary / Edge Case) + +- **ID:** `TC-SALES-008-02` +- **Category:** Boundary / Edge Case +- **Priority:** P0 +- **Preconditions:** Customer with sanctioned limit ₹50,00,000 and current receivables ₹30,00,000. +- **Steps:** + 1. Book order with value ₹ 10,00,000 (projected exposure = ₹ 40,00,000 = 80.0%). + 2. Book order with value ₹ 10,50,000 (projected exposure = ₹ 40,50,000 = 81.0%). + 3. Book order with value ₹ 20,00,000 (projected exposure = ₹ 50,00,000 = 100.0%). + 4. Book order with value ₹ 20,50,000 (projected exposure = ₹ 50,50,000 = 101.0%) without Partner override. + 5. Repeat step 4 with `credit_override=True` and Partner electronic signature. +- **Expected Result:** + - Case 1 confirms with standard status (boundary $\le 80\%$). + - Case 2 confirms with an inline warning badge (`EXPOSURE_WARNING: Projected exposure exceeds 80%`). + - Case 3 confirms at the exact 100.0% boundary without hard lock. + - Case 4 fails with HTTP 422 / 403 (`CREDIT_LIMIT_EXCEEDED: Projected exposure 101.0% exceeds sanctioned limit. Requires Partner override`). + - Case 5 confirms with status `CONFIRMED_OVERRIDE` logging audit event. + +--- + +## TC-SALES-008-03: Invalid Commercial Arithmetic & Negative Allocations (Negative / Security) + +- **ID:** `TC-SALES-008-03` +- **Category:** Negative / Security Rejection +- **Priority:** P0 +- **Preconditions:** Authenticated user in active tenant. +- **Steps:** + 1. Send order payload with mismatching total value (`contract_qty_mt: 50.0`, `contract_rate_qtl: 4800.0`, `total_value_inr: 2500000.0`). + 2. Send order payload with negative quantity (`contract_qty_mt: -5.0`). + 3. Send allocation payload with negative allocated MT (`allocated_qty_mt: -10.0`). + 4. Attempt allocation to a sales order belonging to a different tenant. +- **Expected Result:** + - Step 1 fails with HTTP 422 (`ARITHMETIC_ERROR: total_value_inr must equal contract_qty_mt * 10 * contract_rate_qtl`). + - Step 2 fails with HTTP 422 (`contract_qty_mt must be > 0`). + - Step 3 fails with HTTP 422 (`allocated_qty_mt must be > 0`). + - Step 4 returns HTTP 404 / 403 due to tenant isolation. + +--- + +## TC-SALES-008-04: Allocation Invariant — QC Hold Blocking & Balance Depletion (FSM Invariant & Concurrency) + +- **ID:** `TC-SALES-008-04` +- **Category:** FSM Invariant & Concurrency +- **Priority:** P0 +- **Preconditions:** Sales order for 30.000 MT Soyabean. Warehouse has `LOT-A` (20.000 MT in `QC_HOLD`), `LOT-B` (15.000 MT in `UNDER_QC`), and `LOT-C` (25.000 MT in `RELEASED`, with 10.000 MT already reserved). +- **Steps:** + 1. Attempt to allocate 20.000 MT from `LOT-A` (`QC_HOLD`). + 2. Attempt to allocate 15.000 MT from `LOT-B` (`UNDER_QC`). + 3. Attempt to allocate 20.000 MT from `LOT-C` (where unreserved balance is only 15.000 MT = $25.0 - 10.0$). + 4. Allocate 15.000 MT from `LOT-C` (`RELEASED`). Verify order status is `PARTIALLY_ALLOCATED`. + 5. Attempt a concurrent duplicate allocation of the same 15.000 MT from `LOT-C`. +- **Expected Result:** + - Steps 1 and 2 fail with HTTP 422 (`QC_INVARIANT_VIOLATION: Cannot allocate lot in QC_HOLD or UNDER_QC state. Only RELEASED lots eligible`). + - Step 3 fails with HTTP 422 (`INSUFFICIENT_UNRESERVED_LOT_BALANCE: Requested 20.0 MT exceeds available 15.0 MT`). + - Step 4 succeeds, locking 15.000 MT on `LOT-C` and setting order to `PARTIALLY_ALLOCATED`. + - Step 5 fails with concurrency conflict / insufficient balance. + diff --git a/04_generated_documentation/07_test_design/functional_test_cases/TC-009_outbound_dispatch_delivery.md b/04_generated_documentation/07_test_design/functional_test_cases/TC-009_outbound_dispatch_delivery.md new file mode 100644 index 0000000..8557bff --- /dev/null +++ b/04_generated_documentation/07_test_design/functional_test_cases/TC-009_outbound_dispatch_delivery.md @@ -0,0 +1,85 @@ +# Functional Test Cases: UC-009 Outbound Dispatch and Delivery + +| Field | Value | +|---|---| +| **Test Suite** | `TC-009_outbound_dispatch_delivery.md` | +| **Parent Use Case** | [`UC-009` (Outbound Dispatch and Delivery)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/use-case.md) | +| **Parent FRs** | `FR-DISPATCHDELIVERY-001`, `FR-DISPATCHDELIVERY-002`, `FR-DISPATCHDELIVERY-003` | +| **Status** | Baselined for Construction (Iteration 04) | +| **Version** | 1.0.0 | +| **Iteration** | `iteration-04` | + +--- + +## TC-DISP-009-01: End-to-End Outbound Dispatch, Weighbridge & POD (Happy Path) + +- **ID:** `TC-DISP-009-01` +- **Category:** Functional / Happy Path +- **Priority:** P0 +- **Preconditions:** Confirmed sales order `SAL-26-00401` with allocated lot. Vehicle `RJ-09-GA-1234` registered in fleet with status `AVAILABLE`. +- **Steps:** + 1. Create outbound dispatch via `POST /api/v1/logistics/dispatches` linking order and vehicle. + 2. Verify dispatch status is `SCHEDULED`. + 3. Record outward weighments: Tare 9,800 kg, Gross 34,750 kg, 499 bags loaded. + 4. Verify Net Loaded MT is 24.950 MT (variance -0.20% from 25.0 MT order, within $\pm 1.0\%$ tolerance). + 5. Issue Bilty `BLT-2026-90481` with e-Way bill `381049281723`; transition dispatch to `IN_TRANSIT`. + 6. Record consignee delivery confirmation with destination net weight 24.950 MT and POD upload. +- **Expected Result:** Dispatch progresses through `SCHEDULED` $\to$ `LOADING` $\to$ `IN_TRANSIT` $\to$ `DELIVERED`. Bilty is generated. Delivery triggers automatic finalized Sales Invoice generation. + +--- + +## TC-DISP-009-02: Outward Weighbridge Order Tolerance & Gross/Tare Invariant (Boundary / Edge Case) + +- **ID:** `TC-DISP-009-02` +- **Category:** Boundary / Edge Case +- **Priority:** P0 +- **Preconditions:** Dispatch scheduled for allocated order of 25.000 MT. +- **Steps:** + 1. Record Tare 10,000 kg and Gross 10,000 kg (zero net weight). + 2. Record Tare 10,000 kg and Gross 9,500 kg (`gross < tare`). + 3. Record Tare 10,000 kg and Gross 34,750 kg (Net 24.750 MT = -1.00% variance boundary). + 4. Record Tare 10,000 kg and Gross 35,250 kg (Net 25.250 MT = +1.00% variance boundary). + 5. Record Tare 10,000 kg and Gross 34,700 kg (Net 24.700 MT = -1.20% variance, exceeding $\pm 1.0\%$). +- **Expected Result:** + - Case 1 and 2 fail with HTTP 422 (`INVARIANT_VIOLATION: Gross weight must strictly exceed Tare weight`). + - Cases 3 and 4 succeed (exact $\pm 1.0\%$ tolerance boundaries are permitted). + - Case 5 fails with HTTP 422 (`TOLERANCE_EXCEEDED: Net loaded weight 24.700 MT deviates beyond +/- 1.0% of order MT`). + +--- + +## TC-DISP-009-03: Vehicle Maintenance Lock & Unapproved Dispatch Creation (Negative / Security) + +- **ID:** `TC-DISP-009-03` +- **Category:** Negative / Security Rejection +- **Priority:** P0 +- **Preconditions:** Vehicle `RJ-20-CC-9900` has status `MAINTENANCE` in the fleet registry. +- **Steps:** + 1. Attempt to create dispatch assigning vehicle `RJ-20-CC-9900` (`MAINTENANCE`). + 2. Attempt to create dispatch without an allocated sales order. + 3. Attempt to record delivery POD for a dispatch still in `SCHEDULED` state (skipping weighbridge and transit). + 4. Attempt cross-tenant dispatch modification. +- **Expected Result:** + - Step 1 fails with HTTP 422 (`FLEET_INVARIANT_VIOLATION: Vehicle is in MAINTENANCE status and cannot be assigned`). + - Step 2 fails with HTTP 422 (`UNALLOCATED_ORDER: Dispatch requires confirmed order with allocated inventory lot`). + - Step 3 fails with HTTP 422 (`INVALID_FSM_TRANSITION: Cannot record POD on non-in-transit dispatch`). + - Step 4 returns HTTP 404 / 403 due to tenant isolation. + +--- + +## TC-DISP-009-04: Consignee Shortage Note & 2.0% Approval Credit Note FSM (FSM Invariant & Concurrency) + +- **ID:** `TC-DISP-009-04` +- **Category:** FSM Invariant & Concurrency +- **Priority:** P0 +- **Preconditions:** Dispatched consignment of 25.000 MT in `IN_TRANSIT` state. +- **Steps:** + 1. Record destination delivery with net weight 24.600 MT (shortage = 0.400 MT = 1.60%). + 2. Verify automated generation of Sales Invoice for full amount and compensating Credit Note for 0.400 MT without modifying original Bilty. + 3. On a second dispatch of 25.000 MT, record destination delivery with net weight 24.400 MT (shortage = 0.600 MT = 2.40%, exceeding 2.0% limit). + 4. Attempt to finalize delivery and issue credit note without Sales Manager approval. + 5. Provide Sales Manager approval and re-submit. +- **Expected Result:** + - In step 2, Credit Note is generated automatically because shortage 1.60% $\le 2.0\%$. + - In step 4, operation is blocked with HTTP 422 / 403 (`APPROVAL_REQUIRED: Consignee shortage exceeds 2.0%; requires Sales Manager sign-off`). + - In step 5, Credit Note is issued with status `APPROVED_OVERRIDE` and audit entry logged. + diff --git a/04_generated_documentation/07_test_design/functional_test_cases/TC-010_transport_fleet_registry.md b/04_generated_documentation/07_test_design/functional_test_cases/TC-010_transport_fleet_registry.md new file mode 100644 index 0000000..777fd73 --- /dev/null +++ b/04_generated_documentation/07_test_design/functional_test_cases/TC-010_transport_fleet_registry.md @@ -0,0 +1,86 @@ +# Functional Test Cases: UC-010 Transport Fleet Registry + +| Field | Value | +|---|---| +| **Test Suite** | `TC-010_transport_fleet_registry.md` | +| **Parent Use Case** | [`UC-010` (Transport Fleet Registry)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/use-case.md) | +| **Parent FRs** | `FR-FLEETREGISTRY-001` | +| **Status** | Baselined for Construction (Iteration 04) | +| **Version** | 1.0.0 | +| **Iteration** | `iteration-04` | + +--- + +## TC-FLEET-010-01: Register Own & Contract Transport Vehicles (Happy Path) + +- **ID:** `TC-FLEET-010-01` +- **Category:** Functional / Happy Path +- **Priority:** P1 +- **Preconditions:** Authenticated user with role `Fleet Manager` or `Logistics Coordinator`. Active tenant. +- **Steps:** + 1. Register an owned truck via `POST /api/v1/logistics/fleet` with: + - `vehicle_reg_no`: "RJ-09-GA-5678" + - `make_model`: "Tata Signa 2823.K" + - `payload_capacity_mt`: 28.000 + - `ownership_type`: "OWN" + - `transporter_name`: "ATB Logistics Fleet" + - `fitness_expiry_date`: "2027-08-31" + - `insurance_expiry_date`: "2027-08-15" + - `status`: "AVAILABLE" + 2. Register a contract carrier truck with `ownership_type: "CONTRACT"` and `transporter_name: "Shreenath Roadways"`. + 3. Query `GET /api/v1/logistics/fleet` filtering by `status=AVAILABLE`. +- **Expected Result:** Both vehicles are registered with 3-decimal MT payload capacity. Query returns the active available fleet. + +--- + +## TC-FLEET-010-02: Payload Limits & Registration Number Boundaries (Boundary / Edge Case) + +- **ID:** `TC-FLEET-010-02` +- **Category:** Boundary / Edge Case +- **Priority:** P1 +- **Preconditions:** Authenticated user in active tenant. +- **Steps:** + 1. Register small light commercial vehicle (LCV) with minimal payload `0.500 MT`. + 2. Register multi-axle trailer with maximum payload `55.000 MT`. + 3. Attempt registration with zero payload (`0.000 MT`). + 4. Attempt registration with negative payload (`-10.000 MT`). +- **Expected Result:** + - Cases 1 and 2 succeed with HTTP 201 Created. + - Cases 3 and 4 fail with HTTP 422 Unprocessable Entity (`payload_capacity_mt must be > 0.0`). + +--- + +## TC-FLEET-010-03: Duplicate Registration Number & Expired Fitness (Negative / Security) + +- **ID:** `TC-FLEET-010-03` +- **Category:** Negative / Security Rejection +- **Priority:** P1 +- **Preconditions:** Truck `RJ-09-GA-5678` already registered in current tenant. +- **Steps:** + 1. Attempt to register a duplicate truck with identical `vehicle_reg_no: "RJ-09-GA-5678"`. + 2. Attempt registration with malformed registration format (e.g. `INVALID-TRUCK-123`). + 3. Attempt registration as unauthorized user (e.g. `Yard Clerk`). +- **Expected Result:** + - Step 1 fails with HTTP 409 Conflict (`DUPLICATE_VEHICLE: Vehicle registration number already exists in tenant`). + - Step 2 fails with HTTP 422 (`INVALID_REGISTRATION_FORMAT`). + - Step 3 fails with HTTP 403 Forbidden. + +--- + +## TC-FLEET-010-04: Maintenance Invariant Gating Dispatch Assignment (FSM Invariant & Concurrency) + +- **ID:** `TC-FLEET-010-04` +- **Category:** FSM Invariant & Concurrency +- **Priority:** P1 +- **Preconditions:** Vehicle `RJ-09-GA-5678` registered with status `AVAILABLE`. +- **Steps:** + 1. Update vehicle status to `MAINTENANCE` via `PATCH /api/v1/logistics/fleet/{id}/status`. + 2. Attempt to assign this vehicle to a new dispatch consignment. + 3. Update vehicle status back to `AVAILABLE`. + 4. Assign vehicle to dispatch consignment. + 5. Verify vehicle status transitions to `ON_ROUTE`. +- **Expected Result:** + - In step 2, assignment is rejected with HTTP 422 (`FLEET_INVARIANT_VIOLATION: Vehicle is in MAINTENANCE status and cannot be assigned to dispatches`). + - In step 4, assignment succeeds. + - In step 5, vehicle status reflects `ON_ROUTE` preventing double-assignment to a conflicting dispatch. + diff --git a/04_generated_documentation/07_test_design/manual_qa/iteration-04/MANUAL_TESTING_GUIDE.md b/04_generated_documentation/07_test_design/manual_qa/iteration-04/MANUAL_TESTING_GUIDE.md new file mode 100644 index 0000000..2da2569 --- /dev/null +++ b/04_generated_documentation/07_test_design/manual_qa/iteration-04/MANUAL_TESTING_GUIDE.md @@ -0,0 +1,132 @@ +# Comprehensive Manual Testing Guide — Iteration 04 +## Warehouse Stock Ledger, Customer Sales Contracts, Credit Controls, Lot Allocation, Outbound Dispatch & Transport Fleet Registry + +| Field | Value | +|---|---| +| **Document ID** | `MTG-ITERATION-04` | +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.5 Quality Standard) | +| **Iteration** | `iteration-04` | +| **Scope Slice** | Warehouse Stock Ledger, Capacity & Transfers (`UC-007`), Sales Contracts & Allocation (`UC-008`), Outbound Dispatch & Delivery (`UC-009`), Fleet Registry (`UC-010`) | +| **Child Requirements** | `FR-WAREHOUSEINVENTORY-001`..`003`, `FR-SALESCONTRACTS-001`..`003`, `FR-DISPATCHDELIVERY-001`..`003`, `FR-FLEETREGISTRY-001` (10 FRs) | +| **Associated Screens** | [`SCREEN-WH-001`](../../06_wireframes/screen_specs/SCREEN-WH-001_stock_ledger.md), [`SCREEN-WH-002`](../../06_wireframes/screen_specs/SCREEN-WH-002_capacity_transfers.md), [`SCREEN-SALES-001`](../../06_wireframes/screen_specs/SCREEN-SALES-001_sales_order_booking.md), [`SCREEN-SALES-002`](../../06_wireframes/screen_specs/SCREEN-SALES-002_lot_allocation.md), [`SCREEN-DISP-001`](../../06_wireframes/screen_specs/SCREEN-DISP-001_dispatch_board_weighbridge.md), [`SCREEN-DISP-002`](../../06_wireframes/screen_specs/SCREEN-DISP-002_pod_shortage_settlement.md), [`SCREEN-FLEET-001`](../../06_wireframes/screen_specs/SCREEN-FLEET-001_fleet_registry.md) | +| **Associated APIs** | `GET /api/v1/inventory/ledger`, `POST /api/v1/inventory/adjustments`, `GET /api/v1/inventory/capacity`, `POST /api/v1/inventory/transfers`, `POST/GET /api/v1/sales/orders`, `POST /api/v1/sales/orders/{id}/allocations`, `POST/GET /api/v1/logistics/dispatches`, `POST /api/v1/logistics/dispatches/{id}/weighments`, `POST /api/v1/logistics/dispatches/{id}/pod`, `POST/GET /api/v1/logistics/fleet` | +| **21-Sheet QA Workbook** | `Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx` | +| **Status** | Approved QA Specification (Ready for Construction Verification) | +| **Version** | 1.0.0 | +| **Last CR** | none | + +--- + +## 1. Executive Summary & Objective + +This manual testing guide is authored for Quality Assurance (QA) engineers, Field Operations Testers, Commercial Auditors, and Adversarial Security Testers conducting manual verification and acceptance testing on **Iteration 04**. + +The objective of Iteration 04 manual verification is to rigorously validate the complete physical and commercial inventory fulfillment and dispatch lifecycle: +1. **Multi-Godown Dual-Unit Stock Ledger & Physical Audits (`UC-007`):** Verify real-time double-entry balances in MT and Bags across godowns (`WH-01` Neemuch Main Yard, `WH-02` Neemuch North, `WH-03` Mandsaur, `WH-04` Indore). Perform physical stock audits, verify reason-coded adjustment vouchers (*Ghat / Nami*, Spillage, Bag Burst), enforce non-negative stock invariant, and confirm Partner electronic sign-off is required whenever variance exceeds $\pm 1.0\%$. +2. **Godown Capacity & Utilization Tracking (`UC-007`):** Monitor storage capacity in MT, verify percentage utilization calculation, and validate automated warning alerts when utilization exceeds 85%. +3. **Inter-Godown Internal Stock Transfers (`UC-007`):** Validate origin stock deduction, in-transit status tracking, destination weighbridge capture, and inward balance posting within $\pm 0.2\%$ transfer tolerance limit. +4. **Customer Sales Contracts & Credit Controls (`UC-008`):** Book customer orders across buyer segments (`Wholesale`, `Processor`, `Institutional`, `Distributor`). Verify arithmetic formula ($\text{Total Value} = \text{MT} \times 10 \times \text{Rate}$). Validate real-time customer credit limit evaluation: display inline warning if projected exposure $> 80\%$, and enforce hard-block if $> 100\%$ unless authorized by Partner electronic override. +5. **Released-Lot Sales Order Inventory Allocation (`UC-008`):** Allocate available inventory lots from warehouse stacks to confirmed orders. Verify strict FSM invariant: only lots in `RELEASED` status can be allocated (hard-blocking `QC Hold` and `Under QC` lots) and available unreserved MT must be $\ge$ allocated MT. +6. **Outbound Dispatch Board & Consignment Scheduling (`UC-009`):** Schedule consignments matching confirmed orders, allocated lots, and transport vehicles. Verify that vehicles in `Maintenance` status cannot be assigned. +7. **Outward Weighbridge Logging & Bilty Generation (`UC-009`):** Capture outward Tare (empty truck) and Gross (loaded truck). Verify that net loaded weight matches allocated order MT within $\pm 1.0\%$ tolerance limit. Generate official transport manifest / Bilty with e-Way bill linkage. +8. **In-Transit Tracking, Proof of Delivery (POD) & Shortage Settlement (`UC-009`):** Progress dispatch status to `DELIVERED`, upload POD document, verify automated Sales Invoice generation, and record Consignee Shortage Notes. Generate compensating Sales Credit Notes, verifying that shortages $> 2.0\%$ require mandatory Sales Manager approval. +9. **Transport Fleet & Carrier Registry (`UC-010`):** Register owned and contract carrier trucks, track payloads, fitness expiry dates, and operational statuses (`Available`, `On Route`, `Maintenance`). + +--- + +## 2. Test Environment & Pre-Requisites + +### 2.1 Test Topologies +- **Topology A (Live Microservices & Containers):** + - PostgreSQL 17.11 container (`atb-local-postgres-1` on port `5432`). + - Keycloak 26 container (`atb-local-keycloak-1` on port `8080`). + - FastAPI Backend container (`atb-backend-test` on port `8000`). + - Web Portal running on `http://localhost:3000`. +- **Topology B (Local Python Harness / Automated Runner):** + - Fast execution via `scripts/run_tests.sh --scope iteration-04`. + - Mocks pre-seeded via `sandbox/warehouse_mock.py`, `sandbox/customer_credit_mock.py`, and `sandbox/fleet_mock.py`. + +--- + +## 3. Disposable QA Personas & Credentials Matrix + +| Persona ID | Email / Username | Assigned Role | Facility / Domain Scope | Test Purpose | +|---|---|---|---|---| +| `supervisor@alpha.com` | `supervisor@alpha.com` | Yard Supervisor | WH-01 Neemuch Yard | Stock ledger, physical audits & outward weighbridge (`UC-007`, `UC-009`) | +| `wh_manager@alpha.com` | `wh_manager@alpha.com` | Warehouse Manager | Multi-Godown Network | Capacity alerts & inter-godown transfers (`UC-007`) | +| `sales_mgr@alpha.com` | `sales_mgr@alpha.com` | Sales Manager | Commercial Sales Desk | Contract booking, credit checks & lot allocation (`UC-008`) | +| `partner@alpha.com` | `partner@alpha.com` | Partner / MD | Executive Management | Electronic sign-off on >1.0% audit variance & >100% credit breach | +| `logistics@alpha.com` | `logistics@alpha.com` | Logistics Coordinator | Logistics Control Desk | Dispatch board, Bilty generation, POD & shortage notes (`UC-009`) | +| `fleet_mgr@alpha.com` | `fleet_mgr@alpha.com` | Fleet Manager | Transport Fleet Registry | Vehicle registration, fitness expiry & maintenance gating (`UC-010`) | +| `adversary@beta.com` | `adversary@beta.com` | Tenant Administrator | `tenant-beta` | Adversarial cross-tenant boundary verification | + +--- + +## 4. End-to-End Test Walkthroughs + +### Walkthrough 1: Stock Audit Adjustment with Variance Gating (`UC-007`) +1. Log in as `supervisor@alpha.com`. Navigate to `/inventory/ledger`. +2. Inspect current closing stock for Chana Desi FAQ at `WH-01` (e.g. 500.500 MT, 10,010 Bags). +3. Click **Record Stock Audit**. Enter physical tally: 499.850 MT (9,997 Bags). +4. Verify system displays variance: -0.650 MT (-0.13%). Select reason code `Moisture Loss / Ghat`. +5. Since variance is $\le 1.0\%$, supervisor can commit directly. Balance updates to 499.850 MT. +6. Now attempt an adjustment with physical tally 490.000 MT (-10.500 MT = -2.10% variance). +7. Verify system disables standard commit and prompts for Partner Authorization. +8. Log in as `partner@alpha.com`, enter authorization key, and commit the voucher. + +### Walkthrough 2: Warehouse Capacity 85% Warning Alert (`UC-007`) +1. Log in as `wh_manager@alpha.com`. Navigate to `/inventory/capacity`. +2. Review warehouse capacity metrics. Observe `WH-01` capacity (2,000 MT) and stock (1,760 MT = 88.0% utilization). +3. Verify that an inline amber warning badge appears: `CAPACITY_WARNING: Utilization exceeds 85%`. +4. Verify normal display for `WH-02` (60.0% utilization). + +### Walkthrough 3: Inter-Godown Internal Stock Transfer (`UC-007`) +1. Log in as `logistics@alpha.com`. Navigate to `/inventory/transfers`. +2. Click **Initiate Transfer**. Select origin `WH-03` Mandsaur and destination `WH-01` Neemuch. +3. Select Chana Desi FAQ, quantity 20.000 MT (400 Bags). Assign vehicle `MP-14-GA-8921`. +4. Confirm transfer. Verify `WH-03` stock balance decreases by 20.000 MT and transfer status is `IN_TRANSIT`. +5. Log in as `supervisor@alpha.com` at destination `WH-01`. Receive transfer with 19.980 MT (variance = -0.020 MT = -0.10%). +6. Verify variance is within $\pm 0.2\%$ tolerance. Confirm receipt. `WH-01` stock increases by 19.980 MT. + +### Walkthrough 4: Customer Sales Contract Booking & Credit Guard (`UC-008`) +1. Log in as `sales_mgr@alpha.com`. Navigate to `/sales/orders/new`. +2. Select Customer `CUST-0012` (Adani Wilmar). Enter 50.000 MT Soyabean at ₹4,800/Qtl. +3. Verify Total Sales Value calculates to ₹ 24,00,000.00. +4. Review Credit Assessment: Sanctioned limit ₹50,00,000, Current receivables ₹38,00,000. +5. Projected exposure = ₹62,00,000 (124.0% exposure ratio). +6. Verify that standard confirmation button is disabled with error message `CREDIT_LIMIT_EXCEEDED`. +7. Enter Partner Electronic Override key and justification. Click **Confirm Order**. Order confirms with status `CONFIRMED_OVERRIDE`. + +### Walkthrough 5: Sales Order Lot Allocation FSM (`UC-008`) +1. In order view for `SAL-26-00401`, click **Allocate Lots**. +2. Review available warehouse lots for Soyabean Yellow Desi FAQ. +3. Observe `LOT-MDR-SOY-004` (in `QC_HOLD`). Verify the allocate button is disabled with tooltip `QC_HOLD: Unreleased lot cannot be allocated`. +4. Observe `LOT-UNJ-SOY-001` (in `RELEASED` with 50.000 MT unreserved). +5. Allocate 50.000 MT. Verify lot reserved MT increments by 50.000 MT and order updates to `FULLY_ALLOCATED`. + +### Walkthrough 6: Outbound Weighbridge & Bilty Manifest (`UC-009`) +1. Log in as `logistics@alpha.com`. Navigate to `/logistics/dispatch-board`. +2. Schedule dispatch for order `SAL-26-00401`. Assign truck `RJ-09-GA-1234` from fleet registry. +3. Log in as `supervisor@alpha.com`. Open `/logistics/weighbridge`. +4. Capture outward Tare weight: 9,800 kg. Truck loads produce. Capture outward Gross weight: 34,750 kg. +5. Verify Net Loaded Weight calculates to 24,950 kg (24.950 MT, -0.20% variance from 25.0 MT order). +6. Verify variance is within $\pm 1.0\%$ loading tolerance. +7. Enter Transporter Bilty No `BLT-2026-90481` and 12-digit e-Way bill `381049281723`. Click **Issue Bilty**. +8. Verify dispatch status transitions to `IN_TRANSIT`. + +### Walkthrough 7: POD Confirmation & Shortage Credit Note (`UC-009`) +1. In `/logistics/pod`, locate in-transit consignment `DISP-26-0012`. +2. Enter Actual Delivery Date, destination weighbridge net MT: 24.550 MT (shortage = 0.400 MT = 1.60%). +3. Upload signed POD reference `signed_pod_patanjali.pdf`. +4. Click **Confirm Delivery**. +5. Verify system automatically generates finalized Sales Invoice `INV-2026-00481` and compensating Credit Note `CRN-2026-00012` for ₹ 19,200.00. +6. Verify that for a shortage $> 2.0\%$, Sales Manager electronic sign-off is required. + +### Walkthrough 8: Fleet Registry & Maintenance Gating (`UC-010`) +1. Log in as `fleet_mgr@alpha.com`. Navigate to `/logistics/fleet`. +2. Register truck `RJ-09-GA-5678` with status `MAINTENANCE`. +3. Switch to `/logistics/dispatch-board` and attempt to schedule a dispatch with this truck. +4. Verify the truck is flagged as disabled with message `VEHICLE_IN_MAINTENANCE`. +5. Return to fleet registry, update status to `AVAILABLE`. +6. Return to dispatch board; vehicle is now selectable. + diff --git a/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx b/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx new file mode 100644 index 0000000..36ea2b4 Binary files /dev/null and b/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx differ diff --git a/04_generated_documentation/07_test_design/regression_test_cases.md b/04_generated_documentation/07_test_design/regression_test_cases.md index a66af94..852fad9 100644 --- a/04_generated_documentation/07_test_design/regression_test_cases.md +++ b/04_generated_documentation/07_test_design/regression_test_cases.md @@ -43,4 +43,17 @@ | `TC-QC-006-01` | Functional / Lab Assay & Rebate | `FR-QUALITYANDLOTCONTROL-001` | Automated (pytest) | `tests/backend/test_quality_lot_control.py` | `uc_006`, `fr_qualityandlotcontrol_001`, `iteration_03` | In Construction | | `TC-QC-006-03` | Security / QC Hold Dispatch Guard | `FR-QUALITYANDLOTCONTROL-003` | Automated (pytest) | `tests/backend/test_quality_lot_control.py` | `uc_006`, `fr_qualityandlotcontrol_003`, `iteration_03` | In Construction | | `TC-QC-006-04` | FSM / Lot Lineage Traversal | `FR-QUALITYANDLOTCONTROL-004` | Automated (pytest) | `tests/backend/test_quality_lot_control.py` | `uc_006`, `fr_qualityandlotcontrol_004`, `iteration_03` | In Construction | +| `TC-WH-007-01` | Functional / Stock Ledger | `FR-WAREHOUSEINVENTORY-001` | Automated (pytest) | `tests/backend/test_warehouse_inventory.py` | `uc_007`, `fr_warehouseinventory_001`, `iteration_04` | In Construction | +| `TC-WH-007-02` | Boundary / Audit Variance | `FR-WAREHOUSEINVENTORY-001` | Automated (pytest) | `tests/backend/test_warehouse_inventory.py` | `uc_007`, `fr_warehouseinventory_001`, `iteration_04` | In Construction | +| `TC-WH-007-04` | Functional / Capacity 85% | `FR-WAREHOUSEINVENTORY-002` | Automated (pytest) | `tests/backend/test_warehouse_inventory.py` | `uc_007`, `fr_warehouseinventory_002`, `iteration_04` | In Construction | +| `TC-WH-007-03` | Security & FSM / Transfer | `FR-WAREHOUSEINVENTORY-003` | Automated (pytest) | `tests/backend/test_warehouse_inventory.py` | `uc_007`, `fr_warehouseinventory_003`, `iteration_04` | In Construction | +| `TC-SALES-008-01` | Functional / Sales Order | `FR-SALESCONTRACTS-001` | Automated (pytest) | `tests/backend/test_sales_contracts.py` | `uc_008`, `fr_salescontracts_001`, `iteration_04` | In Construction | +| `TC-SALES-008-02` | Boundary / Credit Exposure | `FR-SALESCONTRACTS-002` | Automated (pytest) | `tests/backend/test_sales_contracts.py` | `uc_008`, `fr_salescontracts_002`, `iteration_04` | In Construction | +| `TC-SALES-008-04` | FSM / Lot Allocation | `FR-SALESCONTRACTS-003` | Automated (pytest) | `tests/backend/test_sales_contracts.py` | `uc_008`, `fr_salescontracts_003`, `iteration_04` | In Construction | +| `TC-DISP-009-01` | Functional / Dispatch Board | `FR-DISPATCHDELIVERY-001` | Automated (pytest) | `tests/backend/test_dispatch_delivery.py` | `uc_009`, `fr_dispatchdelivery_001`, `iteration_04` | In Construction | +| `TC-DISP-009-02` | Boundary / Outward Weighment | `FR-DISPATCHDELIVERY-002` | Automated (pytest) | `tests/backend/test_dispatch_delivery.py` | `uc_009`, `fr_dispatchdelivery_002`, `iteration_04` | In Construction | +| `TC-DISP-009-04` | FSM / POD & Shortage Credit | `FR-DISPATCHDELIVERY-003` | Automated (pytest) | `tests/backend/test_dispatch_delivery.py` | `uc_009`, `fr_dispatchdelivery_003`, `iteration_04` | In Construction | +| `TC-FLEET-010-01` | Functional / Fleet Registry | `FR-FLEETREGISTRY-001` | Automated (pytest) | `tests/backend/test_fleet_registry.py` | `uc_010`, `fr_fleetregistry_001`, `iteration_04` | In Construction | +| `TC-FLEET-010-04` | Invariant / Maintenance Block | `FR-FLEETREGISTRY-001` | Automated (pytest) | `tests/backend/test_fleet_registry.py` | `uc_010`, `fr_fleetregistry_001`, `iteration_04` | In Construction | + diff --git a/04_generated_documentation/07_test_design/test_traceability_matrix.md b/04_generated_documentation/07_test_design/test_traceability_matrix.md index 43343ea..4ae7d8c 100644 --- a/04_generated_documentation/07_test_design/test_traceability_matrix.md +++ b/04_generated_documentation/07_test_design/test_traceability_matrix.md @@ -56,6 +56,18 @@ | `UC-006` | `FR-QUALITYANDLOTCONTROL-002` | `STORY-QC-003` | `TC-QC-006-01` | Functional / Rebate Deduction | Unit / Domain | `tests/backend/test_quality_lot_control.py` | Modeled (Active) | | `UC-006` | `FR-QUALITYANDLOTCONTROL-003` | `STORY-QC-002` | `TC-QC-006-03` | Security & FSM / QC Hold | Unit / FSM | `tests/backend/test_quality_lot_control.py` | Modeled (Active) | | `UC-006` | `FR-QUALITYANDLOTCONTROL-004` | `STORY-QC-004` | `TC-QC-006-04` | FSM / Lineage Tree | Unit / API | `tests/backend/test_quality_lot_control.py` | Modeled (Active) | +| `UC-007` | `FR-WAREHOUSEINVENTORY-001` | `STORY-WH-001` | `TC-WH-007-01` | Functional / Stock Ledger | Unit / API | `tests/backend/test_warehouse_inventory.py` | Modeled (Ready for Construction) | +| `UC-007` | `FR-WAREHOUSEINVENTORY-001` | `STORY-WH-001` | `TC-WH-007-02` | Boundary / Audit Variance | Unit / Domain | `tests/backend/test_warehouse_inventory.py` | Modeled (Ready for Construction) | +| `UC-007` | `FR-WAREHOUSEINVENTORY-002` | `STORY-WH-002` | `TC-WH-007-04` | Functional / Capacity 85% | Unit / API | `tests/backend/test_warehouse_inventory.py` | Modeled (Ready for Construction) | +| `UC-007` | `FR-WAREHOUSEINVENTORY-003` | `STORY-WH-003` | `TC-WH-007-03` | Security & FSM / Transfer | Unit / FSM | `tests/backend/test_warehouse_inventory.py` | Modeled (Ready for Construction) | +| `UC-008` | `FR-SALESCONTRACTS-001` | `STORY-SALES-001` | `TC-SALES-008-01` | Functional / Sales Order | Unit / API | `tests/backend/test_sales_contracts.py` | Modeled (Ready for Construction) | +| `UC-008` | `FR-SALESCONTRACTS-002` | `STORY-SALES-002` | `TC-SALES-008-02` | Boundary / Credit Exposure | Unit / Domain | `tests/backend/test_sales_contracts.py` | Modeled (Ready for Construction) | +| `UC-008` | `FR-SALESCONTRACTS-003` | `STORY-SALES-003` | `TC-SALES-008-04` | FSM / Lot Allocation | Unit / FSM | `tests/backend/test_sales_contracts.py` | Modeled (Ready for Construction) | +| `UC-009` | `FR-DISPATCHDELIVERY-001` | `STORY-DISP-001` | `TC-DISP-009-01` | Functional / Dispatch Board | Unit / API | `tests/backend/test_dispatch_delivery.py` | Modeled (Ready for Construction) | +| `UC-009` | `FR-DISPATCHDELIVERY-002` | `STORY-DISP-002` | `TC-DISP-009-02` | Boundary / Outward Weighment | Unit / Domain | `tests/backend/test_dispatch_delivery.py` | Modeled (Ready for Construction) | +| `UC-009` | `FR-DISPATCHDELIVERY-003` | `STORY-DISP-003` | `TC-DISP-009-04` | FSM / POD & Shortage Credit | Unit / FSM | `tests/backend/test_dispatch_delivery.py` | Modeled (Ready for Construction) | +| `UC-010` | `FR-FLEETREGISTRY-001` | `STORY-FLEET-001` | `TC-FLEET-010-01` | Functional / Fleet Registry | Unit / API | `tests/backend/test_fleet_registry.py` | Modeled (Ready for Construction) | +| `UC-010` | `FR-FLEETREGISTRY-001` | `STORY-FLEET-001` | `TC-FLEET-010-04` | Invariant / Maintenance Block | Unit / FSM | `tests/backend/test_fleet_registry.py` | Modeled (Ready for Construction) | --- @@ -71,6 +83,16 @@ | `STORY-TENANT-003` | **Required** (`TC-TENANT-019-01`, `02`) | **Required** (`SMOKE-TENANT-003`) | **Required** (Header switcher dropdown UX) | **Required** (`switch-tenant.bru`) | **Required** (`tenant_switch.spec.ts`) | Active tenant context resolution and switching. | | `STORY-TENANT-004` | **Required** (`TC-TENANT-017-01`–`03`) | **Required** (`SMOKE-TENANT-004`) | **N/A** (Database engine RLS policies) | **N/A** (Cross-cutting data layer) | **Required** (`rls_leakage.spec.ts`) | Core PostgreSQL RLS multi-tenant data isolation. | | `STORY-TENANT-005` | **Required** (`TC-TENANT-017-04`) | **Required** (`SMOKE-TENANT-005`) | **Required** (Audit log table & diff drawer) | **Required** (`get-audit-events.bru`) | **Required** (`audit_viewer.spec.ts`) | Tamper-resistant immutable mutation audit trail. | +| `STORY-WH-001` | **Required** (`TC-WH-007-01`..`02`) | **Required** | **Required** (Ledger table & variance modal) | **Required** (`get-stock-ledger.bru`, `post-stock-adjustment.bru`) | **Required** | Double-entry stock ledger & audit adjustments. | +| `STORY-WH-002` | **Required** (`TC-WH-007-04`) | **Required** | **Required** (Capacity progress meters & alerts) | **Required** (`get-warehouse-capacity.bru`) | **Required** | Real-time warehouse capacity & 85% warning. | +| `STORY-WH-003` | **Required** (`TC-WH-007-03`) | **Required** | **Required** (Transfer dispatch modal) | **Required** (`create-stock-transfer.bru`) | **Required** | Inter-godown transfer & 0.2% tolerance. | +| `STORY-SALES-001` | **Required** (`TC-SALES-008-01`) | **Required** | **Required** (Order form & value calculator) | **Required** (`create-sales-order.bru`) | **Required** | Customer sales contract booking. | +| `STORY-SALES-002` | **Required** (`TC-SALES-008-02`) | **Required** | **Required** (Credit warning & override modal) | **Required** (Integrated in sales order API) | **Required** | Customer credit exposure guard (80% / 100%). | +| `STORY-SALES-003` | **Required** (`TC-SALES-008-04`) | **Required** | **Required** (Lot allocation matching UI) | **Required** (`allocate-order-lot.bru`) | **Required** | Inventory lot allocation & QC Release invariant. | +| `STORY-DISP-001` | **Required** (`TC-DISP-009-01`) | **Required** | **Required** (Visual dispatch board) | **Required** (`create-dispatch.bru`) | **Required** | Outbound dispatch console & consignment scheduling. | +| `STORY-DISP-002` | **Required** (`TC-DISP-009-02`) | **Required** | **Required** (Weighbridge slip & Bilty print) | **Required** (`post-outward-weighment.bru`) | **Required** | Outward weighbridge & transport manifest / Bilty. | +| `STORY-DISP-003` | **Required** (`TC-DISP-009-04`) | **Required** | **Required** (POD upload & credit note drawer) | **Required** (`post-pod-delivery.bru`) | **Required** | In-transit tracking, POD & shortage credit note. | +| `STORY-FLEET-001` | **Required** (`TC-FLEET-010-01`..`04`) | **Required** | **Required** (Fleet directory & truck editor) | **Required** (`create-vehicle.bru`, `list-fleet.bru`) | **Required** | Transport fleet registry & maintenance gating. | --- @@ -79,4 +101,6 @@ - **Iteration 01:** [`Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx) (32 cases across 16 categories). - **Iteration 02:** [`Iteration02_Multi_Tenant_Core_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration02_Multi_Tenant_Core_Complete_Manual_Testcases.xlsx) (32 cases across 16 categories). - **Iteration 03:** [`Iteration03_Mandi_Procurement_Receiving_QC_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration03_Mandi_Procurement_Receiving_QC_Complete_Manual_Testcases.xlsx) (32 cases across 16 categories). +- **Iteration 04:** [`Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx) (32 cases across 16 categories). + diff --git a/docs/api/bruno/dispatch/create-dispatch.bru b/docs/api/bruno/dispatch/create-dispatch.bru new file mode 100644 index 0000000..034772c --- /dev/null +++ b/docs/api/bruno/dispatch/create-dispatch.bru @@ -0,0 +1,39 @@ +meta { + name: Schedule Outbound Dispatch + type: http + seq: 1 +} + +post { + url: {{baseUrl}}/api/v1/logistics/dispatches + body: json + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Content-Type: application/json + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +body:json { + { + "order_id": "{{orderId}}", + "vehicle_reg_no": "RJ-09-GA-1234", + "target_mt": 25.000, + "target_bags": 500, + "dispatch_date": "2026-10-12" + } +} + +docs { + # Schedule Outbound Dispatch (FR-DISPATCHDELIVERY-001) + + Matches confirmed order and allocated lot to assigned vehicle. + Verifies vehicle is registered and not in MAINTENANCE status. +} + diff --git a/docs/api/bruno/dispatch/post-outward-weighment.bru b/docs/api/bruno/dispatch/post-outward-weighment.bru new file mode 100644 index 0000000..575132f --- /dev/null +++ b/docs/api/bruno/dispatch/post-outward-weighment.bru @@ -0,0 +1,39 @@ +meta { + name: Record Outward Weighment & Issue Bilty + type: http + seq: 2 +} + +post { + url: {{baseUrl}}/api/v1/logistics/dispatches/{{dispatchId}}/weighments + body: json + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Content-Type: application/json + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +body:json { + { + "tare_kg": 9800, + "gross_kg": 34750, + "loaded_bags": 499, + "bilty_no": "BLT-2026-90481", + "eway_bill_no": "381049281723" + } +} + +docs { + # Record Outward Weighment & Issue Bilty (FR-DISPATCHDELIVERY-002) + + Captures outward weighbridge readings. + Enforces invariant gross > tare and verifies loaded MT matches allocated order MT within +/- 1.0% tolerance. +} + diff --git a/docs/api/bruno/dispatch/post-pod-delivery.bru b/docs/api/bruno/dispatch/post-pod-delivery.bru new file mode 100644 index 0000000..c854791 --- /dev/null +++ b/docs/api/bruno/dispatch/post-pod-delivery.bru @@ -0,0 +1,41 @@ +meta { + name: Record Proof of Delivery & Shortage Settlement + type: http + seq: 3 +} + +post { + url: {{baseUrl}}/api/v1/logistics/dispatches/{{dispatchId}}/pod + body: json + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Content-Type: application/json + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +body:json { + { + "delivery_date": "2026-10-12T14:30:00Z", + "dest_net_mt": 24.550, + "dest_bags": 495, + "pod_document_ref": "DOC-POD-26-00412.pdf", + "remarks": "Rain damage on 4 bags in transit. Acknowledged by buyer.", + "sales_manager_approval": false + } +} + +docs { + # Record Proof of Delivery & Shortage Settlement (FR-DISPATCHDELIVERY-003) + + Records consignee receipt and logs transit shortage note. + Automatically triggers finalized Sales Invoice and generates compensating Credit Note. + Enforces Sales Manager sign-off if shortage exceeds 2.0%. +} + diff --git a/docs/api/bruno/fleet/create-vehicle.bru b/docs/api/bruno/fleet/create-vehicle.bru new file mode 100644 index 0000000..d1ccd80 --- /dev/null +++ b/docs/api/bruno/fleet/create-vehicle.bru @@ -0,0 +1,41 @@ +meta { + name: Register Fleet Transport Vehicle + type: http + seq: 1 +} + +post { + url: {{baseUrl}}/api/v1/logistics/fleet + body: json + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Content-Type: application/json + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +body:json { + { + "vehicle_reg_no": "RJ-09-GA-5678", + "make_model": "Tata Signa 2823.K", + "payload_capacity_mt": 28.000, + "ownership_type": "OWN", + "transporter_name": "ATB Logistics Fleet", + "fitness_expiry_date": "2027-08-31", + "insurance_expiry_date": "2027-08-15", + "status": "AVAILABLE" + } +} + +docs { + # Register Fleet Transport Vehicle (FR-FLEETREGISTRY-001) + + Registers transport trucks (owned and contract carriers) and sets initial operational status. +} + diff --git a/docs/api/bruno/fleet/list-fleet.bru b/docs/api/bruno/fleet/list-fleet.bru new file mode 100644 index 0000000..6099cde --- /dev/null +++ b/docs/api/bruno/fleet/list-fleet.bru @@ -0,0 +1,27 @@ +meta { + name: List Transport Fleet + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/api/v1/logistics/fleet?status=AVAILABLE + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +docs { + # List Transport Fleet (FR-FLEETREGISTRY-001) + + Returns registered transport vehicles filtered by operational status. +} + diff --git a/docs/api/bruno/inventory/create-stock-transfer.bru b/docs/api/bruno/inventory/create-stock-transfer.bru new file mode 100644 index 0000000..9b676e1 --- /dev/null +++ b/docs/api/bruno/inventory/create-stock-transfer.bru @@ -0,0 +1,41 @@ +meta { + name: Initiate Inter-Godown Stock Transfer + type: http + seq: 4 +} + +post { + url: {{baseUrl}}/api/v1/inventory/transfers + body: json + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Content-Type: application/json + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +body:json { + { + "origin_wh_id": "WH-03", + "dest_wh_id": "WH-01", + "commodity_id": "c0a80123-0000-0000-0000-000000000001", + "variety": "Desi", + "grade": "FAQ", + "dispatched_mt": 20.000, + "dispatched_bags": 400, + "vehicle_reg_no": "MP-14-GA-8921" + } +} + +docs { + # Initiate Inter-Godown Stock Transfer (FR-WAREHOUSEINVENTORY-003) + + Deducts origin stock and transitions transfer to IN_TRANSIT. +} + diff --git a/docs/api/bruno/inventory/get-stock-ledger.bru b/docs/api/bruno/inventory/get-stock-ledger.bru new file mode 100644 index 0000000..274d969 --- /dev/null +++ b/docs/api/bruno/inventory/get-stock-ledger.bru @@ -0,0 +1,27 @@ +meta { + name: Query Multi-Godown Stock Ledger + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/v1/inventory/ledger?warehouse_id=WH-01&commodity_id=chana + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +docs { + # Query Stock Ledger (FR-WAREHOUSEINVENTORY-001) + + Returns dual-unit double-entry inventory positions (MT and Bags) per warehouse and commodity. +} + diff --git a/docs/api/bruno/inventory/get-warehouse-capacity.bru b/docs/api/bruno/inventory/get-warehouse-capacity.bru new file mode 100644 index 0000000..700e2c5 --- /dev/null +++ b/docs/api/bruno/inventory/get-warehouse-capacity.bru @@ -0,0 +1,27 @@ +meta { + name: Get Warehouse Capacity Utilization + type: http + seq: 3 +} + +get { + url: {{baseUrl}}/api/v1/inventory/capacity + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +docs { + # Get Warehouse Capacity Utilization (FR-WAREHOUSEINVENTORY-002) + + Returns physical capacity in MT and utilization percentages with 85% warning triggers. +} + diff --git a/docs/api/bruno/inventory/post-stock-adjustment.bru b/docs/api/bruno/inventory/post-stock-adjustment.bru new file mode 100644 index 0000000..8c1403d --- /dev/null +++ b/docs/api/bruno/inventory/post-stock-adjustment.bru @@ -0,0 +1,43 @@ +meta { + name: Record Stock Audit Adjustment + type: http + seq: 2 +} + +post { + url: {{baseUrl}}/api/v1/inventory/adjustments + body: json + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Content-Type: application/json + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +body:json { + { + "warehouse_id": "WH-01", + "commodity_id": "c0a80123-0000-0000-0000-000000000001", + "variety": "Desi", + "grade": "FAQ", + "physical_mt": 49.800, + "physical_bags": 996, + "reason_code": "GHAT", + "remarks": "Moisture evaporation after summer storage", + "partner_sign_off": false + } +} + +docs { + # Record Stock Audit Adjustment (FR-WAREHOUSEINVENTORY-001) + + Records physical count tally against book balance. + Enforces +/- 1.0% tolerance limit for supervisor sign-off; larger variances require Partner sign-off. +} + diff --git a/docs/api/bruno/sales/allocate-order-lot.bru b/docs/api/bruno/sales/allocate-order-lot.bru new file mode 100644 index 0000000..5ab4846 --- /dev/null +++ b/docs/api/bruno/sales/allocate-order-lot.bru @@ -0,0 +1,38 @@ +meta { + name: Allocate Released Lot to Sales Order + type: http + seq: 2 +} + +post { + url: {{baseUrl}}/api/v1/sales/orders/{{orderId}}/allocations + body: json + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Content-Type: application/json + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +body:json { + { + "lot_id": "LOT-UNJ-SOY-20261012-001", + "allocated_qty_mt": 50.000, + "allocated_bags": 1000, + "warehouse_id": "WH-01" + } +} + +docs { + # Allocate Released Lot to Sales Order (FR-SALESCONTRACTS-003) + + Allocates available unreserved inventory lots to confirmed sales orders. + Enforces invariant: Only lots in RELEASED status can be allocated (blocks QC_HOLD and UNDER_QC). +} + diff --git a/docs/api/bruno/sales/create-sales-order.bru b/docs/api/bruno/sales/create-sales-order.bru new file mode 100644 index 0000000..c665b0c --- /dev/null +++ b/docs/api/bruno/sales/create-sales-order.bru @@ -0,0 +1,46 @@ +meta { + name: Book Customer Sales Contract + type: http + seq: 1 +} + +post { + url: {{baseUrl}}/api/v1/sales/orders + body: json + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Content-Type: application/json + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +body:json { + { + "order_date": "2026-10-12", + "customer_id": "b0000000-0000-0000-0000-000000000001", + "customer_segment": "PROCESSOR", + "destination_city": "Indore", + "commodity_id": "c0a80123-0000-0000-0000-000000000001", + "variety": "Yellow Desi", + "grade": "FAQ", + "contract_qty_mt": 50.000, + "contract_rate_qtl": 4800.00, + "payment_terms": "15_DAYS", + "total_value_inr": 2400000.00, + "credit_override": false + } +} + +docs { + # Book Customer Sales Contract (FR-SALESCONTRACTS-001, FR-SALESCONTRACTS-002) + + Books customer order and performs credit limit & projected exposure check. + Enforces inline warning if ratio > 80% and blocks confirmation if ratio > 100% without Partner override. +} + diff --git a/prompts/20261012T041907Z-session-process-status.md b/prompts/20261012T041907Z-session-process-status.md index 50ae4ad..6c81e9c 100644 --- a/prompts/20261012T041907Z-session-process-status.md +++ b/prompts/20261012T041907Z-session-process-status.md @@ -207,3 +207,31 @@ Executed Stage 10 Iteration Planning (`/up-iteration-plan`) for Iteration 04 (Wa - Verified Quality Gates 5.1 and 9.1 with zero blocking issues; Gate 14.1 verified for iterations 01, 02, and 03. - Authored Checkpoint `CKPT-023` (`checkpoint-023-iteration-04-planning.md`), updated `checkpoint_index.md` and `master_context.md`. +## 2026-10-12T08:32:00Z — User + +proceed + +## 2026-10-12T08:41:00Z — Assistant — Action summary + +Executed Stage 11 (Wireframe Specifications) and Stage 12 (Test Model Generation) in parallel for Iteration 04: +1. Stage 11 Wireframes & Screen Specifications: + - Authored 7 detailed screen specifications under `04_generated_documentation/06_wireframes/screen_specs/`: + - `SCREEN-WH-001_stock_ledger.md`: Stock ledger & variance audit adjustments (`FR-WAREHOUSEINVENTORY-001`). + - `SCREEN-WH-002_capacity_transfers.md`: Capacity 85% warning & internal transfers (`FR-WAREHOUSEINVENTORY-002`, `003`). + - `SCREEN-SALES-001_sales_order_booking.md`: Customer sales order booking & credit limit guard (`FR-SALESCONTRACTS-001`, `002`). + - `SCREEN-SALES-002_lot_allocation.md`: Released-lot allocation console (`FR-SALESCONTRACTS-003`). + - `SCREEN-DISP-001_dispatch_board_weighbridge.md`: Outbound dispatch board & outward weighbridge (`FR-DISPATCHDELIVERY-001`, `002`). + - `SCREEN-DISP-002_pod_shortage_settlement.md`: In-transit delivery, POD & shortage credit note (`FR-DISPATCHDELIVERY-003`). + - `SCREEN-FLEET-001_fleet_registry.md`: Transport fleet & carrier registry (`FR-FLEETREGISTRY-001`). + - Updated `04_generated_documentation/06_wireframes/wireframe_index.md`. +2. Stage 12 Multi-Path Test Models & QA Deliverables: + - Authored 4 multi-path functional test models covering all 4 dimensions (Happy Path, Boundary/Edge, Negative/Security, FSM Invariant & Concurrency): `TC-007_warehouse_stock_ledger.md`, `TC-008_sales_contracts_credit_allocation.md`, `TC-009_outbound_dispatch_delivery.md`, and `TC-010_transport_fleet_registry.md`. + - Created git-versioned Bruno collections under `docs/api/bruno/inventory/`, `docs/api/bruno/sales/`, `docs/api/bruno/dispatch/`, and `docs/api/bruno/fleet/`. + - Authored `04_generated_documentation/07_test_design/manual_qa/iteration-04/MANUAL_TESTING_GUIDE.md`. + - Compiled 21-sheet, 30-column Excel Manual QA Workbook: `Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx` densely populated with 32 test cases (threshold >= 20). + - Updated `test_traceability_matrix.md` and `regression_test_cases.md`. +3. Quality Gates & Checkpoints: + - Executed `scripts/verify_traceability_gates.py --iteration iteration-04`: Gate 5.1 (PASS), Gate 9.1 (PASS), Gate 14.1 (PASS with 0 Critical, 0 Major, 0 Minor). + - Authored Checkpoint `CKPT-024` (`checkpoint-024-iteration-04-wireframes-test-models.md`), updated `checkpoint_index.md` and `master_context.md`. + +