app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: 智能补货-dws-外发版
  use_icon_as_answer_icon: false
dependencies:
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: hjlarry/database:0.0.6@534bc26cf5bc4ff6b5557457452287ccc71f00eef9378784c4f43ca49954ca2f
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: langgenius/gaode:0.0.3@a366a2187544e9c1c6a5322df79b5f806ea3a6e14c2a47760655e708da987006
- current_identifier: null
  type: package
  value:
    plugin_unique_identifier: langgenius/maas:0.0.13@c7bca6c99f9db6248c72c37e21adb608466b05abb9840d463082e09bd0186f4f
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: qiangxinglin/excel_tools:0.0.2@a21645f3ecb7f0e49c8e9f3a19c00961bea5db124a562fdc0950915501557bce
kind: app
version: 0.3.1
workflow:
  conversation_variables: []
  environment_variables:
  - description: ''
    id: a9018bd1-8c03-44b5-a9f5-5ecd620fb3de
    name: table_name
    selector:
    - env
    - table_name
    value: store_replenishment_advice
    value_type: string
  - description: ''
    id: 0ae9e541-87f0-4a93-b772-d19e2457f338
    name: city
    selector:
    - env
    - city
    value: 北京
    value_type: string
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      enabled: false
      fileUploadConfig:
        audio_file_size_limit: 100
        batch_count_limit: 5
        file_size_limit: 150
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 3
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: parameter-extractor
      id: 1773279486022-source-1773302804483-target
      source: '1773279486022'
      sourceHandle: source
      target: '1773302804483'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: true
        isInLoop: false
        iteration_id: '1773370666703'
        sourceType: iteration-start
        targetType: llm
      id: 1773370666703start-source-1773370679494-target
      source: 1773370666703start
      sourceHandle: source
      target: '1773370679494'
      targetHandle: target
      type: custom
      zIndex: 1002
    - data:
        isInIteration: true
        isInLoop: false
        iteration_id: '1773370666703'
        sourceType: llm
        targetType: code
      id: 1773370679494-source-1773371764143-target
      source: '1773370679494'
      sourceHandle: source
      target: '1773371764143'
      targetHandle: target
      type: custom
      zIndex: 1002
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: iteration
        targetType: code
      id: 1773370666703-source-1773383268153-target
      source: '1773370666703'
      sourceHandle: source
      target: '1773383268153'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: end
      id: 1773383584081-source-1773373078310-target
      source: '1773383584081'
      sourceHandle: source
      target: '1773373078310'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: code
        targetType: tool
      id: 1773383268153-source-1773383584081-target
      source: '1773383268153'
      sourceHandle: source
      target: '1773383584081'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: tool
        targetType: code
      id: 1773641447165-source-17736417312700-target
      source: '1773641447165'
      sourceHandle: source
      target: '17736417312700'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: start
        targetType: tool
      id: 1773194927298-source-1773279471861-target
      source: '1773194927298'
      sourceHandle: source
      target: '1773279471861'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: code
        targetType: code
      id: 17736417312700-source-1773310073685-target
      source: '17736417312700'
      sourceHandle: source
      target: '1773310073685'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: iteration
        targetType: code
      id: 1773370666703-source-1773645411096-target
      source: '1773370666703'
      sourceHandle: source
      target: '1773645411096'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: code
        targetType: tool
      id: 1773645411096-source-1773631148619-target
      source: '1773645411096'
      sourceHandle: source
      target: '1773631148619'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: tool
        targetType: end
      id: 1773631148619-source-1773373078310-target
      source: '1773631148619'
      sourceHandle: source
      target: '1773373078310'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: llm
      id: 1773647567418-source-1773279486022-target
      source: '1773647567418'
      sourceHandle: source
      target: '1773279486022'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: code
      id: 1773279471861-source-1773647738159-target
      source: '1773279471861'
      sourceHandle: source
      target: '1773647738159'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: code
        targetType: tool
      id: 1773647738159-source-1773647567418-target
      source: '1773647738159'
      sourceHandle: source
      target: '1773647567418'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: code
        targetType: iteration
      id: 1773310073685-source-1773370666703-target
      source: '1773310073685'
      sourceHandle: source
      target: '1773370666703'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: parameter-extractor
        targetType: tool
      id: 1773302804483-source-1773648946063-target
      source: '1773302804483'
      sourceHandle: source
      target: '1773648946063'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: tool
        targetType: tool
      id: 1773648946063-source-1773641447165-target
      source: '1773648946063'
      sourceHandle: source
      target: '1773641447165'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables: []
      height: 53
      id: '1773194927298'
      position:
        x: 833.7404857133297
        y: 327.5
      positionAbsolute:
        x: 833.7404857133297
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: '%Y-%m-%d %H:%M:%S'
          form: form
          human_description:
            en_US: Time format in strftime standard.
            ja_JP: Time format in strftime standard.
            pt_BR: Time format in strftime standard.
            zh_Hans: strftime 标准的时间格式。
          label:
            en_US: Format
            ja_JP: Format
            pt_BR: Format
            zh_Hans: 格式
          llm_description: null
          max: null
          min: null
          name: format
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: UTC
          form: form
          human_description:
            en_US: Timezone
            ja_JP: Timezone
            pt_BR: Timezone
            zh_Hans: 时区
          label:
            en_US: Timezone
            ja_JP: Timezone
            pt_BR: Timezone
            zh_Hans: 时区
          llm_description: null
          max: null
          min: null
          name: timezone
          options:
          - icon: null
            label:
              en_US: UTC
              ja_JP: UTC
              pt_BR: UTC
              zh_Hans: UTC
            value: UTC
          - icon: null
            label:
              en_US: America/New_York
              ja_JP: America/New_York
              pt_BR: America/New_York
              zh_Hans: 美洲/纽约
            value: America/New_York
          - icon: null
            label:
              en_US: America/Los_Angeles
              ja_JP: America/Los_Angeles
              pt_BR: America/Los_Angeles
              zh_Hans: 美洲/洛杉矶
            value: America/Los_Angeles
          - icon: null
            label:
              en_US: America/Chicago
              ja_JP: America/Chicago
              pt_BR: America/Chicago
              zh_Hans: 美洲/芝加哥
            value: America/Chicago
          - icon: null
            label:
              en_US: America/Sao_Paulo
              ja_JP: America/Sao_Paulo
              pt_BR: América/São Paulo
              zh_Hans: 美洲/圣保罗
            value: America/Sao_Paulo
          - icon: null
            label:
              en_US: Asia/Shanghai
              ja_JP: Asia/Shanghai
              pt_BR: Asia/Shanghai
              zh_Hans: 亚洲/上海
            value: Asia/Shanghai
          - icon: null
            label:
              en_US: Asia/Ho_Chi_Minh
              ja_JP: Asia/Ho_Chi_Minh
              pt_BR: Ásia/Ho Chi Minh
              zh_Hans: 亚洲/胡志明市
            value: Asia/Ho_Chi_Minh
          - icon: null
            label:
              en_US: Asia/Tokyo
              ja_JP: Asia/Tokyo
              pt_BR: Asia/Tokyo
              zh_Hans: 亚洲/东京
            value: Asia/Tokyo
          - icon: null
            label:
              en_US: Asia/Dubai
              ja_JP: Asia/Dubai
              pt_BR: Asia/Dubai
              zh_Hans: 亚洲/迪拜
            value: Asia/Dubai
          - icon: null
            label:
              en_US: Asia/Kolkata
              ja_JP: Asia/Kolkata
              pt_BR: Asia/Kolkata
              zh_Hans: 亚洲/加尔各答
            value: Asia/Kolkata
          - icon: null
            label:
              en_US: Asia/Seoul
              ja_JP: Asia/Seoul
              pt_BR: Asia/Seoul
              zh_Hans: 亚洲/首尔
            value: Asia/Seoul
          - icon: null
            label:
              en_US: Asia/Singapore
              ja_JP: Asia/Singapore
              pt_BR: Asia/Singapore
              zh_Hans: 亚洲/新加坡
            value: Asia/Singapore
          - icon: null
            label:
              en_US: Europe/London
              ja_JP: Europe/London
              pt_BR: Europe/London
              zh_Hans: 欧洲/伦敦
            value: Europe/London
          - icon: null
            label:
              en_US: Europe/Berlin
              ja_JP: Europe/Berlin
              pt_BR: Europe/Berlin
              zh_Hans: 欧洲/柏林
            value: Europe/Berlin
          - icon: null
            label:
              en_US: Europe/Moscow
              ja_JP: Europe/Moscow
              pt_BR: Europe/Moscow
              zh_Hans: 欧洲/莫斯科
            value: Europe/Moscow
          - icon: null
            label:
              en_US: Australia/Sydney
              ja_JP: Australia/Sydney
              pt_BR: Australia/Sydney
              zh_Hans: 澳大利亚/悉尼
            value: Australia/Sydney
          - icon: null
            label:
              en_US: Pacific/Auckland
              ja_JP: Pacific/Auckland
              pt_BR: Pacific/Auckland
              zh_Hans: 太平洋/奥克兰
            value: Pacific/Auckland
          - icon: null
            label:
              en_US: Africa/Cairo
              ja_JP: Africa/Cairo
              pt_BR: Africa/Cairo
              zh_Hans: 非洲/开罗
            value: Africa/Cairo
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: select
        params:
          format: ''
          timezone: ''
        provider_id: time
        provider_name: time
        provider_type: builtin
        selected: false
        title: 获取当前时间
        tool_configurations:
          format:
            type: mixed
            value: '%Y-%m-%d %H:%M:%S'
          timezone:
            type: constant
            value: Asia/Shanghai
        tool_description: 一个用于获取当前时间的工具。
        tool_label: 获取当前时间
        tool_name: current_time
        tool_node_version: '2'
        tool_parameters: {}
        type: tool
      height: 115
      id: '1773279471861'
      position:
        x: 1184.8405897910484
        y: 327.5
      positionAbsolute:
        x: 1184.8405897910484
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: DeepSeek-V3
          provider: langgenius/maas/huaweicloud_maas
        prompt_template:
        - id: 2a085873-2f17-44c9-a511-0f02f365e305
          role: system
          text: "# 任务描述\n你是一个日期时间分析助手。请根据用户输入的日期时间，判断该时间是周几、是否为中国法定节假日、以及是否为周末。\n\n\
            ## 输入格式\n用户会提供一个具体的日期和时间，格式为：YYYY-MM-DD HH:MM:SS\n\n## 判断逻辑\n1. **星期判断**：根据输入星期几数据解析出是周几\n\
            2. **节假日判断**：判断该日期是否为中国法定节假日\n   - 法定节假日包括：元旦、春节、清明节、劳动节、端午节、中秋节、国庆节\n\
            \   - 注意：需要考虑调休安排（部分周末可能被调整为工作日，部分工作日可能被调整为节假日）\n3. **周末判断**：判断该日期是否为周六或周日\n\
            \n## 输出要求\n- 只输出JSON格式数据，不输出任何其他内容\n- JSON字段说明：\n  - `week`：星期几（0-6，0代表周日，1代表周一，2代表周二，以此类推）\n\
            \  - `holiday`：是否节假日（是节假日赋值1.5，否则赋值1）\n  - `weekend`：是否周末（是周末赋值1.5，否则赋值1）\n\
            \n## 示例\n输入：2024-01-01 10:30:00\n输出：{\"week\":1, \"holiday\":1.5, \"weekend\"\
            :1}\n\n输入：2024-02-10 15:20:00\n输出：{\"week\":6, \"holiday\":1.5, \"weekend\"\
            :1.5}\n\n## 当前中国法定节假日参考（请基于最新节假日安排）\n请参考最新的国务院节假日安排进行判断。主要节假日包括：\n- 元旦：1月1日\n\
            - 春节：农历正月初一（日期每年变化）\n- 清明节：4月4日或5日\n- 劳动节：5月1日\n- 端午节：农历五月初五（日期每年变化）\n\
            - 中秋节：农历八月十五（日期每年变化）\n- 国庆节：10月1日至10月3日\n\n## 注意事项\n- 调休安排：部分周末可能需要上班（不是节假日），部分工作日可能放假（是节假日）\n\
            - 节假日包含调休放假的时间，不包含调休上班的周末\n- 输出必须严格遵循JSON格式\n\n请分析以下日期时间：{{#1773279471861.text#}}\n\
            星期几数据：{{#1773647567418.text#}}"
        - id: 5d0bf068-2dd6-473e-9f2c-c905e15c4387
          role: user
          text: ''
        selected: false
        title: 节假日周末分析
        type: llm
        variables: []
        vision:
          enabled: false
      height: 89
      id: '1773279486022'
      position:
        x: 2326.2636773954205
        y: 327.5
      positionAbsolute:
        x: 2326.2636773954205
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: DeepSeek-V3
          provider: langgenius/maas/huaweicloud_maas
        parameters:
        - description: 周几
          name: week
          required: false
          type: number
        - description: 节假日
          name: holiday
          required: false
          type: number
        query:
        - '1773279486022'
        - text
        reasoning_mode: prompt
        selected: false
        title: 参数提取器 周几、节假日
        type: parameter-extractor
        variables: []
        vision:
          enabled: false
      height: 89
      id: '1773302804483'
      position:
        x: 2703.192870806082
        y: 327.5
      positionAbsolute:
        x: 2703.192870806082
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "import ast\nfrom typing import List, Dict, Any\n\ndef main(data: str,\
          \ holiday: int, weekend: int) -> Dict[str, Any]:\n    # 1. 解析 data 字符串（Python\
          \ 单引号格式）\n    try:\n        data_list = ast.literal_eval(data)\n    except\
          \ (ValueError, SyntaxError):\n        data_list = []\n\n    # 2. 计算因子（作为\
          \ float，符合 numeric(4,2)）\n    holiday_factor = 1.5 if holiday == 1 else\
          \ 1.0\n    weekend_factor = 1.5 if weekend in [0, 6] else 1.0\n\n    # 3.\
          \ 过滤并更新字段\n    filtered = []\n    for item in data_list:\n        if not\
          \ isinstance(item, dict):\n            continue\n        \n        # 直接覆盖原字段，值为\
          \ float（1.0 或 1.5）\n        item[\"holiday_flag\"] = holiday\n        item[\"\
          weekend_flag\"] = weekend_factor\n        filtered.append(item)\n\n    return\
          \ {\"data\": filtered}"
        code_language: python3
        desc: ''
        outputs:
          data:
            children: null
            type: array[object]
        selected: false
        title: 商品过滤
        type: code
        variables:
        - value_selector:
          - '17736417312700'
          - result
          value_type: string
          variable: data
        - value_selector:
          - '1773302804483'
          - holiday
          value_type: number
          variable: holiday
        - value_selector:
          - '1773302804483'
          - week
          value_type: number
          variable: weekend
      height: 53
      id: '1773310073685'
      position:
        x: 3982
        y: 327.5
      positionAbsolute:
        x: 3982
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        error_handle_mode: terminated
        height: 255
        is_parallel: true
        iterator_input_type: array[object]
        iterator_selector:
        - '1773310073685'
        - data
        output_selector:
        - '1773371764143'
        - data
        output_type: array[object]
        parallel_nums: 10
        selected: false
        start_node_id: 1773370666703start
        title: 迭代
        type: iteration
        width: 812
      height: 255
      id: '1773370666703'
      position:
        x: 4286
        y: 327.5
      positionAbsolute:
        x: 4286
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 812
      zIndex: 1
    - data:
        desc: ''
        isInIteration: true
        selected: false
        title: ''
        type: iteration-start
      draggable: false
      height: 48
      id: 1773370666703start
      parentId: '1773370666703'
      position:
        x: 60
        y: 80.5
      positionAbsolute:
        x: 4346
        y: 408
      selectable: false
      sourcePosition: right
      targetPosition: left
      type: custom-iteration-start
      width: 44
      zIndex: 1002
    - data:
        context:
          enabled: true
          variable_selector:
          - '1773370666703'
          - item
        desc: ''
        isInIteration: true
        isInLoop: false
        iteration_id: '1773370666703'
        model:
          completion_params:
            temperature: 0
          mode: chat
          name: DeepSeek-V3
          provider: langgenius/maas/huaweicloud_maas
        prompt_template:
        - id: 372856db-e494-4c89-9aa5-54eff8427aab
          role: system
          text: "你是一个零售销量影响因子分析专家。请根据以下信息，分别评估**季节因素**和**近期天气因素**对该商品销量的影响，并输出两个独立的标准化影响系数。\n\
            \n输入信息：\n- 商品信息：{{#1773370666703.item#}}\n- 当前时间：{{#1773279471861.text#}}\n\
            - 当前城市近几天天气：{{#1773648946063.text#}}\n\n分析要求：\n1. **季节因素（season_factor）**：仅基于“当前时间”判断所处季节（春/夏/秋/冬），评估该季节对商品所属大类（如饮料、水果、生鲜等）销量的典型影响。\n\
            2. **天气因素（weather_factor）**：仅基于“近几天天气”（如高温、降雨、寒潮、晴热等），评估短期天气对商品销量的直接影响。\n\
            3. 同一商品大类在相同季节或相同天气条件下，必须输出一致的系数。\n4. 每个系数严格限定为以下三档之一：\n   - 1.1：正相关\n\
            \   - 1.0：无影响\n   - 0.9：负相关\n\n输出规则：\n- 必须输出一个合法的 JSON 对象，仅包含两个键：`weather_factor`\
            \ 和 `season_factor`\n- 值必须是数字（非字符串），取值为 1.1、1.0、0.9 \n- 不要包含任何其他字段、注释、解释、空格（除\
            \ JSON 必需外）、换行或 Markdown\n- 确保 JSON 可被程序直接解析\n\n示例：\n输入：西瓜，当前时间 2026-08-12，天气：连续高温38℃\
            \  \n输出：{\"weather_factor\": 1.1, \"season_factor\": 1.1}\n\n输入：羽绒服，当前时间\
            \ 2026-02-10，天气：阴天5℃  \n输出：{\"weather_factor\": 1.0, \"season_factor\"\
            : 1.2}\n\n现在请分析并输出："
        selected: false
        title: LLM 2
        type: llm
        variables: []
        vision:
          enabled: false
      height: 89
      id: '1773370679494'
      parentId: '1773370666703'
      position:
        x: 205.32267813342514
        y: 66.32267813342463
      positionAbsolute:
        x: 4491.322678133425
        y: 393.82267813342463
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
      zIndex: 1002
    - data:
        code: "import json\n\ndef main(item, text):\n    item_dict = json.loads(item)\
          \ if isinstance(item, str) else item\n    try:\n        factors = json.loads(text)\n\
          \    except (json.JSONDecodeError, TypeError):\n        # 如果解析失败，设为默认值 1.0\n\
          \        factors = {\"weather_factor\": 1.0, \"season_factor\": 1.0}\n \
          \   item_dict[\"season_factor\"] = factors.get(\"season_factor\", 1.0)\n\
          \    item_dict[\"weather_factor\"] = factors.get(\"weather_factor\", 1.0)\n\
          \    \n    \n    return {\n        \"data\": item_dict\n    }"
        code_language: python3
        desc: ''
        isInIteration: true
        isInLoop: false
        iteration_id: '1773370666703'
        outputs:
          data:
            children: null
            type: object
        selected: false
        title: 代码执行 5
        type: code
        variables:
        - value_selector:
          - '1773370666703'
          - item
          value_type: object
          variable: item
        - value_selector:
          - '1773370679494'
          - text
          value_type: string
          variable: text
      height: 53
      id: '1773371764143'
      parentId: '1773370666703'
      position:
        x: 508
        y: 78
      positionAbsolute:
        x: 4794
        y: 405.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
      zIndex: 1002
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1773383584081'
          - files
          value_type: array[file]
          variable: output
        - value_selector:
          - '1773631148619'
          - text
          value_type: string
          variable: output1
        selected: false
        title: 结束 3
        type: end
      height: 115
      id: '1773373078310'
      position:
        x: 5766
        y: 327.5
      positionAbsolute:
        x: 5766
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "from typing import List, Dict, Any\nimport json\n\ndef main(output:\
          \ List[Dict[str, Any]]) -> Dict[str, Any]:\n    \"\"\"\n    根据英文字段输入，计算建议补货量，并输出中文字段格式\n\
          \    \"\"\"\n    result_list = []\n    \n    for item in output:\n     \
          \   # 从英文字段安全获取值\n        def safe_float(val, default=1.0):\n          \
          \  try:\n                return float(val) if val is not None else default\n\
          \            except (ValueError, TypeError):\n                return default\n\
          \n        stock = safe_float(item.get(\"system_recommend_qty\"), 0.0)\n\
          \        season = safe_float(item.get(\"season_factor\"), 1.0)\n       \
          \ weather = safe_float(item.get(\"weather_factor\"), 1.0)\n        holiday\
          \ = safe_float(item.get(\"holiday_flag\"), 1.0)\n        weekend = safe_float(item.get(\"\
          weekend_flag\"), 1.0)\n\n        # 计算建议补货量\n        if stock < 0:\n    \
          \        replenishment_value = 0\n        else:\n            replenishment\
          \ = stock * season * weather * holiday * weekend\n            replenishment_value\
          \ = int(round(replenishment))\n\n        # 构建中文字段输出\n        new_item =\
          \ {\n            \"门店\": item.get(\"store_id\"),\n            \"商品名称\":\
          \ item.get(\"product_name\"),\n            \"系统推荐库存\": item.get(\"system_recommend_qty\"\
          ),\n            \"季节因素0.8~1.2\": season,\n            \"天气因素0.8~1.2\": weather,\n\
          \            \"节假日\": holiday,\n            \"周末\": weekend,\n         \
          \   \"建议补货量\": replenishment_value\n        }\n        result_list.append(new_item)\n\
          \    \n    return {\n        \"result\": json.dumps(result_list, ensure_ascii=False,\
          \ indent=2)\n    }"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行 6
        type: code
        variables:
        - value_selector:
          - '1773370666703'
          - output
          value_type: array[object]
          variable: output
      height: 53
      id: '1773383268153'
      position:
        x: 5158
        y: 327.5
      positionAbsolute:
        x: 5158
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: The JSON string to convert.
            ja_JP: The JSON string to convert.
            pt_BR: The JSON string to convert.
            zh_Hans: 要转换的JSON字符串。
          label:
            en_US: JSON String
            ja_JP: JSON String
            pt_BR: JSON String
            zh_Hans: JSON字符串
          llm_description: The JSON string to convert.
          max: null
          min: null
          name: json_str
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: The filename for the generated Excel file
            ja_JP: The filename for the generated Excel file
            pt_BR: The filename for the generated Excel file
            zh_Hans: 生成的Excel文件的文件名
          label:
            en_US: Excel filename
            ja_JP: Excel filename
            pt_BR: Excel filename
            zh_Hans: Excel文件名
          llm_description: The filename that will be used for the generated Excel
            file
          max: null
          min: null
          name: filename
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        params:
          filename: ''
          json_str: ''
        provider_id: qiangxinglin/excel_tools/excel_tools
        provider_name: qiangxinglin/excel_tools/excel_tools
        provider_type: builtin
        selected: false
        title: Json转Excel
        tool_configurations: {}
        tool_description: 将Json转换为Excel。
        tool_label: Json转Excel
        tool_name: json2excel
        tool_node_version: '2'
        tool_parameters:
          filename:
            type: mixed
            value: 商品补货单{{#1773279471861.text#}}
          json_str:
            type: mixed
            value: '{{#1773383268153.result#}}'
        type: tool
      height: 53
      id: '1773383584081'
      position:
        x: 5462
        y: 327.5
      positionAbsolute:
        x: 5462
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: The SQL query string.
            ja_JP: The SQL query string.
            pt_BR: The SQL query string.
            zh_Hans: SQL 查询语句。
          label:
            en_US: SQL Query
            ja_JP: SQL Query
            pt_BR: SQL Query
            zh_Hans: SQL 查询语句
          llm_description: The SQL query string.
          max: null
          min: null
          name: query
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Optional, Filling in this field will overwrite the database connection
              entered during authorization.
            ja_JP: Optional, Filling in this field will overwrite the database connection
              entered during authorization.
            pt_BR: Optional, Filling in this field will overwrite the database connection
              entered during authorization.
            zh_Hans: 选填，填写后将覆盖授权时填写的数据库连接。
          label:
            en_US: DB URI
            ja_JP: DB URI
            pt_BR: DB URI
            zh_Hans: DB URI
          llm_description: ''
          max: null
          min: null
          name: db_uri
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: json
          form: form
          human_description:
            en_US: Choose the output format.
            ja_JP: Choose the output format.
            pt_BR: Choose the output format.
            zh_Hans: 选择输出格式。
          label:
            en_US: Output format
            ja_JP: Output format
            pt_BR: Output format
            zh_Hans: 输出格式
          llm_description: ''
          max: null
          min: null
          name: format
          options:
          - icon: ''
            label:
              en_US: JSON
              ja_JP: JSON
              pt_BR: JSON
              zh_Hans: JSON
            value: json
          - icon: ''
            label:
              en_US: CSV
              ja_JP: CSV
              pt_BR: CSV
              zh_Hans: CSV
            value: csv
          - icon: ''
            label:
              en_US: YAML
              ja_JP: YAML
              pt_BR: YAML
              zh_Hans: YAML
            value: yaml
          - icon: ''
            label:
              en_US: Markdown
              ja_JP: Markdown
              pt_BR: Markdown
              zh_Hans: Markdown
            value: md
          - icon: ''
            label:
              en_US: Excel
              ja_JP: Excel
              pt_BR: Excel
              zh_Hans: Excel
            value: xlsx
          - icon: ''
            label:
              en_US: HTML
              ja_JP: HTML
              pt_BR: HTML
              zh_Hans: HTML
            value: html
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: select
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: 'Optional. For example {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              More connection options can be found at https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
            ja_JP: 'Optional. For example {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              More connection options can be found at https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
            pt_BR: 'Optional. For example {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              More connection options can be found at https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
            zh_Hans: '选填项。例如 {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              更多连接选项可参考 https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
          label:
            en_US: DB Config Options
            ja_JP: DB Config Options
            pt_BR: DB Config Options
            zh_Hans: 数据库连接配置选项
          llm_description: ''
          max: null
          min: null
          name: config_options
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        params:
          config_options: ''
          db_uri: ''
          format: ''
          query: ''
        provider_id: hjlarry/database/database
        provider_name: hjlarry/database/database
        provider_type: builtin
        selected: false
        title: SQL Execute
        tool_configurations:
          config_options:
            type: mixed
            value: "{\n  \"connect_args\": {\n    \"client_encoding\": \"utf8\"\n\
              \  }\n}"
          format:
            type: constant
            value: json
        tool_description: 此工具用于在已存在的数据库中执行 SQL 查询。
        tool_label: SQL Execute
        tool_name: sql_execute
        tool_node_version: '2'
        tool_parameters:
          db_uri:
            type: mixed
            value: null
          query:
            type: mixed
            value: '{{#1773645411096.result#}}'
        type: tool
      height: 115
      id: '1773631148619'
      position:
        x: 5462
        y: 421.8226781334247
      positionAbsolute:
        x: 5462
        y: 421.8226781334247
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: The SQL query string.
            ja_JP: The SQL query string.
            pt_BR: The SQL query string.
            zh_Hans: SQL 查询语句。
          label:
            en_US: SQL Query
            ja_JP: SQL Query
            pt_BR: SQL Query
            zh_Hans: SQL 查询语句
          llm_description: The SQL query string.
          max: null
          min: null
          name: query
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Optional, Filling in this field will overwrite the database connection
              entered during authorization.
            ja_JP: Optional, Filling in this field will overwrite the database connection
              entered during authorization.
            pt_BR: Optional, Filling in this field will overwrite the database connection
              entered during authorization.
            zh_Hans: 选填，填写后将覆盖授权时填写的数据库连接。
          label:
            en_US: DB URI
            ja_JP: DB URI
            pt_BR: DB URI
            zh_Hans: DB URI
          llm_description: ''
          max: null
          min: null
          name: db_uri
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: json
          form: form
          human_description:
            en_US: Choose the output format.
            ja_JP: Choose the output format.
            pt_BR: Choose the output format.
            zh_Hans: 选择输出格式。
          label:
            en_US: Output format
            ja_JP: Output format
            pt_BR: Output format
            zh_Hans: 输出格式
          llm_description: ''
          max: null
          min: null
          name: format
          options:
          - icon: ''
            label:
              en_US: JSON
              ja_JP: JSON
              pt_BR: JSON
              zh_Hans: JSON
            value: json
          - icon: ''
            label:
              en_US: CSV
              ja_JP: CSV
              pt_BR: CSV
              zh_Hans: CSV
            value: csv
          - icon: ''
            label:
              en_US: YAML
              ja_JP: YAML
              pt_BR: YAML
              zh_Hans: YAML
            value: yaml
          - icon: ''
            label:
              en_US: Markdown
              ja_JP: Markdown
              pt_BR: Markdown
              zh_Hans: Markdown
            value: md
          - icon: ''
            label:
              en_US: Excel
              ja_JP: Excel
              pt_BR: Excel
              zh_Hans: Excel
            value: xlsx
          - icon: ''
            label:
              en_US: HTML
              ja_JP: HTML
              pt_BR: HTML
              zh_Hans: HTML
            value: html
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: select
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: 'Optional. For example {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              More connection options can be found at https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
            ja_JP: 'Optional. For example {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              More connection options can be found at https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
            pt_BR: 'Optional. For example {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              More connection options can be found at https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
            zh_Hans: '选填项。例如 {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              更多连接选项可参考 https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
          label:
            en_US: DB Config Options
            ja_JP: DB Config Options
            pt_BR: DB Config Options
            zh_Hans: 数据库连接配置选项
          llm_description: ''
          max: null
          min: null
          name: config_options
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        params:
          config_options: ''
          db_uri: ''
          format: ''
          query: ''
        provider_id: hjlarry/database/database
        provider_name: hjlarry/database/database
        provider_type: builtin
        selected: false
        title: 查系统推荐订单
        tool_configurations:
          config_options:
            type: mixed
            value: "{\n  \"connect_args\": {\n    \"client_encoding\": \"utf8\"\n\
              \  }\n}"
          format:
            type: constant
            value: json
        tool_description: 此工具用于在已存在的数据库中执行 SQL 查询。
        tool_label: SQL Execute
        tool_name: sql_execute
        tool_node_version: '2'
        tool_parameters:
          db_uri:
            type: mixed
            value: null
          query:
            type: mixed
            value: select * from store_replenishment_ext limit 100;
        type: tool
      height: 115
      id: '1773641447165'
      position:
        x: 3346.651552471002
        y: 327.5
      positionAbsolute:
        x: 3346.651552471002
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "\ndef main(query_result: dict) -> dict:\n    flag = 0\n    if not query_result:\n\
          \        return {\n        \"flag\": flag,\n        \"result\": \"[]\"\n\
          \    }\n    result = query_result[0].get(\"result\", [])\n    len_result\
          \ = len(result)\n    if len_result ==1:\n        flag = 1\n    elif 1<len_result<101:\n\
          \        flag = 2\n    elif len_result>=101:\n        flag = 3\n    return\
          \ {\n        \"flag\": flag,\n        \"result\": str(result)\n    }"
        code_language: python3
        desc: ''
        outputs:
          flag:
            children: null
            type: number
          result:
            children: null
            type: string
        selected: false
        title: 提取SQL 查询订单信息
        type: code
        variables:
        - value_selector:
          - '1773641447165'
          - json
          value_type: array[object]
          variable: query_result
      height: 53
      id: '17736417312700'
      position:
        x: 3678
        y: 327.5
      positionAbsolute:
        x: 3678
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "from typing import List, Dict, Any\n\ndef main(output: List[Dict[str,\
          \ Any]],table_name:str) -> Dict[str, Any]:\n    \"\"\"\n    生成 INSERT SQL，严格匹配\
          \ store_replenishment_advice 表结构\n    \"\"\"\n    if not output:\n     \
          \   return {\"result\": \"/* No data to insert */\"}\n\n    # 表中存在的字段（按建表顺序，排除\
          \ create_time/update_time）\n    table_fields = [\n        \"store_id\",\n\
          \        \"product_name\",\n        \"system_recommend_stock\",\n      \
          \  \"season_factor\",\n        \"holiday_factor\",\n        \"weekend_factor\"\
          ,\n        \"weather_factor\",\n        \"suggested_order_qty\"\n    ]\n\
          \n    def format_sql_value(value):\n        \"\"\"格式化 SQL 值：None → NULL，数字直接输出，字符串加引号\"\
          \"\"\n        if value is None:\n            return \"NULL\"\n        if\
          \ isinstance(value, (int, float)):\n            return str(value)\n    \
          \    return \"'{}'\".format(str(value).replace(\"'\", \"''\"))\n\n    rows\
          \ = []\n    for item in output:\n        # 安全转换函数\n        def safe_float(val,\
          \ default=1.0):\n            try:\n                return float(val) if\
          \ val is not None else default\n            except (ValueError, TypeError):\n\
          \                return default\n\n        # 获取原始值（用于插入和计算）\n        sys_rec\
          \ = safe_float(item.get(\"system_recommend_qty\"), 0.0)\n        season\
          \ = safe_float(item.get(\"season_factor\"), 1.0)\n        holiday = safe_float(item.get(\"\
          holiday_flag\"), 1.0)   # 来自上游 holiday_flag\n        weekend = safe_float(item.get(\"\
          weekend_flag\"), 1.0)   # 来自 upstream weekend_flag\n        weather = safe_float(item.get(\"\
          weather_factor\"), 1.0)\n\n        # 计算建议补货量\n        if sys_rec < 0:\n\
          \            suggested_qty = 0\n        else:\n            replenishment\
          \ = sys_rec * season * holiday * weekend * weather\n            suggested_qty\
          \ = int(round(replenishment))\n\n        # 构建插入值（按 table_fields 顺序）\n  \
          \      values = [\n            item.get(\"store_id\"),                 \
          \   # store_id\n            item.get(\"product_name\"),                #\
          \ product_name\n            item.get(\"system_recommend_qty\"),        #\
          \ system_recommend_stock\n            item.get(\"season_factor\"),     \
          \          # season_factor\n            holiday,                       \
          \          # holiday_factor ← 来自 holiday_flag\n            weekend,    \
          \                             # weekend_factor ← 来自 weekend_flag\n     \
          \       weather,                                 # weather_factor ← 默认 1.0\n\
          \            suggested_qty                            # suggested_order_qty\n\
          \        ]\n\n        formatted_values = [format_sql_value(v) for v in values]\n\
          \        rows.append(\"({})\".format(\", \".join(formatted_values)))\n\n\
          \    sql = \"INSERT INTO {} ({}) VALUES\\n{};\".format(\n        table_name,\n\
          \        \", \".join(table_fields),\n        \",\\n\".join(rows)\n    )\n\
          \n    return {\"result\": sql}"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行 7
        type: code
        variables:
        - value_selector:
          - '1773370666703'
          - output
          value_type: array[object]
          variable: output
        - value_selector:
          - env
          - table_name
          value_type: string
          variable: table_name
      height: 53
      id: '1773645411096'
      position:
        x: 5158
        y: 451.5
      positionAbsolute:
        x: 5158
        y: 451.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Year
            ja_JP: Year
            pt_BR: Year
            zh_Hans: 年
          label:
            en_US: Year
            ja_JP: Year
            pt_BR: Year
            zh_Hans: 年
          llm_description: null
          max: null
          min: null
          name: year
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: number
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Month
            ja_JP: Month
            pt_BR: Month
            zh_Hans: 月
          label:
            en_US: Month
            ja_JP: Month
            pt_BR: Month
            zh_Hans: 月
          llm_description: null
          max: null
          min: null
          name: month
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: number
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: day
            ja_JP: day
            pt_BR: day
            zh_Hans: 日
          label:
            en_US: day
            ja_JP: day
            pt_BR: day
            zh_Hans: 日
          llm_description: null
          max: null
          min: null
          name: day
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: number
        params:
          day: ''
          month: ''
          year: ''
        provider_id: time
        provider_name: time
        provider_type: builtin
        selected: false
        title: 星期几计算器
        tool_configurations: {}
        tool_description: 计算指定日期为星期几的工具。
        tool_label: 星期几计算器
        tool_name: weekday
        tool_node_version: '2'
        tool_parameters:
          day:
            type: variable
            value:
            - '1773647738159'
            - day
          month:
            type: variable
            value:
            - '1773647738159'
            - month
          year:
            type: variable
            value:
            - '1773647738159'
            - year
        type: tool
      height: 53
      id: '1773647567418'
      position:
        x: 1947.8151257887039
        y: 327.5
      positionAbsolute:
        x: 1947.8151257887039
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "from datetime import datetime\nfrom typing import Dict, Any\n\ndef\
          \ main(time_str: str) -> Dict[str, int]:\n\n    dt = datetime.strptime(time_str,\
          \ \"%Y-%m-%d %H:%M:%S\")\n    return {\n        \"year\": dt.year,\n   \
          \     \"month\": dt.month,\n        \"day\": dt.day\n    }"
        code_language: python3
        desc: ''
        outputs:
          day:
            children: null
            type: number
          month:
            children: null
            type: number
          year:
            children: null
            type: number
        selected: false
        title: 拆分日期
        type: code
        variables:
        - value_selector:
          - '1773279471861'
          - text
          value_type: string
          variable: time_str
      height: 53
      id: '1773647738159'
      position:
        x: 1552.653634025377
        y: 327.5
      positionAbsolute:
        x: 1552.653634025377
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Target city for weather forecast query.
            ja_JP: Target city for weather forecast query.
            pt_BR: Cidade de destino para consulta de previsão do tempo.
            zh_Hans: 天气预报查询的目标城市。
          label:
            en_US: city
            ja_JP: city
            pt_BR: cidade
            zh_Hans: 城市
          llm_description: If you don't know you can extract the city name from the
            question or you can reply：Please tell me your city. You have to extract
            the Chinese city name from the question.
          max: null
          min: null
          name: city
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        params:
          city: ''
        provider_id: langgenius/gaode/gaode
        provider_name: langgenius/gaode/gaode
        provider_type: builtin
        selected: false
        title: 天气预报
        tool_configurations: {}
        tool_description: 天气预报查询。
        tool_label: 天气预报
        tool_name: gaode_weather
        tool_node_version: '2'
        tool_parameters:
          city:
            type: mixed
            value: '{{#env.city#}}'
        type: tool
      height: 53
      id: '1773648946063'
      position:
        x: 3030.368326113647
        y: 327.5
      positionAbsolute:
        x: 3030.368326113647
        y: 327.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    viewport:
      x: -4301.9531611060265
      y: 113.67289962197356
      zoom: 0.9605898711117571
