Commit 4a845fba authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程十八脚本提交

parent e42d2b3a
......@@ -7,7 +7,7 @@ from air_case.public1.public1.public1 import *
from common.db.sql.sql_del_branch_info import delData
from common.db.sql.sql_tools import check_mcms_dept_buy_sql, get_pick_detail_id, get_mdm_goods_code1, get_goods_code1, \
get_pkg_def_id, get_login_user_uxid_bydb, check_batch_id, check_barcode_id, get_create_time, get_PICK_id, \
get_buyBillId, get_PICK_order_no, get_buyOrderNo, get_qty
get_buyBillId, get_PICK_order_no, get_buyOrderNo, get_qty, get_source_id
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
......@@ -181,6 +181,147 @@ def check_mcms_psi_data(type1=10):
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_task(type1=16):
branch_id = get_branch_id()
dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
if type1==16:
sql = " select * from mcms_task where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id,type1)
else:
type1=16
sql = " select * from mcms_task where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type1)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
JG_ID=get_id(" select id from mcms_task where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type1))
task_no=get_id(" select task_no from mcms_task where id='%s';" % (
JG_ID))
hos_id= get_hosid()
# dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
# dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
stock_id = get_stockId_fromdb(get_branch_name() + '中心库房')
stock_name=dept_name
area_code = get_stockAreaId_new_fromDb(dept_name, 1)
start_time=get_create_time("select start_time from mcms_task where id='%s';" % JG_ID)
# expdt_date=get_create_time("select expdt_date from mcms_task where id='%s';" % JG_ID)
# hos_batch_id=get_id("select hos_batch_id from mcms_task where id='%s';" % JG_ID)
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_task where id='%s';" % JG_ID)
last_modified = get_create_time("select last_modified from mcms_task where id='%s';" % JG_ID)
last_modified_user = create_user
type1 = 60
if type1 == 16:
mcms_task_detail(type1,JG_ID)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_task1', JG_ID, task_no,hos_id, branch_id, dept_id,
dept_name, stock_id,area_code,start_time,
create_user,create_time,last_modified,last_modified_user
)
elif type1 == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept5', JG_ID, task_no,hos_id, branch_id, dept_id,
dept_name, stock_id, stock_name,area_code,
create_user,create_time,last_modified,last_modified_user
)
else:
mcms_task_detail(type1, JG_ID)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_task2', JG_ID, task_no,hos_id, branch_id, dept_id,
dept_name, stock_id,area_code,start_time,
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 mcms_task_detail(type,task_id):
branch_id = get_branch_id()
dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
sql = "select * from mcms_task_detail where task_id='%s';"%task_id
actual = check_mcms_dept_buy_sql(sql)
print(actual)
id = get_id("select id from mcms_task_detail where task_id='%s';" % task_id)
if type == 16:
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"]
goods_code=get_goods_code1(hos_goods_id)
source_id=get_source_id(branch_id,hos_goods_id)
hos_id = get_hosid()
# dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
# dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
target_stock_id = get_stockId_fromdb(get_branch_name() + '中心库房')
stock_name = dept_name
target_area_code = get_stockAreaId_new_fromDb(dept_name, 1)
# expdt_date=get_create_time("select expdt_date from mcms_task where id='%s';" % JG_ID)
# hos_batch_id=get_id("select hos_batch_id from mcms_task where id='%s';" % JG_ID)
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_task_detail where id='%s';" % id)
last_modified = get_create_time("select last_modified from mcms_task_detail where id='%s';" % id)
last_modified_user = create_user
target_shelf_code=target_area_code
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_task_detail1', id, task_id, source_id, hos_goods_id, goods_code,
create_user, create_time, last_modified, last_modified_user,
target_stock_id, target_area_code, target_shelf_code
)
elif type == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept5', id, task_id, source_id, hos_goods_id, goods_code,
create_user, create_time, last_modified, last_modified_user,
target_stock_id, target_area_code, target_shelf_code
)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_task_detail2', id, task_id, source_id, hos_goods_id, goods_code,
create_user, create_time, last_modified, last_modified_user,
target_stock_id, target_area_code, target_shelf_code
)
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)
......@@ -191,13 +332,15 @@ from a_c1流程十八中心库业务_拆包功能 import center_Stock_unpack
try:
# updateUserLoginDefaultRange(get_listUserMgrRangePage1(1)) # 设置登录账号默认权限是级库
# updateUserLoginDefaultRange(get_listUserMgrRangePage1(1)) # 设置登录账号默认权限是1级库
# center_Stock_unpack(1) # 低值耗材扫码发放
# check_mcms_psi_data(10) # 检查库存数据(低值)
# check_mcms_task(16)#检查加工单数据
# time.sleep(6)
# center_Stock_unpack(3) # 试剂耗材扫码发放
# time.sleep(6)
check_mcms_psi_data(60) # 检查库存数据(试剂值)
# check_mcms_psi_data(60) # 检查库存数据(试剂值)
check_mcms_task(60) # 检查加工单数据
commonFuc().check_text_exist_result_text('succees', 'succees')
except Exception as e:
# 打印错误信息
......
......@@ -217,6 +217,7 @@ def get_qty(sql):
db.close()
return new_str1
def get_id(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
......@@ -303,6 +304,13 @@ def get_mdm_goods_code1(hos_goods_id):
db.close()
return process_tuple(results)
def get_source_id(branch_id,hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select id from branch_goods_pkg_def where hos_goods_id='%s' and BRANCH_ID='%s';" %(hos_goods_id,branch_id) )
results = cursor.fetchall()
cursor.close()
db.close()
return process_tuple(results)
def get_goods_code1(hos_goods_id):
db, cursor = get_sql_conn()
......
......@@ -236,6 +236,14 @@
"mcms_pick3_1": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "order_no": "%s", "source_id": null, "bill_mode": "66", "create_type": "SG", "pick_type": "TH", "dept_id": "%s", "dept_name": "%s", "stock_id": "%s", "area_code": "%s", "area_name": "自动化测试", "area_mgr_id": None, "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_area_code": %s, "target_area_name": null, "receiver": None, "reason_kind": "1", "barcode_flag": 1, "pkg_flag": 1, "patient_id": None, "patient_name": None, "remark": "", "tb_status": 40, "reviewer": "%s", "review_date": %s, "bill_relation_json": "{"pickOrderNo":"%s","pickBillId":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "last_auditor": None, "last_audit_time": None, "picker": "%s", "picker_name": "%s"}'
#中心库拆包
#中心库拆包库存数据
"mcms_psi_cb1": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "stock_id": "%s", "stock_name": "%s", "area_code": "%s", "area_name": "自动化测试", "pur_mode": 10, "hos_goods_id": "%s", "goods_code": "%s", "batch_code": "333", "expdt_date": %s, "hos_batch_id": "%s", "batch_price": Decimal("99.999900"), "qty": %s, "shelf_code": None, "barcode_flag": 1, "pkg_flag": 1, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": %s}'
"mcms_psi_cb2": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "stock_id": "%s", "stock_name": "%s", "area_code": "%s", "area_name": "自动化测试", "pur_mode": 10, "hos_goods_id": "%s", "goods_code": "%s", "batch_code": "4444", "expdt_date": %s, "hos_batch_id": "%s", "batch_price": Decimal("99.999900"), "qty": %s, "shelf_code": None, "barcode_flag": 1, "pkg_flag": 1, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": %s}'
\ No newline at end of file
"mcms_psi_cb2": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "stock_id": "%s", "stock_name": "%s", "area_code": "%s", "area_name": "自动化测试", "pur_mode": 60, "hos_goods_id": "%s", "goods_code": "%s", "batch_code": "4444", "expdt_date": %s, "hos_batch_id": "%s", "batch_price": Decimal("99.999900"), "qty": %s, "shelf_code": None, "barcode_flag": 1, "pkg_flag": 1, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": %s}'
#加工单
"mcms_task1": '{"id": "%s", "task_no": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "stock_id": "%s", "area_code": "%s", "area_name": "自动化测试", "task_type": "CB", "bill_mode": 16, "source_id": None, "start_time": %s, "end_time": None, "sum_num": 1, "finish_num": 1, "tb_status": 4, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "create_type": "SG", "change_type": "PKG_BULK"}'
"mcms_task2": '{"id": "%s", "task_no": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "stock_id": "%s", "area_code": "%s", "area_name": "自动化测试", "task_type": "CB", "bill_mode": 16, "source_id": None, "start_time": %s, "end_time": None, "sum_num": 1, "finish_num": 1, "tb_status": 4, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "create_type": "SG", "change_type": "PKG_BULK"}'
#加工单子表
"mcms_task_detail1": '{"id": "%s", "task_id": "%s", "source_id": "%s", "source_def_name": "100", "source_def_qty": Decimal("100.00"), "source_qty": Decimal("1.00"), "target_def_id": None, "target_def_name": "散件", "target_def_qty": Decimal("1.00"), "target_qty": Decimal("100.00"), "exe_pkg_qty": Decimal("1.00"), "hos_goods_id": "%s", "goods_code": "%s", "tb_status": 2, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "target_stock_id": "%s", "target_area_code": "%s", "target_shelf_code": "%s-2-01-01"}'
"mcms_task_detail2": '{"id": "%s", "task_id": "%s", "source_id": "%s", "source_def_name": "100", "source_def_qty": Decimal("100.00"), "source_qty": Decimal("1.00"), "target_def_id": None, "target_def_name": "散件", "target_def_qty": Decimal("1.00"), "target_qty": Decimal("100.00"), "exe_pkg_qty": Decimal("1.00"), "hos_goods_id": "%s", "goods_code": "%s", "tb_status": 2, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "target_stock_id": "%s", "target_area_code": "%s", "target_shelf_code": "%s-2-01-01"}'
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