V3_Consumption_AddConsPostExecByName (Post)
- Last UpdatedNov 06, 2025
- 3 minute read
| Post | V3_Consumption_AddConsPostExecByName |
Resource Path:/api/v3/Consumption/PostExec
| Name | Description |
|---|---|
| trans_id | Used to supply the ID of the transaction if the call is taking part in a transaction. |
The request body is of type Mes.WebApi.Models.V3.EnProd.Consumption.
Required. The property information for the item consumption being added.
The response body is of type Mes.WebApi.Models.V3.EnProd.Consumption.
OKThe following Consumption model properties are required:
- To identify the record if doing an update, see "Determining Whether an Item_Cons Record Is Updated or Added" below.
- To identify the user who is adding the consumption: user_id.
- To specify the quantity: qty_cons.
- To specify the BOM position: bom_pos.
The job_pos and apply_scaling_factor property values are ignored.
Determining the Shift Start Time
To determine the shift start time for the new or updated record, the system first uses the supplied created_at_utc property value in the Consumption model. If a created_at_utc property value is not supplied, then it uses the current shift's start time.
Determining Whether an Item_Cons Record Is Updated or Added
- If a matching Item_Cons record is found, that record is updated with the values supplied in the Consumption model.
- If a matching Item_Cons record is not found or the Maintain distinct consumption records system attribute is True, then a new record is created with the values supplied in the Consumption model.
A matching record is found based on either of the following conditions:
- The row_id is the actual primary key for the Item_Cons table. If a value for it is supplied and a matching record is found, then that record is updated with the other property values supplied in the Consumption model.
- A row_id property value is not supplied or found but all of the supplied values for the following effective primary key fields match those of an existing Item_Cons record:
- The shift start time (determined as described above)
- wo_id (cannot be null)
- oper_id (cannot be null)
- seq_no (cannot be null)
- item_id (cannot be null)
- lot_no (can be null, but the existing record’s value must also be null)
- fg_lot_no (can be null, but the existing record’s value must also be null)
- sublot_no (can be null, but the existing record’s value must also be null)
- reas_cd (cannot be null)
- user_id (cannot be null)
- genealogy_id (can be null, but the existing record’s value must also be null)
- upstream_event_id (can be null, but the existing record’s value must also be null)
- segment_requirement_id (can be null, but the existing record’s value must also be null)
- segment_response_id (can be null, but the existing record’s value must also be null)
Other Behaviors of This Endpoint
- If the job details are not provided, they default to the current job running on the entity.
- If any of the lot, container, reason code, or entity values change, then these changes are written to the Job_Bom table and used as the defaults for future transactions where the defaults are to be applied.
- If the fg_lot_no column changes, then this change is remembered for the item being produced. This is as if the lot number was changed using the AddConsByJob endpoint.
- If the update_inv flag is set for this BOM position, then the qty_left column in the Item_Inv record will be reduced by the consumed qty_cons.