Files
F6--/张阳脚本/竞品系统数据导出/京东云修工单子表单.ipynb
T
2026-01-30 11:28:35 +08:00

849 lines
33 KiB
Plaintext

{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "## 工单子表单",
"id": "88666286230ca491"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-23T16:17:14.754376Z",
"start_time": "2025-05-23T11:40:55.999863Z"
}
},
"cell_type": "code",
"source": [
"import requests\n",
"import json\n",
"import time\n",
"import pandas as pd\n",
"from tqdm import tqdm\n",
"from datetime import datetime, timedelta\n",
"from bs4 import BeautifulSoup\n",
"\n",
"headers = {\n",
" \"cookie\": '__jdv=154799550|direct|-|none|-|1747659054237; flash=3_BN5FlBXqwDExD0Hqb3B70F9P_8Auw1KoNHmmWpbTyc_Zf4ughqhQAf3Dn_SYPn5R1Y6WZAd537CdRMmeauNNAqGU8ZwRu5c78bo-JimpRh71cvcmU2N9aKNNe7-ZXmPzhlMsJQhul_B5V3Y1L1TK42h8C0JKQW3xo4Cmtf20_WfGfvlVIXvuG8FnwxnR; pin=jd_BtxRnLkqczoE; unick=%E7%88%B1%E5%B8%AE%E8%BD%A6%E6%9C%8D; thor=F1C2CE45C3BB0D6AFAD21E4048588D13AA86F90A17A75FB8C125D8BBEBCEA71C7F0A7FCB3C3B6F5CDA534E1EA85BF2093B2A93EEE733A7536F7B9CBB50AE8FDCCBED1C41AF1F7F1EC0E525A306CDF7B50EDFC0972CC51ECA2ADCC74EE79CF0FD5BA3EB3798699E847C3D51F381E0F386C7394AE98B1F408C1454AB21FBF87C9E55E01BBD0EB64221F817191FA238708A35E710FCD7238DC9D7A574F3CF85919E; light_key=AASBKE7rOxgWQziEhC_QY6yabH8n9ROlxsU0CDGt7G7DsmfOcYCIBCjtBcp8f2n2enKriWRO; JD_UUID=7254175f-6a89-4144-ba95-823dd36d0fff; yunxiupin=jd_BtxRnLkqczoE; UUID=1f7f9980-72d3-49b9-85bc-ae8b99f559e0; SESSION_USER_NAME=%E6%AC%A7%E9%98%B3%E8%BF%9B%E9%A3%9E; __jda=154799550.17476590542361552970576.1747659054.1747876397.1748000112.4; __jdc=154799550; __jdb=154799550.4.17476590542361552970576|4.1748000112',\n",
" \"referer\": \"https://www.yunxiu.com/legend/account\",\n",
" \"sec-ch-ua\": \"\\\"Not(A:Brand\\\";v=\\\"99\\\", \\\"Microsoft Edge\\\";v=\\\"133\\\", \\\"Chromium\\\";v=\\\"133\\\"\",\n",
" \"sec-ch-ua-mobile\": \"?0\",\n",
" \"sec-ch-ua-platform\": \"\\\"Windows\\\"\",\n",
" \"sec-fetch-dest\": \"empty\",\n",
" \"sec-fetch-mode\": \"cors\",\n",
" \"sec-fetch-site\": \"same-origin\",\n",
" \"user-agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0\",\n",
" \"x-requested-with\": \"XMLHttpRequest\"\n",
"}\n",
"\n",
"all_data = []\n",
"all_service_data = []\n",
"all_parts_data = []\n",
"all_base_ddata = []\n",
"\n",
"number = 1743152268544\n",
"page = 1\n",
"max_retries = 5 # 最大重试次数\n",
"backoff_factor = 10 # 指数退避因子\n",
"\n",
"current_date = datetime.now()\n",
"years_back = 20\n",
"\n",
"end_date = current_date - timedelta(days=365 * years_back)\n",
"start_date = current_date\n",
"\n",
"while start_date >= end_date:\n",
" try:\n",
" search_startTime = (start_date - timedelta(days=365)).strftime('%Y-%m-%d')\n",
" search_endTime = start_date.strftime('%Y-%m-%d')\n",
" print(f'查询时间范围: {search_startTime} 至 {search_endTime}')\n",
"\n",
" start_date -= timedelta(days=365)\n",
" should_break = False\n",
"\n",
" for page in tqdm(range(1, 1001)):\n",
" if should_break: # 检查是否需要跳出\n",
" break\n",
" \n",
" url = f\"https://www.yunxiu.com/legend/shop/order/order-list/list?page={page}&size=12&search_startTime={search_startTime}&search_endTime={search_endTime}&_={number}\"\n",
"\n",
" for attempt in range(max_retries):\n",
" try:\n",
" response = requests.get(url=url, headers=headers)\n",
" response.raise_for_status()\n",
"\n",
" data = response.json().get(\"data\", {})\n",
" res = data.get(\"content\", [])\n",
" total_pages = data.get(\"totalPages\", 1)\n",
"\n",
" if page >= total_pages:\n",
" should_break = True\n",
" break\n",
"\n",
" for item in res:\n",
" if not isinstance(item, dict):\n",
" print(f\"跳过非字典项: {item}\")\n",
" continue\n",
"\n",
" base_info = {k: str(v) for k, v in item.items() if k != \"licenseList\"}\n",
" all_data.append(base_info)\n",
" order_id = item.get(\"id\")\n",
" # order_id = 66752497\n",
"\n",
" if not order_id:\n",
" print(\"订单ID缺失,跳过处理\")\n",
" continue\n",
"\n",
" try:\n",
" # 获取订单详情\n",
" detail_url = f\"https://www.yunxiu.com/legend/shop/order/detail?orderId={order_id}&refer=order-list\"\n",
" detail_resp = requests.get(detail_url, headers=headers)\n",
" detail_soup = BeautifulSoup(detail_resp.text, 'html.parser')\n",
"\n",
" # 检查子单\n",
" sub_order_link = detail_soup.find('a', class_='new-order')\n",
" if sub_order_link and \"查看子单\" in sub_order_link.text:\n",
" # print(\"存在子单\")\n",
" base_info[\"子单\"] = \"存在\"\n",
"\n",
" # 获取子单内容\n",
" sub_order_url = \"https://www.yunxiu.com\" + sub_order_link['href']\n",
" sub_resp = requests.get(sub_order_url, headers=headers)\n",
" sub_soup = BeautifulSoup(sub_resp.text, 'html.parser')\n",
"\n",
" # 提取服务项目\n",
" tables = sub_soup.find_all('table', class_='yqx-table')\n",
" if tables:\n",
" service_table = tables[0]\n",
" # 修正选择器:使用实际的tr class\n",
" service_rows = service_table.select('tr.service-datatr')\n",
"\n",
" service_data = []\n",
" # 调整header与实际列数匹配\n",
" service_headers = [\"服务名称\", \"服务类别\", \"工时费\", \"工时\", \"金额\", \"优惠\",\n",
" \"服务备注\"]\n",
"\n",
" for row in service_rows:\n",
" # 从input标签提取数据\n",
" service_item = {\n",
" \"服务名称\": row.find('input', {'name': 'serviceName'}).get('value', ''),\n",
" \"服务类别\": row.find('input', {'name': 'serviceCatName'}).get('value', ''),\n",
" \"工时费\": row.find('input', {'name': 'servicePrice'}).get('value', ''),\n",
" \"工时\": row.find('input', {'name': 'serviceHour'}).get('value', ''),\n",
" \"金额\": row.find('input', {'name': 'serviceAmount'}).get('value', ''),\n",
" \"优惠\": row.find('input', {'name': 'discount'}).get('value', ''),\n",
" \"服务备注\": row.find('input', {'name': 'serviceNote'}).get('value', ''),\n",
" \"id\": order_id\n",
" }\n",
" service_data.append(service_item)\n",
"\n",
" all_service_data.extend(service_data)\n",
"\n",
" # tables = sub_soup.find_all('table', class_='yqx-table')\n",
" # service_table = tables[0]\n",
" # service_rows = service_table.select('tr.form_item')\n",
" # # print(tables[0])\n",
" # print(service_rows)\n",
" # service_data = []\n",
" # service_headers = [\"服务名称\", \"服务类别\", \"工时费\", \"工时\", \"金额\", \"优惠\", \"维修工\", \"服务备注\"]\n",
" #\n",
" # for row in service_rows:\n",
" # print(1)\n",
" # cells = row.find_all('td')\n",
" # if len(cells) == len(service_headers):\n",
" # service_item = {service_headers[i]: cells[i].get_text(strip=True) for i in range(len(service_headers))}\n",
" # service_item[\"id\"] = order_id\n",
" # service_data.append(service_item)\n",
" #\n",
" # all_service_data.extend(service_data)\n",
"\n",
" # 提取配件项目\n",
" parts_table = tables[1]\n",
" parts_rows = parts_table.select('tr.goods-datatr')\n",
" parts_data = []\n",
" parts_headers = [\"零件号\", \"配件名称\", \"售价\", \"数量\", \"单位\", \"金额\", \"优惠\", \"库存\",\n",
" \"销售员\", \"配件备注\"]\n",
"\n",
" for row in parts_rows:\n",
" parts_item = {\n",
" \"零件号\": row.find('input', {'name': 'goodsFormat'}).get('value', ''),\n",
" \"配件名称\": row.find('input', {'name': 'goodsName'}).get('value', ''),\n",
" \"售价\": row.find('input', {'name': 'goodsPrice'}).get('value', ''),\n",
" \"数量\": row.find('input', {'name': 'goodsNumber'}).get('value', ''),\n",
" \"单位\": row.find('input', {'name': 'measureUnit'}).get('value', ''),\n",
" \"金额\": row.find('input', {'name': 'goodsAmount'}).get('value', ''),\n",
" \"优惠\": row.find('input', {'name': 'discount'}).get('value', ''),\n",
" \"库存\": row.find('input', {'name': 'inventoryPrice'}).get('value', ''),\n",
" \"销售员\": row.find('input', {'name': 'saleId'}).get('value', ''),\n",
" \"配件备注\": row.find('input', {'name': 'goodsNote'}).get('value', ''),\n",
" \"id\": order_id\n",
" }\n",
" parts_data.append(parts_item)\n",
"\n",
" all_parts_data.extend(parts_data)\n",
"\n",
" # parts_table = tables[1]\n",
" # parts_rows = parts_table.select('tr.goods-datatr')\n",
" # parts_data = []\n",
" # parts_headers = [\"零件号\", \"配件名称\", \"售价\", \"数量\", \"金额\", \"优惠\", \"库存\", \"销售员\", \"配件备注\"]\n",
" # \n",
" # for row in parts_rows:\n",
" # cells = row.find_all('td')\n",
" # if len(cells) == len(parts_headers):\n",
" # parts_item = {parts_headers[i]: cells[i].get_text(strip=True) for i in range(len(parts_headers))}\n",
" # parts_item[\"id\"] = order_id\n",
" # parts_data.append(parts_item)\n",
" # \n",
" # all_parts_data.extend(parts_data)\n",
"\n",
" # 提取基本信息\n",
" base_info1 = {}\n",
" inputs = sub_soup.find_all('input')\n",
" for input_tag in inputs:\n",
" name = input_tag.get('name')\n",
" value = input_tag.get('value', '').strip()\n",
" if name:\n",
" key = name.replace('orderInfo.', '')\n",
" base_info1[key] = value\n",
"\n",
" base_info1[\"id\"] = order_id\n",
" all_base_ddata.append(base_info1)\n",
"\n",
" else:\n",
" base_info[\"子单\"] = \"不存在\"\n",
"\n",
"\n",
" except Exception as e:\n",
" print(f\"处理订单{order_id}时出错: {str(e)}\")\n",
" continue\n",
" page += 1\n",
"\n",
" break # 请求成功,跳出重试循环\n",
"\n",
" except requests.exceptions.RequestException as e:\n",
" print(f\"第{page}页请求失败(尝试{attempt + 1}): {str(e)}\")\n",
" if attempt < max_retries - 1:\n",
" time.sleep(backoff_factor * (2 ** attempt))\n",
" else:\n",
" print(f\"达到最大重试次数,跳过第{page}页\")\n",
" break\n",
"\n",
" number += 1\n",
" time.sleep(1)\n",
"\n",
" except Exception as e:\n",
" print(f\"处理日期范围时出错: {str(e)}\")\n",
" continue\n",
"\n",
"df1 = pd.DataFrame(all_data)\n",
"df2 = pd.DataFrame(all_base_ddata)\n",
"df3 = pd.DataFrame(all_service_data)\n",
"df4 = pd.DataFrame(all_parts_data)\n",
"df1.to_csv(r\"D:\\Idea Project\\F6+宜搭+其它(1)\\new\\文件输出\\京东云修数据导出-18186751313 -工单.csv\")\n",
"df2.to_csv(r\"D:\\Idea Project\\F6+宜搭+其它(1)\\new\\文件输出\\京东云修数据导出-18186751313 -工单子单基本信息.csv\")\n",
"df3.to_csv(r\"D:\\Idea Project\\F6+宜搭+其它(1)\\new\\文件输出\\京东云修数据导出-18186751313 -工单子单服务项目.csv\")\n",
"df4.to_csv(r\"D:\\Idea Project\\F6+宜搭+其它(1)\\new\\文件输出\\京东云修数据导出-18186751313 -工单子单配件项目.csv\")\n"
],
"id": "8d6f11a2b11f8be4",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2024-05-23 至 2025-05-23\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 15%|█▍ | 148/1000 [14:31<1:24:49, 5.97s/it]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单60248836时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=60248836&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F22A14DE50>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 16%|█▌ | 158/1000 [15:54<1:31:45, 6.54s/it]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"第159页请求失败(尝试1): HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/order-list/list?page=159&size=12&search_startTime=2024-05-23&search_endTime=2025-05-23&_=1743152268702 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F22C4FDE50>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 16%|█▌ | 159/1000 [16:31<3:42:44, 15.89s/it]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单59683769时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=59683769&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F22AA403E0>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 27%|██▋ | 269/1000 [27:45<1:13:13, 6.01s/it]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单55024316时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=55024316&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F22CD4DA60>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 47%|████▋ | 466/1000 [47:50<54:49, 6.16s/it] \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2023-05-24 至 2024-05-23\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 30%|██▉ | 299/1000 [29:29<1:09:17, 5.93s/it]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单39527167时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=39527167&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F231231520>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 36%|███▌ | 358/1000 [35:36<1:01:30, 5.75s/it]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单38398035时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=38398035&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F231606D80>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 37%|███▋ | 370/1000 [37:11<1:06:33, 6.34s/it]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单38121509时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=38121509&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F2317D58E0>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 37%|███▋ | 374/1000 [37:56<1:27:39, 8.40s/it]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单38000056时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=38000056&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F231817F50>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 49%|████▉ | 492/1000 [49:50<50:05, 5.92s/it] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单35733059时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=35733059&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F232FB2690>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 57%|█████▋ | 570/1000 [57:29<43:22, 6.05s/it] \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2022-05-24 至 2023-05-24\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 46%|████▌ | 455/1000 [42:13<51:13, 5.64s/it] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单28770640时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=28770640&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F2373C4260>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 52%|█████▏ | 517/1000 [48:13<43:45, 5.44s/it] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单28203564时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=28203564&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F237AD5790>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 53%|█████▎ | 530/1000 [49:47<43:38, 5.57s/it] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单28025893时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=28025893&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F2378F6BA0>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 54%|█████▎ | 536/1000 [50:41<51:26, 6.65s/it] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单27977874时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=27977874&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F237CDBDA0>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 66%|██████▌ | 658/1000 [1:02:26<31:20, 5.50s/it]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单26668270时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=26668270&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F22AB0D6D0>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 69%|██████▉ | 691/1000 [1:05:48<29:25, 5.71s/it] \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2021-05-24 至 2022-05-24\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 56%|█████▌ | 555/1000 [51:49<42:13, 5.69s/it] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单20781414时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=20781414&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F23CAFC200>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 57%|█████▋ | 568/1000 [53:22<40:50, 5.67s/it] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单20614104时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=20614104&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F23CBAE900>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 57%|█████▋ | 572/1000 [54:06<54:52, 7.69s/it] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理订单20573201时出错: HTTPSConnectionPool(host='www.yunxiu.com', port=443): Max retries exceeded with url: /legend/shop/order/detail?orderId=20573201&refer=order-list (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F23C8D3680>, 'Connection to www.yunxiu.com timed out. (connect timeout=None)'))\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 68%|██████▊ | 679/1000 [1:04:27<30:28, 5.70s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2020-05-24 至 2021-05-24\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 44%|████▎ | 435/1000 [40:20<52:23, 5.56s/it] \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2019-05-25 至 2020-05-24\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:47, 1.19s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2018-05-25 至 2019-05-25\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:09, 1.15s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2017-05-25 至 2018-05-25\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:23, 1.17s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2016-05-25 至 2017-05-25\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<18:42, 1.12s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2015-05-26 至 2016-05-25\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<18:46, 1.13s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2014-05-26 至 2015-05-26\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:06, 1.15s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2013-05-26 至 2014-05-26\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:12, 1.15s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2012-05-26 至 2013-05-26\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:14, 1.16s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2011-05-27 至 2012-05-26\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:21, 1.16s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2010-05-27 至 2011-05-27\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:56, 1.20s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2009-05-27 至 2010-05-27\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<18:50, 1.13s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2008-05-27 至 2009-05-27\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:23, 1.16s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2007-05-28 至 2008-05-27\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:11, 1.15s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2006-05-28 至 2007-05-28\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:21, 1.16s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2005-05-28 至 2006-05-28\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:16, 1.16s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"查询时间范围: 2004-05-28 至 2005-05-28\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 1/1000 [00:01<19:27, 1.17s/it]\n"
]
}
],
"execution_count": 1
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## 处理附表(废弃)",
"id": "758592b039b5f41a"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-14T02:51:30.881079Z",
"start_time": "2025-05-14T02:51:30.866080Z"
}
},
"cell_type": "code",
"source": [
"df1 = pd.DataFrame(all_data)\n",
"df2 = pd.DataFrame(all_base_ddata)\n",
"df3 = pd.DataFrame(all_service_data)\n",
"df4 = pd.DataFrame(all_parts_data)\n",
"df1.to_csv(r\"D:\\Idea Project\\F6+宜搭+其它(1)\\new\\文件输出\\京东云修数据导出-13986383030 -工单.csv\")\n",
"df2.to_csv(r\"D:\\Idea Project\\F6+宜搭+其它(1)\\new\\文件输出\\京东云修数据导出-13986383030 -工单子单基本信息.csv\")\n",
"df3.to_csv(r\"D:\\Idea Project\\F6+宜搭+其它(1)\\new\\文件输出\\京东云修数据导出-13986383030 -工单子单服务项目.csv\")\n",
"df4.to_csv(r\"D:\\Idea Project\\F6+宜搭+其它(1)\\new\\文件输出\\京东云修数据导出-13986383030 -工单子单配件项目.csv\")\n"
],
"id": "d9dc38b82db31903",
"outputs": [],
"execution_count": 50
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## 附表子单总额计算",
"id": "19be0dac78f1a3e"
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "",
"id": "8a1cc6d877124e86"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}