refactor(处理器): 重构通用供应商处理器以支持规则引擎 docs: 更新README与文档说明供应商管理功能 build: 更新打包脚本注入版本信息 test: 添加规则引擎单元测试
238 lines
5.4 KiB
JSON
238 lines
5.4 KiB
JSON
{
|
||
"suppliers": [
|
||
{
|
||
"name": "蓉城易购",
|
||
"description": "蓉城易购供应商订单处理",
|
||
"filename_patterns": [
|
||
"*蓉城*",
|
||
"*rongcheng*",
|
||
"*易*"
|
||
],
|
||
"content_indicators": [
|
||
"蓉城易购",
|
||
"商品编码",
|
||
"订货数量"
|
||
],
|
||
"column_mapping": {
|
||
"商品条码(小条码)": "barcode",
|
||
"商品名称": "name",
|
||
"规格": "specification",
|
||
"订购数量(小单位)": "quantity",
|
||
"单位": "unit",
|
||
"单价(小单位)": "unit_price",
|
||
"优惠后金额(小单位)": "total_price",
|
||
"备注": "category",
|
||
"行号": "supplier"
|
||
},
|
||
"cleaning_rules": [
|
||
{
|
||
"type": "remove_rows",
|
||
"condition": "订货数量 == 0 or 订货数量.isna()"
|
||
},
|
||
{
|
||
"type": "fill_na",
|
||
"columns": [
|
||
"unit_price"
|
||
],
|
||
"value": 0
|
||
}
|
||
],
|
||
"calculations": [
|
||
{
|
||
"type": "multiply",
|
||
"source_column": "quantity",
|
||
"target_column": "quantity",
|
||
"factor": 1
|
||
}
|
||
],
|
||
"output_suffix": "_蓉城易购_银豹采购单",
|
||
"header_row": 2,
|
||
"rules": [
|
||
{
|
||
"type": "split_quantity_unit",
|
||
"source": "订购数量(小单位)"
|
||
},
|
||
{
|
||
"type": "extract_spec_from_name",
|
||
"source": "商品名称"
|
||
},
|
||
{
|
||
"type": "normalize_unit",
|
||
"target": "unit",
|
||
"map": {
|
||
"箱": "件",
|
||
"提": "件",
|
||
"盒": "件"
|
||
}
|
||
},
|
||
{
|
||
"type": "compute_quantity_from_total"
|
||
},
|
||
{
|
||
"type": "mark_gift"
|
||
},
|
||
{
|
||
"type": "fill_missing",
|
||
"fills": {
|
||
"unit": "瓶"
|
||
}
|
||
}
|
||
],
|
||
"output_templates": [
|
||
"templates/银豹-采购单模板.xls"
|
||
],
|
||
"current_template_index": 0
|
||
},
|
||
{
|
||
"name": "通用食品供应商",
|
||
"description": "通用食品类供应商订单",
|
||
"filename_patterns": [
|
||
"*食品*",
|
||
"*配送*",
|
||
"*供货*"
|
||
],
|
||
"content_indicators": [
|
||
"产品条码",
|
||
"订购量",
|
||
"进货价"
|
||
],
|
||
"column_mapping": {
|
||
"产品条码": "barcode",
|
||
"产品名称": "name",
|
||
"订购量": "quantity",
|
||
"进货价": "unit_price"
|
||
},
|
||
"cleaning_rules": [
|
||
{
|
||
"type": "convert_type",
|
||
"columns": [
|
||
"unit_price"
|
||
],
|
||
"target_type": "float"
|
||
},
|
||
{
|
||
"type": "fill_na",
|
||
"columns": [
|
||
"barcode",
|
||
"name",
|
||
"quantity"
|
||
],
|
||
"value": 0
|
||
}
|
||
],
|
||
"output_suffix": "_食品供应商_银豹采购单",
|
||
"rules": [
|
||
{
|
||
"type": "split_quantity_unit",
|
||
"source": "订购量"
|
||
},
|
||
{
|
||
"type": "extract_spec_from_name",
|
||
"source": "产品名称"
|
||
},
|
||
{
|
||
"type": "normalize_unit",
|
||
"target": "unit",
|
||
"map": {
|
||
"箱": "件",
|
||
"提": "件",
|
||
"盒": "件"
|
||
}
|
||
},
|
||
{
|
||
"type": "compute_quantity_from_total"
|
||
},
|
||
{
|
||
"type": "mark_gift"
|
||
},
|
||
{
|
||
"type": "fill_missing",
|
||
"fills": {
|
||
"unit": "瓶"
|
||
}
|
||
}
|
||
],
|
||
"output_templates": [
|
||
"templates/银豹-采购单模板.xls"
|
||
],
|
||
"current_template_index": 0
|
||
},
|
||
{
|
||
"name": "农夫山泉",
|
||
"description": "",
|
||
"filename_patterns": [],
|
||
"content_indicators": [],
|
||
"column_mapping": {
|
||
"条形码": "barcode",
|
||
"商品名称": "name",
|
||
"销售价": "unit_price",
|
||
"订单金额": "total_price",
|
||
"Unnamed: 0": "supplier",
|
||
"备注": "brand"
|
||
},
|
||
"header_row": 0,
|
||
"rules": [
|
||
{
|
||
"type": "split_quantity_unit",
|
||
"source": "订单数量"
|
||
},
|
||
{
|
||
"type": "extract_spec_from_name",
|
||
"source": "name"
|
||
},
|
||
{
|
||
"type": "normalize_unit",
|
||
"target": "unit",
|
||
"map": {
|
||
"箱": "件",
|
||
"提": "件",
|
||
"盒": "件"
|
||
}
|
||
},
|
||
{
|
||
"type": "compute_quantity_from_total"
|
||
},
|
||
{
|
||
"type": "mark_gift"
|
||
},
|
||
{
|
||
"type": "fill_missing",
|
||
"fills": {
|
||
"unit": "瓶"
|
||
}
|
||
}
|
||
],
|
||
"dictionary": {
|
||
"ignore_words": [
|
||
"白膜",
|
||
"彩膜",
|
||
"赠品"
|
||
],
|
||
"unit_synonyms": {
|
||
"箱": "件",
|
||
"提": "件",
|
||
"盒": "件",
|
||
"瓶": "瓶"
|
||
},
|
||
"pack_multipliers": {
|
||
"件": 24,
|
||
"箱": 24,
|
||
"提": 12,
|
||
"盒": 10
|
||
},
|
||
"name_patterns": [
|
||
"(\\d+(?:\\.\\d+)?)(ml|mL|ML|l|L|升|毫升)[*×xX](\\d+)",
|
||
"(\\d+)[*×xX](\\d+)瓶",
|
||
"(\\d{2,3}).*?(\\d{1,3})"
|
||
],
|
||
"default_unit": "瓶",
|
||
"default_package_quantity": 1
|
||
},
|
||
"output_templates": [
|
||
"templates/银豹-采购单模板.xls"
|
||
],
|
||
"current_template_index": 0
|
||
}
|
||
]
|
||
}
|