diff --git a/app/core/excel/__pycache__/converter.cpython-39.pyc b/app/core/excel/__pycache__/converter.cpython-39.pyc index ab54b9a..a4bc686 100644 Binary files a/app/core/excel/__pycache__/converter.cpython-39.pyc and b/app/core/excel/__pycache__/converter.cpython-39.pyc differ diff --git a/app/core/excel/__pycache__/processor.cpython-39.pyc b/app/core/excel/__pycache__/processor.cpython-39.pyc index 9e63beb..96795de 100644 Binary files a/app/core/excel/__pycache__/processor.cpython-39.pyc and b/app/core/excel/__pycache__/processor.cpython-39.pyc differ diff --git a/app/core/excel/converter.py b/app/core/excel/converter.py index a0cfd39..30c11d4 100644 --- a/app/core/excel/converter.py +++ b/app/core/excel/converter.py @@ -301,8 +301,8 @@ class UnitConverter: if unit in ['提', '盒']: # 如果是三级规格,按件处理 if level3 is not None: - # 计算包装数量 - packaging_count = level2 * level3 + # 计算包装数量 - 只乘以最后一级数量 + packaging_count = level3 # 数量×包装数量 new_quantity = quantity * packaging_count diff --git a/app/core/excel/processor.py b/app/core/excel/processor.py index 0919dad..c36affe 100644 --- a/app/core/excel/processor.py +++ b/app/core/excel/processor.py @@ -171,14 +171,40 @@ class ExcelProcessor: possible_barcode_columns = [ '条码', '条形码', '商品条码', '商品条形码', '商品编码', '商品编号', '条形码', '条码(必填)', - 'barcode', 'Barcode', '编码', '条形码' + 'barcode', 'Barcode', '编码', '条形码', '电脑条码', + '条码ID', '产品条码', 'BarCode' ] found_columns = [] + + # 检查精确匹配 for col in df.columns: col_str = str(col).strip() if col_str in possible_barcode_columns: found_columns.append(col) + logger.info(f"找到精确匹配的条码列: {col_str}") + + # 如果找不到精确匹配,尝试部分匹配 + if not found_columns: + for col in df.columns: + col_str = str(col).strip().lower() + for keyword in ['条码', '条形码', 'barcode', '编码']: + if keyword.lower() in col_str: + found_columns.append(col) + logger.info(f"找到部分匹配的条码列: {col} (包含关键词: {keyword})") + break + + # 如果仍然找不到,尝试使用数据特征识别 + if not found_columns and len(df) > 0: + for col in df.columns: + # 检查此列数据是否符合条码特征 + sample_values = df[col].dropna().astype(str).tolist()[:10] # 取前10个非空值 + + if sample_values and all(len(val) >= 8 and len(val) <= 14 for val in sample_values): + # 大多数条码长度在8-14之间 + if all(val.isdigit() for val in sample_values): + found_columns.append(col) + logger.info(f"基于数据特征识别的可能条码列: {col}") return found_columns @@ -192,6 +218,10 @@ class ExcelProcessor: Returns: 商品信息列表 """ + # 清理数据:移除全空行 + df = df.dropna(how='all') + logger.info(f"移除空行后,有效数据行数: {len(df)}") + # 提取有用的列 barcode_cols = self.extract_barcode(df) @@ -202,36 +232,53 @@ class ExcelProcessor: # 定义列名映射 column_mapping = { - 'name': ['商品名称', '名称', '品名', '商品', '商品名', '商品或服务名称', '品项名'], - 'specification': ['规格', '规格型号', '型号', '商品规格'], - 'quantity': ['数量', '采购数量', '购买数量', '采购数量', '订单数量', '数量(必填)'], - 'unit': ['单位', '采购单位', '计量单位', '单位(必填)'], - 'price': ['单价', '价格', '采购单价', '销售价', '进货价', '单价(必填)'] + 'name': ['商品名称', '名称', '品名', '商品', '商品名', '商品或服务名称', '品项名', '产品名称', '品项'], + 'specification': ['规格', '规格型号', '型号', '商品规格', '产品规格', '包装规格'], + 'quantity': ['数量', '采购数量', '购买数量', '采购数量', '订单数量', '数量(必填)', '入库数', '入库数量'], + 'unit': ['单位', '采购单位', '计量单位', '单位(必填)', '单位名称', '计价单位'], + 'price': ['单价', '价格', '采购单价', '销售价', '进货价', '单价(必填)', '采购价', '参考价', '入库单价'] } # 映射列名到标准名称 mapped_columns = {'barcode': barcode_cols[0]} # 使用第一个找到的条码列 + # 记录列名映射详情 + logger.info(f"使用条码列: {mapped_columns['barcode']}") + for target, possible_names in column_mapping.items(): for col in df.columns: col_str = str(col).strip() for name in possible_names: if col_str == name: mapped_columns[target] = col + logger.info(f"找到{target}列: {col}") break if target in mapped_columns: break + + # 如果没有找到精确匹配,尝试部分匹配 + if target not in mapped_columns: + for col in df.columns: + col_str = str(col).strip().lower() + for name in possible_names: + if name.lower() in col_str: + mapped_columns[target] = col + logger.info(f"找到{target}列(部分匹配): {col}") + break + if target in mapped_columns: + break logger.info(f"列名映射结果: {mapped_columns}") # 提取商品信息 products = [] - for _, row in df.iterrows(): + for idx, row in df.iterrows(): barcode = row.get(mapped_columns['barcode']) # 跳过空行或无效条码 if pd.isna(barcode) or not self.validate_barcode(barcode): + logger.debug(f"跳过第{idx+1}行: 条码为空或无效 [{barcode}]") continue # 创建商品信息字典 @@ -244,9 +291,12 @@ class ExcelProcessor: 'price': extract_number(str(row.get(mapped_columns.get('price', ''), 0))) or 0 } + logger.info(f"第{idx+1}行: 提取商品信息 条码={product['barcode']}, 名称={product['name']}, 规格={product['specification']}, 数量={product['quantity']}, 单位={product['unit']}, 单价={product['price']}") + # 如果商品名称为空但商品条码不为空,则使用条码作为名称 if not product['name'] and product['barcode']: product['name'] = f"商品 ({product['barcode']})" + logger.info(f"商品名称为空,使用条码作为名称: {product['name']}") # 推断规格 if not product['specification'] and product['name']: @@ -257,7 +307,7 @@ class ExcelProcessor: # 单位处理:如果单位为空但数量包含单位信息 quantity_str = str(row.get(mapped_columns.get('quantity', ''), '')) - if not product['unit'] and '数量' in mapped_columns: + if not product['unit'] and 'quantity' in mapped_columns: num, unit = self.unit_converter.extract_unit_from_quantity(quantity_str) if unit: product['unit'] = unit @@ -398,6 +448,77 @@ class ExcelProcessor: logger.error(f"填充模板时出错: {e}") return False + def _find_header_row(self, df: pd.DataFrame) -> Optional[int]: + """ + 自动识别表头行 + + 通过多种规则识别表头: + 1. 检查行是否包含典型的表头关键词(条码、商品名称、数量等) + 2. 检查是否是第一个非空行 + 3. 检查行是否有较多的字符串类型单元格(表头通常是字符串) + + Args: + df: 数据帧 + + Returns: + 表头行索引,如果未找到则返回None + """ + # 定义可能的表头关键词 + header_keywords = [ + '条码', '条形码', '商品条码', '商品名称', '名称', '数量', '单位', '单价', + '规格', '商品编码', '采购数量', '采购单位', '商品', '品名' + ] + + # 存储每行的匹配分数 + row_scores = [] + + # 遍历前10行(通常表头不会太靠后) + max_rows_to_check = min(10, len(df)) + for row in range(max_rows_to_check): + row_data = df.iloc[row] + score = 0 + + # 检查1: 关键词匹配 + for cell in row_data: + if isinstance(cell, str): + cell_clean = str(cell).strip().lower() + for keyword in header_keywords: + if keyword.lower() in cell_clean: + score += 5 # 每匹配一个关键词加5分 + + # 检查2: 非空单元格比例 + non_empty_cells = row_data.count() + if non_empty_cells / len(row_data) > 0.5: # 如果超过一半的单元格有内容 + score += 2 + + # 检查3: 字符串类型单元格比例 + string_cells = sum(1 for cell in row_data if isinstance(cell, str)) + if string_cells / len(row_data) > 0.5: # 如果超过一半的单元格是字符串 + score += 3 + + row_scores.append((row, score)) + + # 日志记录每行的评分情况 + logger.debug(f"第{row+1}行评分: {score},内容: {row_data.values}") + + # 按评分排序 + row_scores.sort(key=lambda x: x[1], reverse=True) + + # 如果最高分达到一定阈值,认为是表头 + if row_scores and row_scores[0][1] >= 5: + best_row = row_scores[0][0] + logger.info(f"找到可能的表头行: 第{best_row+1}行,评分: {row_scores[0][1]}") + return best_row + + # 如果没有找到明确的表头,尝试找第一个非空行 + for row in range(len(df)): + if df.iloc[row].notna().sum() > 3: # 至少有3个非空单元格 + logger.info(f"未找到明确表头,使用第一个有效行: 第{row+1}行") + return row + + logger.warning("无法识别表头行") + return None + def process_specific_file(self, file_path: str) -> Optional[str]: """ 处理指定的Excel文件 @@ -415,10 +536,22 @@ class ExcelProcessor: return None try: - # 读取Excel文件 - df = pd.read_excel(file_path) + # 读取Excel文件时不立即指定表头 + df = pd.read_excel(file_path, header=None) logger.info(f"成功读取Excel文件: {file_path}, 共 {len(df)} 行") + # 自动识别表头行 + header_row = self._find_header_row(df) + if header_row is None: + logger.error("无法识别表头行") + return None + + logger.info(f"识别到表头在第 {header_row+1} 行") + + # 重新读取Excel,正确指定表头行 + df = pd.read_excel(file_path, header=header_row) + logger.info(f"使用表头行重新读取数据,共 {len(df)} 行有效数据") + # 提取商品信息 products = self.extract_product_info(df) diff --git a/data/output/processed_files.json b/data/output/processed_files.json index 077404a..3cc8c6b 100644 --- a/data/output/processed_files.json +++ b/data/output/processed_files.json @@ -1,3 +1,3 @@ { - + "D:\\My Documents\\python\\orc-order-v2\\data\\output\\微信图片_20250227193150(1).xlsx": "D:\\My Documents\\python\\orc-order-v2\\data\\output\\采购单_微信图片_20250227193150(1).xls" } \ No newline at end of file diff --git a/data/output/微信图片_20250227193150(1).xlsx b/data/output/微信图片_20250227193150(1).xlsx index ba11083..7db12e3 100644 Binary files a/data/output/微信图片_20250227193150(1).xlsx and b/data/output/微信图片_20250227193150(1).xlsx differ diff --git a/data/output/采购单_微信图片_20250227193150(1).xls b/data/output/采购单_微信图片_20250227193150(1).xls new file mode 100644 index 0000000..e843746 Binary files /dev/null and b/data/output/采购单_微信图片_20250227193150(1).xls differ diff --git a/logs/__main__.active b/logs/__main__.active index ab58f88..b92430b 100644 --- a/logs/__main__.active +++ b/logs/__main__.active @@ -1 +1 @@ -Active since: 2025-05-02 18:01:40 \ No newline at end of file +Active since: 2025-05-02 18:41:16 \ No newline at end of file diff --git a/logs/__main__.log b/logs/__main__.log index 108033a..cb62039 100644 --- a/logs/__main__.log +++ b/logs/__main__.log @@ -37,3 +37,15 @@ 2025-05-02 18:01:28,275 - __main__ - ERROR - Excel处理失败 2025-05-02 18:01:40,472 - __main__ - INFO - 处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx 2025-05-02 18:01:41,097 - __main__ - ERROR - Excel处理失败 +2025-05-02 18:16:10,314 - __main__ - INFO - 处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:16:10,959 - __main__ - ERROR - Excel处理失败 +2025-05-02 18:27:30,083 - __main__ - INFO - 处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:27:30,957 - __main__ - INFO - Excel处理成功,输出文件: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls +2025-05-02 18:31:29,329 - __main__ - INFO - 处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:31:31,503 - __main__ - INFO - Excel处理成功,输出文件: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls +2025-05-02 18:33:05,104 - __main__ - INFO - 处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:33:07,377 - __main__ - INFO - Excel处理成功,输出文件: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls +2025-05-02 18:38:52,881 - __main__ - INFO - 处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:38:56,890 - __main__ - INFO - Excel处理成功,输出文件: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls +2025-05-02 18:41:16,744 - __main__ - INFO - 处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:41:17,402 - __main__ - INFO - Excel处理成功,输出文件: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls diff --git a/logs/app.core.excel.converter.active b/logs/app.core.excel.converter.active index ab58f88..b92430b 100644 --- a/logs/app.core.excel.converter.active +++ b/logs/app.core.excel.converter.active @@ -1 +1 @@ -Active since: 2025-05-02 18:01:40 \ No newline at end of file +Active since: 2025-05-02 18:41:16 \ No newline at end of file diff --git a/logs/app.core.excel.converter.log b/logs/app.core.excel.converter.log index ae51455..2edb649 100644 --- a/logs/app.core.excel.converter.log +++ b/logs/app.core.excel.converter.log @@ -69,3 +69,77 @@ 2025-05-02 17:57:42,346 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 2025-05-02 17:57:42,346 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 2025-05-02 17:57:42,346 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 +2025-05-02 18:27:30,825 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:27:30,825 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:27:30,826 - app.core.excel.converter - INFO - 特殊条码处理: 6925019900087, 数量: 1.0 -> 10.0, 单价: 55.0 -> 5.5, 单位: 副 -> 瓶 +2025-05-02 18:27:30,826 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:27:30,826 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:27:30,827 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:27:30,827 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:27:30,827 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:27:30,827 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 65.0 -> 4.333333333333333, 单位: 件 -> 瓶 +2025-05-02 18:27:30,828 - app.core.excel.converter - INFO - 解析三级规格: 1*6*15 -> 1*6*15 +2025-05-02 18:27:30,828 - app.core.excel.converter - INFO - 提/盒单位(三级规格)处理: 数量: 1.0 -> 90.0, 单价: 65.0 -> 0.7222222222222222, 单位: 提 -> 瓶 +2025-05-02 18:27:30,828 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:27:30,828 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 +2025-05-02 18:27:30,829 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:27:30,829 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 +2025-05-02 18:31:29,887 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:31:29,887 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:31:29,887 - app.core.excel.converter - INFO - 特殊条码处理: 6925019900087, 数量: 1.0 -> 10.0, 单价: 55.0 -> 5.5, 单位: 副 -> 瓶 +2025-05-02 18:31:29,888 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:31:29,888 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:31:29,888 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:31:29,888 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:31:29,889 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:31:29,889 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 65.0 -> 4.333333333333333, 单位: 件 -> 瓶 +2025-05-02 18:31:29,889 - app.core.excel.converter - INFO - 解析三级规格: 1*6*15 -> 1*6*15 +2025-05-02 18:31:29,890 - app.core.excel.converter - INFO - 提/盒单位(三级规格)处理: 数量: 1.0 -> 90.0, 单价: 65.0 -> 0.7222222222222222, 单位: 提 -> 瓶 +2025-05-02 18:31:29,890 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:31:29,890 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 +2025-05-02 18:31:29,891 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:31:29,891 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 +2025-05-02 18:31:29,891 - app.core.excel.converter - INFO - 解析三级规格: 1*9*8 -> 1*9*8 +2025-05-02 18:31:29,896 - app.core.excel.converter - INFO - 提/盒单位(三级规格)处理: 数量: 1.0 -> 72.0, 单价: 16.0 -> 0.2222222222222222, 单位: 盒 -> 瓶 +2025-05-02 18:33:05,848 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:33:05,848 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:33:05,849 - app.core.excel.converter - INFO - 特殊条码处理: 6925019900087, 数量: 1.0 -> 10.0, 单价: 55.0 -> 5.5, 单位: 副 -> 瓶 +2025-05-02 18:33:05,849 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:33:05,849 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:33:05,850 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:33:05,850 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:33:05,851 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:33:05,851 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 65.0 -> 4.333333333333333, 单位: 件 -> 瓶 +2025-05-02 18:33:05,851 - app.core.excel.converter - INFO - 解析三级规格: 1*6*15 -> 1*6*15 +2025-05-02 18:33:05,851 - app.core.excel.converter - INFO - 提/盒单位(三级规格)处理: 数量: 1.0 -> 90.0, 单价: 65.0 -> 0.7222222222222222, 单位: 提 -> 瓶 +2025-05-02 18:33:05,851 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:33:05,851 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 +2025-05-02 18:33:05,852 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:33:05,852 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 +2025-05-02 18:33:05,852 - app.core.excel.converter - INFO - 解析三级规格: 1*9*8 -> 1*9*8 +2025-05-02 18:33:05,865 - app.core.excel.converter - INFO - 提/盒单位(三级规格)处理: 数量: 1.0 -> 72.0, 单价: 16.0 -> 0.2222222222222222, 单位: 盒 -> 瓶 +2025-05-02 18:38:53,628 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:38:53,628 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:38:53,630 - app.core.excel.converter - INFO - 特殊条码处理: 6925019900087, 数量: 1.0 -> 10.0, 单价: 55.0 -> 5.5, 单位: 副 -> 瓶 +2025-05-02 18:38:53,630 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:38:53,631 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:38:53,632 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:38:53,632 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 55.0 -> 3.6666666666666665, 单位: 件 -> 瓶 +2025-05-02 18:38:53,634 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:38:53,635 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 65.0 -> 4.333333333333333, 单位: 件 -> 瓶 +2025-05-02 18:38:53,636 - app.core.excel.converter - INFO - 解析三级规格: 1*6*15 -> 1*6*15 +2025-05-02 18:38:53,636 - app.core.excel.converter - INFO - 提/盒单位(三级规格)处理: 数量: 1.0 -> 15.0, 单价: 65.0 -> 4.333333333333333, 单位: 提 -> 瓶 +2025-05-02 18:38:53,637 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:38:53,638 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 +2025-05-02 18:38:53,640 - app.core.excel.converter - INFO - 解析二级规格: 1*15 -> 1*15 +2025-05-02 18:38:53,640 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 15.0, 单价: 0 -> 0, 单位: 件 -> 瓶 +2025-05-02 18:38:53,666 - app.core.excel.converter - INFO - 解析三级规格: 1*9*8 -> 1*9*8 +2025-05-02 18:38:53,666 - app.core.excel.converter - INFO - 提/盒单位(三级规格)处理: 数量: 1.0 -> 8.0, 单价: 16.0 -> 2.0, 单位: 盒 -> 瓶 +2025-05-02 18:41:17,311 - app.core.excel.converter - INFO - 从名称推断规格(入): 无糖茶栀栀乌龙*15入纸箱 -> 1*5 +2025-05-02 18:41:17,311 - app.core.excel.converter - INFO - 解析二级规格: 1*5 -> 1*5 +2025-05-02 18:41:17,311 - app.core.excel.converter - INFO - 件单位处理: 数量: 1.0 -> 5.0, 单价: 55.0 -> 11.0, 单位: 件 -> 瓶 +2025-05-02 18:41:17,312 - app.core.excel.converter - INFO - 从名称推断规格(入): 无糖茶茉莉龙井16入纸箱 -> 1*6 +2025-05-02 18:41:17,312 - app.core.excel.converter - INFO - 特殊条码处理: 6925019900087, 数量: 1.0 -> 10.0, 单价: 55.0 -> 5.5, 单位: 副 -> 瓶 +2025-05-02 18:41:17,314 - app.core.excel.converter - INFO - 从名称推断规格(入): 450ml轻乳茶大红袍乌龙12入纸箱 -> 1*2 +2025-05-02 18:41:17,315 - app.core.excel.converter - INFO - 解析二级规格: 1*2 -> 1*2 +2025-05-02 18:41:17,315 - app.core.excel.converter - INFO - 提/盒单位(二级规格)处理: 保持原样 数量: 1.0, 单价: 65.0, 单位: 提 diff --git a/logs/app.core.excel.merger.active b/logs/app.core.excel.merger.active index ab58f88..b92430b 100644 --- a/logs/app.core.excel.merger.active +++ b/logs/app.core.excel.merger.active @@ -1 +1 @@ -Active since: 2025-05-02 18:01:40 \ No newline at end of file +Active since: 2025-05-02 18:41:16 \ No newline at end of file diff --git a/logs/app.core.excel.merger.log b/logs/app.core.excel.merger.log index 8120af7..ccaa994 100644 --- a/logs/app.core.excel.merger.log +++ b/logs/app.core.excel.merger.log @@ -40,3 +40,15 @@ 2025-05-02 18:01:27,765 - app.core.excel.merger - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls 2025-05-02 18:01:40,471 - app.core.excel.merger - INFO - 初始化PurchaseOrderMerger 2025-05-02 18:01:40,472 - app.core.excel.merger - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:16:10,313 - app.core.excel.merger - INFO - 初始化PurchaseOrderMerger +2025-05-02 18:16:10,314 - app.core.excel.merger - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:27:30,081 - app.core.excel.merger - INFO - 初始化PurchaseOrderMerger +2025-05-02 18:27:30,082 - app.core.excel.merger - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:31:29,327 - app.core.excel.merger - INFO - 初始化PurchaseOrderMerger +2025-05-02 18:31:29,328 - app.core.excel.merger - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:33:05,101 - app.core.excel.merger - INFO - 初始化PurchaseOrderMerger +2025-05-02 18:33:05,103 - app.core.excel.merger - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:38:52,880 - app.core.excel.merger - INFO - 初始化PurchaseOrderMerger +2025-05-02 18:38:52,881 - app.core.excel.merger - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:41:16,743 - app.core.excel.merger - INFO - 初始化PurchaseOrderMerger +2025-05-02 18:41:16,743 - app.core.excel.merger - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls diff --git a/logs/app.core.excel.processor.active b/logs/app.core.excel.processor.active index ab58f88..b92430b 100644 --- a/logs/app.core.excel.processor.active +++ b/logs/app.core.excel.processor.active @@ -1 +1 @@ -Active since: 2025-05-02 18:01:40 \ No newline at end of file +Active since: 2025-05-02 18:41:16 \ No newline at end of file diff --git a/logs/app.core.excel.processor.log b/logs/app.core.excel.processor.log index 1fe2fc9..8d03679 100644 --- a/logs/app.core.excel.processor.log +++ b/logs/app.core.excel.processor.log @@ -163,3 +163,297 @@ 2025-05-02 18:01:41,097 - app.core.excel.processor - INFO - 成功读取Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx, 共 12 行 2025-05-02 18:01:41,097 - app.core.excel.processor - ERROR - 未找到条码列,无法处理 2025-05-02 18:01:41,097 - app.core.excel.processor - WARNING - 未提取到有效商品信息 +2025-05-02 18:16:10,312 - app.core.excel.processor - INFO - 初始化ExcelProcessor +2025-05-02 18:16:10,313 - app.core.excel.processor - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:16:10,314 - app.core.excel.processor - INFO - 开始处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:16:10,958 - app.core.excel.processor - INFO - 成功读取Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx, 共 12 行 +2025-05-02 18:16:10,959 - app.core.excel.processor - ERROR - 未找到条码列,无法处理 +2025-05-02 18:16:10,959 - app.core.excel.processor - WARNING - 未提取到有效商品信息 +2025-05-02 18:27:30,080 - app.core.excel.processor - INFO - 初始化ExcelProcessor +2025-05-02 18:27:30,081 - app.core.excel.processor - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:27:30,083 - app.core.excel.processor - INFO - 开始处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:27:30,780 - app.core.excel.processor - INFO - 成功读取Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx, 共 13 行 +2025-05-02 18:27:30,783 - app.core.excel.processor - INFO - 找到可能的表头行: 第2行,评分: 35 +2025-05-02 18:27:30,783 - app.core.excel.processor - INFO - 识别到表头在第 2 行 +2025-05-02 18:27:30,821 - app.core.excel.processor - INFO - 使用表头行重新读取数据,共 11 行有效数据 +2025-05-02 18:27:30,822 - app.core.excel.processor - INFO - 移除空行后,有效数据行数: 11 +2025-05-02 18:27:30,823 - app.core.excel.processor - INFO - 找到精确匹配的条码列: 条码 +2025-05-02 18:27:30,823 - app.core.excel.processor - INFO - 使用条码列: 条码 +2025-05-02 18:27:30,823 - app.core.excel.processor - INFO - 找到name列(部分匹配): 商品全名 +2025-05-02 18:27:30,823 - app.core.excel.processor - INFO - 找到specification列: 规格 +2025-05-02 18:27:30,823 - app.core.excel.processor - INFO - 找到quantity列: 数量 +2025-05-02 18:27:30,823 - app.core.excel.processor - INFO - 找到unit列: 单位 +2025-05-02 18:27:30,824 - app.core.excel.processor - INFO - 找到price列: 单价 +2025-05-02 18:27:30,824 - app.core.excel.processor - INFO - 列名映射结果: {'barcode': '条码', 'name': '商品全名', 'specification': '规格', 'quantity': '数量', 'unit': '单位', 'price': '单价'} +2025-05-02 18:27:30,825 - app.core.excel.processor - INFO - 第1行: 提取商品信息 条码=6973497202346, 名称=无糖茶栀栀乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:27:30,826 - app.core.excel.processor - INFO - 第2行: 提取商品信息 条码=6925019900087, 名称=无糖茶茉莉龙井, 规格=1*15, 数量=1.0, 单位=副, 单价=55.0 +2025-05-02 18:27:30,826 - app.core.excel.processor - INFO - 第3行: 提取商品信息 条码=6973497200267, 名称=活力水平衡香水柠檬味, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:27:30,827 - app.core.excel.processor - INFO - 第4行: 提取商品信息 条码=6973497200403, 名称=活力水平衡红提味, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:27:30,827 - app.core.excel.processor - INFO - 第5行: 提取商品信息 条码=6873497204449, 名称=450ml轻乳茶桂花乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=65.0 +2025-05-02 18:27:30,828 - app.core.excel.processor - INFO - 第6行: 提取商品信息 条码=6973497204432, 名称=450ml轻乳茶大红袍乌龙, 规格=1*6*15, 数量=1.0, 单位=提, 单价=65.0 +2025-05-02 18:27:30,828 - app.core.excel.processor - INFO - 第7行: 提取商品信息 条码=6973497202360, 名称=无糖茶金桂乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:27:30,829 - app.core.excel.processor - INFO - 第8行: 提取商品信息 条码=6973497202889, 名称=无糖茶青柑乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:27:30,830 - app.core.excel.processor - INFO - 提取到 8 个商品信息 +2025-05-02 18:27:30,840 - app.core.excel.processor - INFO - 开始处理8 个产品信息 +2025-05-02 18:27:30,840 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202346, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:27:30,840 - app.core.excel.processor - INFO - 发现正常商品:条码6973497202346, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:27:30,840 - app.core.excel.processor - INFO - 处理商品: 条码=6925019900087, 数量=10.0, 单价=5.5, 是否赠品=False +2025-05-02 18:27:30,840 - app.core.excel.processor - INFO - 发现正常商品:条码6925019900087, 数量=10.0, 单价=5.5 +2025-05-02 18:27:30,840 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200267, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:27:30,841 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200267, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:27:30,841 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200403, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:27:30,951 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200403, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:27:30,951 - app.core.excel.processor - INFO - 处理商品: 条码=6873497204449, 数量=15.0, 单价=4.333333333333333, 是否赠品=False +2025-05-02 18:27:30,951 - app.core.excel.processor - INFO - 发现正常商品:条码6873497204449, 数量=15.0, 单价=4.333333333333333 +2025-05-02 18:27:30,951 - app.core.excel.processor - INFO - 处理商品: 条码=6973497204432, 数量=90.0, 单价=0.7222222222222222, 是否赠品=False +2025-05-02 18:27:30,951 - app.core.excel.processor - INFO - 发现正常商品:条码6973497204432, 数量=90.0, 单价=0.7222222222222222 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202360, 数量=15.0, 单价=0, 是否赠品=True +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 发现赠品:条码6973497202360, 数量=15.0 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202889, 数量=15.0, 单价=0, 是否赠品=True +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 发现赠品:条码6973497202889, 数量=15.0 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 分组后共8 个不同条码的商品 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 条码 6973497202346 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 条码 6925019900087 处理结果:正常商品数量10.0,单价5.5,赠品数量0 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 条码 6973497200267 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 条码 6973497200403 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 条码 6873497204449 处理结果:正常商品数量15.0,单价4.333333333333333,赠品数量0 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 条码 6973497204432 处理结果:正常商品数量90.0,单价0.7222222222222222,赠品数量0 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 条码 6973497202360 处理结果:只有赠品,数量=15.0 +2025-05-02 18:27:30,952 - app.core.excel.processor - INFO - 条码 6973497202889 处理结果:只有赠品,数量=15.0 +2025-05-02 18:27:30,953 - app.core.excel.processor - INFO - 条码 6973497202360 填充:仅有赠品,采购量=0,赠品数量=15.0 +2025-05-02 18:27:30,953 - app.core.excel.processor - INFO - 条码 6973497202889 填充:仅有赠品,采购量=0,赠品数量=15.0 +2025-05-02 18:27:30,955 - app.core.excel.processor - INFO - 采购单已保存到: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls +2025-05-02 18:31:29,326 - app.core.excel.processor - INFO - 初始化ExcelProcessor +2025-05-02 18:31:29,327 - app.core.excel.processor - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:31:29,329 - app.core.excel.processor - INFO - 开始处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:31:29,849 - app.core.excel.processor - INFO - 成功读取Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx, 共 13 行 +2025-05-02 18:31:29,852 - app.core.excel.processor - INFO - 找到可能的表头行: 第2行,评分: 35 +2025-05-02 18:31:29,852 - app.core.excel.processor - INFO - 识别到表头在第 2 行 +2025-05-02 18:31:29,884 - app.core.excel.processor - INFO - 使用表头行重新读取数据,共 11 行有效数据 +2025-05-02 18:31:29,885 - app.core.excel.processor - INFO - 移除空行后,有效数据行数: 11 +2025-05-02 18:31:29,885 - app.core.excel.processor - INFO - 找到精确匹配的条码列: 条码 +2025-05-02 18:31:29,885 - app.core.excel.processor - INFO - 使用条码列: 条码 +2025-05-02 18:31:29,885 - app.core.excel.processor - INFO - 找到name列(部分匹配): 商品全名 +2025-05-02 18:31:29,885 - app.core.excel.processor - INFO - 找到specification列: 规格 +2025-05-02 18:31:29,886 - app.core.excel.processor - INFO - 找到quantity列: 数量 +2025-05-02 18:31:29,886 - app.core.excel.processor - INFO - 找到unit列: 单位 +2025-05-02 18:31:29,886 - app.core.excel.processor - INFO - 找到price列: 单价 +2025-05-02 18:31:29,886 - app.core.excel.processor - INFO - 列名映射结果: {'barcode': '条码', 'name': '商品全名', 'specification': '规格', 'quantity': '数量', 'unit': '单位', 'price': '单价'} +2025-05-02 18:31:29,886 - app.core.excel.processor - INFO - 第1行: 提取商品信息 条码=6973497202346, 名称=无糖茶栀栀乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:31:29,887 - app.core.excel.processor - INFO - 第2行: 提取商品信息 条码=6925019900087, 名称=无糖茶茉莉龙井, 规格=1*15, 数量=1.0, 单位=副, 单价=55.0 +2025-05-02 18:31:29,888 - app.core.excel.processor - INFO - 第3行: 提取商品信息 条码=6973497200267, 名称=活力水平衡香水柠檬味, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:31:29,888 - app.core.excel.processor - INFO - 第4行: 提取商品信息 条码=6973497200403, 名称=活力水平衡红提味, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:31:29,888 - app.core.excel.processor - INFO - 第5行: 提取商品信息 条码=6873497204449, 名称=450ml轻乳茶桂花乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=65.0 +2025-05-02 18:31:29,889 - app.core.excel.processor - INFO - 第6行: 提取商品信息 条码=6973497204432, 名称=450ml轻乳茶大红袍乌龙, 规格=1*6*15, 数量=1.0, 单位=提, 单价=65.0 +2025-05-02 18:31:29,890 - app.core.excel.processor - INFO - 第7行: 提取商品信息 条码=6973497202360, 名称=无糖茶金桂乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:31:29,891 - app.core.excel.processor - INFO - 第8行: 提取商品信息 条码=6973497202889, 名称=无糖茶青柑乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:31:29,891 - app.core.excel.processor - INFO - 第9行: 提取商品信息 条码=6973497202884, 名称=无糖茶(单瓶), 规格=1*9*8, 数量=1.0, 单位=盒, 单价=16.0 +2025-05-02 18:31:29,896 - app.core.excel.processor - INFO - 提取到 9 个商品信息 +2025-05-02 18:31:29,907 - app.core.excel.processor - INFO - 开始处理9 个产品信息 +2025-05-02 18:31:29,907 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202346, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:31:29,907 - app.core.excel.processor - INFO - 发现正常商品:条码6973497202346, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:31:29,907 - app.core.excel.processor - INFO - 处理商品: 条码=6925019900087, 数量=10.0, 单价=5.5, 是否赠品=False +2025-05-02 18:31:29,907 - app.core.excel.processor - INFO - 发现正常商品:条码6925019900087, 数量=10.0, 单价=5.5 +2025-05-02 18:31:29,907 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200267, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:31:29,907 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200267, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:31:29,907 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200403, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200403, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 处理商品: 条码=6873497204449, 数量=15.0, 单价=4.333333333333333, 是否赠品=False +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 发现正常商品:条码6873497204449, 数量=15.0, 单价=4.333333333333333 +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 处理商品: 条码=6973497204432, 数量=90.0, 单价=0.7222222222222222, 是否赠品=False +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 发现正常商品:条码6973497204432, 数量=90.0, 单价=0.7222222222222222 +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202360, 数量=15.0, 单价=0, 是否赠品=True +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 发现赠品:条码6973497202360, 数量=15.0 +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202889, 数量=15.0, 单价=0, 是否赠品=True +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 发现赠品:条码6973497202889, 数量=15.0 +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202884, 数量=72.0, 单价=0.2222222222222222, 是否赠品=False +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 发现正常商品:条码6973497202884, 数量=72.0, 单价=0.2222222222222222 +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 分组后共9 个不同条码的商品 +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 条码 6973497202346 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 条码 6925019900087 处理结果:正常商品数量10.0,单价5.5,赠品数量0 +2025-05-02 18:31:29,908 - app.core.excel.processor - INFO - 条码 6973497200267 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:31:29,909 - app.core.excel.processor - INFO - 条码 6973497200403 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:31:29,909 - app.core.excel.processor - INFO - 条码 6873497204449 处理结果:正常商品数量15.0,单价4.333333333333333,赠品数量0 +2025-05-02 18:31:29,909 - app.core.excel.processor - INFO - 条码 6973497204432 处理结果:正常商品数量90.0,单价0.7222222222222222,赠品数量0 +2025-05-02 18:31:29,909 - app.core.excel.processor - INFO - 条码 6973497202360 处理结果:只有赠品,数量=15.0 +2025-05-02 18:31:29,909 - app.core.excel.processor - INFO - 条码 6973497202889 处理结果:只有赠品,数量=15.0 +2025-05-02 18:31:29,909 - app.core.excel.processor - INFO - 条码 6973497202884 处理结果:正常商品数量72.0,单价0.2222222222222222,赠品数量0 +2025-05-02 18:31:29,909 - app.core.excel.processor - INFO - 条码 6973497202360 填充:仅有赠品,采购量=0,赠品数量=15.0 +2025-05-02 18:31:29,909 - app.core.excel.processor - INFO - 条码 6973497202889 填充:仅有赠品,采购量=0,赠品数量=15.0 +2025-05-02 18:31:31,499 - app.core.excel.processor - INFO - 采购单已保存到: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls +2025-05-02 18:33:05,100 - app.core.excel.processor - INFO - 初始化ExcelProcessor +2025-05-02 18:33:05,101 - app.core.excel.processor - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:33:05,104 - app.core.excel.processor - INFO - 开始处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:33:05,813 - app.core.excel.processor - INFO - 成功读取Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx, 共 14 行 +2025-05-02 18:33:05,816 - app.core.excel.processor - INFO - 找到可能的表头行: 第3行,评分: 35 +2025-05-02 18:33:05,816 - app.core.excel.processor - INFO - 识别到表头在第 3 行 +2025-05-02 18:33:05,844 - app.core.excel.processor - INFO - 使用表头行重新读取数据,共 11 行有效数据 +2025-05-02 18:33:05,845 - app.core.excel.processor - INFO - 移除空行后,有效数据行数: 11 +2025-05-02 18:33:05,845 - app.core.excel.processor - INFO - 找到精确匹配的条码列: 条码 +2025-05-02 18:33:05,845 - app.core.excel.processor - INFO - 使用条码列: 条码 +2025-05-02 18:33:05,846 - app.core.excel.processor - INFO - 找到name列(部分匹配): 商品全名 +2025-05-02 18:33:05,846 - app.core.excel.processor - INFO - 找到specification列: 规格 +2025-05-02 18:33:05,846 - app.core.excel.processor - INFO - 找到quantity列: 数量 +2025-05-02 18:33:05,846 - app.core.excel.processor - INFO - 找到unit列: 单位 +2025-05-02 18:33:05,846 - app.core.excel.processor - INFO - 找到price列: 单价 +2025-05-02 18:33:05,846 - app.core.excel.processor - INFO - 列名映射结果: {'barcode': '条码', 'name': '商品全名', 'specification': '规格', 'quantity': '数量', 'unit': '单位', 'price': '单价'} +2025-05-02 18:33:05,847 - app.core.excel.processor - INFO - 第1行: 提取商品信息 条码=6973497202346, 名称=无糖茶栀栀乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:33:05,849 - app.core.excel.processor - INFO - 第2行: 提取商品信息 条码=6925019900087, 名称=无糖茶茉莉龙井, 规格=1*15, 数量=1.0, 单位=副, 单价=55.0 +2025-05-02 18:33:05,849 - app.core.excel.processor - INFO - 第3行: 提取商品信息 条码=6973497200267, 名称=活力水平衡香水柠檬味, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:33:05,850 - app.core.excel.processor - INFO - 第4行: 提取商品信息 条码=6973497200403, 名称=活力水平衡红提味, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:33:05,850 - app.core.excel.processor - INFO - 第5行: 提取商品信息 条码=6873497204449, 名称=450ml轻乳茶桂花乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=65.0 +2025-05-02 18:33:05,851 - app.core.excel.processor - INFO - 第6行: 提取商品信息 条码=6973497204432, 名称=450ml轻乳茶大红袍乌龙, 规格=1*6*15, 数量=1.0, 单位=提, 单价=65.0 +2025-05-02 18:33:05,851 - app.core.excel.processor - INFO - 第7行: 提取商品信息 条码=6973497202360, 名称=无糖茶金桂乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:33:05,852 - app.core.excel.processor - INFO - 第8行: 提取商品信息 条码=6973497202889, 名称=无糖茶青柑乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:33:05,852 - app.core.excel.processor - INFO - 第9行: 提取商品信息 条码=6973497202884, 名称=无糖茶(单瓶), 规格=1*9*8, 数量=1.0, 单位=盒, 单价=16.0 +2025-05-02 18:33:05,866 - app.core.excel.processor - INFO - 提取到 9 个商品信息 +2025-05-02 18:33:05,874 - app.core.excel.processor - INFO - 开始处理9 个产品信息 +2025-05-02 18:33:05,874 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202346, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:33:05,874 - app.core.excel.processor - INFO - 发现正常商品:条码6973497202346, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:33:05,874 - app.core.excel.processor - INFO - 处理商品: 条码=6925019900087, 数量=10.0, 单价=5.5, 是否赠品=False +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 发现正常商品:条码6925019900087, 数量=10.0, 单价=5.5 +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200267, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200267, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200403, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200403, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 处理商品: 条码=6873497204449, 数量=15.0, 单价=4.333333333333333, 是否赠品=False +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 发现正常商品:条码6873497204449, 数量=15.0, 单价=4.333333333333333 +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 处理商品: 条码=6973497204432, 数量=90.0, 单价=0.7222222222222222, 是否赠品=False +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 发现正常商品:条码6973497204432, 数量=90.0, 单价=0.7222222222222222 +2025-05-02 18:33:05,875 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202360, 数量=15.0, 单价=0, 是否赠品=True +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 发现赠品:条码6973497202360, 数量=15.0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202889, 数量=15.0, 单价=0, 是否赠品=True +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 发现赠品:条码6973497202889, 数量=15.0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202884, 数量=72.0, 单价=0.2222222222222222, 是否赠品=False +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 发现正常商品:条码6973497202884, 数量=72.0, 单价=0.2222222222222222 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 分组后共9 个不同条码的商品 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 条码 6973497202346 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 条码 6925019900087 处理结果:正常商品数量10.0,单价5.5,赠品数量0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 条码 6973497200267 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 条码 6973497200403 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 条码 6873497204449 处理结果:正常商品数量15.0,单价4.333333333333333,赠品数量0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 条码 6973497204432 处理结果:正常商品数量90.0,单价0.7222222222222222,赠品数量0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 条码 6973497202360 处理结果:只有赠品,数量=15.0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 条码 6973497202889 处理结果:只有赠品,数量=15.0 +2025-05-02 18:33:05,876 - app.core.excel.processor - INFO - 条码 6973497202884 处理结果:正常商品数量72.0,单价0.2222222222222222,赠品数量0 +2025-05-02 18:33:05,877 - app.core.excel.processor - INFO - 条码 6973497202360 填充:仅有赠品,采购量=0,赠品数量=15.0 +2025-05-02 18:33:05,877 - app.core.excel.processor - INFO - 条码 6973497202889 填充:仅有赠品,采购量=0,赠品数量=15.0 +2025-05-02 18:33:07,376 - app.core.excel.processor - INFO - 采购单已保存到: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls +2025-05-02 18:38:52,879 - app.core.excel.processor - INFO - 初始化ExcelProcessor +2025-05-02 18:38:52,880 - app.core.excel.processor - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:38:52,881 - app.core.excel.processor - INFO - 开始处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:38:53,571 - app.core.excel.processor - INFO - 成功读取Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx, 共 14 行 +2025-05-02 18:38:53,574 - app.core.excel.processor - INFO - 找到可能的表头行: 第3行,评分: 35 +2025-05-02 18:38:53,574 - app.core.excel.processor - INFO - 识别到表头在第 3 行 +2025-05-02 18:38:53,621 - app.core.excel.processor - INFO - 使用表头行重新读取数据,共 11 行有效数据 +2025-05-02 18:38:53,623 - app.core.excel.processor - INFO - 移除空行后,有效数据行数: 11 +2025-05-02 18:38:53,623 - app.core.excel.processor - INFO - 找到精确匹配的条码列: 条码 +2025-05-02 18:38:53,624 - app.core.excel.processor - INFO - 使用条码列: 条码 +2025-05-02 18:38:53,624 - app.core.excel.processor - INFO - 找到name列(部分匹配): 商品全名 +2025-05-02 18:38:53,624 - app.core.excel.processor - INFO - 找到specification列: 规格 +2025-05-02 18:38:53,624 - app.core.excel.processor - INFO - 找到quantity列: 数量 +2025-05-02 18:38:53,624 - app.core.excel.processor - INFO - 找到unit列: 单位 +2025-05-02 18:38:53,625 - app.core.excel.processor - INFO - 找到price列: 单价 +2025-05-02 18:38:53,625 - app.core.excel.processor - INFO - 列名映射结果: {'barcode': '条码', 'name': '商品全名', 'specification': '规格', 'quantity': '数量', 'unit': '单位', 'price': '单价'} +2025-05-02 18:38:53,627 - app.core.excel.processor - INFO - 第1行: 提取商品信息 条码=6973497202346, 名称=无糖茶栀栀乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:38:53,629 - app.core.excel.processor - INFO - 第2行: 提取商品信息 条码=6925019900087, 名称=无糖茶茉莉龙井, 规格=1*15, 数量=1.0, 单位=副, 单价=55.0 +2025-05-02 18:38:53,630 - app.core.excel.processor - INFO - 第3行: 提取商品信息 条码=6973497200267, 名称=活力水平衡香水柠檬味, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:38:53,632 - app.core.excel.processor - INFO - 第4行: 提取商品信息 条码=6973497200403, 名称=活力水平衡红提味, 规格=1*15, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:38:53,634 - app.core.excel.processor - INFO - 第5行: 提取商品信息 条码=6873497204449, 名称=450ml轻乳茶桂花乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=65.0 +2025-05-02 18:38:53,635 - app.core.excel.processor - INFO - 第6行: 提取商品信息 条码=6973497204432, 名称=450ml轻乳茶大红袍乌龙, 规格=1*6*15, 数量=1.0, 单位=提, 单价=65.0 +2025-05-02 18:38:53,637 - app.core.excel.processor - INFO - 第7行: 提取商品信息 条码=6973497202360, 名称=无糖茶金桂乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:38:53,639 - app.core.excel.processor - INFO - 第8行: 提取商品信息 条码=6973497202889, 名称=无糖茶青柑乌龙, 规格=1*15, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:38:53,641 - app.core.excel.processor - INFO - 第9行: 提取商品信息 条码=6973497202884, 名称=无糖茶(单瓶), 规格=1*9*8, 数量=1.0, 单位=盒, 单价=16.0 +2025-05-02 18:38:53,667 - app.core.excel.processor - INFO - 提取到 9 个商品信息 +2025-05-02 18:38:53,677 - app.core.excel.processor - INFO - 开始处理9 个产品信息 +2025-05-02 18:38:53,678 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202346, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:38:53,678 - app.core.excel.processor - INFO - 发现正常商品:条码6973497202346, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:38:53,678 - app.core.excel.processor - INFO - 处理商品: 条码=6925019900087, 数量=10.0, 单价=5.5, 是否赠品=False +2025-05-02 18:38:53,678 - app.core.excel.processor - INFO - 发现正常商品:条码6925019900087, 数量=10.0, 单价=5.5 +2025-05-02 18:38:53,678 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200267, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:38:53,678 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200267, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:38:53,678 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200403, 数量=15.0, 单价=3.6666666666666665, 是否赠品=False +2025-05-02 18:38:53,679 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200403, 数量=15.0, 单价=3.6666666666666665 +2025-05-02 18:38:53,679 - app.core.excel.processor - INFO - 处理商品: 条码=6873497204449, 数量=15.0, 单价=4.333333333333333, 是否赠品=False +2025-05-02 18:38:53,680 - app.core.excel.processor - INFO - 发现正常商品:条码6873497204449, 数量=15.0, 单价=4.333333333333333 +2025-05-02 18:38:53,680 - app.core.excel.processor - INFO - 处理商品: 条码=6973497204432, 数量=15.0, 单价=4.333333333333333, 是否赠品=False +2025-05-02 18:38:53,680 - app.core.excel.processor - INFO - 发现正常商品:条码6973497204432, 数量=15.0, 单价=4.333333333333333 +2025-05-02 18:38:53,680 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202360, 数量=15.0, 单价=0, 是否赠品=True +2025-05-02 18:38:53,680 - app.core.excel.processor - INFO - 发现赠品:条码6973497202360, 数量=15.0 +2025-05-02 18:38:53,680 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202889, 数量=15.0, 单价=0, 是否赠品=True +2025-05-02 18:38:53,680 - app.core.excel.processor - INFO - 发现赠品:条码6973497202889, 数量=15.0 +2025-05-02 18:38:53,680 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202884, 数量=8.0, 单价=2.0, 是否赠品=False +2025-05-02 18:38:53,680 - app.core.excel.processor - INFO - 发现正常商品:条码6973497202884, 数量=8.0, 单价=2.0 +2025-05-02 18:38:53,681 - app.core.excel.processor - INFO - 分组后共9 个不同条码的商品 +2025-05-02 18:38:53,682 - app.core.excel.processor - INFO - 条码 6973497202346 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:38:53,683 - app.core.excel.processor - INFO - 条码 6925019900087 处理结果:正常商品数量10.0,单价5.5,赠品数量0 +2025-05-02 18:38:53,683 - app.core.excel.processor - INFO - 条码 6973497200267 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:38:53,683 - app.core.excel.processor - INFO - 条码 6973497200403 处理结果:正常商品数量15.0,单价3.6666666666666665,赠品数量0 +2025-05-02 18:38:53,683 - app.core.excel.processor - INFO - 条码 6873497204449 处理结果:正常商品数量15.0,单价4.333333333333333,赠品数量0 +2025-05-02 18:38:53,683 - app.core.excel.processor - INFO - 条码 6973497204432 处理结果:正常商品数量15.0,单价4.333333333333333,赠品数量0 +2025-05-02 18:38:53,683 - app.core.excel.processor - INFO - 条码 6973497202360 处理结果:只有赠品,数量=15.0 +2025-05-02 18:38:53,683 - app.core.excel.processor - INFO - 条码 6973497202889 处理结果:只有赠品,数量=15.0 +2025-05-02 18:38:53,683 - app.core.excel.processor - INFO - 条码 6973497202884 处理结果:正常商品数量8.0,单价2.0,赠品数量0 +2025-05-02 18:38:53,684 - app.core.excel.processor - INFO - 条码 6973497202360 填充:仅有赠品,采购量=0,赠品数量=15.0 +2025-05-02 18:38:53,684 - app.core.excel.processor - INFO - 条码 6973497202889 填充:仅有赠品,采购量=0,赠品数量=15.0 +2025-05-02 18:38:56,888 - app.core.excel.processor - INFO - 采购单已保存到: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls +2025-05-02 18:41:16,741 - app.core.excel.processor - INFO - 初始化ExcelProcessor +2025-05-02 18:41:16,742 - app.core.excel.processor - INFO - 初始化完成,模板文件: templates\银豹-采购单模板.xls +2025-05-02 18:41:16,744 - app.core.excel.processor - INFO - 开始处理Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:41:17,261 - app.core.excel.processor - INFO - 成功读取Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx, 共 14 行 +2025-05-02 18:41:17,264 - app.core.excel.processor - INFO - 找到可能的表头行: 第3行,评分: 30 +2025-05-02 18:41:17,264 - app.core.excel.processor - INFO - 识别到表头在第 3 行 +2025-05-02 18:41:17,309 - app.core.excel.processor - INFO - 使用表头行重新读取数据,共 11 行有效数据 +2025-05-02 18:41:17,309 - app.core.excel.processor - INFO - 移除空行后,有效数据行数: 11 +2025-05-02 18:41:17,309 - app.core.excel.processor - INFO - 找到精确匹配的条码列: 条码 +2025-05-02 18:41:17,309 - app.core.excel.processor - INFO - 使用条码列: 条码 +2025-05-02 18:41:17,309 - app.core.excel.processor - INFO - 找到name列(部分匹配): 商品全名 +2025-05-02 18:41:17,310 - app.core.excel.processor - INFO - 找到quantity列: 数量 +2025-05-02 18:41:17,310 - app.core.excel.processor - INFO - 找到unit列: 单位 +2025-05-02 18:41:17,310 - app.core.excel.processor - INFO - 找到price列: 单价 +2025-05-02 18:41:17,310 - app.core.excel.processor - INFO - 列名映射结果: {'barcode': '条码', 'name': '商品全名', 'quantity': '数量', 'unit': '单位', 'price': '单价'} +2025-05-02 18:41:17,311 - app.core.excel.processor - INFO - 第1行: 提取商品信息 条码=6973497202346, 名称=无糖茶栀栀乌龙*15入纸箱, 规格=, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:41:17,311 - app.core.excel.processor - INFO - 从商品名称推断规格: 无糖茶栀栀乌龙*15入纸箱 -> 1*5 +2025-05-02 18:41:17,312 - app.core.excel.processor - INFO - 第2行: 提取商品信息 条码=6925019900087, 名称=无糖茶茉莉龙井16入纸箱, 规格=, 数量=1.0, 单位=副, 单价=55.0 +2025-05-02 18:41:17,312 - app.core.excel.processor - INFO - 从商品名称推断规格: 无糖茶茉莉龙井16入纸箱 -> 1*6 +2025-05-02 18:41:17,312 - app.core.excel.processor - INFO - 第3行: 提取商品信息 条码=6973497200267, 名称=活力水平衡香水柠檬味, 规格=, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:41:17,314 - app.core.excel.processor - INFO - 第4行: 提取商品信息 条码=6973497200403, 名称=活力水平衡红提味, 规格=, 数量=1.0, 单位=件, 单价=55.0 +2025-05-02 18:41:17,314 - app.core.excel.processor - INFO - 第5行: 提取商品信息 条码=6873497204449, 名称=450ml轻乳茶桂花乌龙18纸箱, 规格=, 数量=1.0, 单位=件, 单价=65.0 +2025-05-02 18:41:17,314 - app.core.excel.processor - INFO - 第6行: 提取商品信息 条码=6973497204432, 名称=450ml轻乳茶大红袍乌龙12入纸箱, 规格=, 数量=1.0, 单位=提, 单价=65.0 +2025-05-02 18:41:17,314 - app.core.excel.processor - INFO - 从商品名称推断规格: 450ml轻乳茶大红袍乌龙12入纸箱 -> 1*2 +2025-05-02 18:41:17,315 - app.core.excel.processor - INFO - 第7行: 提取商品信息 条码=6973497202360, 名称=无糖茶金桂乌龙, 规格=, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:41:17,316 - app.core.excel.processor - INFO - 第8行: 提取商品信息 条码=6973497202889, 名称=无糖茶青柑乌龙, 规格=, 数量=1.0, 单位=件, 单价=0 +2025-05-02 18:41:17,317 - app.core.excel.processor - INFO - 第9行: 提取商品信息 条码=6973497202884, 名称=无糖茶(单瓶), 规格=, 数量=1.0, 单位=盒, 单价=16.0 +2025-05-02 18:41:17,318 - app.core.excel.processor - INFO - 提取到 9 个商品信息 +2025-05-02 18:41:17,329 - app.core.excel.processor - INFO - 开始处理9 个产品信息 +2025-05-02 18:41:17,329 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202346, 数量=5.0, 单价=11.0, 是否赠品=False +2025-05-02 18:41:17,329 - app.core.excel.processor - INFO - 发现正常商品:条码6973497202346, 数量=5.0, 单价=11.0 +2025-05-02 18:41:17,330 - app.core.excel.processor - INFO - 处理商品: 条码=6925019900087, 数量=10.0, 单价=5.5, 是否赠品=False +2025-05-02 18:41:17,391 - app.core.excel.processor - INFO - 发现正常商品:条码6925019900087, 数量=10.0, 单价=5.5 +2025-05-02 18:41:17,392 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200267, 数量=1.0, 单价=55.0, 是否赠品=False +2025-05-02 18:41:17,392 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200267, 数量=1.0, 单价=55.0 +2025-05-02 18:41:17,392 - app.core.excel.processor - INFO - 处理商品: 条码=6973497200403, 数量=1.0, 单价=55.0, 是否赠品=False +2025-05-02 18:41:17,392 - app.core.excel.processor - INFO - 发现正常商品:条码6973497200403, 数量=1.0, 单价=55.0 +2025-05-02 18:41:17,392 - app.core.excel.processor - INFO - 处理商品: 条码=6873497204449, 数量=1.0, 单价=65.0, 是否赠品=False +2025-05-02 18:41:17,393 - app.core.excel.processor - INFO - 发现正常商品:条码6873497204449, 数量=1.0, 单价=65.0 +2025-05-02 18:41:17,393 - app.core.excel.processor - INFO - 处理商品: 条码=6973497204432, 数量=1.0, 单价=65.0, 是否赠品=False +2025-05-02 18:41:17,393 - app.core.excel.processor - INFO - 发现正常商品:条码6973497204432, 数量=1.0, 单价=65.0 +2025-05-02 18:41:17,393 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202360, 数量=1.0, 单价=0, 是否赠品=True +2025-05-02 18:41:17,393 - app.core.excel.processor - INFO - 发现赠品:条码6973497202360, 数量=1.0 +2025-05-02 18:41:17,393 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202889, 数量=1.0, 单价=0, 是否赠品=True +2025-05-02 18:41:17,394 - app.core.excel.processor - INFO - 发现赠品:条码6973497202889, 数量=1.0 +2025-05-02 18:41:17,394 - app.core.excel.processor - INFO - 处理商品: 条码=6973497202884, 数量=1.0, 单价=16.0, 是否赠品=False +2025-05-02 18:41:17,394 - app.core.excel.processor - INFO - 发现正常商品:条码6973497202884, 数量=1.0, 单价=16.0 +2025-05-02 18:41:17,394 - app.core.excel.processor - INFO - 分组后共9 个不同条码的商品 +2025-05-02 18:41:17,394 - app.core.excel.processor - INFO - 条码 6973497202346 处理结果:正常商品数量5.0,单价11.0,赠品数量0 +2025-05-02 18:41:17,394 - app.core.excel.processor - INFO - 条码 6925019900087 处理结果:正常商品数量10.0,单价5.5,赠品数量0 +2025-05-02 18:41:17,394 - app.core.excel.processor - INFO - 条码 6973497200267 处理结果:正常商品数量1.0,单价55.0,赠品数量0 +2025-05-02 18:41:17,395 - app.core.excel.processor - INFO - 条码 6973497200403 处理结果:正常商品数量1.0,单价55.0,赠品数量0 +2025-05-02 18:41:17,395 - app.core.excel.processor - INFO - 条码 6873497204449 处理结果:正常商品数量1.0,单价65.0,赠品数量0 +2025-05-02 18:41:17,395 - app.core.excel.processor - INFO - 条码 6973497204432 处理结果:正常商品数量1.0,单价65.0,赠品数量0 +2025-05-02 18:41:17,395 - app.core.excel.processor - INFO - 条码 6973497202360 处理结果:只有赠品,数量=1.0 +2025-05-02 18:41:17,395 - app.core.excel.processor - INFO - 条码 6973497202889 处理结果:只有赠品,数量=1.0 +2025-05-02 18:41:17,395 - app.core.excel.processor - INFO - 条码 6973497202884 处理结果:正常商品数量1.0,单价16.0,赠品数量0 +2025-05-02 18:41:17,396 - app.core.excel.processor - INFO - 条码 6973497202360 填充:仅有赠品,采购量=0,赠品数量=1.0 +2025-05-02 18:41:17,396 - app.core.excel.processor - INFO - 条码 6973497202889 填充:仅有赠品,采购量=0,赠品数量=1.0 +2025-05-02 18:41:17,400 - app.core.excel.processor - INFO - 采购单已保存到: D:\My Documents\python\orc-order-v2\data\output\采购单_微信图片_20250227193150(1).xls diff --git a/logs/app.core.ocr.baidu_ocr.active b/logs/app.core.ocr.baidu_ocr.active index 5ad1445..b92430b 100644 --- a/logs/app.core.ocr.baidu_ocr.active +++ b/logs/app.core.ocr.baidu_ocr.active @@ -1 +1 @@ -Active since: 2025-05-02 18:01:39 \ No newline at end of file +Active since: 2025-05-02 18:41:16 \ No newline at end of file diff --git a/logs/app.core.ocr.table_ocr.active b/logs/app.core.ocr.table_ocr.active index 5ad1445..b92430b 100644 --- a/logs/app.core.ocr.table_ocr.active +++ b/logs/app.core.ocr.table_ocr.active @@ -1 +1 @@ -Active since: 2025-05-02 18:01:39 \ No newline at end of file +Active since: 2025-05-02 18:41:16 \ No newline at end of file diff --git a/logs/app.core.ocr.table_ocr.log b/logs/app.core.ocr.table_ocr.log index 8417256..034d6ad 100644 --- a/logs/app.core.ocr.table_ocr.log +++ b/logs/app.core.ocr.table_ocr.log @@ -79,3 +79,27 @@ 2025-05-02 18:01:40,470 - app.core.ocr.table_ocr - INFO - 使用输出目录: D:\My Documents\python\orc-order-v2\data\output 2025-05-02 18:01:40,470 - app.core.ocr.table_ocr - INFO - 使用临时目录: D:\My Documents\python\orc-order-v2\data\temp 2025-05-02 18:01:40,470 - app.core.ocr.table_ocr - INFO - OCR处理器初始化完成,输入目录: D:\My Documents\python\orc-order-v2\data\input, 输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:16:10,311 - app.core.ocr.table_ocr - INFO - 使用输入目录: D:\My Documents\python\orc-order-v2\data\input +2025-05-02 18:16:10,311 - app.core.ocr.table_ocr - INFO - 使用输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:16:10,312 - app.core.ocr.table_ocr - INFO - 使用临时目录: D:\My Documents\python\orc-order-v2\data\temp +2025-05-02 18:16:10,312 - app.core.ocr.table_ocr - INFO - OCR处理器初始化完成,输入目录: D:\My Documents\python\orc-order-v2\data\input, 输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:27:30,079 - app.core.ocr.table_ocr - INFO - 使用输入目录: D:\My Documents\python\orc-order-v2\data\input +2025-05-02 18:27:30,079 - app.core.ocr.table_ocr - INFO - 使用输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:27:30,079 - app.core.ocr.table_ocr - INFO - 使用临时目录: D:\My Documents\python\orc-order-v2\data\temp +2025-05-02 18:27:30,080 - app.core.ocr.table_ocr - INFO - OCR处理器初始化完成,输入目录: D:\My Documents\python\orc-order-v2\data\input, 输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:31:29,324 - app.core.ocr.table_ocr - INFO - 使用输入目录: D:\My Documents\python\orc-order-v2\data\input +2025-05-02 18:31:29,325 - app.core.ocr.table_ocr - INFO - 使用输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:31:29,325 - app.core.ocr.table_ocr - INFO - 使用临时目录: D:\My Documents\python\orc-order-v2\data\temp +2025-05-02 18:31:29,326 - app.core.ocr.table_ocr - INFO - OCR处理器初始化完成,输入目录: D:\My Documents\python\orc-order-v2\data\input, 输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:33:05,099 - app.core.ocr.table_ocr - INFO - 使用输入目录: D:\My Documents\python\orc-order-v2\data\input +2025-05-02 18:33:05,099 - app.core.ocr.table_ocr - INFO - 使用输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:33:05,099 - app.core.ocr.table_ocr - INFO - 使用临时目录: D:\My Documents\python\orc-order-v2\data\temp +2025-05-02 18:33:05,100 - app.core.ocr.table_ocr - INFO - OCR处理器初始化完成,输入目录: D:\My Documents\python\orc-order-v2\data\input, 输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:38:52,878 - app.core.ocr.table_ocr - INFO - 使用输入目录: D:\My Documents\python\orc-order-v2\data\input +2025-05-02 18:38:52,878 - app.core.ocr.table_ocr - INFO - 使用输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:38:52,878 - app.core.ocr.table_ocr - INFO - 使用临时目录: D:\My Documents\python\orc-order-v2\data\temp +2025-05-02 18:38:52,879 - app.core.ocr.table_ocr - INFO - OCR处理器初始化完成,输入目录: D:\My Documents\python\orc-order-v2\data\input, 输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:41:16,740 - app.core.ocr.table_ocr - INFO - 使用输入目录: D:\My Documents\python\orc-order-v2\data\input +2025-05-02 18:41:16,740 - app.core.ocr.table_ocr - INFO - 使用输出目录: D:\My Documents\python\orc-order-v2\data\output +2025-05-02 18:41:16,740 - app.core.ocr.table_ocr - INFO - 使用临时目录: D:\My Documents\python\orc-order-v2\data\temp +2025-05-02 18:41:16,741 - app.core.ocr.table_ocr - INFO - OCR处理器初始化完成,输入目录: D:\My Documents\python\orc-order-v2\data\input, 输出目录: D:\My Documents\python\orc-order-v2\data\output diff --git a/logs/app.core.utils.file_utils.active b/logs/app.core.utils.file_utils.active index 5ad1445..21fec46 100644 --- a/logs/app.core.utils.file_utils.active +++ b/logs/app.core.utils.file_utils.active @@ -1 +1 @@ -Active since: 2025-05-02 18:01:39 \ No newline at end of file +Active since: 2025-05-02 18:41:15 \ No newline at end of file diff --git a/logs/app.services.ocr_service.active b/logs/app.services.ocr_service.active index 5ad1445..b92430b 100644 --- a/logs/app.services.ocr_service.active +++ b/logs/app.services.ocr_service.active @@ -1 +1 @@ -Active since: 2025-05-02 18:01:39 \ No newline at end of file +Active since: 2025-05-02 18:41:16 \ No newline at end of file diff --git a/logs/app.services.ocr_service.log b/logs/app.services.ocr_service.log index 2ced16f..3fc133b 100644 --- a/logs/app.services.ocr_service.log +++ b/logs/app.services.ocr_service.log @@ -39,3 +39,15 @@ 2025-05-02 18:01:27,763 - app.services.ocr_service - INFO - OCRService初始化完成 2025-05-02 18:01:40,468 - app.services.ocr_service - INFO - 初始化OCRService 2025-05-02 18:01:40,470 - app.services.ocr_service - INFO - OCRService初始化完成 +2025-05-02 18:16:10,310 - app.services.ocr_service - INFO - 初始化OCRService +2025-05-02 18:16:10,312 - app.services.ocr_service - INFO - OCRService初始化完成 +2025-05-02 18:27:30,078 - app.services.ocr_service - INFO - 初始化OCRService +2025-05-02 18:27:30,080 - app.services.ocr_service - INFO - OCRService初始化完成 +2025-05-02 18:31:29,323 - app.services.ocr_service - INFO - 初始化OCRService +2025-05-02 18:31:29,326 - app.services.ocr_service - INFO - OCRService初始化完成 +2025-05-02 18:33:05,097 - app.services.ocr_service - INFO - 初始化OCRService +2025-05-02 18:33:05,100 - app.services.ocr_service - INFO - OCRService初始化完成 +2025-05-02 18:38:52,876 - app.services.ocr_service - INFO - 初始化OCRService +2025-05-02 18:38:52,879 - app.services.ocr_service - INFO - OCRService初始化完成 +2025-05-02 18:41:16,739 - app.services.ocr_service - INFO - 初始化OCRService +2025-05-02 18:41:16,741 - app.services.ocr_service - INFO - OCRService初始化完成 diff --git a/logs/app.services.order_service.active b/logs/app.services.order_service.active index ab58f88..b92430b 100644 --- a/logs/app.services.order_service.active +++ b/logs/app.services.order_service.active @@ -1 +1 @@ -Active since: 2025-05-02 18:01:40 \ No newline at end of file +Active since: 2025-05-02 18:41:16 \ No newline at end of file diff --git a/logs/app.services.order_service.log b/logs/app.services.order_service.log index a8471c8..14d8c9d 100644 --- a/logs/app.services.order_service.log +++ b/logs/app.services.order_service.log @@ -41,3 +41,21 @@ 2025-05-02 18:01:40,470 - app.services.order_service - INFO - 初始化OrderService 2025-05-02 18:01:40,472 - app.services.order_service - INFO - OrderService初始化完成 2025-05-02 18:01:40,472 - app.services.order_service - INFO - OrderService开始处理指定Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:16:10,312 - app.services.order_service - INFO - 初始化OrderService +2025-05-02 18:16:10,314 - app.services.order_service - INFO - OrderService初始化完成 +2025-05-02 18:16:10,314 - app.services.order_service - INFO - OrderService开始处理指定Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:27:30,080 - app.services.order_service - INFO - 初始化OrderService +2025-05-02 18:27:30,082 - app.services.order_service - INFO - OrderService初始化完成 +2025-05-02 18:27:30,083 - app.services.order_service - INFO - OrderService开始处理指定Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:31:29,326 - app.services.order_service - INFO - 初始化OrderService +2025-05-02 18:31:29,328 - app.services.order_service - INFO - OrderService初始化完成 +2025-05-02 18:31:29,329 - app.services.order_service - INFO - OrderService开始处理指定Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:33:05,100 - app.services.order_service - INFO - 初始化OrderService +2025-05-02 18:33:05,103 - app.services.order_service - INFO - OrderService初始化完成 +2025-05-02 18:33:05,104 - app.services.order_service - INFO - OrderService开始处理指定Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:38:52,879 - app.services.order_service - INFO - 初始化OrderService +2025-05-02 18:38:52,881 - app.services.order_service - INFO - OrderService初始化完成 +2025-05-02 18:38:52,881 - app.services.order_service - INFO - OrderService开始处理指定Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx +2025-05-02 18:41:16,741 - app.services.order_service - INFO - 初始化OrderService +2025-05-02 18:41:16,743 - app.services.order_service - INFO - OrderService初始化完成 +2025-05-02 18:41:16,744 - app.services.order_service - INFO - OrderService开始处理指定Excel文件: D:\My Documents\python\orc-order-v2\data\output\微信图片_20250227193150(1).xlsx diff --git a/启动器.py b/启动器.py index 059bb22..94dd603 100644 --- a/启动器.py +++ b/启动器.py @@ -30,9 +30,12 @@ class LogRedirector: def __init__(self, text_widget): self.text_widget = text_widget self.buffer = "" + self.terminal = sys.__stdout__ # 保存原始的stdout引用 def write(self, string): self.buffer += string + # 同时输出到终端 + self.terminal.write(string) # 在UI线程中更新文本控件 self.text_widget.after(0, self.update_text_widget) @@ -45,7 +48,7 @@ class LogRedirector: self.buffer = "" def flush(self): - pass + self.terminal.flush() # 确保终端也被刷新 def run_command_with_logging(command, log_widget): """运行命令并将输出重定向到日志窗口""" @@ -59,6 +62,13 @@ def run_command_with_logging(command, log_widget): log_widget.insert(tk.END, "=" * 50 + "\n\n") log_widget.configure(state=tk.DISABLED) + # 获取原始的stdout和stderr + old_stdout = sys.stdout + old_stderr = sys.stderr + + # 创建日志重定向器 + log_redirector = LogRedirector(log_widget) + # 设置环境变量,强制OCR模块输出到data目录 env = os.environ.copy() env["OCR_OUTPUT_DIR"] = os.path.abspath("data/output") @@ -66,6 +76,13 @@ def run_command_with_logging(command, log_widget): env["OCR_LOG_LEVEL"] = "DEBUG" # 设置更详细的日志级别 try: + # 重定向stdout和stderr到日志重定向器 + sys.stdout = log_redirector + sys.stderr = log_redirector + + # 打印一条消息,确认重定向已生效 + print("日志重定向已启动,现在同时输出到终端和GUI") + # 运行命令并捕获输出 process = subprocess.Popen( command, @@ -79,7 +96,7 @@ def run_command_with_logging(command, log_widget): # 读取并显示输出 for line in process.stdout: - log_widget.after(0, lambda l=line: add_to_log(log_widget, l)) + print(line.rstrip()) # 直接打印到已重定向的stdout # 等待进程结束 process.wait() @@ -88,12 +105,10 @@ def run_command_with_logging(command, log_widget): end_time = datetime.datetime.now() duration = end_time - start_time - log_widget.after(0, lambda: add_to_log( - log_widget, - f"\n{'=' * 50}\n执行完毕!返回码: {process.returncode}\n" - f"结束时间: {end_time.strftime('%Y-%m-%d %H:%M:%S')}\n" - f"耗时: {duration.total_seconds():.2f} 秒\n" - )) + print(f"\n{'=' * 50}") + print(f"执行完毕!返回码: {process.returncode}") + print(f"结束时间: {end_time.strftime('%Y-%m-%d %H:%M:%S')}") + print(f"耗时: {duration.total_seconds():.2f} 秒") # 如果处理成功,显示成功信息 if process.returncode == 0: @@ -102,8 +117,12 @@ def run_command_with_logging(command, log_widget): log_widget.after(0, lambda: messagebox.showerror("操作失败", f"处理失败,返回码:{process.returncode}")) except Exception as e: - log_widget.after(0, lambda: add_to_log(log_widget, f"\n执行出错: {str(e)}\n")) + print(f"\n执行出错: {str(e)}") log_widget.after(0, lambda: messagebox.showerror("执行错误", f"执行命令时出错: {str(e)}")) + finally: + # 恢复原始stdout和stderr + sys.stdout = old_stdout + sys.stderr = old_stderr # 在新线程中运行,避免UI阻塞 Thread(target=run_in_thread).start() @@ -417,7 +436,7 @@ def main(): # 创建窗口 root = tk.Tk() root.title("OCR订单处理系统 v2.0") - root.geometry("800x600") # 增加窗口宽度以容纳日志 + root.geometry("1200x600") # 增加窗口宽度以容纳日志 # 创建主区域分割 main_pane = tk.PanedWindow(root, orient=tk.HORIZONTAL) @@ -428,7 +447,7 @@ def main(): main_pane.add(left_frame) # 标题 - tk.Label(left_frame, text="OCR订单处理系统", font=("Arial", 16)).pack(pady=10) + tk.Label(left_frame, text="益选-OCR订单处理系统", font=("Arial", 16)).pack(pady=10) # 功能按钮区域 buttons_frame = tk.Frame(left_frame)