供应商和工厂天气风险数据洞见

此消费数据产品示例演示了如何将零复制 SAP Business Data Cloud (SAP BDC) 采购和入库交货共享与通过 BigQuery 共享订阅的 Google WeatherNext 3 集合天气预报相结合。它不需要商业航运遥测订阅,既可以作为独立的设施到设施天气风险加速器,也可以作为供应商入站配送天气风险数据洞见的基础模块。

通过此示例,您可以:

  • 跟踪不同供应商、工厂和关键物料类型的未结入站交付支出和风险价值。
  • 根据预打包的城市地理空间目录,对实际发货地(使用多步骤 SAP 发货地瀑布流)和收货工厂进行地理编码。
  • 在可配置的空间半径(默认为 25 公里)内叠加 72 小时、0.1 度的 WeatherNext 3 集合预报,以预测 P50 和 P90 到达日期,并标记天气导致的时间表差异。

参考架构

概要参考架构简要介绍了为此应用场景提供数据所需的特定于来源的数据产品。

Cortex Framework 的供应商和工厂天气风险数据洞见消费数据产品示例参考架构

图 1. 适用于 Cortex Framework 的供应商和工厂天气风险数据分析使用情况数据产品示例参考架构。

已发布的数据资产

部署 cortex_samples.sap_bdc.products.supplier_plant_weather_risk_insights 会在目标数据集中创建以下 BigQuery 表和视图:

数据资产 具体化 主键粒度 说明
inbound_delivery_insights Table delivery_document,delivery_document_item Conformed inbound delivery item spine resolving physical dispatch origins using a multi-step SAP waterfall (manual PO header override address ADRNR, goods supplier LLIEF, supplying plant RESWK, and vendor master LIFNR), prorated net order value, historical On-Time In-Full (OTIF) flags, and supplier-to-plant lead-time and volatility benchmarks.
supplier_plant_weather_risk_insights View delivery_document,delivery_document_item 消耗视图,在发货地和收货 SAP 工厂上叠加 72 小时 WeatherNext 3 降水、风速、温度和集合离散度预测,以对天气暴露层级进行分类并预测调整后的到达日期。
world_city_directory Table city_id 全球和美国城市的参考表,包含标准化的 WGS84 坐标和预计算的 BigQuery GEOGRAPHY 点 (city_geom),用于空间联接。

必需的外部目录来源

在启用此示例之前,请配置以下外部目录来源:

  • SAP Business Data Cloud (lakehouse_delta_share):导入公开采购订单 (purchaseorder)、供应商 (supplier)、工厂 (plant)、地址 (address)、产品 (product)、公司 (company)、入站交货标头 (delivery_header) 和入站交货项 (delivery_item) 的共享。如需了解设置说明,请参阅 SAP Business Data Cloud 集成。
  • Google WeatherNext 3 (analytics_hub):在 BigQuery Sharing 中订阅 Google WeatherNext 3 列表,并将预测表(例如 weathernext_3_0_0)添加到 analytics_hub 目录模块的 inlineTableSettings.tables 中。如需查看设置说明,请参阅 BigQuery Sharing 集成。

在 config/config.yaml 中启用数据产品

在 data.modules.catalogs 下注册 SAP BDC 和 Google WeatherNext 目录,然后在 data.modules.products 下启用 cortex_samples.sap_bdc.products.supplier_plant_weather_risk_insights:

