Skip to content

Business Affiliate References from Items

Context

The initial implementation of Items in the system treats supply sources as ad-hoc information specific to each item.

Starting from MVP2, the system introduces theBusiness Affiliate Module to support, among other things organizing items and supply sources by vendor.

Expected Capabilities

The requirement is to integrate the current Item and ItemSupply implementation with the Business Affiliate Module

The introduction of Business Affiliates as Vendors brings the following requirements:

  1. An Item may have multiple Supply Sources instead of only two.
  2. Items need to be able to be searched by Vendor.
  3. Support Adding and removing Supply Sources from an Item.

Pre-MVP2 Implementation

The Item Entity includes the properties:

  1. primarySupply
  2. secondarySupply
  3. defaultSupply

primarySupply and secondarySupply are object types with the following properties:

  • supplier
  • name
  • sku
  • orderMethod
  • url
  • orderQuantity
  • unitCost
  • averageLeadTime

defaultSupply is a string that references the name of either the primarySupply or secondarySupply

MVP2 Implementation

Multi-Supply Support

ItemSupply in the item module becomes an additional entity that is associated with an Item entity instance.

uml diagram

With the same information contents as the current value object in the Item entity with the replacement of the supplier property with a BusinessRoleReference value with:

  • supplierName
  • supplierEId

This will be a Floating reference to the BusinessRole entity to be interpreted in the context of the Bitemporal Coordinates of the ItemSupply version that is being used.

There is no constaint on the number of ItemSupply entities associated with a pair of Item and BusinessRole entities as a given BusinessAffiliate could have multiple ways to supply a given Item subject to different conditions or prices.

Primary and Secondary Supply

The actual primarySupply and secondarySupply properties of the Item will be preserved and, if they are not null, will be a copy of two selected ItemSupply entities with an additional Floating reference to the original ItemSupply entity. The value of the properties of the copy will be null for any item entity instance created after these changes are implemented. The values in the business and service layers will be recovered on-the-fly from the database from the ItemSupply entity Universe to support compatibility with the current Clients of the API.

Default Supply

The defaultSupply property of the Item will be handled in the same way (no updates, retrieval on-the-fly from the ItemSupply Universe). An additional Floating reference to the original ItemSupply entity will be added to the Item entity to support this functionality.

Querying By Vendor˝

The Query of Items by Vendor is not a straightforward operation as it requires a conceptual join between Item, ItemSupply, BusinessRole and BusinessAffiliate entities, plus the technical intersection entity between Item and ItemSupply as this is a many-to- many relationship.

The query capability will be implemented in the item module, incorporating, where possible, conditions on properties of the entities involved. Depending on the complexity and
performance of the query, Database views and specialized mappings from the Busines layer to the Data layer will be implemented.

Item Updates

Currently, Item Creations and Updates can freely specify the primarySupply and secondarySupply properties. The goal is to retain as much as possible of this capability while directing those updates to the appropriate ItemSupply entities. The design of this is still work in progress.

Data Migration

Pre-existing Items will be migrated to the new structure by:

  1. Extracting the primarySupply, secondarySupply and defaultSupply properties from the Item entity for all instances of each Tenant.
  2. Resolving Duplicates and assigning a unique ItemSupply entity to each Item entity instance.
  3. Populating all new ItemSupply entities with the resolved properties.
  4. Linking the existing Item entities to the new ItemSupply entities.

Comments