feat(excel): 过滤非采购行并改进单位处理
- 在ExcelProcessor中增加备注列检查,过滤包含"换货"、"退货"等关键字的非采购行 - 改进单位处理器的匹配逻辑,支持"件、"、"箱装"等变体格式 - 修复config.ini文件末尾缺少换行符的问题
This commit is contained in:
@@ -63,8 +63,9 @@ class JianUnitHandler(UnitHandler):
|
||||
Returns:
|
||||
是否可以处理
|
||||
"""
|
||||
unit = product.get('unit', '')
|
||||
return unit == '件'
|
||||
unit = str(product.get('unit', '')).strip()
|
||||
# 匹配"件"、"件、"、"件装"等
|
||||
return unit == '件' or unit.startswith('件')
|
||||
|
||||
def handle(self, product: Dict[str, Any], level1: int, level2: int, level3: Optional[int]) -> Dict[str, Any]:
|
||||
"""
|
||||
@@ -117,8 +118,9 @@ class BoxUnitHandler(UnitHandler):
|
||||
Returns:
|
||||
是否可以处理
|
||||
"""
|
||||
unit = product.get('unit', '')
|
||||
return unit == '箱'
|
||||
unit = str(product.get('unit', '')).strip()
|
||||
# 匹配"箱"、"箱、"、"箱装"等
|
||||
return unit == '箱' or unit.startswith('箱')
|
||||
|
||||
def handle(self, product: Dict[str, Any], level1: int, level2: int, level3: Optional[int]) -> Dict[str, Any]:
|
||||
"""
|
||||
@@ -171,8 +173,8 @@ class TiHeUnitHandler(UnitHandler):
|
||||
Returns:
|
||||
是否可以处理
|
||||
"""
|
||||
unit = product.get('unit', '')
|
||||
return unit in ['提', '盒']
|
||||
unit = str(product.get('unit', '')).strip()
|
||||
return unit in ['提', '盒'] or unit.startswith('提') or unit.startswith('盒')
|
||||
|
||||
def handle(self, product: Dict[str, Any], level1: int, level2: int, level3: Optional[int]) -> Dict[str, Any]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user