qrpa 1.0.27__tar.gz → 1.0.28__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of qrpa might be problematic. Click here for more details.

Files changed (31) hide show
  1. {qrpa-1.0.27 → qrpa-1.0.28}/PKG-INFO +1 -1
  2. {qrpa-1.0.27 → qrpa-1.0.28}/pyproject.toml +1 -1
  3. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/temu_excel.py +40 -13
  4. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa.egg-info/PKG-INFO +1 -1
  5. {qrpa-1.0.27 → qrpa-1.0.28}/README.md +0 -0
  6. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/RateLimitedSender.py +0 -0
  7. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/__init__.py +0 -0
  8. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/db_migrator.py +0 -0
  9. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/feishu_bot_app.py +0 -0
  10. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/fun_base.py +0 -0
  11. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/fun_excel.py +0 -0
  12. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/fun_file.py +0 -0
  13. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/fun_web.py +0 -0
  14. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/fun_win.py +0 -0
  15. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/shein_daily_report_model.py +0 -0
  16. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/shein_excel.py +0 -0
  17. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/shein_lib.py +0 -0
  18. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/shein_sqlite.py +0 -0
  19. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/shein_ziniao.py +0 -0
  20. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/temu_chrome.py +0 -0
  21. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/temu_lib.py +0 -0
  22. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/time_utils.py +0 -0
  23. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/time_utils_example.py +0 -0
  24. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa/wxwork.py +0 -0
  25. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa.egg-info/SOURCES.txt +0 -0
  26. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa.egg-info/dependency_links.txt +0 -0
  27. {qrpa-1.0.27 → qrpa-1.0.28}/qrpa.egg-info/top_level.txt +0 -0
  28. {qrpa-1.0.27 → qrpa-1.0.28}/setup.cfg +0 -0
  29. {qrpa-1.0.27 → qrpa-1.0.28}/setup.py +0 -0
  30. {qrpa-1.0.27 → qrpa-1.0.28}/tests/test_db_migrator.py +0 -0
  31. {qrpa-1.0.27 → qrpa-1.0.28}/tests/test_wxwork.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrpa
3
- Version: 1.0.27
3
+ Version: 1.0.28
4
4
  Summary: qsir's rpa library
5
5
  Author: QSir
6
6
  Author-email: QSir <1171725650@qq.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qrpa"
7
- version = "1.0.27"
7
+ version = "1.0.28"
8
8
  description = "qsir's rpa library"
9
9
  authors = [{ name = "QSir", email = "1171725650@qq.com" }]
10
10
  readme = "README.md"
@@ -3,6 +3,7 @@ from .fun_base import log
3
3
  from .fun_file import read_dict_from_file, read_dict_from_file_ex, write_dict_to_file, write_dict_to_file_ex, delete_file
4
4
  from .time_utils import TimeUtils
5
5
  from .wxwork import WxWorkBot
6
+ import os
6
7
 
7
8
  class TemuExcel:
8
9
 
@@ -47,9 +48,9 @@ class TemuExcel:
47
48
  autofit_column(sheet, ['店铺名称', '商品信息'])
48
49
  column_to_left(sheet, ['商品信息'])
49
50
  InsertImageV2(sheet, ['SKC图片', 'SKU图片'], 'temu', 120)
50
- if sheet.used_range.rows.count > 330:
51
- log('表格数据行数超过了330行,将删除SKC图片')
52
- remove_excel_columns(sheet, ['SKC图片'])
51
+ # if sheet.used_range.rows.count > 330:
52
+ # log('表格数据行数超过了330行,将删除SKC图片')
53
+ # remove_excel_columns(sheet, ['SKC图片'])
53
54
 
54
55
  def write_purchase_advise(self, erp='mb'):
55
56
  cache_file = f'{self.config.auto_dir}/temu/cache/warehouse_list_{TimeUtils.today_date()}.json'
@@ -59,19 +60,23 @@ class TemuExcel:
59
60
 
60
61
  header = ['店铺名称', 'SKC图片', 'SKU图片', '商品信息', '现有库存数量', '已采购数量', '近7日销量', '平均日销', '本地和采购可售天数', '生产天数', '建议采购', '产品起定量', '备货周期(天)', 'SKC', '导出时间']
