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

流程二脚本提交

parent 5c0e5e56
......@@ -3,7 +3,8 @@ from air_case.public1.public1.public1 import updateUserLoginDefaultRange, get_li
get_branch_id, get_dept_buy_id, check_mcms_pur_plan_sql, get_hosid, get_id, \
get_stockAreaId_new_fromDb, get_login_user_uxid, get_expdt_date, get_create_time, get_process_list2, \
compare_text_index, check_mcms_pur_sql, check_source_id, get_mdm_goods_code1, get_goods_code1, get_supply_id, \
get_pkg_def_id, get_goods_gg, get_goods_name, get_login_user_uxid_bydb, process_tuple, get_prov_id, get_prov_id1
get_pkg_def_id, get_goods_gg, get_goods_name, process_tuple, get_prov_id, get_prov_id1
from common.db.sql.sql_tools_out import get_login_user_uxid_bydb
from common.fileUtls import FileUtils
__author__ = "xiaohesheng"
......@@ -20,7 +21,7 @@ from airtest.core.api import using
import sys
def check_supply_relation(type=1):
def check_supply_relation():
print('检查供应关系表数据')
branch_id = get_branch_id()
sql1 = "select * from spd_ybtest_hdi.supply_relation order by create_time desc limit 1;"
......@@ -62,6 +63,48 @@ def check_supply_relation(type=1):
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_supply_relation2():
print('检查供应关系表数据')
branch_id = get_branch_id()
sql1 = "select * from spd_ybtest_hdi.supply_relation order by create_time desc limit 1;"
actual = check_mcms_pur_sql(sql1)
print('actual', actual)
id=get_id("select id from spd_ybtest_hdi.supply_relation order by create_time desc limit 1;")
hos_id=get_id("select hos_id from spd_ybtest_hdi.supply_relation where id='%s';" % id)
prov_id = get_prov_id()
sub_prov_id=get_id("select sub_prov_id from spd_ybtest_hdi.supply_relation where id='%s';" % id)
contact_way=get_id("select contact_way from spd_ybtest_hdi.supply_relation where id='%s';" % id)
contact_user=get_id("select contact_user from spd_ybtest_hdi.supply_relation where id='%s';" % id)
create_time = get_create_time("select create_time from spd_ybtest_hdi.supply_relation where id='%s';" % id)
# last_modified = get_create_time("select last_modified from spd_ybtest_hdi.supply_relation where id='%s';" % id)
# username = commonFuc().get_business_data('b2_herp3_bs', "username")
auditor=get_id("select auditor from spd_ybtest_hdi.supply_relation where id='%s';" % id)
create_user = get_login_user_uxid_bydb(
FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"])
last_modified_user = get_id("select id from spd_ybtest_hdi.sys_user where user_code='test_1';")
audit_time= get_create_time("select audit_time from spd_ybtest_hdi.supply_relation where id='%s';" % id)
last_modified = get_create_time("select last_modified from spd_ybtest_hdi.supply_relation where id='%s';" % id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_supply_relation2', id,hos_id,prov_id,sub_prov_id,contact_way
,contact_user,auditor,audit_time, create_user,create_time, last_modified_user,last_modified)
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')
pro_path = commonFuc().get_pro_path2()
print('pro_path', pro_path)
......@@ -81,6 +124,7 @@ try:
# 供应关系申请-客户类型厂商
FileUtils().w_info1(supply_and_marketing_apply2(), module, '供货关系申请2')
submitSupplyRelation_pass()
check_supply_relation2()
commonFuc().check_text_exist_result_text('succees', 'succees')
print('=================流程二结束=================')
except Exception as e:
......
import time
import pymysql
from common.fileUtls import FileUtils
......@@ -8,7 +10,11 @@ def get_db():
db = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd_hdiorder_test2",
charset="utf8")
return db
def get_db1():
# 打开数据库连接
db = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd_ybtest_hdi",
charset="utf8")
return db
def get_sql_conn():
"""
......@@ -17,6 +23,13 @@ def get_sql_conn():
db = get_db()
cursor = db.cursor()
return db, cursor
def get_sql_conn1():
"""
获取数据库连接
"""
db = get_db1()
cursor = db.cursor()
return db, cursor
def get_index_dict(cursor):
......@@ -135,6 +148,27 @@ def check_out_check_mcms_purchase(sql):
new_str1 = new_str1.replace("'", '')
# print(new_str1)
cursor.close()
return new_str1
def get_login_user_uxid_bydb(username):
while True:
db, cursor = get_sql_conn1()
sql = "select id from sys_user where user_code='%s';" % username
cursor.execute(sql)
results = cursor.fetchone()
str1 = str(results)
if str1=='None':
time.sleep(6)
continue
else:
new_str1 = str1.replace(',)', '')
new_str1 = new_str1.replace('(', '')
new_str1 = new_str1.replace(',', '')
new_str1 = new_str1.replace("'", '')
break
# print(new_str1)
cursor.close()
db.close()
return new_str1
# hos_goods_id = 'h034700004220'
# main2(hos_goods_id)
\ No newline at end of file
企业信息:
e_id: CR202411040062
cname: 国药集团公司iKXtO
e_id: CR202411050093
cname: 国药集团公司C9U^w
供货关系申请:
e_corpId: p1e4dd
供货关系申请2:
e_corpId: p1e4f5
h_corpId: h0347
e_username: 国药集团公司iKXtO
e_username: 国药集团公司C9U^w
h_name: test_1
......@@ -531,4 +531,5 @@
"check_mcms_goods_info_after_approval5": '{"id": "%s", "hos_goods_code": "%s", "hos_id": "%s", "prov_id": "%s", "prov_hos_goods_id": "%s", "srv_id": None, "mdm_goods_code": "%s", "mdm_goods_spec_code": "%s", "spd_goods_code": "%s", "goods_name": "%s", "goods_general_name": "一次性注射器", "goods_mfrs_id": "mfrs-11229", "goods_mfrs_name": "德国歌德公司 Geuder AG", "goods_reg_cert": "", "goods_agent_mfrs_id": None, "brand": "", "short_pinyin": "%s", "kind_sixtyeight_code": None, "unit": "支", "goods_spec": "G-31891", "goods_package": Decimal("1.000000"), "bar_code_mng": 2, "unique_code_strategy": "3", "pur_mode": 10, "sub_pur_mode": None, "erp_code": None, "herp_code": "", "price": Decimal("99.9999"), "abroad_flag": None, "made": "德国", "property": None, "mgr_level": None, "goods_desc": "", "charge_flag": 1, "focus_control_type": None, "temp_flag": 0, "official_status": None, "focus_control": 0, "storage_conditions": "", "transport_conditions": "", "into_cost_flag": None, "rfid_flag": None, "purchase_flag": 1, "tb_status": 0, "version": 1, "create_user": "%s", "create_time": %s, "last_modified_user": "%s", "last_modified": %s, "sterilize_flag": 0, "multi_charge_flag": 0, "use_frequency": 1, "charge_unit": None, "remark": "无 "}'
#检查供应关系表
"check_supply_relation": '{"id": "%s", "hos_id": "%s", "prov_id": "%s", "sub_prov_id": "%s", "client_type": "1", "invitation_code": None, "contact_way": "%s", "contact_user": "%s", "tb_status": 20, "active_flag": "1", "auditor": "%s", "audit_time": %s, "audit_comment": None, "version": 1, "create_user": "GYQX-SPD:user-19669", "create_time": %s, "last_modified_user": "h0347:UID-042066", "last_modified": %s}'
\ No newline at end of file
"check_supply_relation": '{"id": "%s", "hos_id": "%s", "prov_id": "%s", "sub_prov_id": "%s", "client_type": "1", "invitation_code": None, "contact_way": "%s", "contact_user": "%s", "tb_status": 20, "active_flag": "1", "auditor": "%s", "audit_time": %s, "audit_comment": None, "version": 1, "create_user": "GYQX-SPD:user-19669", "create_time": %s, "last_modified_user": "h0347:UID-042066", "last_modified": %s}'
"check_supply_relation2": '{"id":"%s","hos_id":"%s","prov_id":"%s","sub_prov_id":"%s","client_type":"2","invitation_code":"","contact_way":"%s","contact_user":"%s","tb_status":20,"active_flag":"1","auditor":"%s","audit_time":%s,"audit_comment":null,"version":1,"create_user":"%s","create_time":%s,"last_modified_user":"%s","last_modified":%s}'
\ 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