feat(供应商管理): 新增规则引擎与词典配置支持
refactor(处理器): 重构通用供应商处理器以支持规则引擎 docs: 更新README与文档说明供应商管理功能 build: 更新打包脚本注入版本信息 test: 添加规则引擎单元测试
This commit is contained in:
@@ -179,6 +179,14 @@
|
||||
"map_to": "69021343",
|
||||
"description": "条码映射:6923450653012 -> 69021343"
|
||||
},
|
||||
"6923644295844": {
|
||||
"map_to": "6923644285036",
|
||||
"description": "条码映射:6923644295844 -> 6923644285036"
|
||||
},
|
||||
"6907992513157": {
|
||||
"map_to": "6907992513195",
|
||||
"description": "条码映射:6907992513157 -> 6907992513195"
|
||||
},
|
||||
"6925019900087": {
|
||||
"multiplier": 10,
|
||||
"target_unit": "瓶",
|
||||
|
||||
+190
-14
@@ -3,13 +3,26 @@
|
||||
{
|
||||
"name": "蓉城易购",
|
||||
"description": "蓉城易购供应商订单处理",
|
||||
"filename_patterns": ["*蓉城*", "*rongcheng*", "*易*"],
|
||||
"content_indicators": ["蓉城易购", "商品编码", "订货数量"],
|
||||
"filename_patterns": [
|
||||
"*蓉城*",
|
||||
"*rongcheng*",
|
||||
"*易*"
|
||||
],
|
||||
"content_indicators": [
|
||||
"蓉城易购",
|
||||
"商品编码",
|
||||
"订货数量"
|
||||
],
|
||||
"column_mapping": {
|
||||
"商品编码": "barcode",
|
||||
"商品名称": "name",
|
||||
"订货数量": "quantity",
|
||||
"单价": "unit_price"
|
||||
"商品条码(小条码)": "barcode",
|
||||
"商品名称": "name",
|
||||
"规格": "specification",
|
||||
"订购数量(小单位)": "quantity",
|
||||
"单位": "unit",
|
||||
"单价(小单位)": "unit_price",
|
||||
"优惠后金额(小单位)": "total_price",
|
||||
"备注": "category",
|
||||
"行号": "supplier"
|
||||
},
|
||||
"cleaning_rules": [
|
||||
{
|
||||
@@ -18,7 +31,9 @@
|
||||
},
|
||||
{
|
||||
"type": "fill_na",
|
||||
"columns": ["unit_price"],
|
||||
"columns": [
|
||||
"unit_price"
|
||||
],
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
@@ -30,13 +45,57 @@
|
||||
"factor": 1
|
||||
}
|
||||
],
|
||||
"output_suffix": "_蓉城易购_银豹采购单"
|
||||
"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": ["产品条码", "订购量", "进货价"],
|
||||
"filename_patterns": [
|
||||
"*食品*",
|
||||
"*配送*",
|
||||
"*供货*"
|
||||
],
|
||||
"content_indicators": [
|
||||
"产品条码",
|
||||
"订购量",
|
||||
"进货价"
|
||||
],
|
||||
"column_mapping": {
|
||||
"产品条码": "barcode",
|
||||
"产品名称": "name",
|
||||
@@ -46,16 +105,133 @@
|
||||
"cleaning_rules": [
|
||||
{
|
||||
"type": "convert_type",
|
||||
"columns": ["unit_price"],
|
||||
"columns": [
|
||||
"unit_price"
|
||||
],
|
||||
"target_type": "float"
|
||||
},
|
||||
{
|
||||
"type": "fill_na",
|
||||
"columns": ["barcode", "name", "quantity"],
|
||||
"columns": [
|
||||
"barcode",
|
||||
"name",
|
||||
"quantity"
|
||||
],
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"output_suffix": "_食品供应商_银豹采购单"
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user