Skip to main content

InventoryPosition

Struct InventoryPosition 

Source
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: String

Material ID.

§description: String

Material description.

§plant: String

Plant/warehouse.

§storage_location: String

Storage location.

§company_code: String

Company code.

§quantity_on_hand: Decimal

Quantity on hand.

§unit: String

Unit of measure.

§quantity_reserved: Decimal

Reserved quantity.

§quantity_available: Decimal

Available quantity (on hand - reserved).

§quantity_in_inspection: Decimal

Quality inspection quantity.

§quantity_blocked: Decimal

Blocked quantity.

§quantity_in_transit: Decimal

In-transit quantity.

§valuation: PositionValuation

Valuation 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: StockStatus

Stock 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

Source

pub fn new( material_id: String, description: String, plant: String, storage_location: String, company_code: String, unit: String, ) -> Self

Creates a new inventory position.

Source

pub fn calculate_available(&mut self)

Calculates available quantity.

Source

pub fn add_quantity( &mut self, quantity: Decimal, cost: Decimal, date: NaiveDate, )

Adds quantity to position.

Source

pub fn remove_quantity( &mut self, quantity: Decimal, date: NaiveDate, ) -> Option<Decimal>

Removes quantity from position.

Source

pub fn reserve(&mut self, quantity: Decimal) -> bool

Reserves quantity.

Source

pub fn release_reservation(&mut self, quantity: Decimal)

Releases reservation.

Source

pub fn block(&mut self, quantity: Decimal)

Blocks quantity.

Source

pub fn unblock(&mut self, quantity: Decimal)

Unblocks quantity.

Source

pub fn with_stock_levels( self, min: Decimal, max: Decimal, reorder: Decimal, safety: Decimal, ) -> Self

Sets stock level parameters.

Source

pub fn total_value(&self) -> Decimal

Gets total inventory value.

Source

pub fn needs_reorder(&self) -> bool

Checks if reorder is needed.

Source

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

Source§

fn clone(&self) -> InventoryPosition

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InventoryPosition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for InventoryPosition

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for InventoryPosition

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,