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
52ec8365
Commit
52ec8365
authored
Apr 09, 2024
by
xiao-hesheng
Browse files
新增期初录入脚本
parent
88e16d56
Changes
4
Hide whitespace changes
Inline
Side-by-side
air_case/b4_herp3_InitStock/a_a7_期初录入_低值_生成.air/a_a7_期初录入_低值_生成.py
View file @
52ec8365
...
@@ -34,7 +34,7 @@ def test1():
...
@@ -34,7 +34,7 @@ def test1():
# print( token,projectCode,uxid,corpId,info)
# print( token,projectCode,uxid,corpId,info)
#
#
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_mcmsInitStock_
insertTemp
_url"
)
"herpService_mcmsInitStock_
generate
_url"
)
print
(
url
)
print
(
url
)
# 获取请求头信息
# 获取请求头信息
...
@@ -117,7 +117,7 @@ def test1():
...
@@ -117,7 +117,7 @@ def test1():
pro_path
=
commonFuc
().
get_pro_path
()
pro_path
=
commonFuc
().
get_pro_path
()
sys
.
path
.
append
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a8_期初录入_低值_查询单元含量信息.air'
)
sys
.
path
.
append
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a8_期初录入_低值_查询单元含量信息.air'
)
using
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a8_期初录入_低值_查询单元含量信息.air'
)
using
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a8_期初录入_低值_查询单元含量信息.air'
)
from
a_a
7
_期初录入_低值_查询单元含量信息
import
test1
from
a_a
8
_期初录入_低值_查询单元含量信息
import
test1
print
(
'hosGoodsId'
,
hosGoodsId
)
print
(
'hosGoodsId'
,
hosGoodsId
)
test1
(
hosGoodsId
)
test1
(
hosGoodsId
)
#从message3文件中读取单元包信息
#从message3文件中读取单元包信息
...
@@ -140,10 +140,60 @@ def test1():
...
@@ -140,10 +140,60 @@ def test1():
pkgDefId
=
i
[
'id'
]
pkgDefId
=
i
[
'id'
]
pkgDefName
=
i
[
'pkgDefName'
]
pkgDefName
=
i
[
'pkgDefName'
]
pkgDefQty
=
i
[
'pkgDefQty'
]
pkgDefQty
=
i
[
'pkgDefQty'
]
break
# # 请求体
# # 请求体
hospitalId
=
commonFuc
().
get_business_data
(
module
,
"hospitalId"
)
hospitalId
=
commonFuc
().
get_business_data
(
module
,
"hospitalId"
)
branchId
=
commonFuc
().
get_business_data
(
module
,
"branchId"
)
branchId
=
commonFuc
().
get_business_data
(
module
,
"branchId"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload_5"
,
id
,
orderNo
,
hosGoodsId
,
hosGoodsCode
,
provId
,
subProvId
,
inSettlement
,
supplyId
,
batchCode
,
productDate
,
expdtDate
,
stockQty
,
pkgDefId
,
pkgDefName
,
pkgDefQty
)
sys
.
path
.
append
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_b3_期初录入_生成_获取详细信息.air'
)
using
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_b3_期初录入_生成_获取详细信息.air'
)
from
a_b3_期初录入_生成_获取详细信息
import
test1
# 从message5文件中读取期初子表id
info
=
FileUtils
().
r_info8
(
module
,
"期初单子表信息"
,
'message5'
)
# print('info', info)
list_a
=
info
[
'list_a'
]
list_a
=
','
.
join
(
map
(
str
,
list_a
))
print
(
list_a
)
# 输出:
print
(
'list_a'
,
list_a
,
type
(
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_a2'
,
list_a2
,
type
(
list_a2
))
initStockBatchVOS_id
=
'initStockBatchVOS_id'
lastModified
=
'lastModified'
version
=
'version'
createTime
=
'createTime'
createUser
=
'createUser'
lastModifiedUser
=
'lastModifiedUser'
pid
=
'pid'
detailId
=
'detailId'
unit
=
'unit'
purMode
=
'purMode'
unitName
=
'unitName'
batchVORepeatKey
=
'batchVORepeatKey'
for
i
in
list_a2
:
initStockBatchVOS
=
i
[
'initStockBatchVOS'
]
break
for
i
in
initStockBatchVOS
:
initStockBatchVOS_id
=
i
[
'id'
]
lastModified
=
i
[
'lastModified'
]
version
=
i
[
'version'
]
createTime
=
i
[
'createTime'
]
createUser
=
i
[
'createUser'
]
lastModifiedUser
=
i
[
'lastModifiedUser'
]
pid
=
i
[
'pid'
]
detailId
=
i
[
'detailId'
]
unit
=
i
[
'unit'
]
purMode
=
i
[
'purMode'
]
unitName
=
i
[
'unitName'
]
batchVORepeatKey
=
i
[
'batchVORepeatKey'
]
break
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload_9"
,
id
,
orderNo
,
hosGoodsId
,
hosGoodsCode
,
provId
,
subProvId
,
initStockBatchVOS_id
,
lastModified
,
version
,
createTime
,
createUser
,
lastModifiedUser
,
pid
,
detailId
,
batchCode
,
productDate
,
expdtDate
,
stockQty
,
pkgDefId
,
pkgDefName
,
pkgDefQty
,
unit
,
purMode
,
unitName
,
batchVORepeatKey
)
print
(
'request_body'
,
request_body
)
print
(
'request_body'
,
request_body
)
# 发送请求
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
...
...
air_case/b4_herp3_InitStock/a_b3_期初录入_生成_获取详细信息.air/a_b3_期初录入_生成_获取详细信息.py
0 → 100644
View file @
52ec8365
# -*- encoding=utf8 -*-
from
common.db.sql.sql_get_info
import
sql_get_info
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_b3_期初录入_生成_获取详细信息,id2301,id2301-13,sit,on
内网:a_b3_期初录入_生成_获取详细信息
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
def
test1
(
type
=
1
):
module
=
"b4_herp3_InitStock"
"""
场景:a_b2_期初录入_试剂_暂存
用例名称:a_b2_期初录入_试剂_暂存
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# 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
()
# print( token,projectCode,uxid,corpId,info)
#
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_mcmsInitStock_getInitStockDetails_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
)
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
# #从文件中获取库房名称,写脚本时用已经存在的库房,方便编写脚本和调试脚本
# stock_name=commonFuc().get_business_data(module,'stock_name')
# #============================================
# #从基础数据模块写入的库房名称中获取(暂时注释)
# # branch_name = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_name"]
# # stock_name=branch_name+'中心库房'
# #=============================================
# #通过数据库获取库房id和库区id===============
# stockId=sql_get_info().get_mcms_stock_info(stock_name)
# areaCode=sql_get_info().get_mcms_stock_shelf_info(stockId)
# stockId = stockId.replace("'", "")
# areaCode=areaCode.replace("'","")
# # 通过数据库获取库房id和库区id===============
# 调用a_a4_期初录入_低值_录入_获取单据信息
pro_path
=
commonFuc
().
get_pro_path
()
sys
.
path
.
append
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a4_期初录入_低值_录入_获取单据信息.air'
)
using
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a4_期初录入_低值_录入_获取单据信息.air'
)
from
a_a4_期初录入_低值_录入_获取单据信息
import
test1
# 从文件读取期初单号_低值
if
type
==
1
:
info
=
FileUtils
().
r_info8
(
module
,
"期初单号低值"
,
'message'
)
elif
type
==
2
:
info
=
FileUtils
().
r_info8
(
module
,
"期初单号高值"
,
'message'
)
elif
type
==
3
:
info
=
FileUtils
().
r_info8
(
module
,
"期初单号试剂"
,
'message'
)
list2
=
info
[
'list_a'
]
QCID
=
' '
.
join
(
list2
)
# print('bbbb', QCID, type(QCID))
# test1(QCID)
# # 请求体
hospitalId
=
commonFuc
().
get_business_data
(
module
,
"hospitalId"
)
branchId
=
commonFuc
().
get_business_data
(
module
,
"branchId"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload_10"
,
QCID
)
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
and
len
(
data
)
>=
1
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
# 期初字表详细信息写入文件
list_a
=
[]
list_b
=
[]
list_c
=
[]
list_a
.
append
(
data
)
list_b
.
append
(
data
)
list_c
.
append
(
data
)
# 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
,
module
,
'期初单子表信息'
,
titlename
,
'message5'
)
test1
()
data/b4_herp3_InitStock/data
View file @
52ec8365
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
"herpService_mcmsInitStock_insertTemp_url": "/api/herpService/mcmsInitStock/insertTemp"
"herpService_mcmsInitStock_insertTemp_url": "/api/herpService/mcmsInitStock/insertTemp"
"herpService_mcmsInitStock_queryPkgDefList_url": "/api/herpService/mcmsInitStock/queryPkgDefList"
"herpService_mcmsInitStock_queryPkgDefList_url": "/api/herpService/mcmsInitStock/queryPkgDefList"
"herpService_mcmsInitStock_decode_url": "/api/herpService/mcmsInitStock/decode"
"herpService_mcmsInitStock_decode_url": "/api/herpService/mcmsInitStock/decode"
"herpService_mcmsInitStock_generate_url": "/api/herpService/mcmsInitStock/generate"
"herpService_mcmsInitStock_getInitStockDetails_url": "/api/herpService/mcmsInitStock/getInitStockDetails"
data1: "10,20,60"
data1: "10,20,60"
data2: "00001986,一次性医药包-低值,一次性医药包"
data2: "00001986,一次性医药包-低值,一次性医药包"
...
@@ -50,6 +52,8 @@ json_headers2: {
...
@@ -50,6 +52,8 @@ json_headers2: {
"payload_6": {"stockId":"%s","hosId":"%s","code":"%s"}
"payload_6": {"stockId":"%s","hosId":"%s","code":"%s"}
"payload_7": {"initStockDetailDTOList":[{"hosGoodsCode":"%s","id":null,"inSettlement":"%s","hosGoodsId":"%s","provId":"%s","subProvId":"%s","provName":"%s","subProvName":"%s","supplyId":"%s","mfrCode":"%s","pkgCodeSee":"%s","initStockBatchVOS":[{"batchCode":"%s","detailId":null,"expdtDate":"%s","id":null,"lastModified":null,"lastModifiedUser":null,"pid":null,"pkgDefId":null,"pkgDefName":null,"pkgDefQty":null,"productDate":"%s","stockQty":1,"snCode":"%s"}]}],"initStockId":"%s","orderNo":"%s"}
"payload_7": {"initStockDetailDTOList":[{"hosGoodsCode":"%s","id":null,"inSettlement":"%s","hosGoodsId":"%s","provId":"%s","subProvId":"%s","provName":"%s","subProvName":"%s","supplyId":"%s","mfrCode":"%s","pkgCodeSee":"%s","initStockBatchVOS":[{"batchCode":"%s","detailId":null,"expdtDate":"%s","id":null,"lastModified":null,"lastModifiedUser":null,"pid":null,"pkgDefId":null,"pkgDefName":null,"pkgDefQty":null,"productDate":"%s","stockQty":1,"snCode":"%s"}]}],"initStockId":"%s","orderNo":"%s"}
"payload_8": {"initStockId":"%s","orderNo":"%s","initStockDetailDTOList":[{"hosGoodsId":"%s","hosGoodsCode":"%s","provId":"%s","subProvId":"%s","inSettlement":"%s","supplyId":"%s","initStockBatchVOS":[{"batchCode":"%s","productDate":"%s","expdtDate":"%s","stockQty":"%s","pkgDefId":"%s","pkgDefName":" %s","pkgDefQty":"%s"}]}]}
"payload_8": {"initStockId":"%s","orderNo":"%s","initStockDetailDTOList":[{"hosGoodsId":"%s","hosGoodsCode":"%s","provId":"%s","subProvId":"%s","inSettlement":"%s","supplyId":"%s","initStockBatchVOS":[{"batchCode":"%s","productDate":"%s","expdtDate":"%s","stockQty":"%s","pkgDefId":"%s","pkgDefName":" %s","pkgDefQty":"%s"}]}]}
"payload_9": {"initStockId":"%s","orderNo":"%s","initStockDetailDTOList":[{"hosGoodsId":"%s","hosGoodsCode":"%s","provId":"%s","subProvId":"%s","inSettlement":"%s","supplyId":"%s","initStockBatchVOS":[{"id":"%s","lastModified":"%s","version":"%s","createTime":"%s","createUser":"%s","lastModifiedUser":"%s","pid":"%s","detailId":"%s","batchCode":"%s","productDate":"%s","expdtDate":"%s","stockQty":"%s","pkgDefId":"%s","pkgDefName":"%s","pkgDefQty":"%s","snCode":null,"unit":"%s","purMode":"%s","unitName":"%s","batchVORepeatKey":"%s"}]}]}
"payload_10": {"pid":"%s"}
checkDict2: {"code": 0,'msg': None,'data':1}
checkDict2: {"code": 0,'msg': None,'data':1}
report/summary.html
View file @
52ec8365
...
@@ -55,9 +55,9 @@
...
@@ -55,9 +55,9 @@
<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'
>
0
</td>
<td
class=
'details-col-elapsed'
>
0分2秒
</td>
<td
class=
'details-col-elapsed'
>
0分2秒
</td>
<td
class=
"details-col-elapsed"
>
10
0.0%
</td>
<td
class=
"details-col-elapsed"
>
0.0%
</td>
</tr>
</tr>
</table>
</table>
...
@@ -72,9 +72,9 @@
...
@@ -72,9 +72,9 @@
</tr>
</tr>
<tr
width=
"600"
>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/a_
b1
_期初录入_
试剂_暂存
/log.html'
target=
'_blank'
>
a_
b1
_期初录入_
试剂_暂存
</a></td>
<td
class=
"details-col-elapsed"
><a
href=
'../log/a_
a7
_期初录入_
低值_生成
/log.html'
target=
'_blank'
>
a_
a7
_期初录入_
低值_生成
</a></td>
<td
class=
"
success"
>
成功
</td>
<td
class=
"
fail"
>
失败
</td>
<td
class=
"details-col-elapsed"
>
2.
109
</td>
<td
class=
"details-col-elapsed"
>
2.
485
</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