Skip to content

Make lead times specific to raw material and upstream node, not finished product and downstream node #149

@LarrySnyder

Description

@LarrySnyder

See implications, e.g., at

for prod_index in self.node.product_indices:
if rm_index in self.node.raw_materials_by_product(product=prod_index, return_indices=True, network_BOM=True) and \
p_index in self.node.raw_material_suppliers_by_raw_material(raw_material=rm_index, return_indices=True, network_BOM=True):
# Get lead times for this product. # TODO: shouldn't inbound shipment pipeline only use shipment LT, not order LT?
order_lead_time = (self.node.get_attribute('order_lead_time', product=prod_index) or 0)
shipment_lead_time = (self.node.get_attribute('shipment_lead_time', product=prod_index) or 0)
self.inbound_shipment_pipeline[p_index][rm_index] = [0] * (order_lead_time + shipment_lead_time + 1)

# Get lead times and product index (for convenience).
# TODO: LTs should live with the RM, not the FG. Otherwise, different RMs can't have different LTs. (But this doesn't mean interpret LT as applying to the outbound link instead of the inbound.)
order_lead_time = node.get_attribute('order_lead_time', prod) or 0
shipment_lead_time = node.get_attribute('shipment_lead_time', prod) or 0

# TODO: fix this
prod = node.products_by_raw_material(rm_index)[0]
OLT = node.get_attribute('order_lead_time', prod) or 0
SLT = node.get_attribute('shipment_lead_time', prod) or 0

stockpyl/src/stockpyl/sim.py

Lines 1079 to 1086 in 26792d6

# Find a product at successor node that uses prod_index from node as a raw material,
# and use its lead time. If there is more than one such product, use the last one found.
# This is a little klugey. # TODO: improve? should LTs be an attribute of the RM, not the product?
for FG_index in s.product_indices:
if prod_index in s.raw_materials_by_product(product=FG_index, return_indices=True, network_BOM=True) and \
node.index in s.raw_material_suppliers_by_raw_material(raw_material=prod_index, return_indices=True, network_BOM=True):
# Get lead time for this product.
shipment_lead_time = (s.get_attribute('shipment_lead_time', product=FG_index) or 0)

Note: This doesn't mean we should interpret the LT as applying to the outbound link instead of the inbound link.

Metadata

Metadata

Assignees

Labels

coming soonPlan to do this in a not-too-distant releaseenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions