Skip to main content

Material

Struct Material 

Source
pub struct Material {
Show 23 fields pub material_id: String, pub description: String, pub material_type: MaterialType, pub material_group: MaterialGroup, pub base_uom: UnitOfMeasure, pub valuation_method: ValuationMethod, pub standard_cost: Decimal, pub list_price: Decimal, pub purchase_price: Decimal, pub bom_components: Option<Vec<BomComponent>>, pub account_determination: MaterialAccountDetermination, pub weight_kg: Option<Decimal>, pub volume_m3: Option<Decimal>, pub shelf_life_days: Option<u32>, pub is_active: bool, pub company_code: Option<String>, pub plants: Vec<String>, pub min_order_quantity: Decimal, pub lead_time_days: u16, pub safety_stock: Decimal, pub reorder_point: Decimal, pub preferred_vendor_id: Option<String>, pub abc_classification: char,
}
Expand description

Material master data.

Fields§

§material_id: String

Material ID (e.g., “MAT-001234”)

§description: String

Material description

§material_type: MaterialType

Type of material

§material_group: MaterialGroup

Material group

§base_uom: UnitOfMeasure

Base unit of measure

§valuation_method: ValuationMethod

Valuation method

§standard_cost: Decimal

Standard cost per base unit

§list_price: Decimal

List price (selling price) per base unit

§purchase_price: Decimal

Purchase price per base unit

§bom_components: Option<Vec<BomComponent>>

Bill of materials components (if this is a produced item)

§account_determination: MaterialAccountDetermination

Account determination rules

§weight_kg: Option<Decimal>

Weight per base unit (kg)

§volume_m3: Option<Decimal>

Volume per base unit (m3)

§shelf_life_days: Option<u32>

Shelf life in days (for perishables)

§is_active: bool

Is this material active?

§company_code: Option<String>

Company code (if material is company-specific)

§plants: Vec<String>

Plant/location codes where material is available

§min_order_quantity: Decimal

Minimum order quantity

§lead_time_days: u16

Lead time in days for procurement

§safety_stock: Decimal

Safety stock quantity

§reorder_point: Decimal

Reorder point

§preferred_vendor_id: Option<String>

Preferred vendor ID

§abc_classification: char

ABC classification (A=high value, C=low value)

Implementations§

Source§

impl Material

Source

pub fn new( material_id: impl Into<String>, description: impl Into<String>, material_type: MaterialType, ) -> Self

Create a new material with minimal required fields.

Source

pub fn with_group(self, group: MaterialGroup) -> Self

Set material group.

Source

pub fn with_standard_cost(self, cost: Decimal) -> Self

Set standard cost.

Source

pub fn with_list_price(self, price: Decimal) -> Self

Set list price.

Source

pub fn with_purchase_price(self, price: Decimal) -> Self

Set purchase price.

Source

pub fn with_bom(self, components: Vec<BomComponent>) -> Self

Set BOM components.

Source

pub fn with_company_code(self, code: impl Into<String>) -> Self

Set company code.

Source

pub fn with_preferred_vendor(self, vendor_id: impl Into<String>) -> Self

Set preferred vendor.

Source

pub fn with_abc_classification(self, classification: char) -> Self

Set ABC classification.

Source

pub fn calculate_bom_cost( &self, component_costs: &HashMap<String, Decimal>, ) -> Option<Decimal>

Calculate the theoretical cost from BOM.

Source

pub fn gross_margin_percent(&self) -> Decimal

Calculate gross margin percentage.

Source

pub fn needs_reorder(&self, current_stock: Decimal) -> bool

Check if reorder is needed based on current stock.

Source

pub fn suggested_reorder_quantity(&self) -> Decimal

Calculate reorder quantity based on EOQ principles.

Trait Implementations§

Source§

impl Clone for Material

Source§

fn clone(&self) -> Material

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 Material

Source§

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

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

impl<'de> Deserialize<'de> for Material

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 Material

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>,