Digital Management of Multi-Category Products and Global Stores

    A century-old food company with handmade recipes faces wide product ranges, confidential evolving formulas, and highly mixed channels. This article explains a system design centered on master data governance, versioned recipes, batch-level traceability, and regional compliance, from architecture and coding models through recall, rollout, and common anti-patterns.

    1. From business symptoms to technical problems

    A food company that has operated for more than a century and began with handmade recipes shows three typical traits from a digital perspective:

    • Extremely wide assortment: Chocolate, ice cream, sauces, and confectionery run in parallel. SKU counts grow multiplicatively with flavor and pack combinations (hundreds of base recipes × multiple sizes × multilingual packaging ≈ thousands to tens of thousands of SKUs).
    • Recipes as assets: Core recipes must stay confidential over the long term and still evolve (reduced-sugar versions, new flavors). Recipe data must therefore be versioned, not overwritten in place.
    • Highly heterogeneous channels: Owned stores, franchise counters, cross-region distribution, and online fulfillment coexist. The same product faces different labeling, certification, and shelf-life rules by region.

    These three points shift the design focus away from “product display” and toward master data governance + versioned recipes + batch-level traceability + regional compliance.

    2. Layered architecture

    1. Access layer: store POS / mini programs / distributor portals / internal operations console
    2. ↓
    3. Domain services: product master data | recipes and process | inventory and fulfillment | traceability and recall | promotions and pricing
    4. ↓
    5. Platform layer: container platform · message queue · object storage · cache · logging · monitoring and alerting
    6. ↓
    7. Data layer: transactional store (OLTP) + analytical warehouse (OLAP) + object storage (images / documents / batch evidence)

    Key principle: write master data once; every downstream path only reads and references it. No channel may invent its own product codes. Otherwise, later consolidation cost grows exponentially.

    3. Product master data: coding and model

    Use a segmented code of “category + assortment + recipe family + spec + region” so codes stay readable and extensible:

    1. {
    2. "skuCode": "CHO-GIO-0007-100-IT",
    3. "categoryPath": ["Food", "Chocolate", "Hazelnut spread"],
    4. "recipeFamilyId": "RF-GIO-0007",
    5. "recipeVersion": "v3.2",
    6. "spec": { "netWeightG": 100, "packageType": "box" },
    7. "region": "IT",
    8. "labels": { "allergen": ["hazelnut", "milk"], "sugarReduced": false },
    9. "certifications": [{ "type": "originCertified", "scope": "region", "validUntil": "2027-01-01" }],
    10. "lifecycleStatus": "ACTIVE"
    11. }

    Notes:

    1. Decouple recipeFamilyId from skuCode so “same recipe, different pack” shares one recipe and avoids duplicate recipe maintenance.
    2. Model labels and certifications separately. Regional compliance changes affect only the label layer, not the recipe.
    3. lifecycleStatus supports DRAFT → ACTIVE → CLEARANCE → EOL. Discontinued items remain read-only history so past orders stay explainable.

    4. Recipes and process: immutable versions and staged release

    Recipes must never be edited in place. The correct approach is append a new version + an approval flow + store/region staged rollout:

    1. CREATE TABLE recipe_version (
    2. recipe_family_id VARCHAR(32) NOT NULL,
    3. version VARCHAR(16) NOT NULL,
    4. bom_json JSONB NOT NULL, -- ingredients, ratios, process parameters
    5. approval_status VARCHAR(16) NOT NULL, -- DRAFT/APPROVED/RELEASED
    6. effective_from DATE NOT NULL,
    7. checksum CHAR(64) NOT NULL, -- tamper-evident checksum
    8. PRIMARY KEY (recipe_family_id, version)
    9. );

    Engineering constraints:

    • Rows already RELEASED cannot be updated; they can only be logically retired. checksum supports audit comparison.
    • Changes such as sugar reduction or ingredient substitution follow the same pipeline and, after approval, take effect through feature flags that limit scope.
    • Ingredient batches and recipe versions are bound both ways on production work orders, forming lineage.

    5. Batch traceability and recall: locate impact in minutes

    The core metric is the time to go from a finished-goods batch back to ingredient batches and the stores that received them. Design points:

    • Use one batchId end to end and pass it through production, warehousing, and store sales.
    • Prefer first-expire, first-out (FEFO) over first-in, first-out. This matters especially for short-shelf-life goods:
    1. def allocate(batch_list, demand):
    2. # Ascending by expiry date; skip frozen batches
    3. usable = sorted([b for b in batch_list if not b.frozen],
    4. key=lambda b: b.expire_date)
    5. plan, remain = [], demand
    6. for b in usable:
    7. if remain <= 0:
    8. break
    9. take = min(b.qty, remain)
    10. plan.append((b.batch_id, take))
    11. remain -= take
    12. return plan, remain
    • On recall, look up sales lines by batchId and produce the affected store list and quantities. The whole path stays auditable.

    6. Global distribution and regional compliance

    Cross-region operations mean “one product, many rule sets.” Externalize rules as configurable policies:

    Dimension What varies How to handle it
    Labels Allergens, language, nutrition facts Regional label templates + version numbers
    Certifications Origin, quality awards Certificates in object storage + validity checks
    Shelf life Differences by supply path Regional policy overrides the default
    Pricing Currency, tax Price lists isolated by region

    Publish regional policy changes through a configuration center and broadcast them over a message queue to regional services, so a concentrated refresh during peak promotions does not cause jitter.

    7. New-product launch pipeline

    A new flavor, from R&D to store shelf, should be treated as a standard continuous delivery:

    1. The recipe version enters DRAFT; R&D trials it in a sandbox.
    2. After approval, generate SKU master data and regional labels.
    3. The container platform promotes services by environment (development / staging / production).
    4. Use a feature flag to pilot a small set of stores; monitoring and alerts watch sell-through, stockout rate, and return rate.
    5. If metrics meet the bar, open fully; if not, roll the flag back automatically.

    Example configuration:

    1. feature: new_flavor raspberry_caviar
    2. rollout:
    3. stage1: { scope: store, ratio: 0.02, duration: 72h }
    4. stage2: { scope: region, ratio: 0.30, duration: 7d }
    5. stage3: { scope: global, ratio: 1.0 }
    6. guardrail:
    7. metrics: [sell_through, stockout_rate, return_rate]
    8. rollback_on: metric_drop > 15%

    8. Cloud deployment and observability

    On Baidu AI Cloud, these capabilities can sit on general product categories: a container platform for domain services and elastic scale; object storage for pack images, certificates, and batch evidence; a message queue to decouple production from store inventory sync; logging plus monitoring and alerting for tracing and business dashboards. On the data side, the transactional store preserves consistency and the analytical warehouse supports assortment and store performance analysis.

    Three governance items must be in place:

    • Consistency: Inventory deduction uses idempotency plus optimistic locking to avoid overselling under concurrent store demand.
    • Security: Encrypt recipe data, apply least-privilege access, and audit every operation.
    • Capacity: Load-test before holiday peaks, and estimate connections and throughput by store count rather than order count.

    9. Rollout path and common anti-patterns

    A practical sequence is three phases: phase one unifies master data and coding (1–2 months); phase two adds recipe versioning and batch traceability (2–3 months); phase three adds regional compliance policies and staged release (3 months).

    Common anti-patterns include each channel inventing its own codes, overwriting recipes in place, using first-in first-out instead of FEFO, hard-coding compliance rules into business logic, and lacking batch freeze so a recall cannot be stopped quickly. Avoiding these five lets a multi-category global retail system balance scalability and auditability.