脚本
This commit is contained in:
@@ -0,0 +1,417 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"'''\n",
|
||||
"1、单据管理中导出单据列表\n",
|
||||
"2、通过接口获取单据id\n",
|
||||
"3、进入单据详情页面、点击取消收款、点击取消完工\n",
|
||||
"4、通过接口删除单据\n",
|
||||
"'''"
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 获取单据id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 获取单据id\n",
|
||||
"import pandas as pd\n",
|
||||
"import requests\n",
|
||||
"\n",
|
||||
"cookies_str = 'maintainSESSIONID=c9f660ff-291a-4c85-858b-db4420cbc038; sensorsdata2015jssdkcross={\"distinct_id\":\"10691192243902595917\",\"first_id\":\"1750b4690af1f6-089dd3a4874eb8-3d634f03-1327104-1750b4690b09d0\",\"props\":{\"$latest_traffic_source_type\":\"直接流量\",\"$latest_search_keyword\":\"未取到值_直接打开\",\"$latest_referrer\":\"\"},\"$device_id\":\"1750b4690af1f6-089dd3a4874eb8-3d634f03-1327104-1750b4690b09d0\"}; gr_user_id=408fef1a-77ed-4e74-8f1e-31dde3446f2e; prodOrg=11240984669917702548; unp=15658998626808512553; un=15658998626808512553; _up=-NillNN-qyBEJ--t3vnSknvoOF55yPmEucUD0X03Wu9YV_PEoprQjaZJ9Q3d-WrAAGgt60MgQHajHWBHMKKxj0CuWypi1JgKCFP1EPEk-HbrE_oQrI4k0wIL_fFRv-ZNHu3M-GTc2J25HH6gqO9TgesSlVfBOxZsrEj93n659sC4UWM.; tmall=false; sensorsdata2015jssdkcross={\"distinct_id\":\"15658998626808512553\",\"first_id\":\"1750b4690af1f6-089dd3a4874eb8-3d634f03-1327104-1750b4690b09d0\",\"props\":{\"$latest_traffic_source_type\":\"直接流量\",\"$latest_search_keyword\":\"未取到值_直接打开\",\"$latest_referrer\":\"\"},\"$device_id\":\"1750b4690af1f6-089dd3a4874eb8-3d634f03-1327104-1750b4690b09d0\"}'\n",
|
||||
"\n",
|
||||
"cookies_str = cookies_str.encode('utf-8').decode('latin-1')\n",
|
||||
"\n",
|
||||
"cookie_dict = {item.split('=')[0]: item.split('=')[1]\n",
|
||||
" for item in cookies_str.split('; ')}\n",
|
||||
"\n",
|
||||
"headers = {\n",
|
||||
" 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Edg/95.0.1020.40',\n",
|
||||
" \"Content-Type\": \"application/json\",\n",
|
||||
" 'origin': 'https://yunxiu.f6car.cn'\n",
|
||||
"}\n",
|
||||
"list_new = []\n",
|
||||
"for i in range(1,10):\n",
|
||||
" res = requests.get(f'https://yunxiu.f6car.cn/maintain/list/getMaintainList?currentPage={i}&pageSize=100&idOwnOrgList=11240984669917702548&maintainTypeList=GD&beginDate=2022-12-21&endDate=2023-03-21&idEmployeeList=&serviceEmployeeIdList=&isDel=0&sourceFrom=maintainNormal&enableCount=true',cookies=cookie_dict)\n",
|
||||
" for a in range(len(res.json()['data']['list'])):\n",
|
||||
" print(res.json()['data']['list'][a]['billNo'],res.json()['data']['list'][a]['pkId'])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 进入单据详情页面:取消收款"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"GD20230319017 11768276383074107439 2023-03-22 11:47:16\n",
|
||||
"GD20230309005 11764479936146985055 2023-03-22 11:47:24\n",
|
||||
"GD20230319013 11768187725428047918 2023-03-22 11:47:32\n",
|
||||
"GD20230313012 11766014184293158987 2023-03-22 11:47:40\n",
|
||||
"GD20230208001 11767025915467415585 2023-03-22 11:47:48\n",
|
||||
"GD20230308003 11767746673583870043 2023-03-22 11:47:55\n",
|
||||
"GD20230308009 11768284042280063006 2023-03-22 11:48:03\n",
|
||||
"GD20230310002 11767090740411256864 2023-03-22 11:48:10\n",
|
||||
"GD20230311001 11765172295016923178 2023-03-22 11:48:17\n",
|
||||
"GD20230313010 11766001634784591881 2023-03-22 11:48:23\n",
|
||||
"GD20230314005 11766342718580604955 2023-03-22 11:48:30\n",
|
||||
"GD20230314006 11766346247563137102 2023-03-22 11:48:37\n",
|
||||
"GD20230316016 11767060428914442326 2023-03-22 11:48:45\n",
|
||||
"GD20230316028 11767120027042467935 2023-03-22 11:48:52\n",
|
||||
"GD20230318020 11767828869023809571 2023-03-22 11:48:59\n",
|
||||
"GD20230319003 11768074023303397433 2023-03-22 11:49:06\n",
|
||||
"GD20230308002 11767106703382822918 2023-03-22 11:49:14\n",
|
||||
"GD20230312004 11765576222329819181 2023-03-22 11:49:22\n",
|
||||
"GD20230313014 11766032078532005985 2023-03-22 11:49:29\n",
|
||||
"GD20230313016 11766036423570903115 2023-03-22 11:49:36\n",
|
||||
"GD20230314002 11766324742951288907 2023-03-22 11:49:44\n",
|
||||
"GD20230314009 11766357941635010601 2023-03-22 11:49:52\n",
|
||||
"GD20230315002 11766608897853374505 2023-03-22 11:49:59\n",
|
||||
"GD20230316003 11766971868362326039 2023-03-22 11:50:06\n",
|
||||
"GD20230316010 11767018950355861600 2023-03-22 11:50:13\n",
|
||||
"GD20230316013 11767027763922358282 2023-03-22 11:50:20\n",
|
||||
"GD20230317001 11767348061230088287 2023-03-22 11:50:28\n",
|
||||
"GD20230319001\n",
|
||||
"GD20230319004 11768075129513328649 2023-03-22 11:50:42\n",
|
||||
"GD20230319006 11768091781583880281 2023-03-22 11:50:50\n",
|
||||
"GD20230308001 11764555581682110487 2023-03-22 11:50:57\n",
|
||||
"GD20230308004 11767773481192669275 2023-03-22 11:51:04\n",
|
||||
"GD20230310004 11767543705731354662 2023-03-22 11:51:11\n",
|
||||
"GD20230311007 11765384945608966182 2023-03-22 11:51:18\n",
|
||||
"GD20230312003 11765575737032069166 2023-03-22 11:51:25\n",
|
||||
"GD20230312016 11765719958393208922 2023-03-22 11:51:32\n",
|
||||
"GD20230314004 11766339050632396858 2023-03-22 11:51:39\n",
|
||||
"GD20230315006 11766636528153935953 2023-03-22 11:51:46\n",
|
||||
"GD20230315007 11766643584479019054 2023-03-22 11:51:53\n",
|
||||
"GD20230315009 11766702143711498260 2023-03-22 11:52:00\n",
|
||||
"GD20230316018 11767064603312275505 2023-03-22 11:52:07\n",
|
||||
"GD20230316027 11767111906303692881 2023-03-22 11:52:14\n",
|
||||
"GD20230319005 11768077574054367330 2023-03-22 11:52:21\n",
|
||||
"GD20230320003 11768440913121001562 2023-03-22 11:52:28\n",
|
||||
"GD20230224002 11765668846638219320 2023-03-22 11:52:36\n",
|
||||
"GD20230309001 11764439496739799063 2023-03-22 11:52:44\n",
|
||||
"GD20230309008 11764494383657795587 2023-03-22 11:52:50\n",
|
||||
"GD20230309010 11764543445606092841 2023-03-22 11:52:56\n",
|
||||
"GD20230311004 11765363081071312985 2023-03-22 11:53:03\n",
|
||||
"GD20230311008 11767089137738338378 2023-03-22 11:53:09\n",
|
||||
"GD20230312006 11765618351802437659 2023-03-22 11:53:16\n",
|
||||
"GD20230312007 11765619672580374625 2023-03-22 11:53:22\n",
|
||||
"GD20230312011 11765671644129935389 2023-03-22 11:53:28\n",
|
||||
"GD20230312014 11765715726608912421 2023-03-22 11:53:35\n",
|
||||
"GD20230313001 11765932839273517089 2023-03-22 11:53:41\n",
|
||||
"GD20230315001 11766606346894458940 2023-03-22 11:53:47\n",
|
||||
"GD20230315008 11766684928220090406 2023-03-22 11:53:53\n",
|
||||
"GD20230316006 11767003271867158604 2023-03-22 11:54:00\n",
|
||||
"GD20230317002 11767371537093513231 2023-03-22 11:54:06\n",
|
||||
"GD20230318003 11767709188736700508 2023-03-22 11:54:13\n",
|
||||
"GD20230318005 11767734533108023389 2023-03-22 11:54:19\n",
|
||||
"GD20230318015 11767807019652763707 2023-03-22 11:54:25\n",
|
||||
"GD20230318017 11767820305911791705 2023-03-22 11:54:31\n",
|
||||
"GD20230318021 11767829427952570380 2023-03-22 11:54:37\n",
|
||||
"GD20230319008 11768115353333284922 2023-03-22 11:54:44\n",
|
||||
"GD20230319009 11768135358850547763 2023-03-22 11:54:51\n",
|
||||
"GD20230319010 11768138699068428359 2023-03-22 11:54:58\n",
|
||||
"GD20230319016 11768272995422851156 2023-03-22 11:55:07\n",
|
||||
"GD20230320004 11768444464194928738 2023-03-22 11:55:15\n",
|
||||
"GD20230309004 11764460796711555163 2023-03-22 11:55:21\n",
|
||||
"GD20230309007 11764484232548732969 2023-03-22 11:55:28\n",
|
||||
"GD20230313019 11766094525343223828 2023-03-22 11:55:34\n",
|
||||
"GD20230315011 11766723414440562785 2023-03-22 11:55:41\n",
|
||||
"GD20230315012 11766732719491403855 2023-03-22 11:55:47\n",
|
||||
"GD20230316009 11767014278576492547 2023-03-22 11:55:53\n",
|
||||
"GD20230316022 11767101440936394765 2023-03-22 11:55:59\n",
|
||||
"GD20230317007 11767406742277738515 2023-03-22 11:56:05\n",
|
||||
"GD20230318006 11767735424217272393 2023-03-22 11:56:12\n",
|
||||
"GD20230318023 11767848850784538704 2023-03-22 11:56:18\n",
|
||||
"GD20230224001 11765662166550597691 2023-03-22 11:56:25\n",
|
||||
"GD20230302001 11768155761350295606 2023-03-22 11:56:33\n",
|
||||
"GD20230309003 11764453220749950975 2023-03-22 11:56:41\n",
|
||||
"GD20230309012 11767545970307387478 2023-03-22 11:56:50\n",
|
||||
"GD20230310005 11768498060362006533 2023-03-22 11:56:58\n",
|
||||
"GD20230311003 11765262602479882244 2023-03-22 11:57:04\n",
|
||||
"GD20230311009 11767836173127405647 2023-03-22 11:57:11\n",
|
||||
"GD20230313008 11765997375045255171 2023-03-22 11:57:18\n",
|
||||
"GD20230317008 11767416479270584358 2023-03-22 11:57:25\n",
|
||||
"GD20230317011 11767450084927623241 2023-03-22 11:57:32\n",
|
||||
"GD20230317016 11767523474665390152 2023-03-22 11:57:39\n",
|
||||
"GD20230318008 11767749542886264859 2023-03-22 11:57:46\n",
|
||||
"GD20230318010 11767766291610353740 2023-03-22 11:57:52\n",
|
||||
"GD20230320001 11768432913417261135 2023-03-22 11:57:59\n",
|
||||
"GD20230320002 11768435473532338182 2023-03-22 11:58:07\n",
|
||||
"GD20230227001 11768259670920151076 2023-03-22 11:58:13\n",
|
||||
"GD20230308005 11767778371986018357 2023-03-22 11:58:20\n",
|
||||
"GD20230308006 11767780448254578777 2023-03-22 11:58:27\n",
|
||||
"GD20230308007 11767783487086547022 2023-03-22 11:58:33\n",
|
||||
"GD20230308008 11767806217311764487 2023-03-22 11:58:40\n",
|
||||
"GD20230309002 11764443512068657161 2023-03-22 11:58:46\n",
|
||||
"GD20230309011 11764551493007458338 2023-03-22 11:58:52\n",
|
||||
"GD20230310003 11767097652569722957 2023-03-22 11:58:58\n",
|
||||
"GD20230312001 11765541387305504815 2023-03-22 11:59:04\n",
|
||||
"GD20230312002 11765575164249526275 2023-03-22 11:59:10\n",
|
||||
"GD20230312009 11765648082547527681 2023-03-22 11:59:17\n",
|
||||
"GD20230312013 11765713231736229938 2023-03-22 11:59:23\n",
|
||||
"GD20230312017 11765729965356630075 2023-03-22 11:59:29\n",
|
||||
"GD20230312021 11767417093861949481 2023-03-22 11:59:36\n",
|
||||
"GD20230313002 11765933554968576043 2023-03-22 11:59:41\n",
|
||||
"GD20230313003 11765975327577227302 2023-03-22 11:59:47\n",
|
||||
"GD20230313005 11765992118818983940 2023-03-22 11:59:54\n",
|
||||
"GD20230313006 11765993418822537274 2023-03-22 12:00:00\n",
|
||||
"GD20230313007 11765996406228140078 2023-03-22 12:00:05\n",
|
||||
"GD20230313009 11765998306541457494 2023-03-22 12:00:11\n",
|
||||
"GD20230313017 11766037326784905252 2023-03-22 12:00:17\n",
|
||||
"GD20230313020 11767121376194875402 2023-03-22 12:00:23\n",
|
||||
"GD20230314003 11766333837821366309 2023-03-22 12:00:30\n",
|
||||
"GD20230315004 11766629223626723371 2023-03-22 12:00:36\n",
|
||||
"GD20230315005 11766632838739279886 2023-03-22 12:00:42\n",
|
||||
"GD20230315013 11766745699461382157 2023-03-22 12:00:49\n",
|
||||
"GD20230316005 11766998645784727607 2023-03-22 12:00:55\n",
|
||||
"GD20230316008 11767012436748554276 2023-03-22 12:01:01\n",
|
||||
"GD20230316015 11767057978534940764 2023-03-22 12:01:08\n",
|
||||
"GD20230316019 11767067711253794828 2023-03-22 12:01:14\n",
|
||||
"GD20230316020 11767079710968791045 2023-03-22 12:01:20\n",
|
||||
"GD20230316021 11767096913164255265 2023-03-22 12:01:26\n",
|
||||
"GD20230316023 11767102972075462704 2023-03-22 12:01:32\n",
|
||||
"GD20230316024 11767103372694409305 2023-03-22 12:01:38\n",
|
||||
"GD20230316025 11767105651543654493 2023-03-22 12:01:44\n",
|
||||
"GD20230316026 11767111613537075234 2023-03-22 12:01:50\n",
|
||||
"GD20230317004 11767386220907216971 2023-03-22 12:01:56\n",
|
||||
"GD20230317014 11767461272700862469 2023-03-22 12:02:02\n",
|
||||
"GD20230317015 11767473235866701896 2023-03-22 12:02:08\n",
|
||||
"GD20230318002 11767704408756867135 2023-03-22 12:02:14\n",
|
||||
"GD20230318004 11767721288716533810 2023-03-22 12:02:21\n",
|
||||
"GD20230318016 11767816479670550604 2023-03-22 12:02:26\n",
|
||||
"GD20230318018 11767823683979067392 2023-03-22 12:02:32\n",
|
||||
"GD20230318019 11767824964948869140 2023-03-22 12:02:38\n",
|
||||
"GD20230318024 11767891686699585632 2023-03-22 12:02:45\n",
|
||||
"GD20230319002 11768060190400725083 2023-03-22 12:02:50\n",
|
||||
"GD20230319014 11768189399316054102 2023-03-22 12:02:57\n",
|
||||
"GD20230319015 11768193205026181191 2023-03-22 12:03:03\n",
|
||||
"GD20230319018 11768277935696396315 2023-03-22 12:03:09\n",
|
||||
"GD20230320009 11768548487862435859 2023-03-22 12:03:15\n",
|
||||
"GD20230321001 11768790079013671005 2023-03-22 12:03:21\n",
|
||||
"GD20230321004 11768813218510684204 2023-03-22 12:03:27\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# 进入单据详情页面:取消收款\n",
|
||||
"from selenium import webdriver\n",
|
||||
"from selenium.webdriver.support.ui import Select\n",
|
||||
"from selenium.webdriver import ActionChains\n",
|
||||
"import time\n",
|
||||
"from xlutils.copy import copy\n",
|
||||
"from selenium.webdriver.common.keys import Keys\n",
|
||||
"from selenium.webdriver.support.ui import WebDriverWait\n",
|
||||
"from selenium.webdriver.support import expected_conditions as EC\n",
|
||||
"from selenium.webdriver.common.by import By\n",
|
||||
"from selenium.webdriver.support.wait import WebDriverWait\n",
|
||||
"import pandas as pd\n",
|
||||
"from selenium import webdriver\n",
|
||||
"from time import sleep,ctime\n",
|
||||
"#获取基础信息#获取基础信息\n",
|
||||
"name = '18522921001'\n",
|
||||
"password = 'Aa36349@'\n",
|
||||
"option_chrome = webdriver.ChromeOptions()\n",
|
||||
"option_chrome.add_argument('--headless')\n",
|
||||
"\n",
|
||||
"http='https://m.f6car.cn/'\n",
|
||||
"#driver = webdriver.Chrome(chrome_options=option_chrome)\n",
|
||||
"driver = webdriver.Chrome(executable_path=r\"C:\\Users\\admin\\Desktop\\Python脚本\\chromedriver.exe\")\n",
|
||||
"driver.maximize_window()\n",
|
||||
"driver.implicitly_wait(2)\n",
|
||||
"driver.get(http)\n",
|
||||
"\n",
|
||||
"# 在输入框中输入账号和密码\n",
|
||||
"username = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, r'//*[@id=\"pane-username\"]/form/div[1]/div/div[1]/input')))\n",
|
||||
"enter = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, r'//*[@id=\"pane-username\"]/form/div[3]/div/button')))\n",
|
||||
"username.clear()\n",
|
||||
"username.send_keys(name)\n",
|
||||
"driver.find_element_by_xpath(r'//*[@id=\"pane-username\"]/form/div[2]/div/div[1]/input').send_keys(password)\n",
|
||||
"enter.click()\n",
|
||||
"time.sleep(10)#预设时间\n",
|
||||
"\n",
|
||||
"df = pd.read_excel(r'C:\\Users\\admin\\Downloads\\工单详细列表导出 (1).xlsx',sheet_name='导出计数_单号',dtype='string')\n",
|
||||
"df.fillna('', inplace=True)\n",
|
||||
"for i in range(0,len(df)):\n",
|
||||
" try:\n",
|
||||
" code = df.loc[i,'单号']\n",
|
||||
" pkid = df.loc[i,'ID']\n",
|
||||
" https=f'https://yunxiu.f6car.cn/erp/view/index.html#/index/frame?toUrl=%2Fmaintain%2FgetMaintainInfoNew%2F{pkid}.do%3FlistQueryParam%3D%7B%22currentPage%22%3A1,%22pageSize%22%3A100,%22idOwnOrg%22%3A%2211240984669917702548%22,%22idOwnOrgList%22%3A%2211240984669917702548%22,%22maintainTypeList%22%3A%22GD%22,%22beginDate%22%3A%222022-12-22%22,%22endDate%22%3A%222023-03-22%22,%22idEmployeeList%22%3A%22%22,%22serviceEmployeeIdList%22%3A%22%22,%22isDel%22%3A0,%22sourceFrom%22%3A%22maintainNormal%22,%22rowNum%22%3A47%7D'\n",
|
||||
" driver.get(https)\n",
|
||||
" #传值转换\n",
|
||||
" driver.switch_to.frame('erp-qiankun-iframe')\n",
|
||||
" driver.find_element_by_xpath('//*[@id=\"cancelGathering\"]').click() # 取消收款\n",
|
||||
" time.sleep(0.5)\n",
|
||||
" driver.find_element_by_xpath('/html/body/ul/li/div/div/span[1]/a').click() # 确定\n",
|
||||
" time.sleep(0.5)\n",
|
||||
" print(code,pkid,time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))\n",
|
||||
" except:\n",
|
||||
" print(code)\n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 进入单据详情页面:取消完工"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 进入单据详情页面:取消完工\n",
|
||||
"from selenium import webdriver\n",
|
||||
"from selenium.webdriver.support.ui import Select\n",
|
||||
"from selenium.webdriver import ActionChains\n",
|
||||
"import time\n",
|
||||
"from xlutils.copy import copy\n",
|
||||
"from selenium.webdriver.common.keys import Keys\n",
|
||||
"from selenium.webdriver.support.ui import WebDriverWait\n",
|
||||
"from selenium.webdriver.support import expected_conditions as EC\n",
|
||||
"from selenium.webdriver.common.by import By\n",
|
||||
"from selenium.webdriver.support.wait import WebDriverWait\n",
|
||||
"import pandas as pd\n",
|
||||
"from selenium import webdriver\n",
|
||||
"from time import sleep,ctime\n",
|
||||
"#获取基础信息#获取基础信息\n",
|
||||
"name = '18522921001'\n",
|
||||
"password = 'Aa36349@'\n",
|
||||
"option_chrome = webdriver.ChromeOptions()\n",
|
||||
"option_chrome.add_argument('--headless')\n",
|
||||
"\n",
|
||||
"http='https://m.f6car.cn/'\n",
|
||||
"#driver = webdriver.Chrome(chrome_options=option_chrome)\n",
|
||||
"driver = webdriver.Chrome(executable_path=r\"C:\\Users\\admin\\Desktop\\Python脚本\\chromedriver.exe\")\n",
|
||||
"driver.maximize_window()\n",
|
||||
"driver.implicitly_wait(2)\n",
|
||||
"driver.get(http)\n",
|
||||
"\n",
|
||||
"# 在输入框中输入账号和密码\n",
|
||||
"username = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, r'//*[@id=\"pane-username\"]/form/div[1]/div/div[1]/input')))\n",
|
||||
"enter = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, r'//*[@id=\"pane-username\"]/form/div[3]/div/button')))\n",
|
||||
"username.clear()\n",
|
||||
"username.send_keys(name)\n",
|
||||
"driver.find_element_by_xpath(r'//*[@id=\"pane-username\"]/form/div[2]/div/div[1]/input').send_keys(password)\n",
|
||||
"enter.click()\n",
|
||||
"time.sleep(10)#预设时间\n",
|
||||
"\n",
|
||||
"df = pd.read_excel(r'C:\\Users\\admin\\Downloads\\工单详细列表导出 (1).xlsx',sheet_name='导出计数_单号',dtype='string')\n",
|
||||
"df.fillna('', inplace=True)\n",
|
||||
"for i in range(1,len(df)):\n",
|
||||
" try:\n",
|
||||
" code = df.loc[i,'单号']\n",
|
||||
" pkid = df.loc[i,'ID']\n",
|
||||
" https=f'https://yunxiu.f6car.cn/erp/view/index.html#/index/frame?toUrl=%2Fmaintain%2FgetMaintainInfoNew%2F{pkid}.do%3FlistQueryParam%3D%7B%22currentPage%22%3A1,%22pageSize%22%3A100,%22idOwnOrg%22%3A%2211240984669917702548%22,%22idOwnOrgList%22%3A%2211240984669917702548%22,%22maintainTypeList%22%3A%22GD%22,%22beginDate%22%3A%222022-12-22%22,%22endDate%22%3A%222023-03-22%22,%22idEmployeeList%22%3A%22%22,%22serviceEmployeeIdList%22%3A%22%22,%22isDel%22%3A0,%22sourceFrom%22%3A%22maintainNormal%22,%22rowNum%22%3A47%7D'\n",
|
||||
" driver.get(https)\n",
|
||||
" #传值转换\n",
|
||||
" driver.switch_to.frame('erp-qiankun-iframe')\n",
|
||||
" driver.find_element_by_xpath('//*[@id=\"cancelComplete\"]').click() # 取消完工\n",
|
||||
" time.sleep(0.5)\n",
|
||||
" alert=driver.switch_to.alert #创建弹窗对象\n",
|
||||
" alert.accept() #点击弹窗中的【确定】\n",
|
||||
" time.sleep(0.5)\n",
|
||||
" print(code,pkid,time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))\n",
|
||||
" except:\n",
|
||||
" print(code)\n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 删除单据"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 删除单据\n",
|
||||
"import pandas as pd\n",
|
||||
"import requests\n",
|
||||
"\n",
|
||||
"cookies_str = 'maintainSESSIONID=f5071220-d211-4e5e-9c77-c8000d010c1f; sensorsdata2015jssdkcross={\"distinct_id\":\"10691192243902595917\",\"first_id\":\"1750b4690af1f6-089dd3a4874eb8-3d634f03-1327104-1750b4690b09d0\",\"props\":{\"$latest_traffic_source_type\":\"直接流量\",\"$latest_search_keyword\":\"未取到值_直接打开\",\"$latest_referrer\":\"\"},\"$device_id\":\"1750b4690af1f6-089dd3a4874eb8-3d634f03-1327104-1750b4690b09d0\"}; gr_user_id=408fef1a-77ed-4e74-8f1e-31dde3446f2e; prodOrg=11240984669917188035; unp=15632739166222045268; un=15632739166222045268; _up=-NillNN-qyBEJ--t3vnSknvoOF55zvOKs8QE1X09WOVdUvTDoZHQjaZJ9Q3d-WrAAGgt60MgQHajHWBHMKKxj0CuWypi1JgKCFP1EPEk-HbrE_oXr4kj1QYE-flRv-ZNHu3M-GTc2JuzEnShr-tTi-kYkFLGPBVnrEj9mRTDoJuzcWA.; tmall=false; sensorsdata2015jssdkcross={\"distinct_id\":\"15632739166222045268\",\"first_id\":\"1750b4690af1f6-089dd3a4874eb8-3d634f03-1327104-1750b4690b09d0\",\"props\":{\"$latest_traffic_source_type\":\"直接流量\",\"$latest_search_keyword\":\"未取到值_直接打开\",\"$latest_referrer\":\"\"},\"$device_id\":\"1750b4690af1f6-089dd3a4874eb8-3d634f03-1327104-1750b4690b09d0\"}'\n",
|
||||
"\n",
|
||||
"cookies_str = cookies_str.encode('utf-8').decode('latin-1')\n",
|
||||
"\n",
|
||||
"cookie_dict = {item.split('=')[0]: item.split('=')[1]\n",
|
||||
" for item in cookies_str.split('; ')}\n",
|
||||
"\n",
|
||||
"headers = {\n",
|
||||
" 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Edg/95.0.1020.40',\n",
|
||||
" \"Content-Type\": \"application/json\",\n",
|
||||
" 'origin': 'https://yunxiu.f6car.cn'\n",
|
||||
"}\n",
|
||||
"df = pd.read_excel(r'C:\\Users\\admin\\Downloads\\工单列表导出.xlsx',sheet_name='Sheet1',dtype='string')\n",
|
||||
"df.fillna('', inplace=True)\n",
|
||||
"for i in range(1,len(df)):\n",
|
||||
" code = df.loc[i,'单号']\n",
|
||||
" pkid = df.loc[i,'ID']\n",
|
||||
" # 获取version\n",
|
||||
" res = requests.get(f'https://yunxiu.f6car.cn/maintain/onlineeditor/getOnlineEditorsNew?idSourceBill={pkid}&type=1',cookies=cookie_dict,headers=headers)\n",
|
||||
" version = res.json()['data']['version']\n",
|
||||
" data={\n",
|
||||
" \"pkId\": pkid,\n",
|
||||
" \"version\": version\n",
|
||||
" }\n",
|
||||
" res = requests.post(f'https://yunxiu.f6car.cn/maintain/detail/delMaintain',cookies=cookie_dict,headers=headers,json=data)\n",
|
||||
" print(i,code,res.json(),time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "F6processing",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.4"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user