qrpa 1.0.26__py3-none-any.whl → 1.0.28__py3-none-any.whl

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.

qrpa/temu_excel.py CHANGED
@@ -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,6 +48,9 @@ class TemuExcel:
47
48
  autofit_column(sheet, ['店铺名称', '商品信息'])
48
49
  column_to_left(sheet, ['商品信息'])
49
50
  InsertImageV2(sheet, ['SKC图片', 'SKU图片'], 'temu', 120)
51
+ # if sheet.used_range.rows.count > 330:
52
+ # log('表格数据行数超过了330行,将删除SKC图片')
53
+ # remove_excel_columns(sheet, ['SKC图片'])
50
54
 
51
55
  def write_purchase_advise(self, erp='mb'):
52
56
  cache_file = f'{self.config.auto_dir}/temu/cache/warehouse_list_{TimeUtils.today_date()}.json'
@@ -56,19 +60,23 @@ class TemuExcel:
56
60
 
57
61
  header = ['店铺名称', 'SKC图片', 'SKU图片', '商品信息', '现有库存数量', '已采购数量', '近7日销量', '平均日销', '本地和采购可售天数', '生产天数', '建议采购', '产品起定量', '备货周期(天)', 'SKC', '导出时间']
58
62
  new_excel_path_list = []
63
+
59
64
  for mall_id, subOrderList in dict.items():
60
65
  excel_data = []
61
66
  mall_name = store_info.get(mall_id)[1]
67
+
62
68
  for product in subOrderList:
63
69
  spu = str(product['productId']) # temu平台 spu_id
64
70
  skc = str(product['productSkcId']) # temu平台 skc_id
65
71
  skcExtCode = product['skcExtCode'] # 商家 SKC货号
66
72
  category = product['category'] # 叶子类目
67
73
  onSalesDurationOffline = product['onSalesDurationOffline'] # 加入站点时长
74
+
68
75
  for sku in product['skuQuantityDetailList']:
69
76
  priceReviewStatus = sku['priceReviewStatus']
70
77
  if priceReviewStatus == 3: # 过滤 开款价格状态 已作废的 2是已生效
71
78
  continue
79
+
72
80
  mall_info = f'{mall_name}\n{mall_id}'
73
81
  productSkcPicture = product['productSkcPicture'] # skc图片
74
82
  skuExtCode = str(sku['skuExtCode']) # sku货号
@@ -95,15 +103,37 @@ class TemuExcel:
95
103
  row_item.append(TimeUtils.current_datetime())
96
104
  excel_data.append(row_item)
97
105
 
98
- new_excel_path = str(self.config.excel_purcase_advice_temu).replace('#store_name#', mall_name).replace(' ', '_')
99
- new_excel_path_list.append(new_excel_path)
100
- sheet_name = 'Sheet1'
101
- data = [header] + excel_data
102
- close_excel_file(new_excel_path)
103
- log(new_excel_path)
104
- batch_excel_operations(new_excel_path, [
105
- (sheet_name, 'write', sort_by_column(data, 6, 1), ['N']),
106
- (sheet_name, 'format', self.format_purchase_advise_batch)
107
- ])
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
+ ])
108
138
 
109
139
  return new_excel_path_list
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrpa
3
- Version: 1.0.26
3
+ Version: 1.0.28
4
4
  Summary: qsir's rpa library
5
5
  Author: QSir
6
6
  Author-email: QSir <1171725650@qq.com>
@@ -1,6 +1,7 @@
1
1
  qrpa/RateLimitedSender.py,sha256=hqvb1qspDFaW4RsLuVufylOrefkMgixANKeBaGEqYb4,1421
2
2
  qrpa/__init__.py,sha256=OMQjTO0rE2XDyxsM6wVeWfI1rKFyXRGO5oPU6iLqfoA,980
3
3
  qrpa/db_migrator.py,sha256=2VmhzcMsU0MKpl-mNCwKyV8tLTqyEysSpP27-S_rQZ8,21862