61
62
  new_excel_path_list = []
63
+
62
64
  for mall_id, subOrderList in dict.items():
63
65
  excel_data = []
64
66
  mall_name = store_info.get(mall_id)[1]
67
+
65
68
  for product in subOrderList:
66
69
  spu = str(product['productId']) # temu平台 spu_id
67
70
  skc = str(product['productSkcId']) # temu平台 skc_id
68
71
  skcExtCode = product['skcExtCode'] # 商家 SKC货号
69
72
  category = product['category'] # 叶子类目
70
73
  onSalesDurationOffline = product['onSalesDurationOffline'] # 加入站点时长
74
+
71
75
  for sku in product['skuQuantityDetailList']:
72
76
  priceReviewStatus = sku['priceReviewStatus']
73
77
  if priceReviewStatus == 3: # 过滤 开款价格状态 已作废的 2是已生效
74
78
  continue
79
+
75
80
  mall_info = f'{mall_name}\n{mall_id}'
76
81
  productSkcPicture = product['productSkcPicture'] # skc图片
77
82
  skuExtCode = str(sku['skuExtCode']) # sku货号
@@ -98,15 +103,37 @@ class TemuExcel:
98
103
  row_item.append(TimeUtils.current_datetime())
99
104
  excel_data.append(row_item)
100
105
 
101
- new_excel_path = str(self.config.excel_purcase_advice_temu).replace('#store_name#', mall_name).replace(' ', '_')
102
- new_excel_path_list.append(new_excel_path)
103
- sheet_name = 'Sheet1'
104
- data = [header] + excel_data
105
- close_excel_file(new_excel_path)
106
- log(new_excel_path)
107
- batch_excel_operations(new_excel_path, [
108
- (sheet_name, 'write', sort_by_column(data, 6, 1), ['N']),
109
- (sheet_name, 'format', self.format_purchase_advise_batch)
110
- ])
106
+ # 按近7日销量排序
107
+ excel_data = sort_by_column(excel_data, 6, 1)
108
+
109
+ # 计算需要多少个文件(每个文件最多320行数据,包含表头)
110
+ max_data_rows = 320 - 1 # 减去表头行
111
+ total_files = (len(excel_data) + max_data_rows - 1) // max_data_rows # 通过加(max_data_rows-1)实现向上取整
112
+
113
+ for file_index in range(total_files):
114
+ start_idx = file_index * max_data_rows
115
+ end_idx = min((file_index + 1) * max_data_rows, len(excel_data))
116
+ current_data = excel_data[start_idx:end_idx]
117
+
118
+ # 生成文件名,如果超过一个文件则添加序号
119
+ if total_files == 1:
120
+ new_excel_path = str(self.config.excel_purcase_advice_temu).replace('#store_name#', mall_name).replace(' ', '_')
121
+ else:
122
+ # 在文件名后添加 _2, _3 等序号
123
+ base_path = str(self.config.excel_purcase_advice_temu).replace('#store_name#', mall_name).replace(' ', '_')
124
+ file_name, file_ext = os.path.splitext(base_path)
125
+ new_excel_path = f"{file_name}_{file_index + 1}{file_ext}"
126
+
127
+ new_excel_path_list.append(new_excel_path)
128
+ sheet_name = 'Sheet1'
129
+ data = [header] + current_data
130
+
131
+ close_excel_file(new_excel_path)
132
+ log(f"创建文件: {new_excel_path}, 数据行数: {len(current_data)}")
133
+
134
+ batch_excel_operations(new_excel_path, [
135
+ (sheet_name, 'write', data, ['N']),
136
+ (sheet_name, 'format', self.format_purchase_advise_batch)
137
+ ])
111
138
 
112
139
  return new_excel_path_list
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrpa
3
- Version: 1.0.27
3
+ Version: 1.0.28
4
4
  Summary: qsir's rpa library
5
5
  Author: QSir
6
6
  Author-email: QSir <1171725650@qq.com>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes