Commit 6821673f authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程五脚本提交

parent 1f2bff8c
......@@ -2,6 +2,10 @@
import traceback
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from air_case.public1.public1.public1 import get_branch_id, get_hosid, process_tuple, get_dept_buy_id, reGetString, \
get_login_user_uxid2, get_create_time, get_ext_info, get_process_list2, compare_text_index, check_mcms_pur_plan_sql, \
get_id, get_mdm_goods_code1, get_goods_code1, get_goods_name, get_goods_gg, get_goods_mfrs_id, get_expdt_date, \
get_supply_id, call_login, get_hosname
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
from common.timeUtils import timeUtils
......@@ -19,250 +23,378 @@ from airtest.core.api import using
import sys
import time
module = "b6_spd3_core_business_flow_database_check"
def order_dp(type=1):
# execute_command("python runner_test.py tag id2302-5 debug mdm3")
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b5_spd3_core_business_flow', "供货关系申请2", 'message')
# print(info)
username = info['e_username']
def check_hdi_distr(type=16):
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')
distrBillId = distr_main_key
distrOrderNo = distr_order_no
distrUser = get_login_user_uxid2()
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
if type == 16:
# 验证子表数据
check_hdi_distr_detail(distr_main_key, type, purchase_id)
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
password = commonFuc().get_business_data("b2_herp3_bs", "password1")
# username = '001f90380'
# password='1qaz!QAZ'
print('username,password', username, password)
# # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# # 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束
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)))
# =========================查询待确认订单======================
module = "a6_mdm3_dp"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "purchase_page_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
hos_id = branch_id[0:5]
exeProvId = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"]
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')['deptid1'])))
rec_org_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
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_distr_0929', 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, planBillId, planOrderNo,
purOrderNo, purBillId, purBillDate, distrBillId, distrOrderNo,
confirmTime, confirmUser, distrUser, create_user, create_user_name,
create_time, last_modified,
last_modified_user
)
if type == 1:
orderNo1 = FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号', 'message7')["orderNo1"]
print(orderNo1)
elif type == 2:
orderNo1 = FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号高值', 'message11')["orderNo1"]
print(orderNo1)
elif type == 3:
orderNo1 = FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号试剂', 'message12')["orderNo1"]
print(orderNo1)
else:
orderNo1 = 'orderNo1'
request_body = commonFuc().get_business_data(module, "payload1_1_1", orderNo1, hos_id, exeProvId)
# print('request_body',request_body)
# 发送请求
while True:
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
if total == 1:
break
else:
time.sleep(6)
elif type == 20:
# 验证子表数据
check_hdi_distr_detail(distr_main_key, type, purchase_id)
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
data1 = commonFuc().analysis_json('data', data)
id1 = commonFuc().analysis_json('id', data1[0])
print('id1', id1)
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)))
data = commonFuc().analysis_json('data', result)
data1 = commonFuc().analysis_json('data', data)
list_a = []
list_b = []
list_c = []
list_a.append(data1)
list_b.append(data1)
list_c.append(data1)
# 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, 'b5_spd3_core_business_flow', '配送订单信息', titlename, 'message8')
# 从message8文件中获取信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "配送订单信息", 'message8')
# print('info', info)
list_a = info['list_a']
list_a = ','.join(map(str, 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_a', list_a)
billMode = "billMode"
createUser = 'createUser'
hosId = 'hosId'
provId = 'provId'
for i in list_a2:
billMode = i["billMode"]
createUser = i["createUser"]
hosId = i['hosId']
provId = i['provId']
break
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_0929', 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, planBillId, planOrderNo,
purOrderNo, purBillId, purBillDate, distrBillId, distrOrderNo,
confirmTime, confirmUser, distrUser, create_user, create_user_name,
create_time, last_modified,
last_modified_user
)
# =========================查询待确认订单======================
# ==============================确认订单==================
module = "a6_mdm3_dp"
elif type == 66:
# 验证子表数据
check_hdi_distr_detail(distr_main_key, type, purchase_id)
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "ensure_url")
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)))
request_body = commonFuc().get_business_data(module, "payload2", id1, uxid)
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_distr2_0929', 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, planBillId, planOrderNo,
purOrderNo, purBillId, purBillDate, distrBillId, distrOrderNo,
confirmTime, confirmUser, distrUser, create_user, create_user_name,
create_time, last_modified,
last_modified_user
)
# print('request_body',request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
else:
expected = None
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)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
if code == 0:
commonFuc().check_text_exist(code, result)
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist('error', result)
# ==============================确认订单==================
# ==============================配送==================
# url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "purchase_page_url")
#
# request_body = commonFuc().get_business_data(module, "payload3_1_1",exeProvId,hos_id)
# # 发送请求
# result = commonFuc().http_post(url, request_body, headers)
# print('result', result)
# #断言
# code=commonFuc().analysis_json('code',result)
# data=commonFuc().analysis_json('data',result)
# total=commonFuc().analysis_json('total',data)
# data1 = commonFuc().analysis_json('data', data)
# id1=commonFuc().analysis_json('id', data1[0])
# print('id1',id1)
# ==================a3获取订单详细信息中的子表id_3_0医院
# a1订单配送列表数据查询_全部
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "detail_id_url")
request_body = commonFuc().get_business_data(module, "payload4", id1)
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
# print('request_body',request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resulta3获取订单详细信息中的子表id_3_0医院', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
commonFuc().check_text_exist(code, result)
data1 = commonFuc().analysis_json('data', data)
id2 = commonFuc().analysis_json('id', data1[0])
print(id1, id2)
data1 = commonFuc().analysis_json('data', data)
list_a = []
list_b = []
list_c = []
list_a.append(data1)
list_b.append(data1)
list_c.append(data1)
# 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, 'b5_spd3_core_business_flow', '配送订单详细信息', titlename, 'message9')
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 == 20:
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"]
# ==================a3获取订单详细信息中的子表id_3_0医院
# ==================订单配送========================
module = "a6_mdm3_dp"
# a1订单配送列表数据查询_全部
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submit_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
# 从message9文件中获取信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "配送订单详细信息", 'message9')
print('info从message9文件中获取信息', info)
# print('info', info)
list_a = info['list_a']
# print('list_a',list_a,type(list_a))
# list_a = ','.join(map(str, list_a))
# import json
# new_request_body = list_a.replace("'", '"')
# new_request_body1 = new_request_body.replace("None", 'null')
# print('new_request_body1',new_request_body1)
#
# list_a2 = json.loads(new_request_body1)
# print('list_a2', list_a2)
# print('list_a2', type(list_a2))
hosGoodsId = 'hosGoodsId'
mdmGoodsCode = 'mdmGoodsCode'
goodsCode = 'goodsCode'
pkgDefId = 'pkgDefId'
erpCode = 'erpCode'
for i in list_a:
print('aaaaaaaaaaaaaaaaaaaaaaaaaaaa', i)
for j in i:
print('bbbbbbbbbbbbbbbbbbb', j)
hosGoodsId = j['hosGoodsId']
mdmGoodsCode = j['mdmGoodsCode']
goodsCode = j['goodsCode']
pkgDefId = j['pkgDefId']
erpCode = j['erpCode']
break
# # #获取日期
productDate = timeUtils().get_time_hms(5)
expdtDate = timeUtils().get_time_add(190, 2)
if type == 1:
request_body = commonFuc().get_business_data(module, "payload9_2_1_1", id1, id1, hosId, provId, billMode,
createUser, username, createUser, id2, hosGoodsId, mdmGoodsCode,
goodsCode, pkgDefId, productDate, expdtDate, erpCode, id2)
elif type == 2:
request_body = commonFuc().get_business_data(module, "payload9_2_1_2", id1, id1, hosId, provId, billMode,
createUser, username, createUser, id2, hosGoodsId, mdmGoodsCode,
goodsCode, productDate, expdtDate, erpCode, id2)
elif type == 3:
request_body = commonFuc().get_business_data(module, "payload9_2_1_3", id1, id1, hosId, provId, billMode,
createUser, username, createUser, id2, hosGoodsId, mdmGoodsCode,
goodsCode, pkgDefId, productDate, expdtDate, erpCode, id2)
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_0929', 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,
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_0929', 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,
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_0929', 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,
planDetailId, purDetailId, purBillId, distrDetailId,
distrBillId, goods_gg, goods_code, goods_name, erpCode, create_user,
create_time, last_modified, last_modified_user)
else:
expected = None
print('request_body', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# 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)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
id1 = commonFuc().analysis_json('id', data)
info = (id1, id1)
titlename = ('distrBillId1', 'distrBillId2')
# 将配送订单信息息写入到文件中
if type==1:
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '低值配送单号', titlename, 'message10')
elif type==2:
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '高值配送单号', titlename, 'message10')
elif type==3:
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '试剂配送单号', titlename, 'message10')
if code == 0:
commonFuc().check_text_exist(code, result)
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist('error', result)
# ==================订单配送=====================================
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_a6流程五_中心库入库结算_正结算2_外网配送.air')
using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_a6流程五_中心库入库结算_正结算2_外网配送.air')
from a_a6流程五_中心库入库结算_正结算2_外网配送 import order_dp
try:
order_dp(1)# 1低值
order_dp(2)#2高值
order_dp(3)#3试剂
token, projectCode1, uxid1, corpId1, info1 = call_login(1)
# order_dp(1, token, projectCode1, uxid1) # 1低值
# order_dp(2, token, projectCode1, uxid1) # 2高值
# order_dp(3, token, projectCode1, uxid1) # 3试剂
list_data = ['16', '20', '66']
for i in list_data:
time.sleep(6)
check_hdi_distr(int(i)) # 检查配送单(外网)
except Exception as e:
print('订单配送发生错误,请检查脚本或者数据')
print("发生异常:", str(e))
......
......@@ -403,7 +403,7 @@
#手工采购计划子表
"mcms_pur_plan_detail_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": %s, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 10, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "plan_pkg_qty": Decimal("100.00"), "plan_qty": Decimal("10000.00"), "pkg_qty": Decimal("0.00"), "price": Decimal("99.999900"), "qty": Decimal("0.00"), "in_settlement": 1, "supply_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "sub_prov_id": "%s", "sub_prov_name": "%s", "contract_id": None, "remark": None, "close_status": 0, "tb_status": 10, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "coding_type": 0}'
"mcms_pur_plan_detail2_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": %s, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 20, "pkg_def_id": None, "pkg_def_name": None, "pkg_def_qty": Decimal("1.00"), "plan_pkg_qty": Decimal("100.00"), "plan_qty": Decimal("100.00"), "pkg_qty": Decimal("0.00"), "price": Decimal("99.999900"), "qty": Decimal("0.00"), "in_settlement": 1, "supply_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "sub_prov_id": "%s", "sub_prov_name": "%s", "contract_id": None, "remark": None, "close_status": 0, "tb_status": 10, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "coding_type": 0}'
"mcms_pur_plan_detail3_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": %s, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 60, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "plan_pkg_qty": Decimal("100.00"), "plan_qty": Decimal("1000.00"), "pkg_qty": Decimal("0.00"), "price": Decimal("99.999900"), "qty": Decimal("0.00"), "in_settlement": 1, "supply_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "sub_prov_id": "%s", "sub_prov_name": "%s", "contract_id": None, "remark": None, "close_status": 0, "tb_status": 10, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "coding_type": 0}'
"mcms_pur_plan_detail3_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": %s, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 60, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "plan_pkg_qty": Decimal("100.00"), "plan_qty": Decimal("10000.00"), "pkg_qty": Decimal("0.00"), "price": Decimal("99.999900"), "qty": Decimal("0.00"), "in_settlement": 1, "supply_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "sub_prov_id": "%s", "sub_prov_name": "%s", "contract_id": None, "remark": None, "close_status": 0, "tb_status": 10, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "coding_type": 0}'
#采购计划
"mcms_pur_plan_0927": '{"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": "", "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "%s", "priority": 0, "bill_expdt_date": %s, "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s"}", "remark": "", "close_status": 0, "tb_status": 10, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "last_auditor": None, "last_audit_time": None, "rec_type": "YND", "audit_remark": None}'
......@@ -420,3 +420,14 @@
"mcms_purchase_0927": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "rec_type": "YND", "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", "bill_expdt_date": %s, "source_id": "%s", "source_type": "CGJH", "in_settlement": None, "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s"}", "ext_info": "{"epidemicFlag":0,"purMode":10}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "priority": 0, "close_status": 0, "close_date": %s, "up_status": 0, "tb_status": 30, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": None, "version": 0, "del_flag": 0, "last_auditor": "%s", "last_audit_time": %s}'
"mcms_purchase2_0927": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "rec_type": "YND", "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", "bill_expdt_date": %s, "source_id": "%s", "source_type": "CGJH", "in_settlement": None, "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s"}", "ext_info": "{"epidemicFlag":0,"purMode":20}", "barcode_flag": 1, "pkg_flag": 0, "remark": "", "priority": 0, "close_status": 0, "close_date": %s, "up_status": 0, "tb_status": 30, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": None, "version": 0, "del_flag": 0, "last_auditor": "%s", "last_audit_time": %s}'
"mcms_purchase3_0927": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "rec_type": "YND", "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", "bill_expdt_date": %s, "source_id": "%s", "source_type": "CGJH", "in_settlement": None, "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s"}", "ext_info": "{"epidemicFlag":0,"purMode":60}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "priority": 0, "close_status": 0, "close_date": %s, "up_status": 0, "tb_status": 30, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": None, "version": 0, "del_flag": 0, "last_auditor": "%s", "last_audit_time": %s}'
#手工采购计划_配送单子表
"hdi_distr_detail_0929": '{"id": "%s", "pid": "%s", "source_id": "%s", "source_detail_id": "%s", "pur_detail_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "goods_name": "%s", "goods_gg": "%s", "pur_mode": "10", "mfrs_id": "%s", "mfrs_name": "德国歌德公司 Geuder AG", "made": "德国", "unit": "支", "pur_price": Decimal("99.999900"), "batch_code": "333", "expdt_date": %s, "product_date": %s, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "supply_id": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "sub_price": Decimal("99.9999"), "distr_price": Decimal("99.9999"), "distr_pkg_qty": Decimal("100.00"), "distr_qty": Decimal("10000.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","planDetailId":"%s","purDetailId":"%s","purBillId":"%s","distrDetailId":"%s","distrBillId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":10,"goodsName":"%s","ygptCode":"","transCond":"","storageCond":"","erpCode":"%s","ybDefId":""}", "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}'
"hdi_distr_detail2_0929": '{"id": "%s", "pid": "%s", "source_id": "%s", "source_detail_id": "%s", "pur_detail_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "goods_name": "%s", "goods_gg": "%s", "pur_mode": "20", "mfrs_id": "%s", "mfrs_name": "德国歌德公司 Geuder AG", "made": "德国", "unit": "支", "pur_price": Decimal("99.999900"), "batch_code": "222", "expdt_date": %s, "product_date": %s, "pkg_def_id": %s, "pkg_def_name": null, "pkg_def_qty": Decimal("1.00"), "supply_id": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "sub_price": Decimal("99.9999"), "distr_price": Decimal("99.9999"), "distr_pkg_qty": Decimal("100.00"), "distr_qty": Decimal("10000.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","planDetailId":"%s","purDetailId":"%s","purBillId":"%s","distrDetailId":"%s","distrBillId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":20,"goodsName":"%s","ygptCode":"","transCond":"","storageCond":"","erpCode":"%s","ybDefId":""}", "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}'
"hdi_distr_detail3_0929": '{"id": "%s", "pid": "%s", "source_id": "%s", "source_detail_id": "%s", "pur_detail_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "goods_name": "%s", "goods_gg": "%s", "pur_mode": "60", "mfrs_id": "%s", "mfrs_name": "德国歌德公司 Geuder AG", "made": "德国", "unit": "支", "pur_price": Decimal("99.999900"), "batch_code": "4444", "expdt_date": %s, "product_date": %s, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "supply_id": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "sub_price": Decimal("99.9999"), "distr_price": Decimal("99.9999"), "distr_pkg_qty": Decimal("100.00"), "distr_qty": Decimal("10000.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","planDetailId":"%s","purDetailId":"%s","purBillId":"%s","distrDetailId":"%s","distrBillId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":60,"goodsName":"%s","ygptCode":"","transCond":"","storageCond":"","erpCode":"%s","ybDefId":""}", "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}'
#手工采购计划_配送单
"hdi_distr_0929": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "rec_type": "YND", "hos_id": "%s", "hos_name": "%s", "branch_id": "%s", "source_id": "%s", "source_type": "CGD", "pur_bill_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "settlement": None, "pur_dept_id": "%s", "pur_dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "设备科001", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s"}", "ext_info": "{"purMode":10,"confirmTime":"%s","confirmUser":"%s","epidemicFlag":0,"distrUser":"%s"}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "task_id": None, "convert_flag": 1, "convert_time": None, "convert_user_name": None, "reject_status": 0, "tb_status": 20, "create_user": "%s", "create_user_name": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "initial_order": None}'
"hdi_distr1_0929": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "rec_type": "YND", "hos_id": "%s", "hos_name": "%s", "branch_id": "%s", "source_id": "%s", "source_type": "CGD", "pur_bill_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "settlement": None, "pur_dept_id": "%s", "pur_dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "设备科001", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s"}", "ext_info": "{"purMode":20,"confirmTime":"%s","confirmUser":"%s","epidemicFlag":0,"distrUser":"%s"}", "barcode_flag": 1, "pkg_flag": 0, "remark": "", "task_id": None, "convert_flag": 1, "convert_time": None, "convert_user_name": None, "reject_status": 0, "tb_status": 20, "create_user": "%s", "create_user_name": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "initial_order": None}'
"hdi_distr2_0929": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "rec_type": "YND", "hos_id": "%s", "hos_name": "%s", "branch_id": "%s", "source_id": "%s", "source_type": "CGD", "pur_bill_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "settlement": None, "pur_dept_id": "%s", "pur_dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "设备科001", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s"}", "ext_info": "{"purMode":60,"confirmTime":"%s","confirmUser":"%s","epidemicFlag":0,"distrUser":"%s"}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "task_id": None, "convert_flag": 1, "convert_time": None, "convert_user_name": None, "reject_status": 0, "tb_status": 20, "create_user": "%s", "create_user_name": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "initial_order": 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