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
c6494367
Commit
c6494367
authored
Apr 14, 2025
by
liguangyu06
Browse files
增加多线程
parent
1a6e8495
Changes
1
Hide whitespace changes
Inline
Side-by-side
air_case/b2_herp3_bs/生成结算数据.air/生成结算数据.py
View file @
c6494367
...
...
@@ -26,8 +26,9 @@ import json
module
=
"b2_herp3_bs"
def
c_pur
():
def
c_pur
():
# 生成随机数
u_id
=
str
(
uuid
.
uuid4
())
u_random
=
random
.
randint
(
1000
,
100000000000000
)
...
...
@@ -41,38 +42,25 @@ def c_pur():
# print( token,projectCode,uxid,corpId,info)
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers_pur"
,
token
)
#
第二步发起站点资料变更
#
获取供应商产品信息
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"pur_get_goods_url"
)
# print(url)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload_pur"
)
"""
场景: 站点资料申请变更功能验证
用例名称:站点资料申请变更功能验证
输出:{"success":true,"code":"200","message":"OK","data":"success"}
场景: 通过手工入库方式创建结算数据
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
result
=
json
.
loads
(
result
.
content
)
# print(len(result["data"]["data"]))
# len = random.randint(0, len(result["data"]["data"]) - 1)
# # 获取产品信息
# detail_list = result["data"]["data"][len]
# print(detail_list["hosGoodsCode"])
# 轮询获取具体产品信息
for
i
in
result
[
"data"
][
"data"
]:
pkg_def_id
=
i
[
"pkgDefVOList"
][
0
][
"pkgDefId"
]
#
print(i["hosGoodsCode"])
#
设置结算方式为入中心库结算
i
[
"inSettlement"
]
=
1
# pkg_def_id = result["data"]["data"][0]["pkgDefVOList"][0]["pkgDefId"]
# detail_list["inSettlement"] = 1
# 补充批号效期信息
initStockBatchVOS
=
[
{
"batchCode"
:
u_random
,
...
...
@@ -102,7 +90,7 @@ def c_pur():
i
[
"initStockBatchVOS"
]
=
initStockBatchVOS
i
[
"batchVOS"
]
=
batchVOS
i
[
"stockQty"
]
=
1
# 补充供应商信息
json1
=
{
"areaCode"
:
"area0379"
,
"deptId"
:
"391d5e06d0ba4cb39a3a7ee2e7934ae7"
,
...
...
@@ -116,7 +104,6 @@ def c_pur():
}
json1
[
"detailVOS"
]
=
[
i
]
payload_pur
=
json1
# 手工入库
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"pur_submit_url"
)
request_body
=
json1
...
...
@@ -125,14 +112,14 @@ def c_pur():
# 获取接口响应时间
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 创建多线程
threads
=
[]
for
_
in
range
(
1
0
):
for
_
in
range
(
2
0
):
t
=
threading
.
Thread
(
target
=
c_pur
)
threads
.
append
(
t
)
t
.
start
()
# 等待所有线程完成
for
t
in
threads
:
t
.
join
()
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