4
+ qrpa/feishu_bot_app.py,sha256=Pyxt8rBuHJl5KYZjLAwYbC48odUsWlKFNjWBwiUig8o,9482
4
5
  qrpa/fun_base.py,sha256=qg6SvR-GEj2TclB1OL9eLu711jV-bysXJ5Eh2gW9pE8,10600
5
6
  qrpa/fun_excel.py,sha256=qGiTupcGJdZyVZL-LMxkZDTpOPhobzxZesU2Tr8iOl0,111619
6
7
  qrpa/fun_file.py,sha256=yzjDV16WL5vRys7J4uQcNzIFkX4D5MAlSCwxcD-mwQo,11966
@@ -8,16 +9,16 @@ qrpa/fun_web.py,sha256=5QLQorAhRzMOGMRh4eCJ2UH8ZhVHvxkHwobWhmgU5qM,6286
8
9
  qrpa/fun_win.py,sha256=-LnTeocdTt72NVH6VgLdpAT9_C5oV9okeudXG6CftMA,8034
9
10
  qrpa/shein_daily_report_model.py,sha256=H8oZmIN5Pyqe306W1_xuz87lOqLQ_LI5RjXbaxDkIzE,12589
10
11
  qrpa/shein_excel.py,sha256=sRbUsEkFeQVGYsmhtK6nNaoSLdS0jLrm2bffhtQfFks,101399
11
- qrpa/shein_lib.py,sha256=aAyK4ENbI_cqLAS2GvNIgbeyRkjAiJn1y_A1C-0M-Dg,96872
12
+ qrpa/shein_lib.py,sha256=rbrJDO48KoZZBlmlBotQpXp1i_zY2o6q9HN_9aVjAKI,101008
12
13
  qrpa/shein_sqlite.py,sha256=ZQwD0Gz81q9WY7tY2HMEYvSF9r3N_G_Aur3bYfST9WY,5707
13
14
  qrpa/shein_ziniao.py,sha256=nSqqcEPh4nVQtUxUnIRzeZfTLyXywGPjPZn5pP-w57U,18309
14
15
  qrpa/temu_chrome.py,sha256=CbtFy1QPan9xJdJcNZj-EsVGhUvv3ZTEPVDEA4-im40,2803
15
- qrpa/temu_excel.py,sha256=pmXKuCZ1H6A-F7dj0Kg5JjENYPEJO2dr572Q-GkepuI,5447
16
+ qrpa/temu_excel.py,sha256=ssAQvhtRGaTOLAVM3gS-AnmHPkIiHCT6gTsK1hoi-_8,6990
16
17
  qrpa/temu_lib.py,sha256=hYB59zsLS3m3NTic_duTwPMOTSxlHyQVa8OhHnHm-1g,7199
17
18
  qrpa/time_utils.py,sha256=ef0hhbN_6b-gcnz5ETIVOoxemIMvcxGVGGIRnHnGaBo,29564
18
19
  qrpa/time_utils_example.py,sha256=shHOXKKF3QSzb0SHsNc34M61wEkkLuM30U9X1THKNS8,8053
19
20
  qrpa/wxwork.py,sha256=Vy8PGEtlTWt4-1laVhuqpJUGCFH2JymgbjvH00aaBog,10946
20
- qrpa-1.0.26.dist-info/METADATA,sha256=tsIRZvpoWWACWKLq_fvsrrwY84lken14sYSQeCtzCrQ,231
21
- qrpa-1.0.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- qrpa-1.0.26.dist-info/top_level.txt,sha256=F6T5igi0fhXDucPPUbmmSC0qFCDEsH5eVijfVF48OFU,5
23
- qrpa-1.0.26.dist-info/RECORD,,
21
+ qrpa-1.0.28.dist-info/METADATA,sha256=9Ruc1VWX2khZoETKzoLTmxkRmQCdW3d2Ie0979gNQ_E,231
22
+ qrpa-1.0.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ qrpa-1.0.28.dist-info/top_level.txt,sha256=F6T5igi0fhXDucPPUbmmSC0qFCDEsH5eVijfVF48OFU,5
24
+ qrpa-1.0.28.dist-info/RECORD,,
File without changes