Order From Prescribed Header and Lines
Description¶
The User directly provides the information for an OrderHeader and a list of OrderLines. The system will verify the information and
create the OrderHeader and associated OrderLines.
Requirement¶
Users want to create Orders by directly providing the necessary information for both the Order Header and its
Lines.
The system must validate the provided information and create the OrderHeader and OrderLines accordingly.
Preconditions¶
- The provided order lines do not reference Kanban Cards. Extension to support this scenario is a future enhancement. If [//]: # (
user wants to create order lines from Kanban Cards, they should use the Add Lines from Kanban Cards use case. - If the user provides item references in the order lines, the items must exist and be current in the system as of
TimeCoordinates.now()
Scenario Overview¶
- User provides the
OrderHeaderinformation and a list ofOrderLines. - System:
- Validates the information provided by the user. If not valid, errors are reported.
- Retrieves reference information (e.g. Items) from other services as needed.
- Adds default values to the
OrderHeaderandOrderLinesfrom system settings and Item information where not provided by the user (i.e.,nullvalues). - Persists the
OrderHeaderand associatedOrderLinesand returns them to the User.
Important
The behavior of all fields is to take the value provided by the User if it is not null unless explicitly stated.
Calculations described below are only performed when the user provided value is null.
PostConditions¶
- A new OrderHeader and associated OrderLines are available in the system for querying and other operations.
Creation of Order Lines¶
For each OrderLineInput provided by the User, an OrderLine entity and associated OrderLineMetadata entity will be created.
Intermediate Defintions¶
- Define
$inputas theOrderLineInputobject being processed and$as theOrderLinebeing created.
- Define
$effectiveSupplyfor an order line to take the value of$input.item.effectiveSupply(header.supplierName)(see Item Enhancements)
OrderLine fields¶
eId: Generated by the system usingUUID.randomUUID().title: Set to first non-null value of:$input.effectiveSupply.sku,$.item.name, `OrderLineIndescription: Set toOrderLineInput.item..status:OrderLineStatus.BLANKitem:$input.itemsupplierSku:$input.effectiveSupply.skuquantity:$input.quantityif not null, otherwise$effectiveSupply.orderQuantityunitCost:$input.unitCostif not null, otherwise$effectiveSupply.unitCostcost:$input.quantity * $input.unitCost.received:0.0with the same unit as thequantityfield. null if the quantity field is null.notes:nullprivateNotes:null###OrderLineMetadatafields
parentEidthe eId of the createdOrderHeader.rankcomputed by theOrderServicebased on the ordinal value of the line in the provided list (starting at 0 for the first line).
Creation of Order Header¶
OrderHeader fields¶
eId: Generated by the system usingUUID.randomUUID().status:OrderStatus.NEWorderNumber: Generated by the OrderService.orderDate: The current datetime in the timezone obtained from the User Preferences Service, or System timezone if not available.allowPartial:true.deliverBy: The current datetime plus 7 days in the timezone obtained from the User Preferences Service, or System timezone if not available.deliveryAddress:nullprocurement:nullsupplierName:nullsupplierAddress:nullorderMethod:OrderMethod.UNKNOWNsales:nullgoodsValue: Computed as the sum of thecostfield fo all associatedOrderLines, withnullvalues counted as0.0. If thecostfields of the lines are expressed in different currencies, the system will set this field tonull.taxesAndFees: An empty map.totalCost: Sum ofgoodsValueplus the sum of all values in thetaxesAndFeesmap. If there are multiple currencies involved, this field is set to null.termsAndConditions:nullnotes:nullprivateNotes:null
Other Implementation Guidelines¶
✅ Tasks¶
- Additions to Item & ItemSupply: https://github.com/Arda-cards/management/issues/406
- Additions to OrderService and associated persistence layer.