Commit 7b42af5f authored by 肖 和生's avatar 肖 和生
Browse files

Merge remote-tracking branch 'remotes/origin/master' into core_flow

parents 4efd8162 4ca91c9f
......@@ -169,17 +169,17 @@ def check_accept_order(type=1):
break
# ==============================查看订单详情==================
# ========设置验收全部合格
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "check_barcode_save_url")
print('check_barcode_save_url', url)
url2 = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "check_barcode_save_url")
print('check_barcode_save_url', url2)
sourceBillId = sourceId
request_body = commonFuc().get_business_data(module, "payload2", sourceBillId, viewId)
request_body2 = commonFuc().get_business_data(module, "payload2", sourceBillId, viewId)
print('设置验收全部合格request_body',request_body)
print('设置验收全部合格request_body',request_body2)
# 发送请求
time.sleep(6)
while True:
result = commonFuc().http_post(url, request_body, headers)
result = commonFuc().http_post(url2, request_body2, headers)
print('result', result)
data = commonFuc().analysis_json('data', result)
code= commonFuc().analysis_json('code', result)
......@@ -218,6 +218,10 @@ def check_accept_order(type=1):
code = commonFuc().analysis_json('code', result)
if code == 0:
break
else:
result2 = commonFuc().http_post(url2, request_body2, headers)
print('result2', result2)
continue
info = (CHECK_NO, CHECK_NO)
titlename = ('CHECK_NO1', 'CHECK_NO2')
......
......@@ -1675,7 +1675,7 @@ try:
# 这里验收后会自动生成入库单,批次信息,需要同步验证入库单和批次信息
# 根据验收单号到mcms_psi表查询入库单
#
# check_accept_order(2) # 高值
# check_accept_order(3) # 试剂
# second_dept_one_key_in()
......
......@@ -105,6 +105,7 @@ def check_mcms_dept_buy_car(type=1):
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
# 检查二级库请领单审批前的子表数据
def mcms_dept_buy_detail(type=16):
branch_id = get_branch_id()
......@@ -245,7 +246,7 @@ def check_mcms_dept_buy(type=16):
branch_id, type))
rec_addr = deptname2
dept_id1 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
dept_name1=FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
dept_name1 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
stock_name = dept_name1 + "库房"
target_stock_id = get_stockId_fromdb(stock_name)
if type == 16:
......@@ -291,23 +292,73 @@ def check_mcms_dept_buy(type=16):
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_psi_dept_batch(type,DR_ID):
def check_mcms_psi_dept_batch(DR_ID,type,order_no):
branch_id = get_branch_id()
sql = " select * from mcms_psi_dept_batch where pid='%s';" % (
DR_ID)
DR_ID)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
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 = get_pick_detail_id(branch_id,type)
pick_detail_id=source_detail_id
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')['deptid2']
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:
#子表检查
check_mcms_psi_dept_batch(type,DR_ID)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept1',DR_ID
'mcms_psi_dept_batch1', 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_dept2',DR_ID)
'mcms_psi_dept_batch2', 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_dept3',DR_ID)
'mcms_psi_dept_batch3',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')
......@@ -328,72 +379,244 @@ def check_mcms_psi_dept_batch(type,DR_ID):
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_psi_dept(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='CK_SL' order by CREATE_TIME desc LIMIT 1;"%(branch_id,type)
branch_id = get_branch_id()
sql = " select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_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", 'message26')
# print(info)
if type==16:
DR_ID=info['DR_NO2']
elif type==20:
if type == 16:
DR_ID = info['DR_NO2']
elif type == 20:
DR_ID = info['DR_NO3']
else:
DR_ID = info['DR_NO1']
DR_ID = ''.join(DR_ID)
sql="select order_no from mcms_psi_dept where id='%s';"% DR_ID
sql = "select order_no from mcms_psi_dept where id='%s';" % DR_ID
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_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_id=PICK_id
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=DR_ID
psiDeptOutOrderNo=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_dept where id='%s';" % DR_ID)
last_modified=get_create_time("select last_modified from mcms_psi_dept where id='%s';" % DR_ID)
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_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_id = PICK_id
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 = DR_ID
psiDeptOutOrderNo = 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_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
if type == 16:
# 子表检查
check_mcms_psi_dept_batch(DR_ID,type,order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept1', 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_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
buyBillId, pickOrderNo, buyOrderNo, pickBillId, psiDeptOutBillId,
psiDeptOutOrderNo
, create_user, create_time, last_modified, last_modified_user
)
elif type == 20:
# 子表检查
check_mcms_psi_dept_batch(DR_ID, type, order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept2', 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_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
buyBillId, pickOrderNo, buyOrderNo, pickBillId, psiDeptOutBillId,
psiDeptOutOrderNo
, create_user, create_time, last_modified, last_modified_user)
else:
# 子表检查
check_mcms_psi_dept_batch(DR_ID, type, order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept3', 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_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
buyBillId, pickOrderNo, buyOrderNo, pickBillId, psiDeptOutBillId,
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_pick_detail(pid,type,order_no):
branch_id = get_branch_id()
print('拣货单子表检查')
sql = " select * from mcms_pick_detail where pid='%s';" % (
pid)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
id=get_id("select id from mcms_pick_detail where pid='%s';" % ( pid))
source_id=get_buyBillId(branch_id,type)
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)
create_user=picker
create_time=get_create_time("select create_time from mcms_pick_detail where pid='%s';" % (pid))
last_modified=get_create_time("select last_modified from mcms_pick_detail where pid='%s';" % (pid))
last_modified_user=create_user
if type == 16:
#子表检查
check_mcms_psi_dept_batch(type,DR_ID)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_pick_detail1', id,pid,order_no,source_id,hos_goods_id
,mdm_goods_code,goods_code,pkg_def_id,picker,picker_name,
create_user,create_time,last_modified,last_modified_user
)
elif type == 20:
pkg_def_id=None
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_pick_detail2', id,pid,order_no,source_id,hos_goods_id
,mdm_goods_code,goods_code,pkg_def_id,picker,picker_name,
create_user,create_time,last_modified,last_modified_user
)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept1',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_corp_id,source_branch_id,
source_dept_id,source_dept_name,source_stock_id,source_area_code,
buyBillId,pickOrderNo,buyOrderNo,pickBillId,psiDeptOutBillId,psiDeptOutOrderNo
,create_user,create_time,last_modified,last_modified_user
'mcms_pick_detail3', id,pid,order_no,source_id,hos_goods_id
,mdm_goods_code,goods_code,pkg_def_id,picker,picker_name,
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_pick(type=16):
branch_id = get_branch_id()
print('拣货单验证')
sql = " select * from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
id = get_id(
"select id from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
order_no = get_id(
"select order_no from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
source_id = get_buyBillId(branch_id, type)
dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
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_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']
reviewer = get_login_user_uxid_bydb(username)
review_date = get_expdt_date(
"select review_date from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
buyBillId = get_buyBillId(branch_id, type)
pickOrderNo = order_no
buyOrderNo = get_buyOrderNo(branch_id, type)
pickBillId = id
create_user = reviewer
create_time = get_expdt_date(
"select create_time from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
last_modified = get_expdt_date(
"select last_modified from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
last_modified_user=create_user
picker = create_user
picker_name = username
if type == 16:
#检查拣货单子表
check_mcms_pick_detail(id,type,order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_pick1', id, get_hosid(), get_branch_id(), order_no, source_id,
dept_id,
dept_name, stock_id, area_code, target_dept_id, target_dept_name,
target_stock_id, target_area_code, reviewer,
review_date, buyBillId, pickOrderNo, buyOrderNo, pickBillId,
create_user, create_time, last_modified, last_modified_user,picker, picker_name
)
elif type == 20:
# 检查拣货单子表
check_mcms_pick_detail(id,type,order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept2',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_corp_id,source_branch_id,
source_dept_id,source_dept_name,source_stock_id,source_area_code,
buyBillId,pickOrderNo,buyOrderNo,pickBillId,psiDeptOutBillId,psiDeptOutOrderNo
,create_user,create_time,last_modified,last_modified_user)
'mcms_pick2', id, get_hosid(), get_branch_id(), order_no, source_id,
dept_id,
dept_name, stock_id, area_code, target_dept_id, target_dept_name,
target_stock_id, target_area_code, reviewer,
review_date, buyBillId, pickOrderNo, buyOrderNo, pickBillId,
create_user, create_time, last_modified, last_modified_user,picker, picker_name
)
else:
# 检查拣货单子表
check_mcms_pick_detail(id, type, order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept3',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_corp_id,source_branch_id,
source_dept_id,source_dept_name,source_stock_id,source_area_code,
buyBillId,pickOrderNo,buyOrderNo,pickBillId,psiDeptOutBillId,psiDeptOutOrderNo
,create_user,create_time,last_modified,last_modified_user)
'mcms_pick3', id, get_hosid(), get_branch_id(), order_no, source_id,
dept_id,
dept_name, stock_id, area_code, target_dept_id, target_dept_name,
target_stock_id, target_area_code, reviewer,
review_date, buyBillId, pickOrderNo, buyOrderNo, pickBillId,
create_user, create_time, last_modified, last_modified_user,picker, picker_name
)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
......@@ -413,6 +636,8 @@ def check_mcms_psi_dept(type=16):
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
try:
pro_path = commonFuc().get_pro_path2()
print('pro_path', pro_path)
......@@ -421,9 +646,10 @@ try:
from a_b5流程十二请领业务流_二级库向二级库 import add_dept2
from a_b5流程十二请领业务流_二级库向二级库 import add_new_deptinfo,edit_goods_target,second_dept_Request
from a_b5流程十二请领业务流_二级库向二级库 import BuyCarSubmit,pick_execute
#========下面暂时注释
from a_b5流程十二请领业务流_二级库向二级库 import add_new_deptinfo, edit_goods_target, second_dept_Request
from a_b5流程十二请领业务流_二级库向二级库 import BuyCarSubmit, pick_execute
# ========下面暂时注释
# add_dept2() # 新增一个二级科室
# add_new_deptinfo() # 写入科室信息到文件中
# grants_user_new() # 新增授权
......@@ -473,10 +699,14 @@ try:
# # # 二级科室领用出库
# # # 低值拣货执行
# pick_execute()
# # 检查拣货单
# list_data = ['16', '20', '66']
# for i in list_data:
# check_mcms_pick(int(i))
# 上面暂时注释========================
#检查出库单
# check_mcms_psi_dept(16)
# check_mcms_psi_dept(20)
# 检查出库单
check_mcms_psi_dept(16)
check_mcms_psi_dept(20)
check_mcms_psi_dept(66)
second_dept_one_key_in(5)
second_dept_one_key_in(5)
......
......@@ -141,6 +141,64 @@ def approval_center(OBH_ID='OBhxxxxxxxxxxxxxxx'):
else:
commonFuc().check_text_exist('error', result)
def approval_center_all(OBH_ID='OBhxxxxxxxxxxxxxxx'):
module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "apprCenter_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# 请求体
request_body = commonFuc().get_business_data(module, "payload50_6")
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
data1= commonFuc().analysis_json('data', data)
for i in data1:
# code = commonFuc().analysis_json('code', result)
# data = commonFuc().analysis_json('data', result)
# total = commonFuc().analysis_json('total', result)
# data1 = commonFuc().analysis_json('data', i)
taskId = commonFuc().analysis_json('taskId', i)
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "approvalBatch_url")
# 请求体
request_body = commonFuc().get_business_data(module, "payload50_7", taskId)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', result)
if code >= 0:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
def approval_center1():
module = "b2_herp3_bs"
......
......@@ -267,11 +267,37 @@ def check_source_id(hos_goods_id,source_id):
return True
else:
return False
def check_batch_id(source_batch_id):
db, cursor = get_sql_conn()
cursor.execute("select id from mcms_hos_batch where id='%s'" % (source_batch_id))
results1 = cursor.fetchall()
cursor.close()
batch_id= process_tuple(results1)
if batch_id!=None:
return True
else:
return False
def check_barcode_id(barcode_id):
db, cursor = get_sql_conn()
cursor.execute("select id from hdi_barcode where id='%s'" % (barcode_id))
results1 = cursor.fetchall()
cursor.close()
batch_id= process_tuple(results1)
if batch_id!=None:
return True
else:
return False
def get_PICK_id(branch_id,bill_mode):
sql = "select id from mcms_pick 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_pick_detail_id(branch_id,bill_mode):
main_id=get_PICK_id(branch_id,bill_mode)
sql = "select id from mcms_pick_detail where pid='%s';" % (
main_id)
print(sql)
return process_tuple(get_dept_buy_id(sql))
def get_PICK_order_no(branch_id,bill_mode):
PICK_id=get_PICK_id(branch_id,bill_mode)
sql = "select order_no from mcms_pick where id='%s' order by CREATE_TIME desc LIMIT 1;" % (
......@@ -283,6 +309,7 @@ def get_buyBillId(branch_id,bill_mode):
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)
......
#请领单请领车
"check_mcms_dept_buy_car_low_value": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": %s, "pkg_def_id": "%s", "pkg_def_name": "%s", "pkg_def_qty": Decimal("100.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("100.00"), "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "coding_type": 0}'
"check_mcms_dept_buy_car_high_value": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": %s, "pkg_def_id": null, "pkg_def_name": null, "pkg_def_qty": Decimal("1.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("1.00"), "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "coding_type": 0}'
......@@ -73,6 +74,21 @@
"mcms_dept_buy5_2": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "source_id": None, "buy_way": null, "create_type": "SG", "buy_kind": "LY", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_stock_name": "%s", "bill_expdt_date": %s, "bill_expect_date": None, "priority": 0, "buy_priority": 0, "barcode_flag": 1, "pkg_flag": 0, "remark": "", "dept_audit_remark": None, "audit_remark": None, "close_remark": None, "srv_id": None, "srv_name": None, "gen_status": 0, "close_status": 0, "tb_status": 10, "rec_user": "%s", "rec_phone": "xhs0301", "rec_addr": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "close_time": None, "old_order_no": None}'
"mcms_dept_buy5_3": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "source_id": None, "buy_way": null, "create_type": "SG", "buy_kind": "LY", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_stock_name": "%s", "bill_expdt_date": %s, "bill_expect_date": None, "priority": 0, "buy_priority": 0, "barcode_flag": 1, "pkg_flag": 1, "remark": "", "dept_audit_remark": None, "audit_remark": None, "close_remark": None, "srv_id": None, "srv_name": None, "gen_status": 0, "close_status": 0, "tb_status": 10, "rec_user": "%s", "rec_phone": "xhs0301", "rec_addr": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "close_time": None, "old_order_no": None}'
#拣货单
"mcms_pick1": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "order_no": "%s", "source_id": "%s", "bill_mode": "16", "create_type": "ZD", "pick_type": "KS_SL", "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": "默认库区", "receiver": None, "reason_kind": None, "barcode_flag": 1, "pkg_flag": 1, "patient_id": None, "patient_name": None, "remark": "", "tb_status": 40, "reviewer": "%s", "review_date": %s, "bill_relation_json": "{"buyBillId":"%s","pickOrderNo":"%s","buyOrderNo":"%s","pickBillId":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 4, "last_auditor": None, "last_audit_time": None, "picker": "%s", "picker_name": "%s"}'
"mcms_pick2": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "order_no": "%s", "source_id": "%s", "bill_mode": "20", "create_type": "ZD", "pick_type": "KS_SL", "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": "默认库区", "receiver": None, "reason_kind": None, "barcode_flag": 1, "pkg_flag": 0, "patient_id": None, "patient_name": None, "remark": "", "tb_status": 40, "reviewer": "%s", "review_date": %s, "bill_relation_json": "{"buyBillId":"%s","pickOrderNo":"%s","buyOrderNo":"%s","pickBillId":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 4, "last_auditor": None, "last_audit_time": None, "picker": "%s", "picker_name": "%s"}'
"mcms_pick3": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "order_no": "%s", "source_id": "%s", "bill_mode": "66", "create_type": "ZD", "pick_type": "KS_SL", "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": "默认库区", "receiver": None, "reason_kind": None, "barcode_flag": 1, "pkg_flag": 1, "patient_id": None, "patient_name": None, "remark": "", "tb_status": 40, "reviewer": "%s", "review_date": %s, "bill_relation_json": "{"buyBillId":"%s","pickOrderNo":"%s","buyOrderNo":"%s","pickBillId":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 4, "last_auditor": None, "last_audit_time": None, "picker": "%s", "picker_name": "%s"}'
#拣货单子表
"mcms_pick_detail1": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": "%s0001", "pur_mode": 10, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pkg_def_type": None, "pkg_base_mirror": None, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "apply_qty": Decimal("1.00"), "qty": Decimal("1.00"), "picked_qty": Decimal("1.00"), "picker": "%s", "picker_name": "%s", "tb_status": 20, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 2, "plan_flag": None}'
"mcms_pick_detail2": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": "%s0001", "pur_mode": 20, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pkg_def_type": None, "pkg_base_mirror": None, "pkg_def_id": %s, "pkg_def_name": None, "pkg_def_qty": Decimal("1.00"), "apply_qty": Decimal("1.00"), "qty": Decimal("1.00"), "picked_qty": Decimal("1.00"), "picker": "%s", "picker_name": "%s", "tb_status": 20, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 2, "plan_flag": None}'
"mcms_pick_detail3": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": "%s0001", "pur_mode": 60, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pkg_def_type": None, "pkg_base_mirror": None, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "apply_qty": Decimal("1.00"), "qty": Decimal("1.00"), "picked_qty": Decimal("1.00"), "picker": "%s", "picker_name": "%s", "tb_status": 20, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 2, "plan_flag": None}'
#出库单主表
"mcms_psi_dept1": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "rec_type": "YND", "psi_flag": -1, "psi_kind": "204", "stock_kind": "CK_SL", "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": None, "source_repl_id": None, "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": "", "patient_name": "", "machine_id": None, "machine_name": None, "his_charge_no": None, "remark": "", "tb_status": 20, "accounter": None, "account_date": None, "bill_relation_json": "{"buyBillId":"%s","pickOrderNo":"%s","buyOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "last_auditor": None, "last_audit_time": None, "reject_reason": None, "reject_user": None, "reject_time": None, "initial_order": None, "source_type": "SG", "target_coding_type": None}'
"mcms_psi_dept2": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "rec_type": "YND", "psi_flag": -1, "psi_kind": "204", "stock_kind": "CK_SL", "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": None, "source_repl_id": None, "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": "", "patient_name": "", "machine_id": None, "machine_name": None, "his_charge_no": None, "remark": "", "tb_status": 20, "accounter": None, "account_date": None, "bill_relation_json": "{"buyBillId":"%s","pickOrderNo":"%s","buyOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "last_auditor": None, "last_audit_time": None, "reject_reason": None, "reject_user": None, "reject_time": None, "initial_order": None, "source_type": "SG", "target_coding_type": None}'
"mcms_psi_dept3": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "rec_type": "YND", "psi_flag": -1, "psi_kind": "204", "stock_kind": "CK_SL", "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": None, "source_repl_id": None, "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": "", "patient_name": "", "machine_id": None, "machine_name": None, "his_charge_no": None, "remark": "", "tb_status": 20, "accounter": None, "account_date": None, "bill_relation_json": "{"buyBillId":"%s","pickOrderNo":"%s","buyOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "last_auditor": None, "last_audit_time": None, "reject_reason": None, "reject_user": None, "reject_time": None, "initial_order": None, "source_type": "SG", "target_coding_type": None}'
\ No newline at end of file
"mcms_psi_dept3": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "rec_type": "YND", "psi_flag": -1, "psi_kind": "204", "stock_kind": "CK_SL", "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": None, "source_repl_id": None, "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": "", "patient_name": "", "machine_id": None, "machine_name": None, "his_charge_no": None, "remark": "", "tb_status": 20, "accounter": None, "account_date": None, "bill_relation_json": "{"buyBillId":"%s","pickOrderNo":"%s","buyOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "last_auditor": None, "last_audit_time": None, "reject_reason": None, "reject_user": None, "reject_time": None, "initial_order": None, "source_type": "SG", "target_coding_type": None}'
#出库单子表
"mcms_psi_dept_batch1": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "pick_detail_id": "%s", "pur_mode": 10, "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("100.00"), "unit_name": "100支/100", "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_batch2": '{"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("100.00"), "unit_name": "100支/100", "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_batch3": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "pick_detail_id": "%s", "pur_mode": 60, "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("100.00"), "unit_name": "100支/100", "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}'
\ No newline at end of file
......@@ -3,6 +3,10 @@ import sys
import os
# print('根据当前文件获取当前文件所在目录的路径', os.path.dirname(__file__))
import traceback
from air_case.public1.public1.public1 import approval_center, approval_center_all
curPath = os.path.abspath(os.path.dirname(__file__)) # 获取当前文件的所在目录的绝对路径
# print('将路径中的/换成\\', curPath) # C:\Users\Administrator\Desktop\temp\dbshop99\main
# # #将当前文件的所在目录的绝对路径进行分离,分离成 ('C:\\Users\\Administrator\\Desktop\\temp\\dbshop99', 'main'),存到元组中
......@@ -183,20 +187,33 @@ def main_text():
else:
print('Cancel')
def flow5_flow18():
flow5()
flow6()
flow7()
flow8()
flow9()
flow10()
flow11()
flow12()
flow13()
flow14()
flow15()
flow16()
flow17()
flow18()
#脚本运行前清空所有待审批数据
approval_center_all()
i=1
while True:
try:
flow5()
flow6()
flow7()
flow8()
flow9()
flow10()
flow11()
flow12()
flow13()
flow14()
flow15()
flow16()
flow17()
flow18()
except Exception as e:
print('第'+str(i)+'次脚本出现异常,请检查脚本或者数据')
# print("发生异常:", str(e))
# traceback.print_exc()
print('第'+str(i)+'次重新运行')
continue
else:
break
def flow11_flow18():
flow11()
flow12()
......
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