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
2bf54d70
Commit
2bf54d70
authored
May 09, 2025
by
liguangyu06
Browse files
新增期初导入脚本
parent
9ca2d530
Changes
1
Hide whitespace changes
Inline
Side-by-side
air_case/b2_herp3_bs/期初导入.air/期初导入.py
0 → 100644
View file @
2bf54d70
# -*- encoding=utf8 -*-
import
random
import
sys
from
airtest.core.helper
import
using
from
common.db.sql.sql_del_branch_info
import
delData
from
common.db.sql.sql_del_kind_goodsinfo
import
delKindGoodsinfo
from
common.db.sql.sql_del_notices_info
import
delByNoticeName
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
import
threading
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,r_e2用户管理_角色管理_角色列表展示,id20250509,id20250412-id20250509,sit,on
内网:期初导入
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
import
requests
import
uuid
import
json
module
=
"b2_herp3_bs"
def
l_gen1
():
u_random
=
random
.
randint
(
1000
,
100000000000000
)
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username411"
)
## print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password411"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers_pur"
,
token
)
# 生成期初任务
url
=
"http://spdtest.cmic.com.cn:8080/api/herpService/mcmsInitStock/insertInitStock"
# print(url)
request_body
=
{
"stockId"
:
"1d7a43f605574af3bc69c6a24250718e"
,
"areaCode"
:
"area0389"
,
"purMode"
:
"60"
,
"hosId"
:
"h0347"
,
"branchId"
:
"h0347-2013"
}
"""
场景: 期初导入
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
result
=
json
.
loads
(
result
.
content
)
# 获取期初任务id
qc_id
=
result
[
"data"
]
orderNo
=
qc_id
.
replace
(
"h0347"
,
""
)
# 获取产品信息
url
=
"http://spdtest.cmic.com.cn:8080/api/herpService/mcmsInitStock/getMcmsGoodsInfoVOS"
# print(url)
request_body
=
{
"queryObject"
:
{
"id"
:
qc_id
,
"hosId"
:
"h0347"
,
"deptId"
:
"177b66929d40480d910ed7a3177dbd6f"
,
"stockId"
:
"1d7a43f605574af3bc69c6a24250718e"
,
"orderNo"
:
orderNo
,
"purMode"
:
60
,
"goodsSpec"
:
"Test-001"
},
"pageNum"
:
1
,
"pageSize"
:
1
}
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
result
=
json
.
loads
(
result
.
content
)
# print(result)
for
i
in
result
[
"data"
][
"data"
]:
# 获取产品信息
supplyId
=
i
[
"supplyId"
]
hosGoodsId
=
i
[
"hosGoodsId"
]
hosGoodsCode
=
i
[
"hosGoodsCode"
]
pkgDefId
=
i
[
"pkgDefId"
]
# 期初导入
url
=
"http://spdtest.cmic.com.cn:8080/api/herpService/mcmsInitStock/generate"
# print(url)
request_body
=
{
"initStockId"
:
qc_id
,
"orderNo"
:
orderNo
,
"initStockDetailDTOList"
:
[
{
"hosGoodsId"
:
hosGoodsId
,
"hosGoodsCode"
:
hosGoodsCode
,
"provId"
:
"p00002a0c"
,
"subProvId"
:
"p00002a0c"
,
"inSettlement"
:
6
,
"supplyId"
:
supplyId
,
"initStockBatchVOS"
:
[
{
"batchCode"
:
u_random
,
"productDate"
:
"2025-04-01"
,
"expdtDate"
:
"2029-04-30"
,
"stockQty"
:
12
,
"pkgDefId"
:
pkgDefId
,
"pkgDefName"
:
"小包"
,
"pkgDefQty"
:
12
}
],
"price"
:
180
,
"codingType"
:
0
}
],
"ignoreValidExpDate"
:
True
}
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
result
=
json
.
loads
(
result
.
content
)
print
(
result
)
# 创建多线程
threads
=
[]
for
_
in
range
(
4
):
t
=
threading
.
Thread
(
target
=
l_gen1
())
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