Commit 8c04cea3 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程五脚本编写

parent 3a7d6098
...@@ -26,7 +26,7 @@ import time ...@@ -26,7 +26,7 @@ import time
module = "b5_spd3_core_business_flow" module = "b5_spd3_core_business_flow"
def invoice(): def invoice(OBh_ID='OBhxxxxxxxxxxxxxxx'):
# # 登录获取用户id等信息,使用创建的用户登录===========开始 # # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b5_spd3_core_business_flow', "供货关系申请2", 'message') info = FileUtils().r_info8('b5_spd3_core_business_flow', "供货关系申请2", 'message')
# print(info) # print(info)
...@@ -44,7 +44,7 @@ def invoice(): ...@@ -44,7 +44,7 @@ def invoice():
commonFuc().get_business_data(module, "json_contentType"), token, commonFuc().get_business_data(module, "json_contentType"), token,
projectCode) projectCode)
request_body = commonFuc().get_business_data(module, "payload2_1_1", get_hosid(), get_branch_id()) request_body = commonFuc().get_business_data(module, "payload2_1_2", get_hosid(), get_branch_id(),OBh_ID)
# print('request_body',request_body) # print('request_body',request_body)
# 发送请求 # 发送请求
...@@ -71,6 +71,8 @@ def invoice(): ...@@ -71,6 +71,8 @@ def invoice():
# 将发票信息写入文件 # 将发票信息写入文件
data = commonFuc().analysis_json('data', result) data = commonFuc().analysis_json('data', result)
totalInfo = commonFuc().analysis_json('totalInfo', result)
print('totalInfo', totalInfo)
data1 = commonFuc().analysis_json('data', data) data1 = commonFuc().analysis_json('data', data)
list_a = [] list_a = []
list_b = [] list_b = []
...@@ -85,92 +87,95 @@ def invoice(): ...@@ -85,92 +87,95 @@ def invoice():
FileUtils().w_info8(info, module, '结算开票信息', titlename, 'message') FileUtils().w_info8(info, module, '结算开票信息', titlename, 'message')
# 发票录入列表查询================================================= # 发票录入列表查询=================================================
# ===========发票暂存======================================= # ===========发票暂存=======================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "saveCacheBatch_url") # url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "saveCacheBatch_url")
print(url) # print(url)
# 从文件中获取必要信息 # # 从文件中获取必要信息
info = FileUtils().r_info8(module, "结算开票信息", 'message') # info = FileUtils().r_info8(module, "结算开票信息", 'message')
# print('info', info) # # print('info', info)
list_a = info['list_a'] # list_a = info['list_a']
print('list_a', list_a, type(list_a), len(list_a)) # print('list_a', list_a, type(list_a), len(list_a))
pid = 'pid' # pid = 'pid'
settleMonth = "settleMonth" # settleMonth = "settleMonth"
hosGoodsId = 'hosGoodsId' # hosGoodsId = 'hosGoodsId'
batchCode = 'batchCode' # batchCode = 'batchCode'
distrDetailId = 'distrDetailId' # distrDetailId = 'distrDetailId'
distrId = 'distrId' # distrId = 'distrId'
distrOrderNo = 'distrOrderNo'; # distrOrderNo = 'distrOrderNo';
settlePrice = 'settlePrice'; # settlePrice = 'settlePrice';
maxSettleQty = 'maxSettleQty' # maxSettleQty = 'maxSettleQty'
maxSettleAmount = 'maxSettleAmount'; # maxSettleAmount = 'maxSettleAmount';
curSettleQty = 'curSettleQty'; # curSettleQty = 'curSettleQty';
curSettleAmount = 'curSettleAmount' # curSettleAmount = 'curSettleAmount'
leftSettleQty = 'leftSettleQty'; # leftSettleQty = 'leftSettleQty';
leftSettleAmount = 'leftSettleAmount'; # leftSettleAmount = 'leftSettleAmount';
hosId = 'hosId'; # hosId = 'hosId';
provId = 'provId' # provId = 'provId'
branchId = 'branchId'; # branchId = 'branchId';
balanceDetId = 'balanceDetId'; # balanceDetId = 'balanceDetId';
purMode = 'purMode'; # purMode = 'purMode';
barCode = 'barCode'; # barCode = 'barCode';
viewId = 'viewId' # viewId = 'viewId'
for i in list_a: # for i in list_a:
pid = i['pid'] # pid = i['pid']
settleMonth = i['settleMonth'] # settleMonth = i['settleMonth']
hosGoodsId = i['hosGoodsId'] # hosGoodsId = i['hosGoodsId']
detailList = i['detailList'] # detailList = i['detailList']
for j in detailList: # for j in detailList:
batchCode = j['batchCode'] # batchCode = j['batchCode']
distrDetailId = j['distrDetailId'] # distrDetailId = j['distrDetailId']
distrId = j['distrId'] # distrId = j['distrId']
distrOrderNo = j['distrOrderNo'] # distrOrderNo = j['distrOrderNo']
settlePrice = j['settlePrice'] # settlePrice = j['settlePrice']
# maxSettleQty = j['leftSettleQty'] # # maxSettleQty = j['leftSettleQty']
# maxSettleAmount = j['leftSettleAmount'] # # maxSettleAmount = j['leftSettleAmount']
# curSettleQty = j['curSettleQty'] # # curSettleQty = j['curSettleQty']
# curSettleAmount = j['curSettleAmount'] # # curSettleAmount = j['curSettleAmount']
# leftSettleQty = j['leftSettleQty'] # # leftSettleQty = j['leftSettleQty']
leftSettleAmount = j['leftSettleAmount'] # leftSettleAmount = j['leftSettleAmount']
hosId = j['hosId'] # hosId = j['hosId']
provId = j['provId'] # provId = j['provId']
branchId = j['branchId'] # branchId = j['branchId']
balanceDetId = j['balanceDetId'] # balanceDetId = j['balanceDetId']
purMode = j['purMode'] # purMode = j['purMode']
barCode = j['barCode'] # barCode = j['barCode']
viewId = j['viewId'] # viewId = j['viewId']
break # break
list2 = [] # list2 = []
detailList = None # detailList = None
for i in list_a: # for i in list_a:
detailList = i['detailList'] # detailList = i['detailList']
list2 = detailList # list2 = detailList
for k in list2: # for k in list2:
maxSettleQty = k['leftSettleQty'] # maxSettleQty = k['leftSettleQty']
maxSettleAmount = k['settlePrice'] # maxSettleAmount = k['settlePrice']
curSettleQty = k['curSettleQty'] # curSettleQty = k['curSettleQty']
curSettleAmount = k['curSettleAmount'] # curSettleAmount = k['curSettleAmount']
leftSettleQty = k['leftSettleQty'] # leftSettleQty = k['leftSettleQty']
#
request_body = commonFuc().get_business_data(module, "payload3_1_1_1", pid, settleMonth, hosGoodsId, batchCode, # request_body = commonFuc().get_business_data(module, "payload3_1_1_1", pid, settleMonth, hosGoodsId, batchCode,
distrDetailId, distrId, distrOrderNo, settlePrice, maxSettleQty, # distrDetailId, distrId, distrOrderNo, settlePrice, maxSettleQty,
maxSettleAmount, curSettleQty, curSettleAmount, leftSettleQty, # maxSettleAmount, curSettleQty, curSettleAmount, leftSettleQty,
leftSettleAmount, hosId, # leftSettleAmount, hosId,
provId, # provId,
branchId, balanceDetId, purMode, barCode, viewId) # branchId, balanceDetId, purMode, barCode, viewId)
print('request_body', request_body) # print('request_body', request_body)
#
request_body_json = get_process_list(request_body) # request_body_json = get_process_list(request_body)
result = commonFuc().http_post(url, request_body_json, headers) # result = commonFuc().http_post(url, request_body_json, headers)
print('result', result) # print('result', result)
SaveCacheBatch2(headers)
leftSettleQty = commonFuc().analysis_json('totalQty', totalInfo)
maxSettleAmount = commonFuc().analysis_json('totalAmount', totalInfo)
# ===========发票暂存=============================================== # ===========发票暂存===============================================
# ==============发票提交=========================================== # ==============发票提交===========================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitCache_url") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitCache_url")
hosVersion = 3 hosVersion = 3
hosName = commonFuc().get_business_data(module, 'hosName') hosName = commonFuc().get_business_data(module, 'hosName')
invoiceQty = leftSettleQty invoiceQty = leftSettleQty
invoiceAmount = leftSettleAmount invoiceAmount = maxSettleAmount
invoiceDate = timeUtils().get_time_hms(5) invoiceDate = timeUtils().get_time_hms(5)
request_body = commonFuc().get_business_data(module, "payload3_2_2_2", hosName, invoiceQty, invoiceAmount, request_body = commonFuc().get_business_data(module, "payload3_2_2_2", hosName, invoiceQty, invoiceAmount,
invoiceDate, hosId, hosVersion) invoiceDate, get_hosid(), hosVersion)
print('request_body', request_body) print('request_body', request_body)
# 发送请求 # 发送请求
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
...@@ -352,9 +357,9 @@ def invoice(): ...@@ -352,9 +357,9 @@ def invoice():
try: try:
settle() OBD_ID=settle()
# 调用审批结算单 # 调用审批结算单
approval_center() approval_center(OBD_ID)
invoice() invoice()
except Exception as e: except Exception as e:
print('脚本出现异常,请检查脚本或者数据') print('脚本出现异常,请检查脚本或者数据')
......
...@@ -33,7 +33,7 @@ def get_hosid(): ...@@ -33,7 +33,7 @@ def get_hosid():
return hosId return hosId
def approval_center(OBH_ID='OBh0347202404280009'): def approval_center(OBH_ID='OBhxxxxxxxxxxxxxxx'):
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始 # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3') info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
...@@ -55,7 +55,7 @@ def approval_center(OBH_ID='OBh0347202404280009'): ...@@ -55,7 +55,7 @@ def approval_center(OBH_ID='OBh0347202404280009'):
commonFuc().get_business_data(module, "X-APP-CODE")) commonFuc().get_business_data(module, "X-APP-CODE"))
# 请求体 # 请求体
request_body = commonFuc().get_business_data(module, "payload50_6_1_2",OBH_ID) request_body = commonFuc().get_business_data(module, "payload50_6_1_2", OBH_ID)
print(request_body) print(request_body)
# # # 发送请求 # # # 发送请求
...@@ -63,7 +63,7 @@ def approval_center(OBH_ID='OBh0347202404280009'): ...@@ -63,7 +63,7 @@ def approval_center(OBH_ID='OBh0347202404280009'):
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result) print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
data = commonFuc().analysis_json('data', result) data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', result) total = commonFuc().analysis_json('total', result)
if total==0: if total == 0:
request_body = commonFuc().get_business_data(module, "payload50_6") request_body = commonFuc().get_business_data(module, "payload50_6")
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
...@@ -136,8 +136,8 @@ def settle(): # 结算相关 ...@@ -136,8 +136,8 @@ def settle(): # 结算相关
print(url) print(url)
branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"] branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
hosId = branch_id[0:5] hosId = branch_id[0:5]
provId = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2','message')["e_corpId"] provId = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"]
request_body = commonFuc().get_business_data(module, "payload7",provId,hosId,hosId) request_body = commonFuc().get_business_data(module, "payload7", provId, hosId, hosId)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result', result) print('result', result)
data = commonFuc().analysis_json('data', result) data = commonFuc().analysis_json('data', result)
...@@ -159,7 +159,7 @@ def settle(): # 结算相关 ...@@ -159,7 +159,7 @@ def settle(): # 结算相关
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result', result) print('result', result)
# ================== 生成结算单============================== # ================== 生成结算单==============================
#===================结算单查询返回结算单号==================== # ===================结算单查询返回结算单号====================
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_mcmsOutBalance_listVoPage_url") "herpService_mcmsOutBalance_listVoPage_url")
print(url) print(url)
...@@ -167,13 +167,13 @@ def settle(): # 结算相关 ...@@ -167,13 +167,13 @@ def settle(): # 结算相关
print('request_body', request_body) print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
# print('result', result) # print('result', result)
data1=commonFuc().analysis_json('data',commonFuc().analysis_json('data',result)) data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
print('data1',data1[0]) print('data1', data1[0])
return commonFuc().analysis_json('id',data1[0]) return commonFuc().analysis_json('id', data1[0])
#==================结算单查询返回结算单号==================== # ==================结算单查询返回结算单号====================
def get_stockId(name, type=1): def get_stockId(name, type=1): # 获取仓库id参数是库房名称
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 内网登录 # 内网登录
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
...@@ -287,7 +287,7 @@ def dept_query_all(): # 科室查询,将科室id写入文件中 ...@@ -287,7 +287,7 @@ def dept_query_all(): # 科室查询,将科室id写入文件中
FileUtils().w_info8(info1, module, '所有科室name', titlename, 'message6') FileUtils().w_info8(info1, module, '所有科室name', titlename, 'message6')
def get_stockAreaId(dept_id, stockId): def get_stockAreaId(dept_id, stockId): # 获取库区id,参数是部门id和仓库id
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 内网登录 # 内网登录
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
...@@ -327,7 +327,7 @@ def get_stockAreaId(dept_id, stockId): ...@@ -327,7 +327,7 @@ def get_stockAreaId(dept_id, stockId):
for i in data1: for i in data1:
shelfName = commonFuc().analysis_json('shelfName', i) shelfName = commonFuc().analysis_json('shelfName', i)
print(shelfName) print(shelfName)
if shelfName == '默认库区': if shelfName == '默认库区' or shelfName == '自动化测试':
import time import time
# time.sleep(60) # time.sleep(60)
print(shelfName, 'ccccccccccccccccccccccccccc') print(shelfName, 'ccccccccccccccccccccccccccc')
...@@ -477,7 +477,9 @@ def get_udi(type=1): ...@@ -477,7 +477,9 @@ def get_udi(type=1):
titlename = ('list_a', 'list_b', 'list_c') titlename = ('list_a', 'list_b', 'list_c')
# 将条码信息写入文件 # 将条码信息写入文件
FileUtils().w_info8(info, module, '条码信息', titlename, 'message18') FileUtils().w_info8(info, module, '条码信息', titlename, 'message18')
def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
def invoice(type=1, OBh_ID='OBhxxxxxxxxxxxxxxx'):
# # 登录获取用户id等信息,使用创建的用户登录===========开始 # # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b5_spd3_core_business_flow', "供货关系申请2", 'message') info = FileUtils().r_info8('b5_spd3_core_business_flow', "供货关系申请2", 'message')
# print(info) # print(info)
...@@ -489,21 +491,21 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -489,21 +491,21 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
module = "a6_mdm3_si" module = "a6_mdm3_si"
# 发票录入列表查询================================================= # 发票录入列表查询=================================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listGoodsPage_url") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listGoodsPage_url")
print('发票录入列表查询url',url) print('发票录入列表查询url', url)
# 获取请求头信息 # 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2", headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token, commonFuc().get_business_data(module, "json_contentType"), token,
projectCode) projectCode)
if type==1: if type == 1:
request_body = commonFuc().get_business_data(module, "payload2_1_1", get_hosid(), get_branch_id()) request_body = commonFuc().get_business_data(module, "payload2_1_1", get_hosid(), get_branch_id())
elif type==2: elif type == 2:
request_body = commonFuc().get_business_data(module, "payload2_1_2", get_hosid(), get_branch_id(),OBh_ID) request_body = commonFuc().get_business_data(module, "payload2_1_2", get_hosid(), get_branch_id(), OBh_ID)
else: else:
request_body = commonFuc().get_business_data(module, "payload2_1_1", get_hosid(), get_branch_id()) request_body = commonFuc().get_business_data(module, "payload2_1_2", get_hosid(), get_branch_id(), OBh_ID)
print('request_body_发票录入列表查询',request_body) print('request_body_发票录入列表查询', request_body)
# 发送请求 # 发送请求
i=1 i = 1
while True: while True:
time.sleep(6) time.sleep(6)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
...@@ -511,9 +513,9 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -511,9 +513,9 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
try: try:
data = commonFuc().analysis_json('data', result) data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data) total = commonFuc().analysis_json('total', data)
if total==0: if total == 0:
print('数据暂时未同步过来,或者内网没有生成结算单') print('数据暂时未同步过来,或者内网没有生成结算单')
i=i+1 i = i + 1
if i >= 100: if i >= 100:
print('600秒过去了,数据还未查询出来,调用一下内网结算函数') print('600秒过去了,数据还未查询出来,调用一下内网结算函数')
settle() settle()
...@@ -526,6 +528,8 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -526,6 +528,8 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
# 将发票信息写入文件 # 将发票信息写入文件
data = commonFuc().analysis_json('data', result) data = commonFuc().analysis_json('data', result)
totalInfo = commonFuc().analysis_json('totalInfo', result)
print('totalInfo', totalInfo)
data1 = commonFuc().analysis_json('data', data) data1 = commonFuc().analysis_json('data', data)
list_a = [] list_a = []
list_b = [] list_b = []
...@@ -540,89 +544,98 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -540,89 +544,98 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
FileUtils().w_info8(info, module, '结算开票信息', titlename, 'message') FileUtils().w_info8(info, module, '结算开票信息', titlename, 'message')
# 发票录入列表查询================================================= # 发票录入列表查询=================================================
# ===========发票暂存======================================= # ===========发票暂存=======================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "saveCacheBatch_url") if type == 2:
print(url) leftSettleQty, maxSettleAmount = SaveCacheBatch(headers)
# 从文件中获取必要信息 elif type == 3: # 需要暂存2条结算数据
info = FileUtils().r_info8(module, "结算开票信息", 'message') SaveCacheBatch2(headers)
# print('info', info) leftSettleQty = commonFuc().analysis_json('totalQty', totalInfo)
list_a = info['list_a'] maxSettleAmount = commonFuc().analysis_json('totalAmount', totalInfo)
# print('list_a', list_a,type(list_a),len(list_a)) else:
pid='pid' leftSettleQty, maxSettleAmount = SaveCacheBatch(headers)
settleMonth = "settleMonth" # url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "saveCacheBatch_url")
hosGoodsId = 'hosGoodsId' # print(url)
batchCode = 'batchCode' # # 从文件中获取必要信息
distrDetailId = 'distrDetailId' # info = FileUtils().r_info8(module, "结算开票信息", 'message')
distrId='distrId' # # print('info', info)
distrOrderNo='distrOrderNo';settlePrice='settlePrice';maxSettleQty='maxSettleQty' # list_a = info['list_a']
maxSettleAmount='maxSettleAmount';curSettleQty='curSettleQty';curSettleAmount='curSettleAmount' # # print('list_a', list_a,type(list_a),len(list_a))
leftSettleQty='leftSettleQty';leftSettleAmount='leftSettleAmount';hosId='hosId';provId='provId' # pid='pid'
branchId='branchId'; balanceDetId='balanceDetId'; purMode='purMode';barCode='barCode';viewId='viewId' # settleMonth = "settleMonth"
for i in list_a: # hosGoodsId = 'hosGoodsId'
pid = i['pid'] # batchCode = 'batchCode'
settleMonth = i['settleMonth'] # distrDetailId = 'distrDetailId'
hosGoodsId = i['hosGoodsId'] # distrId='distrId'
detailList = i['detailList'] # distrOrderNo='distrOrderNo';settlePrice='settlePrice';maxSettleQty='maxSettleQty'
for j in detailList: # maxSettleAmount='maxSettleAmount';curSettleQty='curSettleQty';curSettleAmount='curSettleAmount'
batchCode = j['batchCode'] # leftSettleQty='leftSettleQty';leftSettleAmount='leftSettleAmount';hosId='hosId';provId='provId'
distrDetailId=j['distrDetailId'] # branchId='branchId'; balanceDetId='balanceDetId'; purMode='purMode';barCode='barCode';viewId='viewId'
distrId = j['distrId']
distrOrderNo = j['distrOrderNo']
settlePrice = j['settlePrice']
maxSettleQty = j['maxSettleQty']
maxSettleAmount = j['maxSettleAmount']
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: # for i in list_a:
# pid = i['pid']
# settleMonth = i['settleMonth']
# hosGoodsId = i['hosGoodsId']
# detailList = i['detailList'] # detailList = i['detailList']
# break # for j in detailList:
# list2=detailList # batchCode = j['batchCode']
# for k in list2: # distrDetailId=j['distrDetailId']
# maxSettleQty = k['leftSettleQty'] # distrId = j['distrId']
# maxSettleAmount = k['settlePrice'] # distrOrderNo = j['distrOrderNo']
# curSettleQty = k['curSettleQty'] # settlePrice = j['settlePrice']
# curSettleAmount = k['curSettleAmount'] # maxSettleQty = j['maxSettleQty']
# leftSettleQty = k['leftSettleQty'] # maxSettleAmount = j['maxSettleAmount']
# curSettleQty = j['curSettleQty']
request_body = commonFuc().get_business_data(module, "payload3_1_1_1", pid, settleMonth, hosGoodsId, batchCode, # curSettleAmount = j['curSettleAmount']
distrDetailId, distrId, distrOrderNo, settlePrice, maxSettleQty, # leftSettleQty = j['leftSettleQty']
maxSettleAmount, curSettleQty, curSettleAmount, leftSettleQty,leftSettleAmount, hosId, # leftSettleAmount = j['leftSettleAmount']
provId, # hosId = j['hosId']
branchId, balanceDetId,purMode, barCode,viewId) # provId = j['provId']
print('request_body', request_body) # branchId = j['branchId']
request_body_json=get_process_list(request_body) # balanceDetId = j['balanceDetId']
result = commonFuc().http_post(url, request_body_json, headers) # purMode = j['purMode']
print('result',result) # barCode = j['barCode']
# viewId=j['viewId']
# break
# # list2=[]
# # detailList=None
# # for i in list_a:
# # detailList = i['detailList']
# # break
# # 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") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitCache_url")
print('发票提交',url) print('发票提交', url)
hosVersion=3 hosVersion = 3
hosName=commonFuc().get_business_data(module,'hosName') hosName = commonFuc().get_business_data(module, 'hosName')
invoiceQty=leftSettleQty invoiceQty = leftSettleQty
invoiceAmount=maxSettleAmount invoiceAmount = maxSettleAmount
invoiceDate=timeUtils().get_time_hms(5) invoiceDate = timeUtils().get_time_hms(5)
request_body = commonFuc().get_business_data(module, "payload3_2_2_2",hosName,invoiceQty,invoiceAmount,invoiceDate,hosId,hosVersion) request_body = commonFuc().get_business_data(module, "payload3_2_2_2", hosName, invoiceQty, invoiceAmount,
print('发票提交request_body',request_body) invoiceDate, get_hosid(), hosVersion)
print('发票提交request_body', request_body)
# 发送请求 # 发送请求
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('发票提交',result) print('发票提交', result)
time.sleep(3) time.sleep(3)
print('result', result) print('result', result)
#==============发票提交=========================================== # ==============发票提交===========================================
#===============发票确认列表查询 # ===============发票确认列表查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url1") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url1")
request_body = commonFuc().get_business_data(module, "payload3_3") request_body = commonFuc().get_business_data(module, "payload3_3")
...@@ -630,12 +643,12 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -630,12 +643,12 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
# 发送请求 # 发送请求
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result', result) print('result', result)
data=commonFuc().analysis_json('data', result) data = commonFuc().analysis_json('data', result)
data1=commonFuc().analysis_json('data', data) data1 = commonFuc().analysis_json('data', data)
id1 = commonFuc().analysis_json('id', data1[0]) id1 = commonFuc().analysis_json('id', data1[0])
print(id1) print(id1)
#===============发票确认列表查询 # ===============发票确认列表查询
#===============发票确认 # ===============发票确认
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "invoiceUpdateStatus_url") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "invoiceUpdateStatus_url")
request_body = commonFuc().get_business_data(module, "payload3_4", id1) request_body = commonFuc().get_business_data(module, "payload3_4", id1)
...@@ -643,8 +656,8 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -643,8 +656,8 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
# 发送请求 # 发送请求
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result', result) print('result', result)
#===============发票确认 # ===============发票确认
#==============内网发票核对============ # ==============内网发票核对============
module = "b5_spd3_core_business_flow" module = "b5_spd3_core_business_flow"
# # 登录获取用户id等信息,使用创建的用户登录===========开始 # # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3') info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
...@@ -652,16 +665,17 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -652,16 +665,17 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
password = commonFuc().get_business_data("b2_herp3_bs", "password") password = commonFuc().get_business_data("b2_herp3_bs", "password")
print('username,password', username, password) print('username,password', username, password)
# # 获取token和projectCode # # 获取token和projectCode
token, projectCode, uxid, corpId, info = login(username, password,2) token, projectCode, uxid, corpId, info = login(username, password, 2)
# 登录获取用户id等信息,使用创建的用户登录============结束 # 登录获取用户id等信息,使用创建的用户登录============结束
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "mcmsInvoice_listVoPage_url") url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "mcmsInvoice_listVoPage_url")
print('url',url) print('url', url)
# 获取请求头信息 # 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2", headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token, commonFuc().get_business_data(module, "json_contentType"), token,
projectCode) projectCode)
request_body = commonFuc().get_business_data(module, "payload9", timeUtils.get_time_hms(5),timeUtils.get_time_hms(5),get_hosid(),get_hosid()) request_body = commonFuc().get_business_data(module, "payload9", timeUtils.get_time_hms(5),
print('request_body',request_body) timeUtils.get_time_hms(5), get_hosid(), get_hosid())
print('request_body', request_body)
# 发送请求 # 发送请求
i = 1 i = 1
while True: while True:
...@@ -682,37 +696,39 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -682,37 +696,39 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
except: except:
continue continue
print('result','内网发票核对', result) print('result', '内网发票核对', result)
data1=commonFuc().analysis_json('data',commonFuc().analysis_json('data',result)) data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
VI_id=commonFuc().analysis_json('id',data1[0]) VI_id = commonFuc().analysis_json('id', data1[0])
print('VI_id',VI_id) print('VI_id', VI_id)
#==============发票列表查询 # ==============发票列表查询
#==============发票核对提交 # ==============发票核对提交
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "mcmsInvoice_invoiceUpdateStatusList_url") url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_invoiceUpdateStatusList_url")
print('url', url) print('url', url)
request_body = commonFuc().get_business_data(module, "payload10",VI_id,get_hosid()) request_body = commonFuc().get_business_data(module, "payload10", VI_id, get_hosid())
print('request_body', request_body) print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result',result) print('result', result)
# ==============发票核对提交 # ==============发票核对提交
#==============内网发票核对============ # ==============内网发票核对============
#==============内网发票提交开始 # ==============内网发票提交开始
#列表查询 # 列表查询
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_listVoPage_url") "mcmsInvoice_listVoPage_url")
print('url', 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()) 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) print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result','内网发票提交列表查询结果', result) print('result', '内网发票提交列表查询结果', result)
data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)) data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
total=commonFuc().analysis_json('total', commonFuc().analysis_json('data', result)) total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result))
if total==0: if total == 0:
print('检查被测程序,发票提交列表查询数据是否正确') print('检查被测程序,发票提交列表查询数据是否正确')
else: else:
for i in range(total): for i in range(total):
VI_id2 = commonFuc().analysis_json('id', data1[i]) VI_id2 = commonFuc().analysis_json('id', data1[i])
if VI_id2==VI_id: if VI_id2 == VI_id:
break break
print('VI_id2', VI_id2) print('VI_id2', VI_id2)
# ==============发票提交,下一步归档 # ==============发票提交,下一步归档
...@@ -722,9 +738,9 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -722,9 +738,9 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
request_body = commonFuc().get_business_data(module, "payload12", VI_id, get_hosid()) request_body = commonFuc().get_business_data(module, "payload12", VI_id, get_hosid())
print('request_body', request_body) print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result','发票提交,下一步归档', result) print('result', '发票提交,下一步归档', result)
# ==============发票提交,下一步归档 # ==============发票提交,下一步归档
#==============发票归档列表查询 # ==============发票归档列表查询
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_listVoPage_url") "mcmsInvoice_listVoPage_url")
print('url', url) print('url', url)
...@@ -744,7 +760,7 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -744,7 +760,7 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
break break
print('VI_id3', VI_id3) print('VI_id3', VI_id3)
# ==============发票归档列表查询 # ==============发票归档列表查询
#==================发票归档提交 # ==================发票归档提交
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_invoiceUpdateStatusList_url") "mcmsInvoice_invoiceUpdateStatusList_url")
print('url', url) print('url', url)
...@@ -752,8 +768,8 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -752,8 +768,8 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
print('request_body', request_body) print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result', '发票归档提交,下一步付款', result) print('result', '发票归档提交,下一步付款', result)
#==================发票归档提交 # ==================发票归档提交
#==================付款单列表查询 # ==================付款单列表查询
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_listVoPage_url") "mcmsInvoice_listVoPage_url")
print('url', url) print('url', url)
...@@ -771,7 +787,7 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -771,7 +787,7 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
if VI_id4 == VI_id3: if VI_id4 == VI_id3:
break break
print('VI_id4', VI_id4) print('VI_id4', VI_id4)
#==================付款单列表查询 # ==================付款单列表查询
# ==================付款提交 # ==================付款提交
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"mcmsInvoice_genPaymentBills_url") "mcmsInvoice_genPaymentBills_url")
...@@ -783,12 +799,698 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -783,12 +799,698 @@ def invoice(type=1,OBh_ID='OBhxxxxxxxxxxxxxxx'):
# 断言 # 断言
code = commonFuc().analysis_json('code', result) code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result) data = commonFuc().analysis_json('data', result)
if code == 0 and data== 1: if code == 0 and data == 1:
commonFuc().check_text_exist(0, result) commonFuc().check_text_exist(0, result)
else: else:
commonFuc().check_text_exist('error', result) commonFuc().check_text_exist('error', result)
# ==================付款提交 # ==================付款提交
# ==============内网发票提交 # ==============内网发票提交
#================发票查询列表页面验证 # ================发票查询列表页面验证
# ================发票查询列表页面验证
def SaveCacheBatch(headers):
module = "a6_mdm3_si"
# 获取请求头信息
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['maxSettleQty']
maxSettleAmount = j['maxSettleAmount']
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']
# break
# 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)
return leftSettleQty, maxSettleAmount
def SaveCacheBatch2(headers):
module = "a6_mdm3_si"
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)
# 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['maxSettleQty']
maxSettleAmount = j['maxSettleAmount']
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
for i in list_a:
pid2 = i['pid']
settleMonth2 = i['settleMonth']
hosGoodsId2 = i['hosGoodsId']
detailList2 = i['detailList']
for j in detailList2:
batchCode2 = j['batchCode']
distrDetailId2 = j['distrDetailId']
distrId2 = j['distrId']
distrOrderNo2 = j['distrOrderNo']
settlePrice2 = j['settlePrice']
maxSettleQty2 = j['maxSettleQty']
maxSettleAmount2 = j['maxSettleAmount']
curSettleQty2 = j['curSettleQty']
curSettleAmount2 = j['curSettleAmount']
leftSettleQty2 = j['leftSettleQty']
leftSettleAmount2 = j['leftSettleAmount']
hosId2 = j['hosId']
provId2 = j['provId']
branchId2 = j['branchId']
balanceDetId2 = j['balanceDetId']
purMode2 = j['purMode']
barCode2 = j['barCode']
viewId2 = j['viewId']
break
# list2=[]
# detailList=None
# for i in list_a:
# detailList = i['detailList']
# break
# list2=detailList
# for k in list2:
# maxSettleQty = k['leftSettleQty']
# maxSettleAmount = k['settlePrice']
# curSettleQty = k['curSettleQty']
# curSettleAmount = k['curSettleAmount']
# leftSettleQty = k['leftSettleQty']
request_body1 = commonFuc().get_business_data(module, "payload3_1_1_2", pid, settleMonth, hosGoodsId, batchCode,
distrDetailId, distrId, distrOrderNo, settlePrice, maxSettleQty,
maxSettleAmount, curSettleQty, curSettleAmount, leftSettleQty,
leftSettleAmount, hosId,
provId,
branchId, balanceDetId, purMode, barCode, viewId)
request_body2 = commonFuc().get_business_data(module, "payload3_1_1_2", pid2, settleMonth2, hosGoodsId2, batchCode2,
distrDetailId2, distrId2, distrOrderNo2, settlePrice2, maxSettleQty2,
maxSettleAmount2, curSettleQty2, curSettleAmount2, leftSettleQty2,
leftSettleAmount2, hosId2,
provId2,
branchId2, balanceDetId2, purMode2, barCode2, viewId2)
# print('request_body1', request_body1,request_body1)
# print('request_body2', request_body2, request_body2)
request_body3 = str(request_body1) + ',' + str(request_body2)
request_body4 = get_process_list(request_body3)
print('request_body4', request_body4)
result = commonFuc().http_post(url, request_body4, headers)
print('result', result)
def set_dept_lead(): # 设置科室负责人
module = 'b2_herp3_bs'
username = FileUtils().r_info8(module, '用户名信息', 'message3')["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()
# print( token,projectCode,uxid,corpId,info)
# print(list_id)
# for i in list_id:
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "deptProcOrder_update__url")
# url=url+userid
print(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"))
dept2_id = FileUtils().r_info8(module, '所有科室id', 'message6')["deptid2"]
# 请求体
request_body = commonFuc().get_business_data(module, "payload61_5", uxid, dept2_id)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
data1 = commonFuc().analysis_json('data', data)
cname = commonFuc().analysis_json('cname', data1)
# print(len(data1))
if code == 0 and data == 1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
def getUserOnlineLoginWithMgrRange(dept_id): # 切换权限
module = 'b2_herp3_bs'
username = FileUtils().r_info8(module, '用户名信息', 'message3')["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()
module = 'b5_spd3_core_business_flow'
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"platformService_getUserOnlineLoginWithMgrRange_url")
# url=url+userid
print(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('b5_spd3_core_business_flow', "payload23", corpId, dept_id, uxid)
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
def updateUserLoginDefaultRange(roleid):
module = 'b2_herp3_bs'
username = FileUtils().r_info8(module, '用户名信息', 'message3')["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()
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"platformService_updateUserLoginDefaultRange_url")
url = url + roleid
print(url)
result = commonFuc().http_get(url, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
def get_listUserMgrRangePage(type=1): # 查询权限id
module = 'b2_herp3_bs'
username = FileUtils().r_info8(module, '用户名信息', 'message3')["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()
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"platformService_listUserMgrRangePage_url")
request_body = commonFuc().get_business_data('b2_herp3_bs', "payload66", uxid)
result = commonFuc().http_post(url, request_body, headers)
data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
if type == 1:
return commonFuc().analysis_json('id', data1[1])
elif type == 2:
return commonFuc().analysis_json('id', data1[0])
def get_stockAreaId_new(dept_id, deptName, type=1):
module = "b2_herp3_bs"
username = FileUtils().r_info8(module, '用户名信息', 'message3')["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()
stockId = 'stockId'
# 获取库房id========= 开始====
if type == 1:
# 中心库房名称
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId = get_stockId(branch_name + '中心库房')
# 二级库房名称
elif type == 2:
stockId = get_stockId(deptName + '库房', 2)
print(stockId)
elif type == 3:
stockId = get_stockId(deptName + '库房', 3)
print(stockId)
# 获取库房id==========结束============
# ====获取库区id===== 开始==========
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockShelf_page_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, "payload62_4", dept_id, stockId)
print('request_body查询库区id', request_body)
result = commonFuc().http_post(url, request_body, headers)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
data1 = commonFuc().analysis_json('data', data)
if code == 0 and len(data) >= 1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
# 增加一段返回库区name
shelfCode = "shelfCode"
for i in data1:
shelfName = commonFuc().analysis_json('shelfName', i)
print(shelfName)
if shelfName == '默认库区' or shelfName == '自动化测试':
import time
id1 = commonFuc().analysis_json('id', i)
shelfCode = commonFuc().analysis_json('shelfCode', i)
areaName = commonFuc().analysis_json('shelfName', i)
return shelfCode
def herpService_mcmsDeptGoodsInfo_getByProvIdPage(): # 高值跟台获取产品信息
module = "b5_spd3_core_business_flow"
username = FileUtils().r_info8('b2_herp3_bs', '用户名信息', 'message3')["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()
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_mcmsDeptGoodsInfo_getByProvIdPage_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"))
# 请求体
provId = FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_corpId']
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload25", GoodsId, provId)
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 写入文件中
data = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
list_a = []
list_b = []
list_c = []
list_a.append(data)
list_b.append(data)
list_c.append(data)
info = (list_a, list_b, list_c)
titlename = ('list_a', 'list_b', 'list_c')
# 将条码信息写入文件
FileUtils().w_info8(info, module, '产品信息', titlename, 'message19')
#================发票查询列表页面验证
def height_value_order_dp(orderno, type=2): # 高值跟台配送
# # 登录获取用户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")
# username = '001f90380'
# password='1qaz!QAZ'
print('username,password', username, password)
# # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# # 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束
# =========================查询待确认订单======================
module = "b5_spd3_core_business_flow"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "purchase_page_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
hos_id = branch_id[0:5]
exeProvId = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"]
if type == 1:
orderNo1 = FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号', 'message7')["orderNo1"]
print(orderNo1)
elif type == 2:
orderNo1 = orderno
print(orderNo1)
elif type == 3:
orderNo1 = FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号试剂', 'message12')["orderNo1"]
print(orderNo1)
else:
orderNo1 = 'orderNo1'
request_body = commonFuc().get_business_data(module, "payload1_1_1", orderNo1, hos_id, exeProvId)
# print('request_body',request_body)
# 发送请求
while True:
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
if total == 1:
break
else:
time.sleep(6)
data1 = commonFuc().analysis_json('data', data)
id1 = commonFuc().analysis_json('id', data1[0])
print('id1', id1)
data = commonFuc().analysis_json('data', result)
data1 = commonFuc().analysis_json('data', data)
list_a = []
list_b = []
list_c = []
list_a.append(data1)
list_b.append(data1)
list_c.append(data1)
# 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, 'b5_spd3_core_business_flow', '配送订单信息', titlename, 'message8')
# 从message8文件中获取信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "配送订单信息", 'message8')
# print('info', info)
list_a = info['list_a']
list_a = ','.join(map(str, list_a))
import json
new_request_body = list_a.replace("'", '"')
new_request_body1 = new_request_body.replace("None", 'null')
print(new_request_body1)
list_a2 = json.loads(new_request_body1)
# print('list_a', list_a)
billMode = "billMode"
createUser = 'createUser'
hosId = 'hosId'
provId = 'provId'
for i in list_a2:
billMode = i["billMode"]
createUser = i["createUser"]
hosId = i['hosId']
provId = i['provId']
break
# =========================查询待确认订单======================
# ==============================确认订单==================
module = "a6_mdm3_dp"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "ensure_url")
request_body = commonFuc().get_business_data(module, "payload2", id1, uxid)
# 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:
commonFuc().check_text_exist(code, result)
else:
commonFuc().check_text_exist('error', result)
# ==============================确认订单==================
# ==============================配送==================
# url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "purchase_page_url")
#
# request_body = commonFuc().get_business_data(module, "payload3_1_1",exeProvId,hos_id)
# # 发送请求
# result = commonFuc().http_post(url, request_body, headers)
# print('result', result)
# #断言
# code=commonFuc().analysis_json('code',result)
# data=commonFuc().analysis_json('data',result)
# total=commonFuc().analysis_json('total',data)
# data1 = commonFuc().analysis_json('data', data)
# id1=commonFuc().analysis_json('id', data1[0])
# print('id1',id1)
# ==================a3获取订单详细信息中的子表id_3_0医院
# a1订单配送列表数据查询_全部
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "detail_id_url")
request_body = commonFuc().get_business_data(module, "payload4", id1)
# print('request_body',request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resulta3获取订单详细信息中的子表id_3_0医院', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
commonFuc().check_text_exist(code, result)
data1 = commonFuc().analysis_json('data', data)
id2 = commonFuc().analysis_json('id', data1[0])
print(id1, id2)
data1 = commonFuc().analysis_json('data', data)
list_a = []
list_b = []
list_c = []
list_a.append(data1)
list_b.append(data1)
list_c.append(data1)
# 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, 'b5_spd3_core_business_flow', '配送订单详细信息', titlename, 'message9')
# ==================a3获取订单详细信息中的子表id_3_0医院
# ==================订单配送========================
module = "a6_mdm3_dp"
# a1订单配送列表数据查询_全部
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submit_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
# 从message9文件中获取信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "配送订单详细信息", 'message9')
print('info从message9文件中获取信息', info)
# print('info', info)
list_a = info['list_a']
# print('list_a',list_a,type(list_a))
# list_a = ','.join(map(str, list_a))
# import json
# new_request_body = list_a.replace("'", '"')
# new_request_body1 = new_request_body.replace("None", 'null')
# print('new_request_body1',new_request_body1)
#
# list_a2 = json.loads(new_request_body1)
# print('list_a2', list_a2)
# print('list_a2', type(list_a2))
hosGoodsId = 'hosGoodsId'
mdmGoodsCode = 'mdmGoodsCode'
goodsCode = 'goodsCode'
pkgDefId = 'pkgDefId'
erpCode = 'erpCode'
for i in list_a:
print('aaaaaaaaaaaaaaaaaaaaaaaaaaaa', i)
for j in i:
print('bbbbbbbbbbbbbbbbbbb', j)
hosGoodsId = j['hosGoodsId']
mdmGoodsCode = j['mdmGoodsCode']
goodsCode = j['goodsCode']
pkgDefId = j['pkgDefId']
erpCode = j['erpCode']
break
# # #获取日期
productDate = timeUtils().get_time_hms(5)
expdtDate = timeUtils().get_time_add(190, 2)
if type == 1:
request_body = commonFuc().get_business_data(module, "payload9_2_1_1", id1, id1, hosId, provId, billMode,
createUser, username, createUser, id2, hosGoodsId, mdmGoodsCode,
goodsCode, pkgDefId, productDate, expdtDate, erpCode, id2)
elif type == 2:
request_body = commonFuc().get_business_data(module, "payload9_2_1_2", id1, id1, hosId, provId, billMode,
createUser, username, createUser, id2, hosGoodsId, mdmGoodsCode,
goodsCode, productDate, expdtDate, erpCode, id2)
elif type == 3:
request_body = commonFuc().get_business_data(module, "payload9_2_1_3", id1, id1, hosId, provId, billMode,
createUser, username, createUser, id2, hosGoodsId, mdmGoodsCode,
goodsCode, pkgDefId, productDate, expdtDate, erpCode, id2)
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)
id1 = commonFuc().analysis_json('id', data)
info = (id1, id1)
titlename = ('distrBillId1', 'distrBillId2')
# 将配送订单信息息写入到文件中
if type == 1:
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '低值配送单号', titlename, 'message10')
elif type == 2:
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '高值配送单号', titlename, 'message10')
elif type == 3:
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '试剂配送单号', titlename, 'message10')
if code == 0:
commonFuc().check_text_exist(code, result)
else:
commonFuc().check_text_exist('error', result)
def Search_OrderNO():
# 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data('b2_herp3_bs', "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login(username, password, 2)
# 登录获取用户id等信息,使用创建的用户登录============结束
# print( token,projectCode,uxid,corpId,info)
module = 'b3_herp3_purchase'
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_operationNotice_url")
print(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"))
print('headers', headers)
# 从文件中获取院区id
branchId = commonFuc().get_business_data(module, 'branchId')
# # #获取日期
date1 = timeUtils().get_time_hms(5)
date2 = timeUtils().get_time_add(-180, 2)
# print(date1,date2)
# # 请求体
request_body = commonFuc().get_business_data(module, "payload23", date2, date1, branchId)
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))
return commonFuc().analysis_json('orderNo', data1)
企业信息: 企业信息:
e_id: CR202404280119 e_id: CR202404300057
cname: 国药集团公司#&hau cname: 国药集团公司@Fnl#
医院信息: 医院信息:
h_id: 湖南省人民医院mJSkG h_id: 湖南省人民医院EQSi$
h_name: 湖南省人民医院mJSkG h_name: 湖南省人民医院EQSi$
产品审核信息: 产品审核信息:
MSPid: MSP2404280026_1 MSPid: MSP2404300016_1
hosId: h0347 hosId: h0347
hosGoodsId: h034700003222 hosGoodsId: h034700003270
provGoodsid: provGood-99220331 provGoodsid: provGood-99220379
goodsAuditBillId: MSP2404280026 goodsAuditBillId: MSP2404300016
targetId: MSP2404280026_1 targetId: MSP2404300016_1
院区新增: 院区新增:
branch_id: h0347-3539 branch_id: h0347-3549
branch_name: 东土城路院区PDz&a branch_name: 东土城路院区$PwX^
科室信息: 科室信息:
dept2_id: ea3691b307894b3a8987b4bf444fcdca dept2_id: 8887b708eb1842f2b606b8827266dcaa
dept2_name: 二级检验科002 dept2_name: 二级检验科002
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<tr width="600"> <tr width="600">
<td class='details-col-elapsed'>1</td> <td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>1</td> <td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>1分31</td> <td class='details-col-elapsed'>1分27</td>
<td class="details-col-elapsed">100.0%</td> <td class="details-col-elapsed">100.0%</td>
</tr> </tr>
</table> </table>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<tr width="600"> <tr width="600">
<td class="details-col-elapsed"><a href='../log/a_a9流程六_中心库入库结算_负结算/log.html' target='_blank'>a_a9流程六_中心库入库结算_负结算</a></td> <td class="details-col-elapsed"><a href='../log/a_a9流程六_中心库入库结算_负结算/log.html' target='_blank'>a_a9流程六_中心库入库结算_负结算</a></td>
<td class="success">成功</td> <td class="success">成功</td>
<td class="details-col-elapsed">91.585</td> <td class="details-col-elapsed">87.551</td>
<td class="details-col-elapsed">xiaohesheng</td> <td class="details-col-elapsed">xiaohesheng</td>
</tr> </tr>
......
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