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

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

parent beadb526
......@@ -322,20 +322,20 @@ def pick_execute():
# 生成拣货单列表锁定===============================================
# 拣货==============================
if billMode == 16:
if billMode == '16':
udi_code = get_udi2(1) # 获取条码 低值1 高值2 试剂3
elif billMode == 20:
elif billMode == '20':
udi_code = get_udi2(2) # 获取条码 低值1 高值2 试剂3
elif billMode == 66:
elif billMode == '66':
udi_code = get_udi2(3) # 获取条码 低值1 高值2 试剂3
else:
udi_code = 'udi_code'
print('udi_code', udi_code)
if billMode == 16:
if billMode == '16':
targetAreaCode, sourceId = pickScan2(BH_ID, udi_code, 1) # 低值
elif billMode == 20:
elif billMode == '20':
targetAreaCode, sourceId = pickScan2(BH_ID, udi_code, 2) # 高值
elif billMode == 66:
elif billMode == '66':
targetAreaCode, sourceId = pickScan2(BH_ID, udi_code, 3) # 试剂
else:
targetAreaCode = 'targetAreaCode'
......@@ -344,11 +344,11 @@ def pick_execute():
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_out_use_submit_url")
print('提交拣货执行单=================', url)
if billMode == 16:
if billMode == '16':
request_body = commonFuc().get_business_data(module, "payload51_1_1", targetAreaCode, sourceId)
elif billMode == 20:
elif billMode == '20':
request_body = commonFuc().get_business_data(module, "payload51_1_2", targetAreaCode, sourceId)
elif billMode == 66:
elif billMode == '66':
request_body = commonFuc().get_business_data(module, "payload51_1_3", targetAreaCode, sourceId)
print('提交拣货执行单', 'request_body', request_body)
......
......@@ -369,8 +369,8 @@ def check_mcms_pick(type=16):
dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
stock_id = get_stockId_fromdb(dept_name + '库房')
area_code = get_stockAreaId_new_fromDb(dept_name, 2)
target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid5']
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid5']
target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3']
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3']
target_stock_id = get_stockId_fromdb(target_dept_name + '库房')
target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 2)
username = FileUtils().r_info8("b2_herp3_bs", "用户名信息", 'message3')['username1']
......@@ -536,7 +536,7 @@ def check_mcms_psi_dept(type=16):
branch_id, type)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单id", 'message26')
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单id", 'message28')
# print(info)
if type == 16:
......@@ -550,8 +550,8 @@ def check_mcms_psi_dept(type=16):
order_no = get_id(sql)
target_corp_id = get_hosid()
target_branch_id = get_branch_id()
target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid5']
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid5']
target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3']
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3']
target_stock_id = get_stockId_fromdb(target_dept_name + '库房')
target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 2)
PICK_id = get_PICK_id(branch_id, type)
......@@ -608,6 +608,200 @@ def check_mcms_psi_dept(type=16):
psiDeptOutOrderNo
, create_user, create_time, last_modified, last_modified_user)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
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)
print(compare_text_index(actual_value2, expected_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')
def check_mcms_psi_dept_in(type=16):
branch_id = get_branch_id()
sql = " select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_SL' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单id", 'message28')
if type == 16:
source_id = info['DR_NO2']
elif type == 20:
source_id = info['DR_NO3']
else:
source_id = info['DR_NO1']
source_id = ''.join(source_id)
source_no=get_id("select order_no from mcms_psi_dept where id='%s';"%source_id)
#获取入库单主键DR_ID
sql = " select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_SL' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type)
DR_ID = get_id(sql)
#获取order_no
sql = " select order_no from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_SL' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type)
order_no = get_id(sql)
target_corp_id = get_hosid()
target_branch_id = get_branch_id()
target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3']
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3']
target_stock_id = get_stockId_fromdb(target_dept_name + '库房')
target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 2)
PICK_id = get_PICK_id(branch_id, type)
source_corp_id = get_hosid()
source_branch_id = get_branch_id()
source_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
source_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
source_stock_id = get_stockId_fromdb(source_dept_name + '库房')
source_area_code = get_stockAreaId_new_fromDb(source_dept_name, 2)
buyBillId = get_buyBillId(branch_id, type)
pickOrderNo = get_PICK_order_no(branch_id, type)
buyOrderNo = get_buyOrderNo(branch_id, type)
pickBillId = get_PICK_id(branch_id, type)
psiDeptOutBillId = source_id
psiDeptOutOrderNo = source_no
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_psi_dept where id='%s';" % DR_ID)
last_modified = get_create_time("select last_modified from mcms_psi_dept where id='%s';" % DR_ID)
last_modified_user = create_user
accounter=create_user
sql="select account_date from mcms_psi_dept where id='%s';"%DR_ID
account_date=get_account_date(sql)
psiDeptInBillId=DR_ID
psiDeptInOrderNo=order_no
if type == 16:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID,type,order_no,source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_in_1', DR_ID, order_no, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id,source_no, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter,account_date,buyBillId, pickOrderNo, buyOrderNo, pickBillId, psiDeptOutBillId,
psiDeptOutOrderNo,psiDeptInBillId,psiDeptInOrderNo
, create_user, create_time, last_modified, last_modified_user
)
elif type == 20:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID, type, order_no,source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_in_2', DR_ID, order_no, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id,source_no, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter,account_date,buyBillId, pickOrderNo, buyOrderNo, pickBillId, psiDeptOutBillId,
psiDeptOutOrderNo,psiDeptInBillId,psiDeptInOrderNo
, create_user, create_time, last_modified, last_modified_user
)
else:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID, type, order_no,source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_in_3', DR_ID, order_no, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id,source_no, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter,account_date,buyBillId, pickOrderNo, buyOrderNo, pickBillId, psiDeptOutBillId,
psiDeptOutOrderNo,psiDeptInBillId,psiDeptInOrderNo
, create_user, create_time, last_modified, last_modified_user
)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
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)
print(compare_text_index(actual_value2, expected_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')
def check_mcms_psi_dept_batch_in(DR_ID,type,order_no,source_id1):
branch_id = get_branch_id()
sql = " select * from mcms_psi_dept_batch where pid='%s';" % (
DR_ID)
actual = check_mcms_dept_buy_sql(sql)
print('actual', actual)
batch_main_key = get_id("select id from mcms_psi_dept_batch where pid='%s';" % DR_ID)
pid = DR_ID
# order_no = get_id("select order_no from mcms_psi_dept_batch where pid='%s';" % DR_ID)
source_detail_id = source_id1+'0001'
pick_detail_id=None
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"]
mdm_goods_code = get_mdm_goods_code1(hos_goods_id)
goods_code = get_goods_code1(hos_goods_id)
pkg_def_id = get_pkg_def_id(hos_goods_id)
picker_name = FileUtils().r_info8("b2_herp3_bs", "用户名信息", 'message3')['username1']
picker = get_login_user_uxid_bydb(picker_name)
source_batch_id=get_id("select source_batch_id from mcms_psi_dept_batch where pid='%s';" % DR_ID)
target_batch_id=source_batch_id
if check_batch_id(source_batch_id)==True:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist_result_text('error', 'succees')
barcode_id=get_id("select barcode_id from mcms_psi_dept_batch where pid='%s';" % DR_ID)
if check_barcode_id(barcode_id)==True:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist_result_text('error', 'succees')
dept_name=FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3']
shelf_code= get_stockAreaId_new_fromDb(dept_name, 2)
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_psi_dept_batch where pid='%s';" % DR_ID)
last_modified = get_create_time("select last_modified from mcms_psi_dept_batch where pid='%s';" % DR_ID)
last_modified_user = create_user
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_batch_in1', batch_main_key, pid, order_no,source_detail_id
,pick_detail_id,hos_goods_id,mdm_goods_code,goods_code,source_batch_id,
target_batch_id,barcode_id,shelf_code,create_user,create_time,last_modified,
last_modified_user
)
elif type == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_batch_in2', batch_main_key, pid, order_no,source_detail_id
,pick_detail_id,hos_goods_id,mdm_goods_code,goods_code,source_batch_id,
target_batch_id,barcode_id,shelf_code,create_user,create_time,last_modified,
last_modified_user
)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_batch_in3',batch_main_key, pid, order_no,source_detail_id
,pick_detail_id,hos_goods_id,mdm_goods_code,goods_code,source_batch_id,
target_batch_id,barcode_id,shelf_code,create_user,create_time,last_modified,
last_modified_user
)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
actual_value1 = get_process_list2(actual)
......@@ -636,19 +830,19 @@ try:
from a_b6流程十三请领业务流_三级库向二级库 import edit_goods_target, second_dept_Request
from a_b6流程十三请领业务流_三级库向二级库 import BuyCarSubmit, pick_execute
# # 设置部门用户
# set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'],
# FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3'], 3)
# # 设置部门负责人
# set_dept_lead_new(FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid3"]) # 设置二级科室负责人
# get_stockAreaId_new(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'],
# FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3'], 3)
# deptName3 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3']
# # 设置库区联系人
# set_stockShelf_Linkman(FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid3"],
# get_stockAreaId2_new_fromDb(deptName3, 3)) # 设置库区联系人
# #三级科室产品分配
# dept_goods_distribute(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'])
# 上面暂时注释===================================
set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'],
FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3'], 3)
# 设置部门负责人
set_dept_lead_new(FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid3"]) # 设置二级科室负责人
get_stockAreaId_new(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'],
FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3'], 3)
deptName3 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3']
# 设置库区联系人
set_stockShelf_Linkman(FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid3"],
get_stockAreaId2_new_fromDb(deptName3, 3)) # 设置库区联系人
#三级科室产品分配
dept_goods_distribute(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'])
updateUserLoginDefaultRange(get_listUserMgrRangePage1(3)) # 设置登录账号默认权限是三级库
# # # 低值
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'], 1)
......@@ -673,6 +867,7 @@ try:
#二级科室领用出库
# 低值拣货执行
pick_execute()
# 检查拣货单
list_data = ['16', '20', '66']
for i in list_data:
......@@ -683,9 +878,15 @@ try:
check_mcms_psi_dept(20)
check_mcms_psi_dept(66)
updateUserLoginDefaultRange(get_listUserMgrRangePage1(3)) #设置登录账号默认权限是三级库
# 上面暂时注释===================================
second_dept_one_key_in(3)
second_dept_one_key_in(3)
second_dept_one_key_in(3)
time.sleep(6)
# 检查入库单
check_mcms_psi_dept_in(16)
check_mcms_psi_dept_in(20)
check_mcms_psi_dept_in(66)
commonFuc().check_text_exist_result_text('succees', 'succees')
except:
commonFuc().check_text_exist_result_text('error ', '1')
......@@ -3262,7 +3262,12 @@ def second_dept_one_key_in(type=2):
code=commonFuc().analysis_json('code',result)
if code==1010:
commonFuc().check_text_exist_result_text('error', 'succees')
return data
elif len(data)>=1:
commonFuc().check_text_exist_result_text('succees', 'succees')
return data
else:
commonFuc().check_text_exist_result_text('error', 'succees')
return None
# 一键入库====================================================
......
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