@
feat: 商品记忆库 — 从OCR结果学习,逐步替代OCR识别 - 扩展 product_db.py: schema迁移(specification/source/confidence/usage_count/last_seen) + 学习逻辑(learn_from_product)、置信度系统、批量查询、导入导出、云端同步 - 注入处理管线: processor.py 在提取产品后调用 _apply_memory() 用记忆补全OCR + _is_spec_suspicious() 检测OCR规格质量,处理完后自动学习 - order_service.py 创建共享 ProductDatabase 实例 - dialog_utils.py 新增商品记忆库云端同步条目 - 新建 memory_editor.py: Treeview查看/编辑/搜索/删除/重新导入 - main_window.py 系统设置区新增"商品记忆库"按钮 - build_exe.py 添加 memory_editor 到 hidden_imports @
This commit is contained in:
@@ -29,9 +29,16 @@ class OrderService:
|
||||
"""
|
||||
logger.info("初始化OrderService")
|
||||
self.config = config or ConfigManager()
|
||||
|
||||
|
||||
# 创建共享的商品数据库实例
|
||||
db_path = self.config.get_path('Paths', 'product_db', fallback='data/product_cache.db') if hasattr(self.config, 'get_path') else 'data/product_cache.db'
|
||||
tpl_folder = self.config.get('Paths', 'template_folder', fallback='templates')
|
||||
item_data = self.config.get('Templates', 'item_data', fallback='商品资料.xlsx')
|
||||
tpl_path = os.path.join(tpl_folder, item_data)
|
||||
self.product_db = ProductDatabase(db_path, tpl_path)
|
||||
|
||||
# 创建Excel处理器和采购单合并器
|
||||
self.excel_processor = ExcelProcessor(self.config)
|
||||
self.excel_processor = ExcelProcessor(self.config, product_db=self.product_db)
|
||||
self.order_merger = PurchaseOrderMerger(self.config)
|
||||
|
||||
logger.info("OrderService初始化完成")
|
||||
@@ -195,18 +202,11 @@ class OrderService:
|
||||
"""
|
||||
try:
|
||||
import pandas as pd
|
||||
import os
|
||||
from app.core.utils.file_utils import smart_read_excel
|
||||
from app.core.handlers.column_mapper import ColumnMapper as CM
|
||||
|
||||
config = ConfigManager()
|
||||
template_folder = config.get('Paths', 'template_folder', fallback='templates')
|
||||
item_data = config.get('Templates', 'item_data', fallback='商品资料.xlsx')
|
||||
item_path = os.path.join(template_folder, item_data)
|
||||
product_db_path = config.get('Paths', 'product_db', fallback='data/product_cache.db')
|
||||
|
||||
# 使用 SQLite 查询商品进货价
|
||||
product_db = ProductDatabase(product_db_path, item_path)
|
||||
# 使用共享的商品数据库实例
|
||||
product_db = self.product_db
|
||||
|
||||
# 读取待校验的采购单
|
||||
df_res = smart_read_excel(result_path)
|
||||
|
||||
Reference in New Issue
Block a user