Skip to content

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

  1. User provides the OrderHeader information and a list of OrderLines.
  2. System:
    1. Validates the information provided by the user. If not valid, errors are reported.
    2. Retrieves reference information (e.g. Items) from other services as needed.
    3. Adds default values to the OrderHeader and OrderLines from system settings and Item information where not provided by the user (i.e., null values).
    4. Persists the OrderHeader and associated OrderLines and 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

  1. 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 $input as the OrderLineInput object being processed and $ as the OrderLine being created.
  • Define $effectiveSupply for an order line to take the value of $input.item.effectiveSupply(header.supplierName) (see Item Enhancements)

OrderLine fields

  1. eId: Generated by the system using UUID.randomUUID().
  2. title: Set to first non-null value of: $input.effectiveSupply.sku, $.item.name, `OrderLineIn
  3. description: Set to OrderLineInput.item..
  4. status: OrderLineStatus.BLANK
  5. item: $input.item
  6. supplierSku: $input.effectiveSupply.sku
  7. quantity: $input.quantity if not null, otherwise $effectiveSupply.orderQuantity
  8. unitCost: $input.unitCost if not null, otherwise $effectiveSupply.unitCost
  9. cost: $input.quantity * $input.unitCost.
  10. received: 0.0 with the same unit as the quantity field. null if the quantity field is null.
  11. notes: null
  12. privateNotes: null### OrderLineMetadata fields
  • parentEid the eId of the created OrderHeader.
  • rank computed by the OrderService based on the ordinal value of the line in the provided list (starting at 0 for the first line).

Creation of Order Header

OrderHeader fields

  1. eId: Generated by the system using UUID.randomUUID().
  2. status: OrderStatus.NEW
  3. orderNumber: Generated by the OrderService.
  4. orderDate: The current datetime in the timezone obtained from the User Preferences Service, or System timezone if not available.
  5. allowPartial: true.
  6. deliverBy: The current datetime plus 7 days in the timezone obtained from the User Preferences Service, or System timezone if not available.
  7. deliveryAddress: null
  8. procurement: null
  9. supplierName: null
  10. supplierAddress: null
  11. orderMethod: OrderMethod.UNKNOWN
  12. sales: null
  13. goodsValue: Computed as the sum of the cost field fo all associated OrderLines, with null values counted as 0.0. If the cost fields of the lines are expressed in different currencies, the system will set this field to null.
  14. taxesAndFees: An empty map.
  15. totalCost: Sum of goodsValue plus the sum of all values in the taxesAndFees map. If there are multiple currencies involved, this field is set to null.
  16. termsAndConditions: null
  17. notes: null
  18. privateNotes: null

Other Implementation Guidelines

✅ Tasks

Comments