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
41331c56
Commit
41331c56
authored
Apr 22, 2024
by
xiao-hesheng
Browse files
优化脚本
parent
c1af44ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
air_case/b5_spd3_core_business_flow/a_a5流程五_中心库入库结算_正结算1_提交采购计划.air/a_a5流程五_中心库入库结算_正结算1_提交采购计划.py
View file @
41331c56
...
...
@@ -256,20 +256,19 @@ def get_GoodsPkgDef(hosGoodsId):
info
=
(
unitPackageid
,
unitPackageid
)
titlename
=
(
'unitPackageid1'
,
'unitPackageid2'
)
FileUtils
().
w_info8
(
info
,
'b5_spd3_core_business_flow'
,
'产品包装信息'
,
titlename
,
'message6'
)
#
try:
#
# 获取低值的hosGoodsId
#
hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
#
get_GoodsPkgDef(hosGoodsId) # 获取单元包id
#
except:
#
print('流程五获取hosGoodsId出现错误,请检查脚本或者数据')
#
try:
#
test1()
#
except:
#
print('采购计划提交出现错误,请检查脚本或者数据')
try
:
# 获取低值的hosGoodsId
hosGoodsId
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品审核信息'
,
'message2'
)[
"hosGoodsId"
]
get_GoodsPkgDef
(
hosGoodsId
)
# 获取单元包id
except
:
print
(
'流程五获取hosGoodsId出现错误,请检查脚本或者数据'
)
try
:
test1
()
except
:
print
(
'采购计划提交出现错误,请检查脚本或者数据'
)
#审批
try
:
approval_center
()
except
Exception
as
e
:
print
(
'审批采购计划出现错误,请检查脚本或者数据'
)
print
(
"发生异常:"
,
str
(
e
))
\ No newline at end of file
air_case/b5_spd3_core_business_flow/a_a6流程五_中心库入库结算_正结算2_外网配送.air/a_a6流程五_中心库入库结算_正结算2_外网配送.py
View file @
41331c56
...
...
@@ -5,8 +5,8 @@ from common.run_cmd_script import execute_command
__author__
=
"xiaohesheng"
"""
case_tag:api,mdm-core,a_a
5
流程五_中心库入库结算_正结算,id2302,id2302-
5
,sit,on
主数据平台:a_a
5
流程五_中心库入库结算_正结算
case_tag:api,mdm-core,a_a
6
流程五_中心库入库结算_正结算
2_外网配送
,id2302,id2302-
6
,sit,on
主数据平台:a_a
6
流程五_中心库入库结算_正结算
2_外网配送
"""
from
common.common_func
import
commonFuc
...
...
@@ -35,241 +35,3 @@ def login():
# 登录获取用户id等信息,使用创建的用户登录============结束
# 采购计划_低值
def
test1
():
module
=
"b3_herp3_purchase"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info
=
FileUtils
().
r_info8
(
'b2_herp3_bs'
,
"用户名信息"
,
'message3'
)
print
(
info
)
username1
=
info
[
'username1'
]
username
=
username1
## print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# 登录获取用户id等信息,使用创建的用户登录============结束
# 获取暂存的单号=======================================
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_purPlan_insert_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
hosGoodsId
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品审核信息'
,
'message2'
)[
"hosGoodsId"
]
pkgDefId
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品包装信息'
,
'message6'
)[
"unitPackageid1"
]
# 获取院区id
branch_id
=
FileUtils
().
r_info
(
'b2_herp3_bs'
,
'院区新增'
)[
"branch_id"
]
hosId
=
branch_id
[
0
:
5
]
deptid1
=
FileUtils
().
r_info8
(
'b2_herp3_bs'
,
'所有科室id'
,
'message6'
)[
"deptid1"
]
hospital_name
=
commonFuc
().
get_business_data
(
module
,
'hospital_name'
)
areaCode
=
FileUtils
().
r_info8
(
'b2_herp3_bs'
,
'shelfinfo'
,
'message7'
)[
"shelfCode"
]
areaName
=
FileUtils
().
r_info8
(
'b2_herp3_bs'
,
'shelfinfo'
,
'message7'
)[
"areaName"
]
recUser
=
uxid
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload1_1_1"
,
hosGoodsId
,
pkgDefId
,
hosId
,
branch_id
,
hospital_name
,
deptid1
,
deptid1
,
areaCode
,
areaName
,
recUser
)
print
(
'request_body'
,
request_body
)
# new_request_body = request_body.replace("'", '"')
# new_request_body = new_request_body.replace("None", 'null')
# # print(new_request_body)
# import json
# request_body_json = json.loads(new_request_body)
# print('request_body_json', request_body_json)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
pid
=
commonFuc
().
analysis_json
(
'data'
,
result
)
# 采购计划号
# 获取暂存的单号==========================================================
# 获取采购计划详情中的id
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_purPlan_listVo_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload11"
,
pid
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'resultaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
id1
=
commonFuc
().
analysis_json
(
'id'
,
data
[
0
])
orderNo
=
commonFuc
().
analysis_json
(
'orderNo'
,
data
[
0
])
print
(
'orderNo'
,
orderNo
)
titlename
=
(
'orderNo1'
,
'orderNo2'
)
info
=
(
orderNo
,
orderNo
)
FileUtils
().
w_info8
(
info
,
'b5_spd3_core_business_flow'
,
'采购计划单号'
,
titlename
,
'message7'
)
# =====================================
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_purPlan_submitPurPlan_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
provId
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_corpId"
]
provName
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_username"
]
subProvId
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_corpId"
]
subProvName
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_username"
]
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload12_1_1"
,
pid
,
id1
,
provId
,
provName
,
subProvId
,
subProvName
,
hosGoodsId
,
pkgDefId
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'resultbbbbbbbbbbbbbbbbbbbb'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
if
code
==
0
and
data
==
None
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
def
approval_center
():
module
=
"b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info
=
FileUtils
().
r_info8
(
'b2_herp3_bs'
,
"用户名信息"
,
'message3'
)
print
(
info
)
username1
=
info
[
'username1'
]
username
=
username1
## print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# 登录获取用户id等信息,使用创建的用户登录============结束
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"apprCenter_url"
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
# 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload50_6"
)
print
(
request_body
)
# # # 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'resultaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
result
)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
result
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
commonFuc
().
check_text_exist
(
0
,
result
)
taskId
=
commonFuc
().
analysis_json
(
'taskId'
,
data1
[
0
])
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"approvalBatch_url"
)
# 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload50_7"
,
taskId
)
print
(
request_body
)
# # # 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'resultaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
result
)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
result
)
if
code
>=
0
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
def
get_GoodsPkgDef
(
hosGoodsId
):
# 获取院区产品id==================开始
module
=
"b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info
=
FileUtils
().
r_info8
(
'b2_herp3_bs'
,
"用户名信息"
,
'message3'
)
print
(
info
)
username1
=
info
[
'username1'
]
username
=
username1
## print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# 登录获取用户id等信息,使用创建的用户登录===========结束
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"mcmsBranchGoodsInfo_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
# 获取院区id
branch_id
=
FileUtils
().
r_info
(
module
,
'院区新增'
)[
"branch_id"
]
hos_id
=
branch_id
[
0
:
5
]
print
(
hos_id
)
# hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
GoodsId
=
hosGoodsId
.
replace
(
hos_id
,
''
)
print
(
GoodsId
)
deptid1
=
FileUtils
().
r_info8
(
module
,
'所有科室id'
,
'message6'
)[
"deptid1"
]
# #请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload39_1_1"
,
branch_id
,
hos_id
,
GoodsId
,
deptid1
)
print
(
request_body
)
# # # 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
commonFuc
().
analysis_json
(
'data'
,
result
))
data
=
commonFuc
().
analysis_json
(
'data'
,
commonFuc
().
analysis_json
(
'data'
,
result
))
branchGoodsId
=
commonFuc
().
analysis_json
(
'branchGoodsId'
,
data
)
hosGoodsId
=
commonFuc
().
analysis_json
(
'hosGoodsId'
,
data
)
# 获取院区产品id ===========结束
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"branchGoodsPkgDef_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
# 获取院区id
branch_id
=
FileUtils
().
r_info
(
module
,
'院区新增'
)[
"branch_id"
]
# #请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload42_2"
,
hos_id
,
branch_id
,
branchGoodsId
)
print
(
'request_body'
,
request_body
)
# # # 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
unitPackageid
=
commonFuc
().
analysis_json
(
'id'
,
commonFuc
().
analysis_json
(
'data'
,
result
))
print
(
'unitPackageid'
,
unitPackageid
)
info
=
(
unitPackageid
,
unitPackageid
)
titlename
=
(
'unitPackageid1'
,
'unitPackageid2'
)
FileUtils
().
w_info8
(
info
,
'b5_spd3_core_business_flow'
,
'产品包装信息'
,
titlename
,
'message6'
)
# try:
# # 获取低值的hosGoodsId
# hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
# get_GoodsPkgDef(hosGoodsId) # 获取单元包id
# except:
# print('流程五获取hosGoodsId出现错误,请检查脚本或者数据')
# try:
# test1()
# except:
# print('采购计划提交出现错误,请检查脚本或者数据')
#审批
try
:
approval_center
()
except
Exception
as
e
:
print
(
'审批采购计划出现错误,请检查脚本或者数据'
)
print
(
"发生异常:"
,
str
(
e
))
\ No newline at end of file
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