updateHarvest
@svenvw/fdm-source / fdm-core/src / updateHarvest
Function: updateHarvest()
updateHarvest(
fdm,principal_id,b_id_harvesting,b_lu_harvest_date,properties?):Promise<void>
Defined in: fdm-core/src/harvest.ts:604
Updates an existing harvest record.
This function allows for the modification of harvest details. It first verifies that the principal has the necessary permissions to update the harvest. Within a database transaction, it updates the harvest date and the associated analysis data, such as yield and nutrient content. If the cultivation is designated as a single-harvest type, the function also adjusts the cultivation's termination date to match the new harvest date.
Parameters
fdm
any
The FDM instance providing the connection to the database.
principal_id
any
The ID of the principal performing the update, for permission checking.
b_id_harvesting
any
The unique identifier of the harvest to be updated.
b_lu_harvest_date
any
The new date of the harvest.
properties?
An object containing the harvest properties.
b_lu_cp?
any
The crude protein content of the harvest, in g/kg.
b_lu_dm?
any
The dry matter content of the harvest, in g/kg.
b_lu_k_harvestable?
any
The new total potassium content in the harvestable yield (g K2O/kg).
b_lu_k_residue?
any
The new total potassium content in the crop residue (g K2O/kg).
b_lu_moist?
any
The moisture content of the harvest, in g/kg.
b_lu_n_harvestable?
any
The new total nitrogen content in the harvestable yield (g N/kg).
b_lu_n_residue?
any
The new total nitrogen content in the crop residue (g N/kg).
b_lu_p_harvestable?
any
The new total phosphorus content in the harvestable yield (g P2O5/kg).
b_lu_p_residue?
any
The new total phosphorus content in the crop residue (g P2O5/kg).
b_lu_tarra?
any
The tarra percentage of the harvest (e.g., soil).
b_lu_uww?
any
The underwater weight of the harvest, in g/5kg.
b_lu_yield?
any
The new dry-matter yield for the harvest, in kg/ha.
b_lu_yield_bruto?
any
The gross yield of the harvest, in kg/ha.
b_lu_yield_fresh?
any
The fresh-matter yield of the harvest, in kg/ha.
Returns
Promise<void>
A Promise that resolves when the update is complete.
Throws
Error if the harvest does not exist, permission checks fail, or any database update fails.