diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" "b/air_case/b6_spd3_core_business_flow_database_check/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index 9bef18254c189dd989860b7f3dcdb6ae56c8aa37..6ed8ed43ac69a7a59d63be6d2e80ffa7be3b4e59 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" +++ "b/air_case/b6_spd3_core_business_flow_database_check/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -8,7 +8,9 @@ from common.db.sql.sql_del_branch_info import delData from common.db.sql.sql_tools import get_create_time, check_mcms_dept_buy_car_sql, get_dept_buy_id, \ check_mcms_dept_buy_sql, get_mdm_goods_code, get_expdt_date, check_mcms_pur_plan_sql, check_in_check_mcms_purchase, \ get_expdt_date1, process_date, get_mdm_goods_code1, get_goods_code1, get_goods_name, get_goods_gg, \ - get_goods_mfrs_id, get_supply_id, check_mcms_pur_sql, check_source_id, get_pkg_def_id + get_goods_mfrs_id, get_supply_id, check_mcms_pur_sql, check_source_id, get_pkg_def_id, get_buyBillId, \ + get_planBillId, get_planOrderNo, get_buyOrderNo, get_purOrderNo, get_purBillId, get_purBillDate, get_distrBillId, \ + get_distrOrderNo from common.db.sql.sql_tools_out import check_out_check_mcms_purchase from common.fileUtls import FileUtils @@ -49,7 +51,7 @@ def check_mcms_dept_buy_car(type=1): print('create_time', create_time, 'id', id) sql = """select * from mcms_dept_buy_car where branch_id='%s' and hos_goods_id='%s' order by create_time desc LIMIT 1; """ % (branch_id, hos_goods_id) - #要验证的sql,取自数据库的表中 + # 要验证的sql,取自数据库的表中 actual_value1 = check_mcms_dept_buy_car_sql(sql) print(actual_value1) deptid2 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'] @@ -838,7 +840,7 @@ def check_mcms_purchase(type=16): ) elif type == 20: - #检查采购订单子表 + # 检查采购订单子表 check_mcms_purchase_detail(id1, type, order_no) hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] planBillId = process_tuple( @@ -873,7 +875,7 @@ def check_mcms_purchase(type=16): create_time, last_modified, last_auditor, last_audit_time ) elif type == 66: - #检查采购订单子表数据 + # 检查采购订单子表数据 check_mcms_purchase_detail(id1, type, order_no) hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] planBillId = process_tuple( @@ -960,19 +962,20 @@ def check_mcms_purchase_detail(id, type, OrderNo): 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"] - source_id=get_id("select source_id from mcms_purchase_detail where pid='%s' order by create_time desc LIMIT 1;"%id) - if check_source_id(hos_goods_id,source_id)==True: + source_id = get_id( + "select source_id from mcms_purchase_detail where pid='%s' order by create_time desc LIMIT 1;" % id) + if check_source_id(hos_goods_id, source_id) == True: commonFuc().check_text_exist_result_text('succees', 'succees') else: commonFuc().check_text_exist_result_text('error', 'succees') - mdm_goods_code=get_mdm_goods_code1(hos_goods_id) - goods_code=get_goods_code1(hos_goods_id) - supply_id=get_supply_id(hos_goods_id) - pkg_def_id=get_pkg_def_id(hos_goods_id) + mdm_goods_code = get_mdm_goods_code1(hos_goods_id) + goods_code = get_goods_code1(hos_goods_id) + supply_id = get_supply_id(hos_goods_id) + pkg_def_id = get_pkg_def_id(hos_goods_id) planBillId = process_tuple( - get_id( - "select pid from mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % ( - hos_goods_id))) + get_id( + "select pid from 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) @@ -982,21 +985,24 @@ def check_mcms_purchase_detail(id, type, OrderNo): planDetailId = get_id( "select id from spd3_herp_test2.mcms_pur_plan_detail where pid='%s';" % planBillId) - source_id=planDetailId - goodsGg=get_goods_gg(hos_goods_id) - goodsCode=get_goods_code1(hos_goods_id) - goodsName=get_goods_name(hos_goods_id) - create_user=get_login_user_uxid() - create_time=get_create_time("select create_time from mcms_purchase_detail where id='%s';"%detail_main_key) - last_modified=create_time - last_modified_user=create_user + source_id = planDetailId + goodsGg = get_goods_gg(hos_goods_id) + goodsCode = get_goods_code1(hos_goods_id) + goodsName = get_goods_name(hos_goods_id) + create_user = get_login_user_uxid() + create_time = get_create_time("select create_time from mcms_purchase_detail where id='%s';" % detail_main_key) + last_modified = create_time + last_modified_user = create_user if type == 16: expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', - 'mcms_purchase_detail', detail_main_key, pid, OrderNo, source_id, hos_goods_id, - mdm_goods_code, goods_code, supply_id,pkg_def_id, planBillId, buyDetailId,planDetailId, - goodsGg, goodsCode,goodsName,create_user,create_time,last_modified,last_modified_user - ) + 'mcms_purchase_detail', detail_main_key, pid, OrderNo, source_id, + hos_goods_id, + mdm_goods_code, goods_code, supply_id, pkg_def_id, planBillId, + buyDetailId, planDetailId, + goodsGg, goodsCode, goodsName, create_user, create_time, last_modified, + last_modified_user + ) elif type == 20: expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', @@ -1153,7 +1159,7 @@ def check_hdi_distr(type=16): 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']))) + 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 = create_time @@ -1300,14 +1306,13 @@ def check_hdi_distr_detail(distr_main_key, type, purchase_id): 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: + if type == 16: hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] - elif type==20: + 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) goods_name = get_goods_name(hos_goods_id) @@ -1348,13 +1353,13 @@ def check_hdi_distr_detail(distr_main_key, type, purchase_id): purBillId = id1 distrDetailId = distr_detail_main_key distrBillId = distr_main_key - erpCode = mdm_goods_code#11661563 + 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=create_time - last_modified_user=create_user + last_modified = create_time + 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, @@ -1363,8 +1368,9 @@ def check_hdi_distr_detail(distr_main_key, type, purchase_id): 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: + 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 @@ -1374,7 +1380,7 @@ def check_hdi_distr_detail(distr_main_key, type, purchase_id): 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: + 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 @@ -1385,32 +1391,89 @@ def check_hdi_distr_detail(distr_main_key, type, purchase_id): distrBillId, goods_gg, goods_code, goods_name, erpCode, create_user, create_time, last_modified, last_modified_user) 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) - 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') + expected = None + + comparison_result(actual, expected) + def check_mcms_check(type=1): + if type == 1: + bill_mode = 16 + elif type == 2: + bill_mode = 20 + else: + bill_mode = 66 print('检查验收单数据库写值') - check_no=FileUtils().r_info8('b5_spd3_core_business_flow', '验收单号', 'message15') + check_no = FileUtils().r_info8('b5_spd3_core_business_flow', '验收单号', 'message15')['CHECK_NO1'] sql = "select * from mcms_check where id = '%s';" % check_no + order_no = get_id("select order_no from mcms_check where id = '%s';" % check_no) # 获取实际值 actual = check_mcms_pur_plan_sql(sql) print('actual', actual) + if type == 1: + source_id = FileUtils().r_info8('b5_spd3_core_business_flow', '低值配送单号', 'message10')['distrBillId1'] + elif type == 2: + source_id = FileUtils().r_info8('b5_spd3_core_business_flow', '高值配送单号', 'message10')['distrBillId1'] + else: + source_id = FileUtils().r_info8('b5_spd3_core_business_flow', '试剂配送单号', 'message10')['distrBillId1'] + source_no = source_id + prov_id = get_prov_id() + prov_name = get_prov_name() + rec_org_id = get_rec_org_id(2) + rec_org_name = get_rec_org_name(2) + dept_id = rec_org_id + dept_name = rec_org_name + branch_id=get_branch_id() + buyBillId = get_buyBillId(branch_id,bill_mode) + buyOrderNo = get_buyOrderNo(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"] + planBillId = get_planBillId(hos_goods_id) + planOrderNo = get_planOrderNo(hos_goods_id) + purOrderNo = get_purOrderNo(branch_id,bill_mode) + purBillId = get_purBillId(branch_id,bill_mode) + bill_relation_json = get_purBillDate(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=check_no + checkOrderNo=order_no + create_user=get_login_user_uxid() + sql="select create_time from mcms_check where id='%s';"%check_no + create_time=get_create_time(sql) + last_modified=create_time + last_modified_user=create_user + if type==1: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'mcms_check', check_no, + order_no, get_hosid(), get_branch_id(), source_id, source_no, prov_id, + prov_name, rec_org_id, rec_org_name, dept_id, dept_name, buyBillId, + planBillId, planOrderNo, buyOrderNo, purOrderNo, purBillId, purBillDate, + distrBillId,distrOrderNo,checkBillId,checkOrderNo,create_user,create_time,last_modified, + last_modified_user) + elif type==2: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'mcms_check1', check_no, + order_no, get_hosid(), get_branch_id(), source_id, source_no, prov_id, + prov_name, rec_org_id, rec_org_name, dept_id, dept_name, buyBillId, + planBillId, planOrderNo, buyOrderNo, purOrderNo, purBillId, + purBillDate, + distrBillId, distrOrderNo, checkBillId, checkOrderNo, create_user, + create_time, last_modified, + last_modified_user) + else: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'mcms_check2', check_no, + order_no, get_hosid(), get_branch_id(), source_id, source_no, prov_id, + prov_name, rec_org_id, rec_org_name, dept_id, dept_name, buyBillId, + planBillId, planOrderNo, buyOrderNo, purOrderNo, purBillId, + purBillDate, + distrBillId, distrOrderNo, checkBillId, checkOrderNo, create_user, + create_time, last_modified, + last_modified_user) + # 对比预期值和实际值是否一致 + comparison_result(actual, expected) try: @@ -1419,8 +1482,6 @@ try: sys.path.append(pro_path + r'/air_case/b5_spd3_core_business_flow/a_b4流程十一请领业务流_二级库向直送.air') using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_b4流程十一请领业务流_二级库向直送.air') - - from a_b4流程十一请领业务流_二级库向直送 import goods_move2 from a_b4流程十一请领业务流_二级库向直送 import second_dept_Request @@ -1454,6 +1515,7 @@ try: # check_mcms_dept_buy_approval_after(int(i)) # mcms_dept_buy_detail_approval_after(int(i)) # + # time.sleep(20) # # 检查自动生成的采购计划数据 # list_data = ['16', '20', '66'] # for i in list_data: @@ -1461,27 +1523,42 @@ try: # # 采购模块处理 # purchase_module_process() # - # for i in range(3): # 三个单据共审批3次 - # approval_center() - # 上面暂时注释========================================= - list_data = ['16', '20', '66'] - for i in list_data: - check_mcms_purchase(int(i)) - - #检查同步到外网的采购订单数据跟内网的是否一致 - check_mcms_purchase_out_and_in(1) - check_mcms_purchase_out_and_in(2) - order_dp(1) # 1低值 - order_dp(2) # 2高值 - order_dp(3) # 3试剂 - - list_data = ['16', '20', '66'] - for i in list_data: - check_hdi_distr(int(i)) + # 三个单据共审批三次 + # approval_center(FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号试剂', 'message12')) + # approval_center(FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号', 'message7')) + # approval_center(FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号高值', 'message11')) + # time.sleep(20) + # list_data = ['16', '20', '66'] + # for i in list_data: + # check_mcms_purchase(int(i)) + # + # #检查同步到外网的采购订单数据跟内网的是否一致 + # check_mcms_purchase_out_and_in(1) + # print('检查同步到外网的采购订单数据跟内网的是否一致') + # check_mcms_purchase_out_and_in(2) + # order_dp(1) # 1低值 + # time.sleep(6) + # order_dp(2) # 2高值 + # time.sleep(6) + # order_dp(3) # 3试剂 + # time.sleep(6) + # time.sleep(20) + # list_data = ['16', '20', '66'] + # for i in list_data: + # check_hdi_distr(int(i)) + # check_accept_order(1) # 低值 - # - # check_mcms_check(1)#调用函数检查验收单数据库写值 + # check_mcms_check(1) # 调用函数检查验收单数据库写值 + # 上面暂时注释======================================== + + # check_accept_order(2) # 高值 + # check_mcms_check(2) # 调用函数检查验收单数据库写值 + # check_accept_order(3) # 试剂 + check_mcms_check(3) # 调用函数检查验收单数据库写值 + # 这里验收后会自动生成入库单,批次信息,需要同步验证入库单和批次信息 + # 根据验收单号到mcms_psi表查询入库单 + # # check_accept_order(2) # 高值 # check_accept_order(3) # 试剂 diff --git a/air_case/public1/public1/public1.py b/air_case/public1/public1/public1.py index 066280c103ede0380ac0b5b78d44f0e25e1e54c8..134fb852207bcc8690f746146f9d1abd9e17683d 100644 --- a/air_case/public1/public1/public1.py +++ b/air_case/public1/public1/public1.py @@ -3464,4 +3464,39 @@ def get_login_user_uxid2(): # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') # 获取token和projectCode token1, projectCode1, uxid1, corpId1, info1 = login(username, password,1) - return uxid1 \ No newline at end of file + return uxid1 + +def 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') +def get_prov_id(): + return FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"] + +def get_prov_name(): + return FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"] + +def get_rec_org_id(type=1): + if type==1: + return FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] + elif type==2: + return FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'] +def get_rec_org_name(type=1): + if type==1: + return FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + elif type==2: + return FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'] \ No newline at end of file diff --git a/common/db/sql/sql_tools.py b/common/db/sql/sql_tools.py index e19dfc92ebb6b625615af331ded31f2e2e4974d8..31e5a137933ddb6a725ca32e07a1c1c43f61ea03 100644 --- a/common/db/sql/sql_tools.py +++ b/common/db/sql/sql_tools.py @@ -1,5 +1,6 @@ import pymysql +from air_case.public1.public1.public1 import * from common.fileUtls import FileUtils @@ -245,7 +246,63 @@ def check_source_id(hos_goods_id,source_id): return True else: return False +def get_buyBillId(branch_id,bill_mode): + 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, bill_mode) + print(sql) + return process_tuple(get_dept_buy_id(sql)) +def get_buyOrderNo(branch_id,bill_mode): + 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, bill_mode) + print(sql) + return process_tuple(get_dept_buy_id(sql)) +def get_purOrderNo(branch_id,bill_mode): + sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, bill_mode) + # 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, bill_mode, id1) + print(sql) + return process_tuple(get_dept_buy_id(sql)) +def get_purBillId(branch_id,bill_mode): + sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, bill_mode) + # print(sql) + return process_tuple(get_dept_buy_id(sql)) +def get_planBillId(hos_goods_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))) + return planBillId +def get_planOrderNo(hos_goods_id): + return 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))) + +def get_purBillDate(branch_id,bill_mode): + 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, bill_mode)) + 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, bill_mode)) + # print(bill_relation_json) + return bill_relation_json +def get_distrBillId(branch_id,bill_mode): + 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, bill_mode)) + return distr_main_key +def get_distrOrderNo(branch_id,bill_mode): + # 查询配送单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;" % ( + get_distrBillId(branch_id,bill_mode), bill_mode)) + return distr_order_no def check_in_check_mcms_purchase(sql): db, cursor = get_sql_conn() cursor.execute(sql) diff --git a/data/b6_spd3_core_business_flow_database_check/data b/data/b6_spd3_core_business_flow_database_check/data index f4a9672695c2d5dcddf84323ea02ff901e8c0ee7..16e3485700b701e88cb8f852a11f7167b3681f9b 100644 --- a/data/b6_spd3_core_business_flow_database_check/data +++ b/data/b6_spd3_core_business_flow_database_check/data @@ -52,3 +52,9 @@ "hdi_distr_detail": '{"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("1.00"), "distr_qty": Decimal("100.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","buyDetailId":"%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": '{"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("1.00"), "distr_qty": Decimal("1.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","buyDetailId":"%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": '{"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("1.00"), "distr_qty": Decimal("100.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","buyDetailId":"%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}' + + +"mcms_check": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "hos_id": "%s", "branch_id": "%s", "source_id": "%s", "source_no": "%s", "source_type": "PSD", "tb_status": 20, "prov_id": "%s", "prov_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "dept_id": "%s", "dept_name": "%s", "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "initial_order": None, "remark": ""}' +"mcms_check1": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "hos_id": "%s", "branch_id": "%s", "source_id": "%s", "source_no": "%s", "source_type": "PSD", "tb_status": 20, "prov_id": "%s", "prov_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "dept_id": "%s", "dept_name": "%s", "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "initial_order": None, "remark": ""}' +"mcms_check2": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "hos_id": "%s", "branch_id": "%s", "source_id": "%s", "source_no": "%s", "source_type": "PSD", "tb_status": 20, "prov_id": "%s", "prov_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "dept_id": "%s", "dept_name": "%s", "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "initial_order": None, "remark": ""}' +