Solutech Engineering

Price List Data Synchronization

Documentation for the intelligent price list generation and synchronization between KDL and SAT systems

Price List Data Synchronization

The price list synchronization ensures that SAT receives transformed, deduplicated, and intelligently grouped price lists based on customer buying groups and business rules, rather than simple direct exports from KDL.

SAT's price list scheduler then runs every five minutes and pulls the newly generated pricelists from KDL to SAT through the API api/sap/pull-pricelist

Overview

This scheduled integration point runs twice daily (11:00 and 16:00), generating comprehensive price lists that are constructed according to customer buying groups, checked for duplicates, and enhanced with product details including alternate units of measure.

Technical Details

Code Location

  • Scheduled Command: sat-pull:populate-new-price-list
  • Registration: app/Console/Kernel.php
  • Controller: NewPriceListController.php
  • Key Methods:
    • populatePriceList: Generates price list combinations
    • getPriceListWithProducts: Enriches with product details

Execution Schedule

// Laravel Scheduler - twice daily
$schedule->command('sat-pull:populate-new-price-list')->twiceDaily(11, 16);

Primary Tables

  • Core: ArCustomer, NewPricelist, NewPricelistGroup
  • Linking: customer_price_list
  • Product Data: InvMaster, SorContractPrice
  • Configuration: buying_groups

Price List Generation Process

1. Customer Analysis

For each customer, the system analyzes buying group configurations:

// Example customer buying groups
$customer = [
    'BuyingGroup1' => 'RETAIL',
    'BuyingGroup2' => 'WHOLESALE', 
    'BuyingGroup3' => null,
    'BuyingGroup4' => 'PROMO',
    'BuyingGroup5' => null
];

2. Combination Generation

All possible price list combinations are generated from non-null buying groups:

// Generated combinations for above customer
$combinations = [
    ['RETAIL'],
    ['WHOLESALE'],
    ['PROMO'],
    ['RETAIL', 'WHOLESALE'],
    ['RETAIL', 'PROMO'],
    ['WHOLESALE', 'PROMO'],
    ['RETAIL', 'WHOLESALE', 'PROMO']
];

3. Deduplication & Naming

// Price list naming convention
$pricelistName = implode('-', $buyingGroups);
// Example: "RETAIL-WHOLESALE-PROMO"

// Check for existing price lists to avoid duplicates
$existing = NewPricelist::where('pricelist_name', $pricelistName)->first();

4. Customer Assignment

// Update customer with new price list code
$customer->update([
    'SATPriceList' => $newPricelist->price_list_id,
    'SAT_SYNC' => 'Y'
]);

Data Mapping & Transformation

Price List Header

Source Field(s)Source Table(s)SAT FieldTransformation Notes
BuyingGroup1-5ArCustomerbuying_groupUsed to generate combinations
GeneratedNewPricelistpricelist_nameConcatenated buying groups
price_list_idcustomer_price_listpricelist_codeUnique identifier

Price List Products

Source FieldSource TableSAT FieldTransformation Notes
product_codeInvMaster/SorContractPriceproduct_codeDirect mapping
DescriptionInvMasterproduct_nameDirect mapping
PriceSorContractPricepriceIncludes UOM conversion
StockUomInvMasteruom_codePrimary UOM
AlternateUomInvMasteralt_uom_codeAlternate UOM
ConvFactAltUomInvMasterconversion_altUsed for price calculation

UOM Price Calculations

// Primary UOM price (direct from contract)
$primaryPrice = $contractPrice->Price;

// Alternate UOM price (converted)
if ($product->AlternateUom && $product->ConvFactAltUom) {
    $alternatePrice = $primaryPrice / $product->ConvFactAltUom;
}

Troubleshooting

Issue: Price Lists Not Generating

Symptoms: Customers not getting price list assignments

Diagnostic Steps:

  1. Check customer buying group configuration
  2. Verify buying group price data exists
  3. Review scheduler execution