Sales and Inventory Jobs
Sales Data Sources
Section titled “Sales Data Sources”- Fishbowl
- Wholesale/Manual orders
- Marketplace orders (eBay, Amazon, etc.)
- Channel Advisor
- Mercado Libre
- Kentucky (out of scope for this)
Basic Data Flow
Section titled “Basic Data Flow”- Import Channel Advisor data file to temporary table in ShopFloor
- Import Fishbowl sales via direct database connection to new sales tables
- Import Mercado Libre sales via API to new sales tables
- Update sales channel for Fishbowl sales
- Update WorkTracking inventory and sales data for serialized items
Channel Advisor Data Flow
Section titled “Channel Advisor Data Flow”The only reason this exists is to determine which marketplace a sale came from. It does not change anything else for a sale. The temporary table SalesImport is used for nothing else.
- Data is pulled from Channel Advisor by Mohammad G and saved in a CSV file in the
salesbucket on Azure - An Azure function
ctldatafilesync-prodruns every 45 minutes to parse that file and import it to theSalesImporttable in the ShopFloor database. This might not be working 100% at the moment because the job takes too long to complete. GitHub
This can be expanded later to include sales from the Kentucky printer system. Adding a new mapping configuration for the data file is needed, and then a new job in ShopFloor to map these entries to the new sales data tables if required (for a more complete sales report).
Fishbowl Data Flow
Section titled “Fishbowl Data Flow”This is the primary source of sales data. Most everything comes from Fishbowl, for both Dallas and Mexicali.
Note: Transfers of inventory to a third party (Mercado Libre or Amazon FBA) are included in Fishbowl. The current process is Dallas will enter those items transferred as a sale at $0. This incorrectly removes the item from ShopFloor inventory and marks it as sold. Mexicali uses the Set as Sold station (I think) to remove the items from inventory. Also wrong.
- Data is pulled daily at 7:30AM UTC for all the previous day’s sales (wrong in the current production version, but updated in the Mercado Libre branch on UAT). Job name in ShopFloor is
FishbowlSalesImportJob. - All sales that were created in the previous day are downloaded and translated to the new sales tables:
ProductSalesOrder,ProductSalesOrderLineItem, andProductSalesOrderLineItemDetail. - This job also checks the
SalesImporttable to see if the order exists and updates theChannelNamecolumn if available.
Mercado Libre Data Flow
Section titled “Mercado Libre Data Flow”Not yet on production. This flow gets all sales data from Mercado Libre’s API and translates it to the new sales data format.
Note: Mohammad G has experienced several inconsistencies with the Mercado Libre API. For example, if a user deactivates their account, their orders do not show up in the API anymore. This should only impact historical sales data, unless a user orders and deactivates in less than 24 hours.
- Data is pulled daily at 8:00AM UTC for the previous day’s sales. Job name in ShopFloor is
MercadoLibreSalesImportJob. - All sales data is translated to the new sales data format.
Update Sales Channels
Section titled “Update Sales Channels”This job will try to match up any Fishbowl sales with the Channel Advisor data import by order number and set the correct channel.
All Fishbowl sales will show “Fishbowl” as the channel, until a matching order is found in the data import. This is in the UpdateSalesChannelJob in ShopFloor.
Inventory Update
Section titled “Inventory Update”This job is responsible for updating the WorkTracking records in ShopFloor for sold items. This replaces the SyncItemsShippedOrSold method in SyncSalesAndInventoryWithWorkTrackingJob. This is in the SalesInventoryUpdateJob in ShopFloor.
- For any Mercado Libre orders where the status is
shippedordeliveredOR - For any non-Mercado Libre orders where the status is
Fulfilled- Determine which tenant in ShopFloor to look in (MX and CA locations are Mexicali, assume all others are Dallas).
- If the
ProductSalesOrderLineItemDetailrecord does not have an associatedWorkTrackingID- If there is a known serial number from the sales data, find that
WorkTrackingrecord:- Update
WorkTrackingIDandBOMHeaderIDin the sales tables - Update the
UnitSalesPrice,UnitSoldDateinWorkTrackingwith the sales data
- Update
- If there is NO serial number from the sales data NOT YET DEVELOPED
- Find the FIFO item from
WorkTrackingfor that third party warehouse (if sold from one) or the closest match- Update
WorkTrackingIDandBOMHeaderIDin the sales tables - Update the
UnitSalesPrice,UnitSoldDateinWorkTrackingwith the sales data
- Update
- Find the FIFO item from
- If there is a known serial number from the sales data, find that
The purpose of this job is to update the WorkTracking table exactly like it did before, but the source of the data is more comprehensive.
Database Schema
Section titled “Database Schema”Most columns in the tables are self-explanatory. The ones documented are ones that might be unclear.
ProductSalesOrder
Section titled “ProductSalesOrder”Status- this is a copy from the data source and not mapped to any internal statusChannelName- this is the source of the data. “Fishbowl” is used as the default for Fishbowl, but updated later from theUpdateSalesChannelJob.ChannelOrderID- for Fishbowl sales, this is the order # from the marketplace (eBay, Amazon, etc.). For Mercado Libre, this is the order #ExternalReferenceNumber- for Fishbowl sales, this is the database id column from thesotable. For Mercado Libre, this is the pack #
ProductSalesOrderLineItem
Section titled “ProductSalesOrderLineItem”BOMHeaderID- not populated during the sales download, but parsed later during theSalesInventoryUpdateJobif a match is found. Primarily used for easier lookups later.ProductSKU/ProductDescription- these are the values from the sales channel, not the internal ShopFloor values.
ProductSalesOrderLineItemDetail
Section titled “ProductSalesOrderLineItemDetail”A record is created in this table for each unit on the sale. If 10 of a SKU is sold, there will be 10 records for that line item in this table. This is used to keep track of serialized line items. Sometimes we will have the serial number sold, sometimes we will not, but each one will eventually map back to a related record in WorkTracking.
WorkTrackingID- the related work tracking item for this sold item. This is populated in theSalesInventoryUpdateJob.