pub struct InventoryPosition {Show 23 fields
pub material_id: String,
pub description: String,
pub plant: String,
pub storage_location: String,
pub company_code: String,
pub quantity_on_hand: Decimal,
pub unit: String,
pub quantity_reserved: Decimal,
pub quantity_available: Decimal,
pub quantity_in_inspection: Decimal,
pub quantity_blocked: Decimal,
pub quantity_in_transit: Decimal,
pub valuation: PositionValuation,
pub last_movement_date: Option<NaiveDate>,
pub last_count_date: Option<NaiveDate>,
pub min_stock: Option<Decimal>,
pub max_stock: Option<Decimal>,
pub reorder_point: Option<Decimal>,
pub safety_stock: Option<Decimal>,
pub status: StockStatus,
pub batches: Vec<BatchStock>,
pub serial_numbers: Vec<SerialNumber>,
pub updated_at: DateTime<Utc>,
}Expand description
Inventory position (stock on hand).
Fields§
§material_id: StringMaterial ID.
description: StringMaterial description.
plant: StringPlant/warehouse.
storage_location: StringStorage location.
company_code: StringCompany code.
quantity_on_hand: DecimalQuantity on hand.
unit: StringUnit of measure.
quantity_reserved: DecimalReserved quantity.
quantity_available: DecimalAvailable quantity (on hand - reserved).
quantity_in_inspection: DecimalQuality inspection quantity.
quantity_blocked: DecimalBlocked quantity.
quantity_in_transit: DecimalIn-transit quantity.
valuation: PositionValuationValuation data.
last_movement_date: Option<NaiveDate>Last movement date.
last_count_date: Option<NaiveDate>Last count date.
min_stock: Option<Decimal>Minimum stock level.
max_stock: Option<Decimal>Maximum stock level.
reorder_point: Option<Decimal>Reorder point.
safety_stock: Option<Decimal>Safety stock.
status: StockStatusStock status.
batches: Vec<BatchStock>Batch/lot tracking.
serial_numbers: Vec<SerialNumber>Serial numbers (if serialized).
updated_at: DateTime<Utc>Last updated.
Implementations§
Source§impl InventoryPosition
impl InventoryPosition
Sourcepub fn new(
material_id: String,
description: String,
plant: String,
storage_location: String,
company_code: String,
unit: String,
) -> Self
pub fn new( material_id: String, description: String, plant: String, storage_location: String, company_code: String, unit: String, ) -> Self
Creates a new inventory position.
Sourcepub fn calculate_available(&mut self)
pub fn calculate_available(&mut self)
Calculates available quantity.
Sourcepub fn add_quantity(
&mut self,
quantity: Decimal,
cost: Decimal,
date: NaiveDate,
)
pub fn add_quantity( &mut self, quantity: Decimal, cost: Decimal, date: NaiveDate, )
Adds quantity to position.
Sourcepub fn remove_quantity(
&mut self,
quantity: Decimal,
date: NaiveDate,
) -> Option<Decimal>
pub fn remove_quantity( &mut self, quantity: Decimal, date: NaiveDate, ) -> Option<Decimal>
Removes quantity from position.
Sourcepub fn release_reservation(&mut self, quantity: Decimal)
pub fn release_reservation(&mut self, quantity: Decimal)
Releases reservation.
Sourcepub fn with_stock_levels(
self,
min: Decimal,
max: Decimal,
reorder: Decimal,
safety: Decimal,
) -> Self
pub fn with_stock_levels( self, min: Decimal, max: Decimal, reorder: Decimal, safety: Decimal, ) -> Self
Sets stock level parameters.
Sourcepub fn total_value(&self) -> Decimal
pub fn total_value(&self) -> Decimal
Gets total inventory value.
Sourcepub fn needs_reorder(&self) -> bool
pub fn needs_reorder(&self) -> bool
Checks if reorder is needed.
Sourcepub fn days_of_supply(&self, average_daily_usage: Decimal) -> Option<Decimal>
pub fn days_of_supply(&self, average_daily_usage: Decimal) -> Option<Decimal>
Gets days of supply based on average usage.
Trait Implementations§
Source§impl Clone for InventoryPosition
impl Clone for InventoryPosition
Source§fn clone(&self) -> InventoryPosition
fn clone(&self) -> InventoryPosition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InventoryPosition
impl Debug for InventoryPosition
Source§impl<'de> Deserialize<'de> for InventoryPosition
impl<'de> Deserialize<'de> for InventoryPosition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for InventoryPosition
impl RefUnwindSafe for InventoryPosition
impl Send for InventoryPosition
impl Sync for InventoryPosition
impl Unpin for InventoryPosition
impl UnwindSafe for InventoryPosition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more