feat(excel): 过滤非采购行并改进单位处理

- 在ExcelProcessor中增加备注列检查,过滤包含"换货"、"退货"等关键字的非采购行
- 改进单位处理器的匹配逻辑,支持"件、"、"箱装"等变体格式
- 修复config.ini文件末尾缺少换行符的问题
This commit is contained in:
2026-03-30 10:24:18 +08:00
parent 3e2f46d26d
commit bfccdd3a37
9 changed files with 243 additions and 7 deletions
@@ -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]:
"""