Skip to content

Multiplication: Harvest UI

This ticket adds a new custom UI for handling the harvested material coming back from the field/screenhouse. For each of the planted inventories:

  1. Set quantity of the planted inventory to 0. Fail if quantity is already 0.
  2. Register a new inventory to represent the harvested inventory. Link it with the planted inventory (parentInventory), increment generation by 1, set quantity to null (or a value if provided)

The harvest system is based on inventory action HARVEST where done = true means successfully completed, done = false means that no material came back from the field (lost, did not germinate, etc.)

Genebanks can schedule this action automatically through workflows, or manually in the Inventory module by filtering for material planted in the field.

UI

The UI fetches from the server the list of inventories that the criteria for harvest (i.e. have a pending or completed HARVEST action and the provided inventory filters). The API responds with FilteredPage<InventoryHarvest, InventoryActionFilter> where type InventoryHarvest = InventoryDTO & { harvestedInventory: InventoryDTO, harvestAction: InventoryActionDTO }.

A <Table shows columns: Harvested inventory (link), Harvest action (state only: pending, canceled, completed), Planted inventory (link), Planted inventory fields (common inventory fields). This allows the user to browse past and currently harvested material, and register the harvested material as new inventories in the system as described above.

Actions

The default FAB offers one option: Register harvested material. This opens a dialog with the same title:

  1. A field to scan inventory barcode of the planted material. The same API endpoint is used with filters adjusted for scanned inventory barcode to load data, as it may be on a different Page<>.
  2. Check that scanned planted inventory has quantity, no harvestedInventory, and a pending harvestAction. Beep accordingly.
  3. If it's possible to create the harvestedInventory, enable fields for Label template, Number of labels, inventoryMaintenancePolicy, quantityOnHand, quantityOnHandUnitCode to allow the user to make changes. When a harvestedInventory exists, show error.
  4. On Save, create the harvestedInventory by calling an API endpoint that does the business logic as described above, print new labels for the returned harvestedInventory, then reset the form.
  5. On Reset, the form is reset: quantityOnHand = null, other fields kept as set by the user.
  6. On Cancel, the form is closed

It is possible that after all harvested material is processed, some of the planted inventories with open HARVEST action are still unresolved. That is usually an indication that they did not germinate and there was no material to harvest. Those need to be closed: set quantity of the planted inventory to 0, and close the HARVEST action as done = false, and note = "No material harvested".

By selecting the rows in the table where all selected rows have harvestedInventory === null, the FAB offers No material harvested option. This opens a dialog for the user to specify the note of the failed HARVEST action. By hitting Confirm, those actions are closed.