Commit 1505bee0 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程五脚本提交

parent e2d80585
......@@ -458,7 +458,7 @@ def check_mcms_psi_batch_in(DR_ID, type, order_no, source_id1):
batch_main_key = get_id("select id from mcms_psi_batch where pid='%s' order by create_time desc LIMIT 1;" % 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 = source_id1 + '0001'
source_detail_id = get_id("select source_detail_id from mcms_psi_batch where id='%s';" % batch_main_key)
pick_detail_id = None
if type == 1:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
......@@ -480,7 +480,7 @@ def check_mcms_psi_batch_in(DR_ID, type, order_no, source_id1):
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)
barcode_id = get_id("select barcode_id from mcms_psi_batch where id='%s';" % batch_main_key)
if check_barcode_id(barcode_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
......@@ -976,8 +976,12 @@ def check_mcms_out_balance_detail_approve_after(type=1, pid=""):
# 从文件中获取条码信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "条码信息", 'message18')
list_a = info['list_a']
bar_id = commonFuc().analysis_json('id', list_a)
bar_code = commonFuc().analysis_json('pkgCodeSee', list_a)
bar_id = get_id("select bar_id from mcms_out_balance_detail where id='%s';" % (
id))
bar_code = get_id("select bar_code from mcms_out_balance_detail where id='%s';" % (
id))
# bar_id = commonFuc().analysis_json('id', list_a)
# bar_code = commonFuc().analysis_json('pkgCodeSee', list_a)
# from_id = get_id(
# "select id from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % (hos_goods_id))
# from_order_no = get_id(
......@@ -1003,7 +1007,7 @@ def check_mcms_out_balance_detail_approve_after(type=1, pid=""):
sub_prov_name = prov_name
account_date = get_account_date1("select account_date from mcms_out_balance_detail where id='%s';" % id)
un_settle_id = get_id(
"select id from mcms_out_un_balance where branch_id='%s' and from_kind='CK_TH' and hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % (
"select id from mcms_out_un_balance where branch_id='%s' and from_kind='RK_YS' and hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, hos_goods_id))
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_out_balance_detail_1009_1', id,
......@@ -1135,36 +1139,35 @@ sys.path.append(pro_path + r'/air_case/b5_spd3_core_business_flow/a_a7流程五_
using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_a7流程五_中心库入库结算_正结算3_内网验收入库结算.air')
from a_a7流程五_中心库入库结算_正结算3_内网验收入库结算 import check_accept_order,putaway
try:
# # # 验收
# check_accept_order(3) # 试剂
# time.sleep(6)
# check_mcms_check(3)
# time.sleep(3)
# check_accept_order(2) # 高值
# time.sleep(6)
# check_mcms_check(2)
# time.sleep(3)
# check_accept_order(1) # 低值
# time.sleep(6)
# check_mcms_check(1)
# # 入库上架
# putaway()
# time.sleep(6)
# check_mcms_psi(1)
# putaway()
# time.sleep(6)
# check_mcms_psi(2)
# putaway()
# time.sleep(6)
# check_mcms_psi(3)
# time.sleep(3)
# OBD_ID = settle()# 生成结算单
# print(OBD_ID)
# time.sleep(6)
OBD_ID='OBh0347202410090005'
# check_mcms_out_balance(1, OBD_ID) # 检查审批前的结算数据
# # 验收
check_accept_order(3) # 试剂
time.sleep(6)
check_mcms_check(3)
time.sleep(3)
check_accept_order(2) # 高值
time.sleep(6)
check_mcms_check(2)
time.sleep(3)
check_accept_order(1) # 低值
time.sleep(6)
check_mcms_check(1)
# 入库上架
putaway()
time.sleep(6)
check_mcms_psi(1)
putaway()
time.sleep(6)
check_mcms_psi(2)
putaway()
time.sleep(6)
check_mcms_psi(3)
time.sleep(3)
OBD_ID = settle()# 生成结算单
print(OBD_ID)
time.sleep(6)
check_mcms_out_balance(1, OBD_ID) # 检查审批前的结算数据
# # 调用审批结算单
# approval_center(OBD_ID)
approval_center(OBD_ID)
time.sleep(6)
check_mcms_out_balance_approve_after(1, OBD_ID) # 检查审批后的结算数据
commonFuc().check_text_exist_result_text('succees', 'succees')
......
......@@ -4,6 +4,7 @@ import traceback
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from air_case.public1.public1.public1 import *
from common.dateUtils import dateUtils
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
......@@ -26,365 +27,333 @@ import time
module = "b6_spd3_core_business_flow_database_check"
def invoice():
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b5_spd3_core_business_flow', "供货关系申请2", 'message')
# print(info)
username = info['e_username']
password = commonFuc().get_business_data("b2_herp3_bs", "password1")
token, projectCode, uxid, corpId, info = login(username, password)
# print(token, projectCode, uxid, corpId, info)
# 登录获取用户id等信息,使用创建的用户登录============结束
module = "a6_mdm3_si"
# 发票录入列表查询=================================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listGoodsPage_url")
print('发票录入列表查询url', url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
request_body = commonFuc().get_business_data(module, "payload2_1_1", get_hosid(), get_branch_id())
# print('request_body',request_body)
# 发送请求
i = 1
while True:
time.sleep(6)
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
try:
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
if total == 0:
print('数据暂时未同步过来,或者内网没有生成结算单')
i = i + 1
if i >= 100:
print('600秒过去了,数据还未查询出来,调用一下内网结算函数')
settle()
approval_center()
continue
else:
break
except:
continue
# 将发票信息写入文件
data = commonFuc().analysis_json('data', result)
data1 = commonFuc().analysis_json('data', data)
list_a = []
list_b = []
list_c = []
list_a.append(data1[0])
list_b.append(data1[0])
list_c.append(data1[0])
# print('list_a', len(list_a), list_a)
info = (list_a, list_b, list_c)
titlename = ('list_a', 'list_b', 'list_c')
# 将发票信息写入文件
FileUtils().w_info8(info, module, '结算开票信息', titlename, 'message')
# 发票录入列表查询=================================================
# ===========发票暂存=======================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "saveCacheBatch_url")
print(url)
# 从文件中获取必要信息
info = FileUtils().r_info8(module, "结算开票信息", 'message')
# print('info', info)
list_a = info['list_a']
print('list_a', list_a, type(list_a), len(list_a))
pid = 'pid'
settleMonth = "settleMonth"
hosGoodsId = 'hosGoodsId'
batchCode = 'batchCode'
distrDetailId = 'distrDetailId'
distrId = 'distrId'
distrOrderNo = 'distrOrderNo'
settlePrice = 'settlePrice'
maxSettleQty = 'maxSettleQty'
maxSettleAmount = 'maxSettleAmount'
curSettleQty = 'curSettleQty'
curSettleAmount = 'curSettleAmount'
leftSettleQty = 'leftSettleQty'
leftSettleAmount = 'leftSettleAmount'
hosId = 'hosId'
provId = 'provId'
branchId = 'branchId'
balanceDetId = 'balanceDetId'
purMode = 'purMode'
barCode = 'barCode'
viewId = 'viewId'
for i in list_a:
pid = i['pid']
settleMonth = i['settleMonth']
hosGoodsId = i['hosGoodsId']
detailList = i['detailList']
for j in detailList:
batchCode = j['batchCode']
distrDetailId = j['distrDetailId']
distrId = j['distrId']
distrOrderNo = j['distrOrderNo']
settlePrice = j['settlePrice']
# maxSettleQty = j['leftSettleQty']
# maxSettleAmount = j['leftSettleAmount']
# curSettleQty = j['curSettleQty']
# curSettleAmount = j['curSettleAmount']
# leftSettleQty = j['leftSettleQty']
leftSettleAmount = j['leftSettleAmount']
hosId = j['hosId']
provId = j['provId']
branchId = j['branchId']
balanceDetId = j['balanceDetId']
purMode = j['purMode']
barCode = j['barCode']
viewId = j['viewId']
break
list2 = []
detailList = None
for i in list_a:
detailList = i['detailList']
list2 = detailList
for k in list2:
maxSettleQty = k['leftSettleQty']
maxSettleAmount = k['settlePrice']
curSettleQty = k['curSettleQty']
curSettleAmount = k['curSettleAmount']
leftSettleQty = k['leftSettleQty']
request_body = commonFuc().get_business_data(module, "payload3_1_1_1", pid, settleMonth, hosGoodsId, batchCode,
distrDetailId, distrId, distrOrderNo, settlePrice, maxSettleQty,
maxSettleAmount, curSettleQty, curSettleAmount, leftSettleQty,
leftSettleAmount, hosId,
provId,
branchId, balanceDetId, purMode, barCode, viewId)
print('request_body', request_body)
request_body_json = get_process_list(request_body)
result = commonFuc().http_post(url, request_body_json, headers)
print('发票暂存result', result)
# ===========发票暂存===============================================
# ==============发票缓存提交===========================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitCache_url")
hosVersion = 3
hosName = commonFuc().get_business_data(module, 'hosName')
invoiceQty = leftSettleQty
invoiceAmount = leftSettleAmount
invoiceDate = timeUtils().get_time_hms(5)
request_body = commonFuc().get_business_data(module, "payload3_2_2_2_1", hosName, invoiceQty, invoiceAmount,
invoiceDate, hosId, provId,hosVersion)
print('发票缓存提交request_body', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('发票缓存提交result', result)
VI_id = commonFuc().analysis_json('billIds',
commonFuc().analysis_json('data', result))
VI_id= ' '.join(VI_id)
print('VI_id',VI_id)
# ==============发票缓存提交===========================================
# ===============预开票列表查询====================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url1")
request_body = commonFuc().get_business_data(module, "payload3_3_1")
print('预开票列表查询request_body', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('预开票列表查询', 'result', result)
provName= commonFuc().analysis_json('provName',
commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)))
sumAmount= commonFuc().analysis_json('sumAmount',
commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)))
# ===============预开票列表查询====================================
# ===============预开票提交====================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "mcmsOutBalance_submitInvoice_url")
lastModified = timeUtils().get_time_hms(1)
createTime = timeUtils().get_time_hms(1)
invoiceTitle = hosName
settleMonths=settleMonth
request_body = commonFuc().get_business_data(module, "payload3_3_2", VI_id, lastModified, createTime, uxid,
get_hosid(), provId, provName, invoiceAmount, invoiceDate,
settleMonths, invoiceQty, hosName, invoiceTitle, sumAmount)
print('预开票提交request_body', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('预开票提交', 'result', result)
# ===============预开票提交====================================
# ===============发票确认列表查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url1")
request_body = commonFuc().get_business_data(module, "payload3_3")
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('发票确认列表查询result', result)
data = commonFuc().analysis_json('data', result)
data1 = commonFuc().analysis_json('data', data)
id1 = commonFuc().analysis_json('id', data1[0])
print(id1)
# ===============发票确认列表查询
# ===============发票确认
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "invoiceUpdateStatus_url")
request_body = commonFuc().get_business_data(module, "payload3_4", id1)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('发票确认result', result)
# ===============发票确认
# ==============内网发票核对============
module = "b5_spd3_core_business_flow"
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
username = info['username1']
password = commonFuc().get_business_data("b2_herp3_bs", "password")
print('username,password', username, password)
# # 获取token和projectCode
token, projectCode, uxid, corpId, info = login(username, password, 2)
# 登录获取用户id等信息,使用创建的用户登录============结束
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "mcmsInvoice_listVoPage_url")
print('url', url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
request_body = commonFuc().get_business_data(module, "payload9", timeUtils().get_time_hms(5),
timeUtils().get_time_hms(5), get_hosid(), get_hosid())
print('request_body', request_body)
# 发送请求
i = 1
while True:
time.sleep(6)
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
try:
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
if total == 0:
print('数据暂时未同步过来')
i = i + 1
if i >= 100:
print('600秒过去了,数据还未查询出来,检查一下脚本或者被测软件')
continue
else:
break
except:
continue
print('result', '内网发票核对', result)
data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
VI_id = commonFuc().analysis_json('id', data1[0])
print('VI_id', VI_id)
# ==============发票列表查询
# ==============发票核对提交
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_invoiceUpdateStatusList_url")
print('url', url)
request_body = commonFuc().get_business_data(module, "payload10", VI_id, get_hosid())
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
def check_mcms_invoice():
print('检查发票数据')
prov_id = get_prov_id()
# 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"]
sql = "select * from mcms_invoice where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % (
prov_id)
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
sql = "select id from mcms_invoice where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % (
prov_id)
id = get_id(sql)
hos_id = get_hosid()
prov_name = get_prov_name()
create_user = get_login_user_uxid_bydb(
FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username'])
# create_user = account_user_id
create_time = get_create_time("select create_time from mcms_invoice where id='%s';" % id)
last_modified = get_create_time("select last_modified from mcms_invoice where id='%s';" % id)
last_modified_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
year, month = dateUtils().get_year_month(dateUtils().get_current_time())
if month < 10:
month = "0" + str(month)
year_month = str(year) + str(month)
settle_months = year_month
invoice_date = get_account_date1("select invoice_date from mcms_invoice where id='%s';" % id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_invoice_0924', id,
hos_id, prov_id, prov_name, invoice_date, settle_months, create_user,
create_time, last_modified, last_modified_user
)
# 对比预期值和实际值是否一致z
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')
# 检查发票子表数据
check_mcms_invoice_detail(1, id)
# check_mcms_invoice_detail2(1, id)
def check_mcms_invoice_detail(type=1, pid=""):
print('检查发票子表数据')
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"]
branch_id = get_branch_id()
sql = "select * from mcms_invoice_detail where pid='%s' order by id LIMIT 1;" % (
pid)
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
sql = "select id from mcms_invoice_detail where pid='%s' order by id LIMIT 1;" % (
pid)
id = get_id(sql)
hos_id = get_hosid()
prov_id = get_prov_id()
prov_name = get_prov_name()
sub_prov_id = prov_id
settle_dept_id = None
distr_detail_id = get_id("select distr_detail_id from mcms_out_balance_detail where id='%s';" % id)
if check_distr_detail_id(distr_detail_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('success', 'success')
else:
commonFuc().check_text_exist_result_text('error', 'success')
hos_batch_id = get_id("select hos_batch_id from mcms_out_balance_detail where id='%s';" % id)
if check_batch_id(hos_batch_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('success', 'success')
else:
commonFuc().check_text_exist_result_text('error', 'success')
account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_user = get_login_user_uxid_bydb(
FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username'])
create_time = get_create_time("select create_time from mcms_invoice_detail where id='%s';" % id)
last_modified = get_create_time("select last_modified from mcms_invoice_detail where id='%s';" % id)
last_modified_user = create_user
year, month = dateUtils().get_year_month(dateUtils().get_current_time())
if month < 10:
month = "0" + str(month)
settle_month = str(year) + str(month)
hobd_id = get_id("select id from mcms_out_balance_detail where prov_id='%s' order by id desc LIMIT 1 OFFSET 1;" % (
prov_id))
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_invoice_detail_0919_1', id,
pid, hobd_id, branch_id, hos_goods_id, settle_month, create_user,
create_time, last_modified, last_modified_user, hos_id
)
# 对比预期值和实际值是否一致
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_invoice_detail2(type=1, pid=""):
print('检查发票子表数据')
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"]
branch_id = get_branch_id()
sql = "select * from mcms_invoice_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % (
pid)
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
sql = "select id from mcms_invoice_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % (
pid)
id = get_id(sql)
hos_id = get_hosid()
prov_id = get_prov_id()
prov_name = get_prov_name()
sub_prov_id = prov_id
settle_dept_id = None
distr_detail_id = get_id("select distr_detail_id from mcms_out_balance_detail where id='%s';" % id)
if check_distr_detail_id(distr_detail_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('success', 'success')
else:
commonFuc().check_text_exist_result_text('error', 'success')
hos_batch_id = get_id("select hos_batch_id from mcms_out_balance_detail where id='%s';" % id)
if check_batch_id(hos_batch_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('success', 'success')
else:
commonFuc().check_text_exist_result_text('error', 'success')
account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_user = get_login_user_uxid_bydb(
FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username'])
create_time = get_create_time("select create_time from mcms_invoice_detail where id='%s';" % id)
last_modified = get_create_time("select last_modified from mcms_invoice_detail where id='%s';" % id)
last_modified_user = create_user
year, month = dateUtils().get_year_month(dateUtils().get_current_time())
if month < 10:
month = "0" + str(month)
settle_month = str(year) + str(month)
hobd_id = get_id("select id from mcms_out_balance_detail where prov_id='%s' order by id desc LIMIT 1;" % (
prov_id))
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_invoice_detail_0919_2', id,
pid, hobd_id, branch_id, hos_goods_id, settle_month, create_user,
create_time, last_modified, last_modified_user, hos_id
)
# 对比预期值和实际值是否一致
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)
# ==============发票核对提交
# ==============内网发票核对============
# ==============内网发票提交开始
# 列表查询
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_listVoPage_url")
print('内网发票提交url', url)
request_body = commonFuc().get_business_data(module, "payload11", timeUtils().get_time_hms(5),
timeUtils().get_time_hms(5), get_hosid(), get_hosid())
print('内网发票提交request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('result', '内网发票提交列表查询结果', result)
data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result))
VI_id2='VI_id2'
if total == 0:
print('检查被测程序,发票提交列表查询数据是否正确')
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
for i in range(total):
VI_id2 = commonFuc().analysis_json('id', data1[i])
if VI_id2 == VI_id:
break
print('VI_id2', VI_id2)
# ==============发票提交,下一步归档
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_invoiceUpdateStatusList_url")
print('url', url)
request_body = commonFuc().get_business_data(module, "payload12", VI_id, get_hosid())
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('result', '发票提交,下一步归档', result)
# ==============发票提交,下一步归档
# ==============发票归档列表查询
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_listVoPage_url")
print('url', url)
request_body = commonFuc().get_business_data(module, "payload13", timeUtils().get_time_hms(5),
timeUtils().get_time_hms(5), get_hosid(), get_hosid())
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('result', '发票归档列表查询', result)
data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result))
VI_id3='VI_id3'
if total == 0:
print('检查被测程序,发票归档列表查询查询数据是否正确')
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_invoice_ext():
print('检查付款单数据')
prov_id = get_prov_id()
# 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"]
sql = "select * from mcms_invoice_ext where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % (
prov_id)
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
sql = "select id from mcms_invoice_ext where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % (
prov_id)
id = get_id(sql)
hos_id = get_hosid()
prov_name = get_prov_name()
create_user = get_login_user_uxid_bydb(
FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username'])
# create_user = account_user_id
create_time = get_create_time("select create_time from mcms_invoice_ext where id='%s';" % id)
last_modified = get_create_time("select last_modified from mcms_invoice_ext where id='%s';" % id)
last_modified_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_user = last_modified_user
year, month = dateUtils().get_year_month(dateUtils().get_current_time())
if month < 10:
month = "0" + str(month)
year_month = str(year) + str(month)
settle_months = year_month
pay_date = get_account_date1("select pay_date from mcms_invoice_ext where id='%s';" % id)
pay_user = create_user
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_invoice_ext_0924', id,
hos_id, prov_id, prov_name, pay_date, create_user,
create_time, last_modified, last_modified_user, pay_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:
for i in range(total):
VI_id3 = commonFuc().analysis_json('id', data1[i])
if VI_id3 == VI_id2:
break
print('VI_id3', VI_id3)
# ==============发票归档列表查询
# ==================发票归档提交
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_invoiceUpdateStatusList_url")
print('url', url)
request_body = commonFuc().get_business_data(module, "payload14", VI_id, get_hosid())
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('result', '发票归档提交,下一步付款', result)
# ==================发票归档提交
# ==================付款单列表查询
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_listVoPage_url")
print('url', url)
request_body = commonFuc().get_business_data(module, "payload15", get_hosid(), get_hosid())
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('result', '付款单列表查询', result)
data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result))
VI_id4='VI_id4'
if total == 0:
print('检查被测程序,发票归档列表查询查询数据是否正确')
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
# 检查子表数据
check_mcms_invoice_ext_detail(1, id)
def check_mcms_invoice_ext_detail(type=1, pid=""):
print('检查付款单子表数据')
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:
for i in range(total):
VI_id4 = commonFuc().analysis_json('id', data1[i])
if VI_id4 == VI_id3:
break
print('VI_id4', VI_id4)
# ==================付款单列表查询
# ==================付款提交
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_genPaymentBills_url")
print('url', url)
request_body = commonFuc().get_business_data(module, "payload16", VI_id, get_hosid())
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('result', '付款提交', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
if code == 0 and data == 1:
commonFuc().check_text_exist(0, result)
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
branch_id = get_branch_id()
sql = "select * from mcms_invoice_ext_detail where pid='%s';" % (
pid)
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
sql = "select id from mcms_invoice_ext_detail where pid='%s';" % (
pid)
id = get_id(sql)
hos_id = get_hosid()
prov_id = get_prov_id()
account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_user = account_user_id
create_time = get_create_time("select create_time from mcms_invoice_ext_detail where id='%s';" % id)
last_modified = get_create_time("select last_modified from mcms_invoice_ext_detail where id='%s';" % id)
last_modified_user = create_user
invoice_id = get_id("select id from mcms_invoice where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % (
prov_id))
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_invoice_ext_detail_0919_1', id,
pid, invoice_id, create_user, create_time, last_modified,
last_modified_user, hos_id
)
# 对比预期值和实际值是否一致
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:
commonFuc().check_text_exist('error', result)
# ==================付款提交
# ==============内网发票提交
# ================发票查询列表页面验证
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
# ================发票查询列表页面验证
try:
......@@ -393,6 +362,11 @@ try:
approval_center(OBH_ID)
from air_case.public1.public1.public1 import *
invoice(2,OBH_ID)
# 检查发票数据
check_mcms_invoice()
time.sleep(3)
# 检查付款单数据
check_mcms_invoice_ext()
except Exception as e:
print('脚本出现异常,请检查脚本或者数据')
print("发生异常:", str(e))
......
......@@ -452,6 +452,15 @@
"check_mcms_out_balance_1008": '{"id": "%s", "order_no": "%s", "branch_id": "%s", "hos_id": "%s", "prov_id": "%s", "prov_name": "%s", "settle_dept_id": None, "tb_status": 0, "sum_row": 2, "settle_amount": Decimal("19999.980000"), "settle_way": 0, "settle_month": "%s", "settle_start_time": %s, "settle_end_time": %s, "remark": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "check_msg": None, "settle_qty": Decimal("200.0000"), "check_user": None, "check_time": None}'
#手工采购计划入库_结算数据子表
"check_mcms_out_balance_detail_1008_1": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 10, "price": Decimal("99.999900"), "settle_qty": Decimal("-100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("-9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}'
"check_mcms_out_balance_detail_1008_1": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 10, "price": Decimal("99.999900"), "settle_qty": Decimal("100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}'
"check_mcms_out_balance_detail_1008_2": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 10, "price": Decimal("99.999900"), "settle_qty": Decimal("100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}'
\ No newline at end of file
"check_mcms_out_balance_detail_1008_2": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 10, "price": Decimal("99.999900"), "settle_qty": Decimal("100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}'
#中心库退货出库_结算数据主表_审批后
"check_mcms_out_balance_1009": '{"id": "%s", "order_no": "%s", "branch_id": "%s", "hos_id": "%s", "prov_id": "%s", "prov_name": "%s", "settle_dept_id": None, "tb_status": 20, "sum_row": 2, "settle_amount": Decimal("19999.980000"), "settle_way": 0, "settle_month": "%s", "settle_start_time": %s, "settle_end_time": %s, "remark": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "check_msg": "22", "settle_qty": Decimal("200.0000"), "check_user": "%s", "check_time": %s}'
#中心库退货出库_结算数据子表_审批后
"check_mcms_out_balance_detail_1009_1": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 11, "price": Decimal("99.999900"), "settle_qty": Decimal("100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}'
"check_mcms_out_balance_detail_1009_2": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 11, "price": Decimal("99.999900"), "settle_qty": Decimal("100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}'
\ 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