Commit 2bc2f313 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程八脚本提交

parent 49d77758
......@@ -226,9 +226,15 @@ def supply_and_marketing_apply2():
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# #获取接口返回数据
#
check_dict = commonFuc().get_business_data(module, "checkDict")
commonFuc().check_result(check_dict, result)
#验证返回内容
code=commonFuc().analysis_json('code',result)
if code==0:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error,检查供应关系_厂商_审核结果')
commonFuc().check_text_exist_result_text('succees', 'succees')
e_corpId = corpId
e_username = username
return e_corpId, h_corpId, e_username, h_name
......
......@@ -5,7 +5,8 @@ import traceback
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from air_case.public1.public1.public1 import *
from common.db.sql.sql_tools import check_mcms_dept_buy_sql, get_login_user_uxid_bydb, get_create_time, get_goods_code1, \
get_goods_name
get_goods_name, get_dept_buy_id, get_ext_info, check_mcms_pur_plan_sql, get_mdm_goods_code1, get_goods_gg, \
get_goods_mfrs_id, get_expdt_date, get_supply_id
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
......@@ -275,21 +276,23 @@ def check_mcms_operation_notice():
source_area_code = get_stockAreaId_new_fromDb(source_dept_name, 1)
create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_time = get_create_time("select create_time from mcms_operation_apply where id='%s';" % ID)
last_modified = get_create_time("select last_modified from mcms_operation_apply where id='%s';" % ID)
oper_date = get_create_time("select oper_date from mcms_operation_apply where id='%s';" % ID)
expire_date = get_create_time("select expire_date from mcms_operation_apply where id='%s';" % ID)
create_time = get_create_time("select create_time from mcms_operation_notice where id='%s';" % ID)
last_modified = get_create_time("select last_modified from mcms_operation_notice where id='%s';" % ID)
oper_date = get_create_time("select oper_date from mcms_operation_notice where id='%s';" % ID)
last_modified_user = create_user
hos_id = get_hosid()
hos_name = get_hosname()
branch_name = get_branch_name()
create_user_name= FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']
prov_id=get_prov_id()
prov_name=get_prov_name()
# 子表检查
check_mcms_operation_notice_list(ID,order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_operation_notice', ID, hos_id, hos_name,
branch_id, branch_name, order_no,
rec_dept_id, rec_dept_name, rec_address_id, oper_date, expire_date
, create_user, create_time, last_modified, last_modified_user
'check_mcms_operation_notice', ID,order_no, source_bill_id,source_order_no,hos_id, hos_name,
branch_id, branch_name,
rec_dept_id, rec_dept_name, oper_date, prov_id
, prov_name,rec_address_id,create_user, create_user_name,create_time, last_modified, last_modified_user
)
......@@ -363,6 +366,251 @@ def check_mcms_operation_notice_list(pid,p_order_no):
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_hdi_distr(type=25):
from common.db.sql.sql_tools_out import check_mcms_pur_plan_sql, get_id
branch_id = get_branch_id()
# 验证配送单主表
sql = "select * from hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
hos_id = get_hosid()
# 获取采购订单id
purchase_id = get_id(
"select id from mcms_purchase where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type))
# 查询配送单主键
distr_main_key = get_id(
"select id from hdi_distr a where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type))
# 查询配送单order_no
distr_order_no = get_id(
"select order_no from hdi_distr a where id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
distr_main_key, type))
# 从采购订单获取source_id
source_id = get_id(
"select id from mcms_purchase where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type))
pur_bill_id = source_id
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
rec_user = info['username1']
sql = "select id from spd3_herp_test2.mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)
print(sql)
buyBillId = process_tuple(get_dept_buy_id(sql))
bill_relation_json = get_id(
"select bill_relation_json from hdi_distr a where id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
distr_main_key, type))
print(bill_relation_json)
purBillDate = reGetString(bill_relation_json, r'purBillDate":"', r'""distrBillId')
# purBillDate = get_expdt_date(
# "select create_time from mcms_purchase where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
# branch_id, type))
# process_date(purBillDate)
distrBillId = distr_main_key
distrOrderNo = distr_order_no
distrUser = get_login_user_uxid_bydb(FileUtils().r_info8("b2_herp3_bs", "用户名信息", 'message3')['username1'])
create_user = distrUser
create_user_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"]
create_time = get_create_time(
"select create_time from hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type))
last_modified_user = distrUser
# 验证子表数据
check_hdi_distr_detail(distr_main_key, type, purchase_id)
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
planBillId = process_tuple(
get_id(
"select pid from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % (
hos_goods_id)))
planOrderNo = process_tuple(
get_id(
"select order_no from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % (
hos_goods_id)))
sql = "select order_no from spd3_herp_test2.mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)
print(sql)
buyOrderNo = process_tuple(get_dept_buy_id(sql))
sql = "select id from mcms_purchase 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_purchase where branch_id='%s' and bill_mode='%s'and id='%s' order by create_time desc LIMIT 1;" % (
branch_id, type, id1)
print(sql)
purOrderNo = process_tuple(get_dept_buy_id(sql))
purBillId = id1
prov_id = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"]
prov_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"]
exe_prov_id = prov_id
exe_prov_name = prov_name
pur_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
pur_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
rec_org_id = process_tuple(
get_id("select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';" % (
branch_id, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'])))
rec_org_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
last_modified = get_create_time(
"select last_modified from hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type))
confirmUser = distrUser
ext_info = get_ext_info(branch_id, type)
confirmTime = reGetString(ext_info, r'"confirmTime":"', r'""confirmUser')
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'hdi_distr1', distr_main_key, distr_order_no, hos_id, get_hosname(),
get_branch_id(), source_id, pur_bill_id, prov_id, prov_name,
exe_prov_id, exe_prov_name, pur_dept_id, pur_dept_name, rec_org_id,
rec_org_name, rec_user, buyBillId, planBillId, planOrderNo, buyOrderNo,
purOrderNo, purBillId, purBillDate, distrBillId, distrOrderNo,
confirmTime, confirmUser, distrUser, create_user, create_user_name,
create_time, last_modified,
last_modified_user
)
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
result = (compare_text_index(actual_value2, expected_value2))
print('result', result)
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')
def check_hdi_distr_detail(distr_main_key, type, purchase_id):
sql = "select * from hdi_distr_detail where pid = '%s';" % distr_main_key
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
# 获取子表主键
distr_detail_main_key = get_id(
"select id from hdi_distr_detail where pid = '%s';" % (
distr_main_key))
source_id = purchase_id
source_detail_id = get_id("select id from mcms_purchase_detail where pid='%s'" % purchase_id)
pur_detail_id = source_detail_id
if type == 16:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 25:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
mdm_goods_code = get_mdm_goods_code1(hos_goods_id)
goods_code = get_goods_code1(hos_goods_id)
goods_name = get_goods_name(hos_goods_id)
goods_gg = get_goods_gg(hos_goods_id)
mfrs_id = get_goods_mfrs_id(hos_goods_id)
expdt_date = get_expdt_date(
"select expdt_date from hdi_distr_detail where pid = '%s';" % (
distr_main_key))
product_date = get_expdt_date(
"select product_date from hdi_distr_detail where pid = '%s';" % (
distr_main_key))
pkg_def_id = process_tuple(
get_id("select pkg_def_id from mcms_pkg where hos_goods_id='%s' LIMIT 1;" % hos_goods_id))
supply_id = get_supply_id(hos_goods_id)
sub_prov_id = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"]
sub_prov_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"]
planBillId = process_tuple(
get_id(
"select pid from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % (
hos_goods_id)))
sql = "select id from spd3_herp_test2.mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
get_branch_id(), type)
print(sql)
buyBillId = process_tuple(get_dept_buy_id(sql))
buyDetailId = get_id(
"select id from mcms_dept_buy_detail where pid='%s';" % buyBillId)
# planBillId = process_tuple(
# get_id(
# "select pid from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % (
# hos_goods_id)))
planDetailId = get_id(
"select id from spd3_herp_test2.mcms_pur_plan_detail where pid='%s';" % planBillId)
purDetailId = pur_detail_id
sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
get_branch_id(), type)
print(sql)
id1 = process_tuple(get_dept_buy_id(sql))
purBillId = id1
distrDetailId = distr_detail_main_key
distrBillId = distr_main_key
erpCode = mdm_goods_code # 11661563
create_user = get_login_user_uxid2()
create_time = get_create_time(
"select create_time from hdi_distr_detail where id = '%s';" % (
distr_detail_main_key))
last_modified = get_create_time(
"select last_modified from hdi_distr_detail where id = '%s';" % (
distr_detail_main_key))
last_modified_user = create_user
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'hdi_distr_detail', distr_detail_main_key, distr_main_key, source_id,
source_detail_id, pur_detail_id
, hos_goods_id, mdm_goods_code, goods_code, goods_name, goods_gg,
mfrs_id, expdt_date, product_date
, pkg_def_id, supply_id, sub_prov_id, sub_prov_name, planBillId,
buyDetailId, planDetailId, purDetailId, purBillId, distrDetailId,
distrBillId, goods_gg, goods_code, goods_name, erpCode, create_user,
create_time, last_modified, last_modified_user)
elif type == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'hdi_distr_detail2', distr_detail_main_key, distr_main_key, source_id,
source_detail_id, pur_detail_id
, hos_goods_id, mdm_goods_code, goods_code, goods_name, goods_gg,
mfrs_id, expdt_date, product_date
, pkg_def_id, supply_id, sub_prov_id, sub_prov_name, planBillId,
buyDetailId, planDetailId, purDetailId, purBillId, distrDetailId,
distrBillId, goods_gg, goods_code, goods_name, erpCode, create_user,
create_time, last_modified, last_modified_user)
elif type == 66:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'hdi_distr_detail3', distr_detail_main_key, distr_main_key, source_id,
source_detail_id, pur_detail_id
, hos_goods_id, mdm_goods_code, goods_code, goods_name, goods_gg,
mfrs_id, expdt_date, product_date
, pkg_def_id, supply_id, sub_prov_id, sub_prov_name, planBillId,
buyDetailId, planDetailId, purDetailId, purBillId, distrDetailId,
distrBillId, goods_gg, goods_code, goods_name, erpCode, create_user,
create_time, last_modified, last_modified_user)
else:
expected = None
# comparison_result(actual, expected)
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
result = (compare_text_index(actual_value2, expected_value2))
print('result', result)
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')
pro_path = commonFuc().get_pro_path2()
print('pro_path', pro_path)
sys.path.append(pro_path + r'/air_case/b5_spd3_core_business_flow/a_b1流程八_高值跟台业务流程.air')
......@@ -384,11 +632,11 @@ try:
# check_mcms_operation_apply_approval_after() # 手术跟台申请单审批后的数据库检查
# # #内网查询手术通知单号
# updateUserLoginDefaultRange(get_listUserMgrRangePage(1)) # 设置登录账号默认权限是中心库
# orderno = Search_OrderNO() # 手术通知单接口查询单号
# time.sleep(6)
check_mcms_operation_notice()# 手术通知单数据库检查
height_value_order_dp(orderno) # 高值跟台外网配送
# check_mcms_operation_notice()# 手术通知单数据库检查
# orderno = Search_OrderNO() # 手术通知单接口查询单号
# height_value_order_dp(orderno) # 高值跟台外网配送
check_hdi_distr()
check_accept_order() # 内网验收
updateUserLoginDefaultRange(get_listUserMgrRangePage(2)) # 设置登录账号默认权限是二级库
second_dept_in_warehouse() # 二级科室入库
......
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