GuardMarket

inventory.abc_classify

ABC 库存分类

Sort annual consumption value descending; classify by cumulative share BEFORE each item (A<80%, B<95%, else C); zero-value totals are C.

Version 1.0.0确定性数据处理Backend required

使用场景 / Purpose

Inventory: abc classify. 本技能对提供的参数执行计算,输入输出契约如下。文档例子来自已实现函数的固定验收样例;网页本身不执行代码。

输入字段 / Parameters

字段类型要求约束与说明
items"array"必填 Required{"items": {"type": "object", "properties": {"sku": {"type": "string", "minLength": 1, "maxLength": 128}, "unit_cost": {"type": "string", "minLength": 1, "maxLength": 32}, "annual_units": {"type": "integer", "minimum": 0, "maximum": 1000000}}, "required": ["sku", "unit_cost", "annual_units"], "additionalProperties": false, "maxProperties": 1000}, "minItems": 1, "maxItems": 500}

输入例子 / Example input

{
  "items": [
    {
      "sku": "A",
      "unit_cost": "8.00",
      "annual_units": 10
    },
    {
      "sku": "B",
      "unit_cost": "2.00",
      "annual_units": 10
    }
  ]
}

预期输出 / Expected output

[
  {
    "sku": "A",
    "annual_value": "80.00",
    "class": "A",
    "cumulative_percent": 80.0
  },
  {
    "sku": "B",
    "annual_value": "20.00",
    "class": "B",
    "cumulative_percent": 100.0
  }
]
完整输入 JSON Schema
{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "sku": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "unit_cost": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "annual_units": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          }
        },
        "required": [
          "sku",
          "unit_cost",
          "annual_units"
        ],
        "additionalProperties": false,
        "maxProperties": 1000
      },
      "minItems": 1,
      "maxItems": 500
    }
  },
  "required": [
    "items"
  ],
  "additionalProperties": false,
  "maxProperties": 1000
}
完整输出 JSON Schema
{
  "type": "array",
  "items": {
    "type": [
      "object",
      "array",
      "string",
      "number",
      "boolean",
      "null"
    ],
    "maxProperties": 1000,
    "maxItems": 1000,
    "maxLength": 60000,
    "minimum": -1e+100,
    "maximum": 1e+100
  },
  "minItems": 0,
  "maxItems": 10000
}