e4d62df7e3
- 智能供应商识别(蓉城易购/烟草/杨碧月/通用) - 百度 OCR 表格识别集成 - 规则引擎(列映射/数据清洗/单位转换/规格推断) - 条码映射管理与云端同步(Gitea REST API) - 云端同步支持:条码映射、供应商配置、商品资料、采购模板 - 拖拽一键处理(图片→OCR→Excel→合并) - 191 个单元测试 - 移除无用的模板管理功能 - 清理 IDE 产物目录 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
"""条码映射编辑模块"""
|
|
|
|
from tkinter import messagebox
|
|
|
|
from app.core.excel.converter import UnitConverter
|
|
from app.core.utils.dialog_utils import show_barcode_mapping_dialog
|
|
|
|
from .logging_ui import add_to_log
|
|
|
|
|
|
def edit_barcode_mappings(log_widget):
|
|
"""编辑条码映射配置"""
|
|
try:
|
|
add_to_log(log_widget, "正在加载条码映射配置...\n", "info")
|
|
|
|
unit_converter = UnitConverter()
|
|
|
|
current_mappings = unit_converter.special_barcodes
|
|
|
|
def save_mappings(new_mappings):
|
|
success = unit_converter.update_barcode_mappings(new_mappings)
|
|
if success:
|
|
add_to_log(log_widget, f"成功保存条码映射配置,共{len(new_mappings)}项\n", "success")
|
|
else:
|
|
add_to_log(log_widget, "保存条码映射配置失败\n", "error")
|
|
|
|
show_barcode_mapping_dialog(None, save_mappings, current_mappings)
|
|
|
|
except Exception as e:
|
|
add_to_log(log_widget, f"编辑条码映射时出错: {str(e)}\n", "error")
|
|
messagebox.showerror("错误", f"编辑条码映射时出错: {str(e)}")
|