Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-airtest-web-spd
Commits
f283f827
Commit
f283f827
authored
Apr 23, 2024
by
xiao-hesheng
Browse files
优化脚本
parent
ce208e03
Changes
4
Hide whitespace changes
Inline
Side-by-side
air_case/a6_mdm3_dp/a1订单配送列表数据查询_待确认查询3医院.air/a1订单配送列表数据查询_待确认查询3医院.py
View file @
f283f827
...
@@ -53,7 +53,10 @@ def select1():
...
@@ -53,7 +53,10 @@ def select1():
# print('request_body',request_body)
# print('request_body',request_body)
# 发送请求
# 发送请求
i
=
1
while
True
:
while
True
:
if
i
==
100
:
print
(
'600秒过去了,数据还没有同步到外网,请检查同步或者脚本或者环境'
)
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
print
(
'result'
,
result
)
# 断言
# 断言
...
@@ -64,6 +67,8 @@ def select1():
...
@@ -64,6 +67,8 @@ def select1():
break
break
else
:
else
:
time
.
sleep
(
6
)
time
.
sleep
(
6
)
i
=
i
+
1
print
(
'a1订单配送列表数据查询_待确认查询3'
,
'采购计划数据还没有传送到外网,等待6秒'
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
if
code
==
0
and
total
>=
1
:
if
code
==
0
and
total
>=
1
:
...
...
air_case/b5_spd3_core_business_flow/a_a6流程五_中心库入库结算_正结算2_外网配送.air/a_a6流程五_中心库入库结算_正结算2_外网配送.py
View file @
f283f827
...
@@ -255,8 +255,8 @@ def order_dp(type=1):
...
@@ -255,8 +255,8 @@ def order_dp(type=1):
try
:
try
:
#
order_dp(1) # 1低值
order_dp
(
1
)
# 1低值
#
order_dp(2)#2高值
order_dp
(
2
)
#2高值
order_dp
(
3
)
#3试剂
order_dp
(
3
)
#3试剂
except
Exception
as
e
:
except
Exception
as
e
:
print
(
'订单配送发生错误,请检查脚本或者数据'
)
print
(
'订单配送发生错误,请检查脚本或者数据'
)
...
...
air_case/b5_spd3_core_business_flow/a_a7流程五_中心库入库结算_正结算3_内网验收入库结算.air/a_a7流程五_中心库入库结算_正结算3_内网验收入库结算.py
0 → 100644
View file @
f283f827
# -*- encoding=utf8 -*-
import
traceback
from
air_case.mdm_login.登录外网系统.登录外网系统
import
login_system
from
common.fileUtls
import
FileUtils
from
common.run_cmd_script
import
execute_command
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,mdm-core,a_a7流程五_中心库入库结算_正结算3_内网验收入库结算,id2302,id2302-7,sit,on
主数据平台:a_a7流程五_中心库入库结算_正结算3_内网验收入库结算
python runner_test.py tag id2302-6 debug mdm3
"""
from
common.common_func
import
commonFuc
from
airtest.core.api
import
using
import
sys
import
time
module
=
"b5_spd3_core_business_flow"
def
check_order
(
type
=
1
):
execute_command
(
"python runner_test.py tag id2302-5 debug sit"
)
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
"供货关系申请2"
,
'message'
)
# print(info)
username
=
info
[
'e_username'
]
password
=
commonFuc
().
get_business_data
(
"b2_herp3_bs"
,
"password1"
)
# username = '001f90380'
# password='1qaz!QAZ'
print
(
'username,password'
,
username
,
password
)
# # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# # 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# 登录获取用户id等信息,使用创建的用户登录============结束
# =========================查询待确认订单======================
module
=
"a6_mdm3_dp"
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"purchase_page_url"
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
projectCode
)
branch_id
=
FileUtils
().
r_info
(
'b2_herp3_bs'
,
'院区新增'
)[
"branch_id"
]
hos_id
=
branch_id
[
0
:
5
]
exeProvId
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_corpId"
]
if
type
==
1
:
orderNo1
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'采购计划单号'
,
'message7'
)[
"orderNo1"
]
print
(
orderNo1
)
elif
type
==
2
:
orderNo1
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'采购计划单号高值'
,
'message11'
)[
"orderNo1"
]
print
(
orderNo1
)
elif
type
==
3
:
orderNo1
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'采购计划单号试剂'
,
'message12'
)[
"orderNo1"
]
print
(
orderNo1
)
else
:
orderNo1
=
'orderNo1'
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload1_1_1"
,
orderNo1
,
hos_id
,
exeProvId
)
# print('request_body',request_body)
# 发送请求
while
True
:
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
if
total
==
1
:
break
else
:
time
.
sleep
(
6
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
id1
=
commonFuc
().
analysis_json
(
'id'
,
data1
[
0
])
print
(
'id1'
,
id1
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
list_a
=
[]
list_b
=
[]
list_c
=
[]
list_a
.
append
(
data1
)
list_b
.
append
(
data1
)
list_c
.
append
(
data1
)
# print('list_a', len(list_a), list_a)
info
=
(
list_a
,
list_b
,
list_c
)
titlename
=
(
'list_a'
,
'list_b'
,
'list_c'
)
# 将配送订单信息息写入到文件中
FileUtils
().
w_info8
(
info
,
'b5_spd3_core_business_flow'
,
'配送订单信息'
,
titlename
,
'message8'
)
# 从message8文件中获取信息
info
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
"配送订单信息"
,
'message8'
)
# print('info', info)
list_a
=
info
[
'list_a'
]
list_a
=
','
.
join
(
map
(
str
,
list_a
))
import
json
new_request_body
=
list_a
.
replace
(
"'"
,
'"'
)
new_request_body1
=
new_request_body
.
replace
(
"None"
,
'null'
)
print
(
new_request_body1
)
list_a2
=
json
.
loads
(
new_request_body1
)
# print('list_a', list_a)
billMode
=
"billMode"
createUser
=
'createUser'
hosId
=
'hosId'
provId
=
'provId'
for
i
in
list_a2
:
billMode
=
i
[
"billMode"
]
createUser
=
i
[
"createUser"
]
hosId
=
i
[
'hosId'
]
provId
=
i
[
'provId'
]
break
# =========================查询待确认订单======================
# ==============================确认订单==================
module
=
"a6_mdm3_dp"
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"ensure_url"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2"
,
id1
,
uxid
)
# print('request_body',request_body)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
if
code
==
0
:
commonFuc
().
check_text_exist
(
code
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
# ==============================确认订单==================
# ==============================配送==================
# url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "purchase_page_url")
#
# request_body = commonFuc().get_business_data(module, "payload3_1_1",exeProvId,hos_id)
# # 发送请求
# result = commonFuc().http_post(url, request_body, headers)
# print('result', result)
# #断言
# code=commonFuc().analysis_json('code',result)
# data=commonFuc().analysis_json('data',result)
# total=commonFuc().analysis_json('total',data)
# data1 = commonFuc().analysis_json('data', data)
# id1=commonFuc().analysis_json('id', data1[0])
# print('id1',id1)
# ==================a3获取订单详细信息中的子表id_3_0医院
# a1订单配送列表数据查询_全部
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"detail_id_url"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload4"
,
id1
)
# print('request_body',request_body)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'resulta3获取订单详细信息中的子表id_3_0医院'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
commonFuc
().
check_text_exist
(
code
,
result
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
id2
=
commonFuc
().
analysis_json
(
'id'
,
data1
[
0
])
print
(
id1
,
id2
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
list_a
=
[]
list_b
=
[]
list_c
=
[]
list_a
.
append
(
data1
)
list_b
.
append
(
data1
)
list_c
.
append
(
data1
)
# print('list_a', len(list_a), list_a)
info
=
(
list_a
,
list_b
,
list_c
)
titlename
=
(
'list_a'
,
'list_b'
,
'list_c'
)
# 将配送订单信息息写入到文件中
FileUtils
().
w_info8
(
info
,
'b5_spd3_core_business_flow'
,
'配送订单详细信息'
,
titlename
,
'message9'
)
# ==================a3获取订单详细信息中的子表id_3_0医院
# ==================订单配送========================
module
=
"a6_mdm3_dp"
# a1订单配送列表数据查询_全部
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"submit_url"
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
projectCode
)
# 从message9文件中获取信息
info
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
"配送订单详细信息"
,
'message9'
)
print
(
'info从message9文件中获取信息'
,
info
)
# print('info', info)
list_a
=
info
[
'list_a'
]
# print('list_a',list_a,type(list_a))
# list_a = ','.join(map(str, list_a))
# import json
# new_request_body = list_a.replace("'", '"')
# new_request_body1 = new_request_body.replace("None", 'null')
# print('new_request_body1',new_request_body1)
#
# list_a2 = json.loads(new_request_body1)
# print('list_a2', list_a2)
# print('list_a2', type(list_a2))
hosGoodsId
=
'hosGoodsId'
mdmGoodsCode
=
'mdmGoodsCode'
goodsCode
=
'goodsCode'
pkgDefId
=
'pkgDefId'
erpCode
=
'erpCode'
for
i
in
list_a
:
print
(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
i
)
for
j
in
i
:
print
(
'bbbbbbbbbbbbbbbbbbb'
,
j
)
hosGoodsId
=
j
[
'hosGoodsId'
]
mdmGoodsCode
=
j
[
'mdmGoodsCode'
]
goodsCode
=
j
[
'goodsCode'
]
pkgDefId
=
j
[
'pkgDefId'
]
erpCode
=
j
[
'erpCode'
]
break
# # #获取日期
productDate
=
timeUtils
().
get_time_hms
(
5
)
expdtDate
=
timeUtils
().
get_time_add
(
190
,
2
)
if
type
==
1
:
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload9_2_1_1"
,
id1
,
id1
,
hosId
,
provId
,
billMode
,
createUser
,
username
,
createUser
,
id2
,
hosGoodsId
,
mdmGoodsCode
,
goodsCode
,
pkgDefId
,
productDate
,
expdtDate
,
erpCode
,
id2
)
elif
type
==
2
:
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload9_2_1_2"
,
id1
,
id1
,
hosId
,
provId
,
billMode
,
createUser
,
username
,
createUser
,
id2
,
hosGoodsId
,
mdmGoodsCode
,
goodsCode
,
productDate
,
expdtDate
,
erpCode
,
id2
)
elif
type
==
3
:
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload9_2_1_3"
,
id1
,
id1
,
hosId
,
provId
,
billMode
,
createUser
,
username
,
createUser
,
id2
,
hosGoodsId
,
mdmGoodsCode
,
goodsCode
,
pkgDefId
,
productDate
,
expdtDate
,
erpCode
,
id2
)
print
(
'request_body'
,
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
id1
=
commonFuc
().
analysis_json
(
'id'
,
data
)
info
=
(
id1
,
id1
)
titlename
=
(
'distrBillId1'
,
'distrBillId2'
)
# 将配送订单信息息写入到文件中
FileUtils
().
w_info8
(
info
,
'b5_spd3_core_business_flow'
,
'低值配送单号'
,
titlename
,
'message10'
)
if
code
==
0
:
commonFuc
().
check_text_exist
(
code
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
# ==================订单配送=====================================
try
:
check_order
(
1
)
# 1低值
except
Exception
as
e
:
print
(
'请检查脚本或者数据'
)
print
(
"发生异常:"
,
str
(
e
))
traceback
.
print_exc
()
report/summary.html
View file @
f283f827
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
<tr
width=
"600"
>
<tr
width=
"600"
>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
0
分5
2
秒
</td>
<td
class=
'details-col-elapsed'
>
1
分5
8
秒
</td>
<td
class=
"details-col-elapsed"
>
100.0%
</td>
<td
class=
"details-col-elapsed"
>
100.0%
</td>
</tr>
</tr>
</table>
</table>
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
<tr
width=
"600"
>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/a_a6流程五_中心库入库结算_正结算2_外网配送/log.html'
target=
'_blank'
>
a_a6流程五_中心库入库结算_正结算2_外网配送
</a></td>
<td
class=
"details-col-elapsed"
><a
href=
'../log/a_a6流程五_中心库入库结算_正结算2_外网配送/log.html'
target=
'_blank'
>
a_a6流程五_中心库入库结算_正结算2_外网配送
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
51.897
</td>
<td
class=
"details-col-elapsed"
>
118.158
</td>
<td
class=
"details-col-elapsed"
>
xiaohesheng
</td>
<td
class=
"details-col-elapsed"
>
xiaohesheng
</td>
</tr>
</tr>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment