Commit f57d58c9 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

数据库验证流程十一脚本编写

parent feac47e6
......@@ -6,7 +6,7 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
from air_case.public1.public1.public1 import *
from common.db.sql.sql_del_branch_info import delData
from common.db.sql.sql_tools import get_create_time, check_mcms_dept_buy_car_sql, get_dept_buy_id, \
check_mcms_dept_buy_sql, get_mdm_goods_code, get_expdt_date
check_mcms_dept_buy_sql, get_mdm_goods_code, get_expdt_date, check_mcms_pur_plan_sql
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
......@@ -469,12 +469,72 @@ def mcms_dept_buy_detail_approval_after(type=16):
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_mcms_pur_plan():
def check_mcms_mcms_pur_plan(type=16):
branch_id = get_branch_id()
# 获取主表主键
sql = "select id from mcms_pur_plan where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
# 获取请领单主键id
sql = "select id from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)
print(sql)
id1 = process_tuple(get_dept_buy_id(sql))
sql = "select order_no from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)
print(sql)
buyOrderNo1 = process_tuple(get_dept_buy_id(sql))
# 根据请领单的id获取采购计划单主表主键
sql = "select id from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;" % (
branch_id,id1)
id2 = process_tuple(get_dept_buy_id(sql))#采购计划主表主键
PLAN_order_no="select order_no from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;" % (
branch_id,id1)
PLAN_order_no=process_tuple(get_dept_buy_id(sql))#采购计划主表order_no
#要验证的数据sql
sql1="select * from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;"% (
branch_id,id1)
#获取实际值
actual = check_mcms_pur_plan_sql(sql1)
print('actual', actual)
hos_id=get_hosid()
dept_id1=FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
dept_name1=FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
dept_name2=FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
rec_org_id=process_tuple(get_id("select * from sys_org where branch_id='%s' and ename='%s'"%(branch_id,dept_name2)))
rec_org_name=dept_name2
info = FileUtils().r_info8("b5_spd3_core_business_flow", "库区信息", 'message22')
list_a = info['list_a']
area_code = commonFuc().analysis_json('shelfCode', list_a)
area_name = '默认库区'
source_id=id1
rec_user=get_login_user_uxid()
rec_addr='自动化测试'
bill_expdt_date = get_expdt_date(
"select bill_expdt_date from mcms_pur_plan where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type))
buyBillId=id1
planBillId=id2
buyOrderNo=buyOrderNo1
create_user=rec_user
create_time = get_create_time("select create_time from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;" % (
branch_id,id1))
last_modified = create_time
last_modified_user = create_user
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_detail_approval_after', id2, PLAN_order_no, hos_id,
get_branch_id(),dept_id1,dept_name1,rec_org_id,rec_org_name,area_code,area_name,source_id,rec_user,
rec_addr, bill_expdt_date, buyBillId, planBillId, buyOrderNo,
create_time, last_modified, last_modified_user)
elif type == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_detail_approval_after1', detail_id, id1, order_no1,
hos_goods_id,
mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user,
create_time, last_modified, last_modified_user)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_detail_approval_after2', detail_id, id1, order_no1,
hos_goods_id,
mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user,
create_time, last_modified, last_modified_user)
try:
# add_dept2() # 新增一个二级科室
# add_new_deptinfo() # 写入科室信息到文件中
......@@ -501,27 +561,28 @@ try:
from a_b4流程十一请领业务流_二级库向直送 import check_accept_order
for i in range(1):
# # 低值
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'], 1)
check_mcms_dept_buy_car(1)
# # 高值
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId'], 2)
check_mcms_dept_buy_car(2)
# # 试剂
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'], 3)
check_mcms_dept_buy_car(3)
BuyCarSubmit() # 请领车提交
#上面暂时注释=========================================
list_data = ['16', '20', '66']
for i in list_data:
check_mcms_dept_buy(int(i))
mcms_dept_buy_detail(int(i))
for i in range(6): # 三个单据共审批6次
approval_center()
list_data = ['16', '20', '66']
for i in list_data:
check_mcms_dept_buy_approval_after(int(i))
mcms_dept_buy_detail_approval_after(int(i))
# # # 低值
# second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'], 1)
# check_mcms_dept_buy_car(1)
# # # 高值
# second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId'], 2)
# check_mcms_dept_buy_car(2)
# # # 试剂
# second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'], 3)
# check_mcms_dept_buy_car(3)
# BuyCarSubmit() # 请领车提交
#
# list_data = ['16', '20', '66']
# for i in list_data:
# check_mcms_dept_buy(int(i))
# mcms_dept_buy_detail(int(i))
# for i in range(6): # 三个单据共审批6次
# approval_center()
# list_data = ['16', '20', '66']
# for i in list_data:
# check_mcms_dept_buy_approval_after(int(i))
# mcms_dept_buy_detail_approval_after(int(i))
# 上面暂时注释=========================================
#检查自动生成的采购计划数据
check_mcms_mcms_pur_plan()
# 采购模块处理
......
......@@ -116,6 +116,12 @@ def check_mcms_dept_buy_sql(sql):
print('res_dict', res_dict)
cursor.close()
return res_dict
def check_mcms_pur_plan_sql(sql):
db, cursor = get_sql_conn()
res_dict = get_dict_data_sql(cursor, sql)
print('res_dict', res_dict)
cursor.close()
return res_dict
def get_create_time(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
......
......@@ -24,3 +24,6 @@
"mcms_dept_buy_approval_after4": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "source_id": None, "buy_way": "3", "create_type": "SG", "buy_kind": "QL", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_stock_name": "%s", "bill_expdt_date": %s, "bill_expect_date": None, "priority": 0, "buy_priority": 0, "barcode_flag": 1, "pkg_flag": 1, "remark": "", "dept_audit_remark": "22", "audit_remark": None, "close_remark": None, "srv_id": None, "srv_name": None, "gen_status": 0, "close_status": 0, "tb_status": 40, "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": "%s", "last_audit_time": %s, "close_time": None, "old_order_no": None}'
"mcms_dept_buy_approval_after5": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "source_id": None, "buy_way": "3", "create_type": "SG", "buy_kind": "QL", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_stock_name": "%s", "bill_expdt_date": %s, "bill_expect_date": None, "priority": 0, "buy_priority": 0, "barcode_flag": 1, "pkg_flag": 0, "remark": "", "dept_audit_remark": "22", "audit_remark": None, "close_remark": None, "srv_id": None, "srv_name": None, "gen_status": 0, "close_status": 0, "tb_status": 40, "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": "%s", "last_audit_time": %s, "close_time": None, "old_order_no": None}'
"mcms_dept_buy_approval_after6": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "source_id": None, "buy_way": "3", "create_type": "SG", "buy_kind": "QL", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_stock_name": "%s", "bill_expdt_date": %s, "bill_expect_date": None, "priority": 0, "buy_priority": 0, "barcode_flag": 1, "pkg_flag": 1, "remark": "", "dept_audit_remark": "22", "audit_remark": None, "close_remark": None, "srv_id": None, "srv_name": None, "gen_status": 0, "close_status": 0, "tb_status": 40, "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": "%s", "last_audit_time": %s, "close_time": None, "old_order_no": None}'
"mcms_pur_plan": '{"id": "%s", "order_no": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "area_code": "%s", "area_name": "%s", "create_type": "SG", "source_id": "%s", "source_type": "QLD", "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "priority": 0, "bill_expdt_date": %s, "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s"}", "remark": "", "close_status": 0, "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "last_auditor": None, "last_audit_time": None, "rec_type": "HDI", "audit_remark": None}'
\ 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