Commit 18efab2a authored by xiao-hesheng's avatar xiao-hesheng
Browse files

脚本优化

parent e635078e
......@@ -21,65 +21,70 @@ python runner_test.py tag id2303-13 debug mdm3
"""
def check_mcms_dept_buy(type):
if type == 1: # 低值
def check_mcms_dept_buy(type=1):
hos_goods_id='hos_goods_id'
if type==1:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
branch_id = get_branch_id()
# 获取每次都会变化的字段create_time的值
create_time = get_create_time(
"select create_time from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s';" % (
branch_id, hos_goods_id))
print('create_time',create_time)
id = get_id(
"select id from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s';" % (branch_id, hos_goods_id))
print('id',id)
create_user = get_id(
"select create_user from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s' LIMIT 1;" % (
branch_id, hos_goods_id))
print('create_time', create_time, 'id', id)
sql = """select * from mcms_dept_buy_car where branch_id='%s' and hos_goods_id='%s' LIMIT 1;
""" % (branch_id, hos_goods_id)
actual_value1 = check_mcms_dept_buy_car(sql)
print(actual_value1)
deptid2 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
deptname2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
areaCode = get_stockAreaId_new(deptid2, deptname2, 2)
areaName = '默认库区'
# 读取文件中的信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
list_a = info['list_a']
mdm_goods_code = commonFuc().analysis_json('mdmGoodsCode', list_a)
pur_mode = commonFuc().analysis_json('purMode', list_a)
goodsCode = commonFuc().analysis_json('goodsCode', list_a)
pkgDefId = commonFuc().analysis_json('pkgDefId', list_a)
pkgDefName = commonFuc().analysis_json('pkgDefName', list_a)
last_modified_user = create_user
last_modified = create_time
# print('actual_value1',actual_value1)
actual_value2 = get_process_list2(actual_value1)
# print('actual_value2')
# print( actual_value2)
# prov_hos_goods_id = '8d6273b7bca84dd8aace12b9422d7fd6'
expected_value2 = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_dept_buy_car', id, get_hosid(), branch_id, deptid2,
deptname2, areaCode, areaName, hos_goods_id, mdm_goods_code,
goodsCode, pkgDefId, pkgDefName
, create_user, create_time, last_modified, last_modified_user)
# print('expected_value2', expected_value2)
# expected_value2=get_process_list2(expected_value2)
actual_value2 = actual_value2.replace(" ", "")
expected_value2 = expected_value2.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
elif type==2:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
branch_id = get_branch_id()
# 获取每次都会变化的字段create_time的值
create_time = get_create_time(
"select create_time from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s';" % (
branch_id, hos_goods_id))
print('create_time',create_time)
id = get_id(
"select id from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s';" % (branch_id, hos_goods_id))
print('id',id)
create_user = get_id(
"select create_user from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s' LIMIT 1;" % (
branch_id, hos_goods_id))
print('create_time', create_time, 'id', id)
sql = """select * from mcms_dept_buy_car where branch_id='%s' and hos_goods_id='%s' LIMIT 1;
""" % (branch_id, hos_goods_id)
actual_value1 = check_mcms_dept_buy_car(sql)
print(actual_value1)
deptid2 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
deptname2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
areaCode = get_stockAreaId_new(deptid2, deptname2, 2)
areaName = '默认库区'
# 读取文件中的信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
list_a = info['list_a']
mdm_goods_code = commonFuc().analysis_json('mdmGoodsCode', list_a)
pur_mode = commonFuc().analysis_json('purMode', list_a)
goodsCode = commonFuc().analysis_json('goodsCode', list_a)
pkgDefId = commonFuc().analysis_json('pkgDefId', list_a)
pkgDefName = commonFuc().analysis_json('pkgDefName', list_a)
last_modified_user = create_user
last_modified = create_time
# print('actual_value1',actual_value1)
actual_value2 = get_process_list2(actual_value1)
# print('actual_value2')
# print( actual_value2)
# prov_hos_goods_id = '8d6273b7bca84dd8aace12b9422d7fd6'
expected_value2 = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_dept_buy_car', id, get_hosid(), branch_id, deptid2,
deptname2, areaCode, areaName, hos_goods_id, mdm_goods_code,
goodsCode,pur_mode, pkgDefId, pkgDefName
, create_user, create_time, last_modified, last_modified_user)
# print('expected_value2', expected_value2)
# expected_value2=get_process_list2(expected_value2)
actual_value2 = actual_value2.replace(" ", "")
expected_value2 = expected_value2.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
try:
......@@ -105,9 +110,11 @@ try:
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'], 1)
check_mcms_dept_buy(1)
# # # 高值
# second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId'], 2)
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId'], 2)
check_mcms_dept_buy(2)
# # # 试剂
# second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'], 3)
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'], 3)
check_mcms_dept_buy(3)
# BuyCarSubmit() # 请领车提交
# for i in range(6): # 三个单据共审批6次
# approval_center()
......
二级库请领产品信息:
list_a:
- &id001
- hosGoodsId: h034700004500
purMode: 10
- hosGoodsId: h034700004499
purMode: 20
grantRule:
id:
goodsName: 一次性注射器_低值wExpg
goodsName: 高值牙钻机PFKHm
goodsSpec: G-31891
mdmGoodsCode: '11661453'
goodsCode: '00004500'
mdmGoodsCode: '11661452'
goodsCode: '00004499'
unit:
goodsMfrsName: 德国歌德公司 Geuder AG
miDjmc: ''
miCode: ''
pkgDefName: '100'
pkgDefQty: 100.0
pkgDefName:
pkgDefQty: 1.0
pkgQty:
qty: 500.0
qty: 5.0
goodsImg: []
pkgDefId: 34b26233759a4720920cc8328dd1f8d1
pkgDefId:
buyPkgQty:
unitName: 100支/100
unitName: 1
price: 99.9999
hosId:
branchId:
......@@ -37,12 +37,12 @@
grantWay: 2
deptGoodsStatus:
codingType: 0
purModeText: 值耗材
goodsGeneralName: 一次性注射器
purModeText: 值耗材
goodsGeneralName: 牙钻机
provName: 国药集团公司^n1@F
noRecPkgQty: 15.0
noRecQty: 1500.0
autoUnpack: 0
noRecQty: 15.0
autoUnpack:
consumeQty:
consumePkgQty:
list_b:
......
"check_mcms_dept_buy_car": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 10, "pkg_def_id": "%s", "pkg_def_name": "%s", "pkg_def_qty": Decimal("100.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("100.00"), "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "coding_type": 0}'
\ No newline at end of file
"check_mcms_dept_buy_car": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": %s, "pkg_def_id": "%s", "pkg_def_name": "%s", "pkg_def_qty": Decimal("100.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("100.00"), "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "coding_type": 0}'
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment