Commit 24dccb45 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程八脚本提交

parent 47a97abc
......@@ -6,7 +6,7 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
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_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
get_goods_mfrs_id, get_expdt_date, get_supply_id, get_id
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
......@@ -1583,9 +1583,9 @@ def check_mcms_psi_dept_out(type=25):
source_id = get_PICK_id_KS_TK(branch_id,bill_mode)
source_no = get_id("select order_no from mcms_psi_dept where id='%s';" % source_id)
# 获取order_no
# sql = " select order_no from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_TK' order by CREATE_TIME desc LIMIT 1;" % (
# branch_id, bill_mode)
order_no = None
sql = " select order_no from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
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')['deptid1']
......@@ -1601,11 +1601,12 @@ def check_mcms_psi_dept_out(type=25):
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, bill_mode)
pickOrderNo = get_PICK_order_no(branch_id, bill_mode)
pickBillId = get_PICK_id_KS_TK(branch_id, bill_mode)
sql="select order_no from mcms_pick where id='%s';"%pickBillId
pickOrderNo = get_id(sql)
buyOrderNo = get_buyOrderNo(branch_id, bill_mode)
pickBillId = get_PICK_id(branch_id, bill_mode)
psiDeptOutBillId = source_id
psiDeptOutOrderNo = source_no
psiDeptOutBillId = id
psiDeptOutOrderNo = order_no
if type == 16:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 25:
......@@ -1643,26 +1644,15 @@ def check_mcms_psi_dept_out(type=25):
# 子表检查
check_mcms_psi_dept_batch_out(id, type, hos_goods_id)
operationApplyOrderNo = get_id(
"select order_no from spd3_herp_test2.mcms_operation_apply where branch_id='%s' order by create_time desc LIMIT 1;" % branch_id)
operationNoticeBillId = get_id(
"select id from spd3_herp_test2.mcms_operation_notice where branch_id='%s' order by create_time desc LIMIT 1;" % branch_id)
operationNoticeOrderNo = get_id(
"select order_no from spd3_herp_test2.mcms_operation_notice where branch_id='%s' order by create_time desc LIMIT 1;" % branch_id)
operationApplyBillId = get_id(
"select id from spd3_herp_test2.mcms_operation_apply where branch_id='%s' order by create_time desc LIMIT 1;" % branch_id)
psiOutBillId=get_id("select id from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_QL' order by CREATE_TIME desc LIMIT 1;"%(branch_id,bill_mode))
psiOutOrderNo=get_id("select order_no from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_QL' order by CREATE_TIME desc LIMIT 1;"%(branch_id,bill_mode))
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_out_0913', 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_repl_id,
, target_area_code, source_id,
source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter, account_date, operationApplyOrderNo, operationNoticeBillId, distrBillId,
operationNoticeOrderNo, distrOrderNo, operationApplyBillId, checkBillId, checkOrderNo,
psiInBillId, psiInOrderNo, psiOutBillId, psiOutOrderNo, psiDeptInBillId,
psiDeptInOrderNo,
accounter, account_date, pickOrderNo, pickBillId, psiDeptOutBillId,
psiDeptOutOrderNo,
create_user, create_time, last_modified, last_modified_user)
......@@ -2064,6 +2054,189 @@ def check_mcms_psi_dept_batch_xhrk(DR_ID,source_ID,type,order_no):
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_psi_out(type=2):
print('检查中心库出库单')
if type == 1:
bill_mode = 16
elif type == 2:
bill_mode = 25
else:
bill_mode = 66
branch_id = get_branch_id()
sql = "select * from mcms_psi where source_branch_id='%s' and bill_mode='%s' and stock_kind='RK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
sql = "select id from mcms_psi where source_branch_id='%s' and bill_mode='%s' and stock_kind='RK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
id = get_id(sql)
sql = "select order_no from mcms_psi where source_branch_id='%s' and bill_mode='%s' and stock_kind='RK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
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')['deptid1']
target_dept_name =FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
stock_name = get_branch_name() + "中心库房"
target_stock_id = get_stockId_fromdb(get_branch_name()+'中心库房')
target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 1)
source_id =get_id("select id from mcms_psi_dept where target_branch_id='%s' and stock_kind='CK_TK' order by CREATE_TIME desc LIMIT 1;"%branch_id)
source_no = None
source_repl_id = None
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)
accounter = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
account_date = get_create_time("select account_date from mcms_psi where id='%s';" % id)
buyBillId = get_buyBillId(branch_id, bill_mode)
if type == 1:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 2:
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"]
pickBillId = get_PICK_id_KS_TK(branch_id, bill_mode)
pickOrderNo =get_id("select order_no from mcms_pick where id='%s';"%pickBillId)
planBillId = get_planBillId(hos_goods_id)
psiOutBillId = get_id("select id from mcms_psi_dept where target_branch_id='%s' and stock_kind='CK_TK' order by CREATE_TIME desc LIMIT 1;"%branch_id)
psiOutOrderNo =get_id("select order_no from mcms_psi_dept where id='%s';"%psiOutBillId)
buyOrderNo = get_buyOrderNo(branch_id, bill_mode)
purOrderNo = get_purOrderNo(branch_id, bill_mode)
purBillId = get_purBillId(branch_id, bill_mode)
bill_relation_json = get_purBillDate2(branch_id, bill_mode)
purBillDate = reGetString(bill_relation_json, r'purBillDate":"', r'""distrBillId')
distrBillId = get_distrBillId(branch_id, bill_mode)
distrOrderNo = get_distrOrderNo(branch_id, bill_mode)
checkBillId = source_id
sql = "select order_no from mcms_check where id='%s';" % checkBillId
checkOrderNo = get_id(sql)
psiInBillId = id
psiInOrderNo = order_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 where id='%s';" % id)
last_modified = get_create_time("select last_modified from mcms_psi where id='%s';" % id)
last_modified_user = create_user
check_mcms_psi_batch_out2(id, type, order_no, source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi_out_0913', id,
order_no, target_corp_id, target_branch_id, target_dept_id,
target_dept_name, target_stock_id
, target_area_code, source_id,
source_corp_id, source_branch_id, source_dept_id, source_dept_name
, source_stock_id, source_area_code, accounter, account_date,
pickOrderNo, pickBillId,
psiOutBillId, psiOutOrderNo,psiInBillId,psiInOrderNo,
create_user
, 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_mcms_psi_batch_out2(DR_ID, type, order_no, source_id1):
if type == 1:
bill_mode = 16
elif type == 2:
bill_mode = 25
else:
bill_mode = 66
branch_id = get_branch_id()
sql = " select * from mcms_psi_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_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)
sql="select id from mcms_psi_dept where target_branch_id='%s' and stock_kind='CK_TK' order by CREATE_TIME desc LIMIT 1;"%branch_id
source_detail_id =get_id(sql)
source_detail_id=source_detail_id+'0001'
pick_detail_id = None
if type == 1:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 2:
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_batch where pid='%s';" % DR_ID)
distrBillId = get_distrBillId(branch_id, bill_mode)
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_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')['deptid2']
shelf_code = get_stockAreaId_new_fromDb(get_branch_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_psi_batch where pid='%s';" % DR_ID)
last_modified = get_create_time("select last_modified from mcms_psi_batch where pid='%s';" % DR_ID)
last_modified_user = None
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_batch_out_0913', 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)
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')
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')
......@@ -2110,7 +2283,11 @@ try:
# time.sleep(6)
# #这里的业务会产生二级库消耗出库和消耗退货入库单据,和二级库出库数据
# check_mcms_psi_dept_XH_CK()
check_mcms_psi_dept_out()# 检查二级库退库出库单数据库表数据
# time.sleep(6)
# check_mcms_psi_dept_out()# 检查二级库退库出库单数据库表数据
# # 检查中心库出库单
# time.sleep(2)
check_mcms_psi_out()
commonFuc().check_text_exist_result_text('succees', 'succees')
except Exception as e:
# 打印错误信息
......
......@@ -344,3 +344,9 @@
"mcms_psi_dept_batch_0913": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "pick_detail_id": "%s", "pur_mode": 20, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "source_batch_id": "%s", "target_batch_id": "%s", "settle_flag": 0, "psi_price": Decimal("99.9999"), "qty": Decimal("1.00"), "unit_name": "1支", "barcode_id": "%s", "sub_barcode_id": None, "shelf_code": "%s-A-01-01", "tb_status": 0, "charge_flag": 1, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}'
#跟台二级库出库单到中心库主表
"mcms_psi_dept_out_0913": '{"id":"%s","order_no":"%s","bill_mode":"25","rec_type":"YND","psi_flag":-1,"psi_kind":"203","stock_kind":"CK_TK","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":"%s","target_area_name":"自动化测试","source_id":"%s","source_no":null,"source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":0,"patient_id":null,"patient_name":null,"machine_id":null,"machine_name":null,"his_charge_no":null,"remark":null,"tb_status":40,"accounter":"%s","account_date":"%s","bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":2,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":null}'
#跟台中心库出库子表
"mcms_psi_batch_out_0913": '{"id":"%s","pid":"%s","order_no":"%s","source_detail_id":"%s","pick_detail_id":%s,"pur_mode":20,"hos_goods_id":"%s","mdm_goods_code":"%s","goods_code":"%s","source_batch_id":"%s","target_batch_id":"%s","psi_price":Decimal("99.999900"),"qty":Decimal("1.00"),"unit_name":"1支","barcode_id":"%s","sub_barcode_id":null,"shelf_code":"%s-2-01-01","settle_flag":0,"tb_status":0,"pur_task_id":null,"create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":%s,"version":0}'
#跟台中心库出库主表
"check_mcms_psi_out_0913": '{"id":"%s","order_no":"%s","bill_mode":"25","rec_type":"YND","psi_flag":1,"psi_kind":"103","stock_kind":"RK_TK","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":"%s","target_area_name":"自动化测试","source_id":"%s","source_no":null,"source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","remark":null,"tb_status":30,"accounter":"%s","account_date":%s,"bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s","psiInBillId":"%s","psiInOrderNo":"%s"}","reject_time":null,"reject_remark":null,"create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":1,"last_auditor":null,"last_audit_time":null,"reject_user":null,"initial_order":null,"source_type":"SG","reject_reason":null,"receipt_status":0}'
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