data:
  namespaces:
    - name: cortex
    - name: cortex_samples

  modules:
    catalogs:
      # SAP Business Data Cloud Delta Sharing catalog.
      - id: sap_bdc_catalog
        type: lakehouse_delta_share
        bindsNamespaces: [sap_bdc]
        connectionSettings:
          catalogId: sap_bdc_catalog
          projectId: SAP_BDC_CATALOG_PROJECT_ID
          location: US
          shares:
            - shareId: PURCHASE_ORDER_SHARE_ID
            - shareId: SUPPLIER_SHARE_ID
            - shareId: PLANT_SHARE_ID
            - shareId: ADDRESS_SHARE_ID
            - shareId: PRODUCT_SHARE_ID
            - shareId: COMPANY_SHARE_ID
            - shareId: DELIVERY_HEADER_SHARE_ID
            - shareId: DELIVERY_ITEM_SHARE_ID

      # Google WeatherNext 3 linked dataset subscribed from BigQuery sharing.
      - id: ah_weathernext_catalog
        type: analytics_hub
        bindsNamespaces: [cortex.external.weathernext]
        connectionSettings:
          projectId: LINKED_DATASET_PROJECT_ID
          datasetId: WEATHERNEXT_DATASET_ID
          location: US
        inlineTableSettings:
          tables:
            - weathernext_3_0_0

    products:
      # Enabled Supplier & Plant Weather Risk Insights sample.
      - moduleId: supplier_plant_weather_risk_insights
        enabled: true
        modulePath: cortex_samples.sap_bdc.products.supplier_plant_weather_risk_insights
        dataTargetId: samples_target
        dependencyBindings:
          sapBdcPurchaseOrder: sap_bdc_catalog.purchaseorder
          sapBdcSupplier: sap_bdc_catalog.supplier
          sapBdcPlant: sap_bdc_catalog.plant
          sapBdcAddress: sap_bdc_catalog.address
          sapBdcProduct: sap_bdc_catalog.product
          sapBdcCompany: sap_bdc_catalog.company
          sapBdcDeliveryHeader: sap_bdc_catalog.delivery_header
          sapBdcDeliveryItem: sap_bdc_catalog.delivery_item
          weatherNext: ah_weathernext_catalog.weathernext_3_0_0
        inlineTableSettings:
          supplier_plant_weather_risk_insights:
            filters:
              critical_material_types: ["ROH", "RAW", "HALB"]
              weather_thresholds:
                forecast_horizon_hours: 72
                spatial_radius_meters: 25000

替换以下内容:

  • SAP_BDC_CATALOG_PROJECT_ID:托管 BigLake Delta Sharing 目录的 Google Cloud 项目 ID,例如:my-sap-bdc-project。
  • PURCHASE_ORDER_SHARE_ID:从 SAP BDC 导入的采购订单的物理 Delta Sharing 共享 ID,例如:purchaseorder。
  • SUPPLIER_SHARE_ID:从 SAP BDC for Supplier 导入的物理 Delta Sharing 共享 ID,例如:supplier。
  • PLANT_SHARE_ID:从 SAP BDC 导入的工厂物理 Delta Sharing 共享 ID,例如:plant。
  • ADDRESS_SHARE_ID:从 SAP BDC 导入的地址物理 Delta Sharing 共享 ID,例如:address。
  • PRODUCT_SHARE_ID:从 SAP BDC for Product 导入的物理 Delta Sharing 共享 ID,例如:product。
  • COMPANY_SHARE_ID:从 SAP BDC 导入的公司物理 Delta Sharing 共享 ID,例如:company。
  • DELIVERY_HEADER_SHARE_ID:从 SAP BDC 导入的入库交货单头的物理 Delta Sharing 共享 ID,例如:delivery_header。
  • DELIVERY_ITEM_SHARE_ID:从 SAP BDC 导入的入库交货项的物理 Delta Sharing 共享 ID,例如:delivery_item。
  • LINKED_DATASET_PROJECT_ID:托管已订阅的 WeatherNext 关联数据集的 Google Cloud 项目 ID,例如:my-cortex-project。
  • WEATHERNEXT_DATASET_ID:您订阅的 WeatherNext 3 列表的 BigQuery 数据集 ID,例如:google_weathernext_3。

您可以在 inlineTableSettings 或 tableSettings 文件中每个资产的 filters 代码块下,进一步自定义 SAP 客户端和交付过滤条件(inbound_delivery_insights 上的 sap_client、inbound_delivery_categories_vbtyp 和 ocean_incoterms)、关键物料类型 (critical_material_types)、计划差异缓冲区 (schedule_variance_thresholds) 和恶劣天气截止时间 (weather_thresholds)。如需查看可调阈值和默认值的完整列表,请参阅 src/data_modules/cortex_samples/sap_bdc/products/supplier_plant_weather_risk_insights/table_settings.default.yaml。

构建并部署配置的示例:

export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-build-and-deploy --config $CORTEX_CONFIG_FILE

实体关系图

您可以在模块的 README.md 中查看实体关系 (ER) 图表,也可以使用 uv run cortex-metadata erd 从已编译的工作区生成该图表:

export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-metadata erd \
  --config $CORTEX_CONFIG_FILE \
  --module-id supplier_plant_weather_risk_insights

源代码

在 src/data_modules/cortex_samples/sap_bdc/products/supplier_plant_weather_risk_insights 探索代码库中的 SQL 模型、manifest.yaml 和注释。

启用 AI 智能体

在 BigQuery 中具体化 inbound_delivery_insights 和 supplier_plant_weather_risk_insights 后,您可以使用 uv run cortex-create-ca-agents 预配自然语言数据智能体,或直接在 BigQuery Studio 中构建自定义数据智能体(创建数据智能体),以询问有关受天气影响的交付、延迟的供应商和面临风险的工厂支出的问题。

后续步骤