inventoryproduct
One product (seed, input) held in a farmer's inventory with quantity and unit.
Table factsheetagri_db
- Written by
- Legacy setup (
InventoryProductDTO) - Data setup (
Setup.kt,SetupForUserviaSetupService.getInventoryProduct) - Inventory screen via
BridgeSyncHelper(createInventoryProduct,updateInventoryProduct)
- Legacy setup (
- Read by
InventoryProductWorker(sync)BridgeSyncHelper
- Filled from
POST api/setupdata/v2 (InventoryProductDTO)GET /ctld/api/inventory/inventoryproduct/v1- Sync
- appId is a client UUID primary key. syncStatus starts at SYNC_DONE for downloaded rows, becomes SYNC_NOT_INITIALIZED when the row is created or edited on the device, and goes back to SYNC_DONE when the response handler writes the server id. opId holds the id of the last queued library operation. Sync entity INVENTORY_PRODUCT (POST, PATCH). Depends on the parent INVENTORY operation.
- Source
- data/src/main/java/org/mindtree/app/agricultor/data/entity/InventoryProduct.kt
Columns
| Column | Type | Null | Key | Meaning |
|---|---|---|---|---|
usableQuantity | INTEGER | Yes | Integer part of the entered quantity (the app sends the same value as quantity). | |
notes | TEXT | Yes | Fractional part of the entered quantity as text (e.g. "0.5"), because quantity is an integer. Added back when read. | |
aliasId | TEXT | Yes | Business alias (stable cross-system id). | |
quantity | INTEGER | Yes | Total quantity. | |
id | INTEGER | Yes | Server id. Null or 0 until the row is synced. | |
isActive | INTEGER | Yes | Soft-delete flag (1 = active). | |
appId | TEXT | No | PK | Client-side UUID. Defaults to a random UUID when the object is built, including when server JSON is parsed. |
opId | TEXT | Yes | Id of the last queued operation in the library queue (SYNC_QUEUE_DB). | |
syncStatus | TEXT | No | SYNC_NOT_INITIALIZED | IN_SYNC_QUEUE | SYNC_DONE (default). | |
quantityInUOM_id | INTEGER | Yes | Unit of measure detail (flattened embedded DTO). | |
quantityInUOM_value | REAL | Yes | Numeric quantity value (flattened embedded quantity). | |
quantityInUOM_uom_symbol | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
quantityInUOM_uom_code | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
quantityInUOM_uom_unitName | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
quantityInUOM_uom_measurementtype_label | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
quantityInUOM_uom_measurementtype_dataCode | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
quantityInUOM_uom_measurementtype_globalrefclass_classCode | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
quantityInUOM_uom_measurementtype_globalrefclass_name | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
quantityInUOM_uom_measurementtype_language_language | TEXT | Yes | Language name. | |
quantityInUOM_uom_measurementtype_language_languageCode | TEXT | Yes | Language code (ENG, TEL, ...). | |
productsku_id | INTEGER | Yes | FK → product_productsku.id | Server id of the embedded object. Link by convention only, no FK constraint. |
uom_symbol | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
uom_code | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
uom_unitName | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
uom_measurementtype_label | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
uom_measurementtype_dataCode | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
uom_measurementtype_globalrefclass_classCode | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
uom_measurementtype_globalrefclass_name | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
uom_measurementtype_language_language | TEXT | Yes | Language name. | |
uom_measurementtype_language_languageCode | TEXT | Yes | Language code (ENG, TEL, ...). | |
inventory_owningEnitityId | INTEGER | Yes | Owner farmer id (column name typo "Enitity"). | |
inventory_notes | TEXT | Yes | No description in code. | |
inventory_owningEntityType | TEXT | Yes | No description in code. | |
inventory_name | TEXT | Yes | Owner name sent with the product: farmer's full name, or the logged-in user's first name for a user-owned inventory. | |
inventory_id | INTEGER | Yes | FK → inventory.id | Server id of the embedded object. Link by convention only, no FK constraint. |
inventory_isActive | INTEGER | Yes | Active flag of the embedded object. | |
inventory_supervisor_isActive | INTEGER | Yes | Active flag of the embedded object. | |
inventory_supervisor_id | INTEGER | Yes | Server id of the embedded object. | |
inventory_supervisor_aliasId | TEXT | Yes | Farmer alias (ie.aliasId) of the owner, or the user id for a user-owned inventory. | |
inventory_supervisor_actorId | TEXT | Yes | Farmer server id of the owner (ACTOR_TYPE.IE), or the user id for a user-owned inventory (ACTOR_TYPE.USER). | |
inventory_supervisor_actortype_dataCode | TEXT | Yes | Reference data code. | |
inventory_supervisor_actortype_globalrefclass_classCode | TEXT | Yes | Reference class of the code (flattened embedded DTO). | |
inventory_supervisor_actortype_language_languageCode | TEXT | Yes | Language code (ENG, TEL, ...). | |
appmill_metadata_ie_appId | TEXT | Yes | FK → ie.appId | Local appId of the owning farmer (ie.appId). Used to link rows before the farmer has a server id. Link by convention only, no FK constraint. |
Notes
- Around 44 columns because the parent inventory, its supervisor and two units of measure are flattened into each row.
- The inventory screen itself reads the legacy ie_inventory table.