Commit 62294e7b authored by xiao-hesheng's avatar xiao-hesheng
Browse files

优化调整脚本

parent 37904ae4
...@@ -329,6 +329,7 @@ def add_StockArea():#添加货位 ...@@ -329,6 +329,7 @@ def add_StockArea():#添加货位
def recover_dataFile(): def recover_dataFile():
delData().Delete_branch_by_id(2) delData().Delete_branch_by_id(2)
delData().Delete_probeInfo_other(2)
pro_path = commonFuc().get_pro_path2() pro_path = commonFuc().get_pro_path2()
src = pro_path + r'/data' src = pro_path + r'/data'
dst=FileUtils().r_info8('b5_spd3_core_business_flow', '备份路径','message29')['备份目录'] dst=FileUtils().r_info8('b5_spd3_core_business_flow', '备份路径','message29')['备份目录']
...@@ -338,7 +339,7 @@ def recover_dataFile(): ...@@ -338,7 +339,7 @@ def recover_dataFile():
if os.path.exists(src): if os.path.exists(src):
shutil.rmtree(src) shutil.rmtree(src)
FileUtils().copy_folder_backup(dst, src) FileUtils().copy_folder_backup(dst, src)
def branch_add(token): def branch_add():
module='b2_herp3_bs' module='b2_herp3_bs'
# 内网登录 # 内网登录
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
...@@ -369,7 +370,7 @@ def branch_add(token): ...@@ -369,7 +370,7 @@ def branch_add(token):
#备份当前data目录 #备份当前data目录
pro_path = commonFuc().get_pro_path2() pro_path = commonFuc().get_pro_path2()
src=pro_path+r'/data' src=pro_path+r'/data'
dst=pro_path+r'/data'+ timeUtils().get_time_hms(5) dst=pro_path+r'/data'+ get_branch_name()+get_branch_id()
#将备份的目录路径写入到文件中 #将备份的目录路径写入到文件中
info = (src, dst) info = (src, dst)
titlename = ('源目录', '备份目录') titlename = ('源目录', '备份目录')
......
# -*- encoding=utf8 -*- # -*- encoding=utf8 -*-
import traceback import traceback
from air_case.public1.public1.public1 import get_hosid, get_branch_id from air_case.public1.public1.public1 import get_hosid, get_branch_id, login
from common.fileUtls import FileUtils from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command from common.run_cmd_script import execute_command
...@@ -22,21 +22,21 @@ import time ...@@ -22,21 +22,21 @@ import time
module = "b5_spd3_core_business_flow" module = "b5_spd3_core_business_flow"
def login(): # def login():
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')
print(info) # print(info)
username1 = info['username1'] # username1 = info['username1']
#
username = username1 # username = username1
## print('医院名称',username) # ## print('医院名称',username)
password = commonFuc().get_business_data(module, "password") # password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') # # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode # # 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token() # token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
return token, projectCode, uxid, corpId, info # return token, projectCode, uxid, corpId, info
# 登录获取用户id等信息,使用创建的用户登录============结束 # # 登录获取用户id等信息,使用创建的用户登录============结束
# 采购计划_低值 # 采购计划_低值
...@@ -455,9 +455,62 @@ def reagent_purchase_plan(): ...@@ -455,9 +455,62 @@ def reagent_purchase_plan():
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 goods_move3(): # 设置请领出库渠道为中心库
# # 登录获取用户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等信息,使用创建的用户登录============结束
module = "b2_herp3_bs"
# 设置请领出库渠道为中心库
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "updateSettleType_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"))
for i in range(1, 4):
info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息", 'message%s' % i)
hosGoodsId = info['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '')
branchGoodsId = SERACH_goods_id(GoodsId)
# #请求体
request_body = commonFuc().get_business_data(module, "payload47_3", branchGoodsId, hosGoodsId, get_branch_id())
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('goods_move,result', result)
def SERACH_goods_id(GoodsId):
# 在请领出库渠道直送中搜索产品
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等信息,使用创建的用户登录============结束\
# 获取请求头信息
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,
"herpService_mcmsBranchGoodsInfo_page_url")
dept1 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
# hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId']
# GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload53_3", GoodsId, get_hosid(), get_branch_id(), dept1)
result = commonFuc().http_post(url, request_body, headers)
branchGoodsId = commonFuc().analysis_json('id', commonFuc().analysis_json('data', commonFuc().analysis_json('data',
result)))
return branchGoodsId
def main(): def main():
try: try:
goods_move3()
# 获取低值的hosGoodsId # 获取低值的hosGoodsId
hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
get_GoodsPkgDef(hosGoodsId) # 获取单元包id get_GoodsPkgDef(hosGoodsId) # 获取单元包id
......
...@@ -40,7 +40,7 @@ def center_warehouse_return(): ...@@ -40,7 +40,7 @@ def center_warehouse_return():
token, projectCode, uxid, corpId, info = login(username, password, 2) token, projectCode, uxid, corpId, info = login(username, password, 2)
# 登录获取用户id等信息,使用创建的用户登录============结束 # 登录获取用户id等信息,使用创建的用户登录============结束
# 到库房明细查询,查询产品的udi码 # 到库房明细查询,查询产品的udi码
get_udi(1) get_udi_bydb(1)
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_pick_submit_url") url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_pick_submit_url")
print('url', url) print('url', url)
headers = commonFuc().get_business_data(module, "json_headers2", headers = commonFuc().get_business_data(module, "json_headers2",
......
...@@ -61,7 +61,7 @@ import sys ...@@ -61,7 +61,7 @@ import sys
# 备份当前data目录 # 备份当前data目录
pro_path = commonFuc().get_pro_path2() pro_path = commonFuc().get_pro_path2()
src = pro_path + r'/data' src = pro_path + r'/data'
dst = pro_path + r'/data' + timeUtils().get_time_hms(5) dst = pro_path + r'/data' + get_branch_name()+get_branch_id()
#将备份的目录路径写入到文件中 #将备份的目录路径写入到文件中
info = (src, dst) info = (src, dst)
titlename = ('源目录', '备份目录') titlename = ('源目录', '备份目录')
......
...@@ -27,7 +27,6 @@ def get_process_list(request_body): ...@@ -27,7 +27,6 @@ def get_process_list(request_body):
def compare_text_index(text1, text2): def compare_text_index(text1, text2):
import difflib, re import difflib, re
# 创建SequenceMatcher对象 # 创建SequenceMatcher对象
matcher = difflib.SequenceMatcher(a=text1, b=text2) matcher = difflib.SequenceMatcher(a=text1, b=text2)
...@@ -53,11 +52,11 @@ def get_process_list2(request_body): ...@@ -53,11 +52,11 @@ def get_process_list2(request_body):
new_request_body = request_body.replace("'", '"') new_request_body = request_body.replace("'", '"')
new_request_body1 = new_request_body.replace("\\", '\\\\') new_request_body1 = new_request_body.replace("\\", '\\\\')
new_request_body2 = new_request_body1.replace("None", 'null') new_request_body2 = new_request_body1.replace("None", 'null')
new_request_body3= new_request_body2.replace("[", '') new_request_body3 = new_request_body2.replace("[", '')
new_request_body4 = new_request_body3.replace("]", '') new_request_body4 = new_request_body3.replace("]", '')
print('new_request_body4',new_request_body4) print('new_request_body4', new_request_body4)
try: try:
new_request_body4=json.dumps(new_request_body4)#格式化 new_request_body4 = json.dumps(new_request_body4) # 格式化
request_body_json = json.loads(new_request_body4) request_body_json = json.loads(new_request_body4)
except json.decoder.JSONDecodeError: except json.decoder.JSONDecodeError:
print("JSONDecodeError: No valid JSON object could be decoded from the string.") print("JSONDecodeError: No valid JSON object could be decoded from the string.")
...@@ -65,7 +64,6 @@ def get_process_list2(request_body): ...@@ -65,7 +64,6 @@ def get_process_list2(request_body):
return request_body_json return request_body_json
def get_branch_id(): def get_branch_id():
return FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"] return FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
...@@ -141,6 +139,7 @@ def approval_center(OBH_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -141,6 +139,7 @@ def approval_center(OBH_ID='OBhxxxxxxxxxxxxxxx'):
else: else:
commonFuc().check_text_exist('error', result) commonFuc().check_text_exist('error', result)
def approval_center_all(OBH_ID='OBhxxxxxxxxxxxxxxx'): def approval_center_all(OBH_ID='OBhxxxxxxxxxxxxxxx'):
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始 # 登录获取用户id等信息,使用创建的用户登录===========开始
...@@ -172,7 +171,7 @@ def approval_center_all(OBH_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -172,7 +171,7 @@ def approval_center_all(OBH_ID='OBhxxxxxxxxxxxxxxx'):
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result) print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
data = commonFuc().analysis_json('data', result) data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data) total = commonFuc().analysis_json('total', data)
data1= commonFuc().analysis_json('data', data) data1 = commonFuc().analysis_json('data', data)
for i in data1: for i in data1:
# code = commonFuc().analysis_json('code', result) # code = commonFuc().analysis_json('code', result)
# data = commonFuc().analysis_json('data', result) # data = commonFuc().analysis_json('data', result)
...@@ -200,6 +199,7 @@ def approval_center_all(OBH_ID='OBhxxxxxxxxxxxxxxx'): ...@@ -200,6 +199,7 @@ def approval_center_all(OBH_ID='OBhxxxxxxxxxxxxxxx'):
else: else:
commonFuc().check_text_exist('error', result) commonFuc().check_text_exist('error', result)
def approval_center1(): def approval_center1():
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始 # 登录获取用户id等信息,使用创建的用户登录===========开始
...@@ -400,10 +400,12 @@ def get_stockId(name, type=1): # 获取仓库id参数是库房名称 ...@@ -400,10 +400,12 @@ def get_stockId(name, type=1): # 获取仓库id参数是库房名称
id3 = i['id'] id3 = i['id']
print(id3) print(id3)
return id3 return id3
def get_stockId_fromdb(name): # 获取仓库id参数是库房名称 def get_stockId_fromdb(name): # 获取仓库id参数是库房名称
stockId=process_tuple( stockId = process_tuple(
get_id("select id from mcms_stock_info where stock_name='%s'and branch_id='%s';" % (name,get_branch_id()))) get_id("select id from mcms_stock_info where stock_name='%s'and branch_id='%s';" % (name, get_branch_id())))
return stockId return stockId
...@@ -526,7 +528,9 @@ def set_dept_user(dept_id, deptName, type=1): ...@@ -526,7 +528,9 @@ def set_dept_user(dept_id, deptName, type=1):
# ====获取库区id===== 开始========== # ====获取库区id===== 开始==========
# stockAreaId = get_stockAreaId(dept_id, stockId) # stockAreaId = get_stockAreaId(dept_id, stockId)
stockAreaId=process_tuple(get_id("select id from mcms_stock_shelf where address='%s' and del_flag=0 order by CREATE_TIME desc LIMIT 1;"%(deptName))) stockAreaId = process_tuple(get_id(
"select id from mcms_stock_shelf where address='%s' and del_flag=0 order by CREATE_TIME desc LIMIT 1;" % (
deptName)))
print(stockAreaId) print(stockAreaId)
# ====获取库区id===== 结束========== # ====获取库区id===== 结束==========
# dept_query_all() # dept_query_all()
...@@ -563,7 +567,7 @@ def set_dept_user(dept_id, deptName, type=1): ...@@ -563,7 +567,7 @@ def set_dept_user(dept_id, deptName, type=1):
# print('查询库区是否已经存在人员', result) # print('查询库区是否已经存在人员', result)
# userCode = commonFuc().analysis_json('userCode', # userCode = commonFuc().analysis_json('userCode',
# commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))) # commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)))
userCode=delData().del_mcms_stock_user(username1,dept_id) userCode = delData().del_mcms_stock_user(username1, dept_id)
# print('userCode',userCode) # print('userCode',userCode)
if userCode != username1: if userCode != username1:
# 查询库区是否已经存在人员,不需要重复添加=============== # 查询库区是否已经存在人员,不需要重复添加===============
...@@ -647,8 +651,8 @@ def get_udi1(type=1): # 库存明细查询获取条码 ...@@ -647,8 +651,8 @@ def get_udi1(type=1): # 库存明细查询获取条码
# # # # 发送请求 # # # # 发送请求
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
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>=1: if total >= 1:
# pkgcode = data1['pkgCodeSee'] # pkgcode = data1['pkgCodeSee']
# pkgcode1 = pkgcode[0:20] # pkgcode1 = pkgcode[0:20]
# pkgcode2 = pkgcode[21:len(pkgcode)] # pkgcode2 = pkgcode[21:len(pkgcode)]
...@@ -725,21 +729,23 @@ def get_udi2(type=1): # 二级科室库存明细查询获取条码 ...@@ -725,21 +729,23 @@ def get_udi2(type=1): # 二级科室库存明细查询获取条码
if type == 1: if type == 1:
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'] hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '') GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload17_2", GoodsId, get_branch_id(), deptid2,stockId2) request_body = commonFuc().get_business_data(module, "payload17_2", GoodsId, get_branch_id(), deptid2, stockId2)
elif type == 2: elif type == 2:
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId'] hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '') GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload17_2_1", GoodsId, get_branch_id(), deptid2,stockId2) request_body = commonFuc().get_business_data(module, "payload17_2_1", GoodsId, get_branch_id(), deptid2,
stockId2)
elif type == 3: elif type == 3:
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'] hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '') GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload17_2_2", GoodsId, get_branch_id(), deptid2,stockId2) request_body = commonFuc().get_business_data(module, "payload17_2_2", GoodsId, get_branch_id(), deptid2,
stockId2)
elif type == 4: # 试剂单瓶条码 elif type == 4: # 试剂单瓶条码
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'] hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '') GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload17_3", GoodsId, get_branch_id(), deptid2,stockId2) request_body = commonFuc().get_business_data(module, "payload17_3", GoodsId, get_branch_id(), deptid2, stockId2)
print('getudi_request_body', request_body) print('getudi_request_body', request_body)
# # # # 发送请求 # # # # 发送请求
...@@ -772,6 +778,7 @@ def get_udi2(type=1): # 二级科室库存明细查询获取条码 ...@@ -772,6 +778,7 @@ def get_udi2(type=1): # 二级科室库存明细查询获取条码
break break
return pkgCodeSee return pkgCodeSee
def get_udi3(type=1): # 三级科室库存明细查询获取条码 def get_udi3(type=1): # 三级科室库存明细查询获取条码
# type=1低值 2高值 3试剂 # type=1低值 2高值 3试剂
module = "b5_spd3_core_business_flow" module = "b5_spd3_core_business_flow"
...@@ -792,21 +799,23 @@ def get_udi3(type=1): # 三级科室库存明细查询获取条码 ...@@ -792,21 +799,23 @@ def get_udi3(type=1): # 三级科室库存明细查询获取条码
if type == 1: if type == 1:
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'] hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '') GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload17_2", GoodsId, get_branch_id(), deptid3,stockId3) request_body = commonFuc().get_business_data(module, "payload17_2", GoodsId, get_branch_id(), deptid3, stockId3)
elif type == 2: elif type == 2:
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId'] hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '') GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload17_2_1", GoodsId, get_branch_id(), deptid3,stockId3) request_body = commonFuc().get_business_data(module, "payload17_2_1", GoodsId, get_branch_id(), deptid3,
stockId3)
elif type == 3: elif type == 3:
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'] hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '') GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload17_2_2", GoodsId, get_branch_id(), deptid3,stockId3) request_body = commonFuc().get_business_data(module, "payload17_2_2", GoodsId, get_branch_id(), deptid3,
stockId3)
elif type == 4: # 试剂单瓶条码 elif type == 4: # 试剂单瓶条码
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'] hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '') GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload17_3", GoodsId, get_branch_id(), deptid3,stockId3) request_body = commonFuc().get_business_data(module, "payload17_3", GoodsId, get_branch_id(), deptid3, stockId3)
print('getudi_request_body', request_body) print('getudi_request_body', request_body)
# # # # 发送请求 # # # # 发送请求
...@@ -839,6 +848,71 @@ def get_udi3(type=1): # 三级科室库存明细查询获取条码 ...@@ -839,6 +848,71 @@ def get_udi3(type=1): # 三级科室库存明细查询获取条码
break break
return pkgCodeSee return pkgCodeSee
def get_udi_bydb(type=1): # 通过数据库获取中心库退货出库扫条码
if type == 1:
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId']
elif type == 2:
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId']
elif type == 3:
hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId']
else:
hosGoodsId = 'hosGoodsId'
deptname1 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
branch_id = get_branch_id()
area_code = get_stockAreaId_new_fromDb(deptname1, 1)
if type == 1:
sql = (
" select id from mcms_pkg where branch_id='%s' and area_code='%s' and lock_status='0' and use_status='0' and hos_goods_id='%s' and pkg_type='16' and dept_name='%s';" % (
branch_id, area_code, hosGoodsId, deptname1))
elif type == 2:
sql = (
" select id from mcms_pkg where branch_id='%s' and area_code='%s' and lock_status='0' and use_status='0' and hos_goods_id='%s' and pkg_type='20' and dept_name='%s';" % (
branch_id, area_code,hosGoodsId, deptname1))
elif type == 3:
sql = (
" select id from mcms_pkg where branch_id='%s'and area_code='%s' and lock_status='0' and use_status='0' and hos_goods_id='%s' and pkg_type='66' and dept_name='%s';" % (
branch_id, area_code,hosGoodsId, deptname1))
else:
sql = 'sql'
print('sql', sql)
pkgCodeSee = get_id(sql)
pkgcode = pkgCodeSee
module = "b5_spd3_core_business_flow"
token, projectCode1, uxid1, corpId1, info1 = call_login()
# 获取请求头信息
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, "herpService_pick_return_scan_url")
print('herpService_pick_return_scan_url', url)
branch_name = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_name"]
stockId = get_stockId(branch_name + '中心库房')
areaCode = FileUtils().r_info8("b2_herp3_bs", "shelfinfo", 'message7')['shelfCode']
request_body = commonFuc().get_business_data(module, "payload18", areaCode, pkgcode, stockId)
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
code = commonFuc().analysis_json('code', result)
if code == 1001:
commonFuc().check_text_exist_result_text('error', 'succees')
# # 将条码信息写入文件
data = commonFuc().analysis_json('data', result)
list_a = []
list_b = []
list_c = []
list_a.append(data)
list_b.append(data)
list_c.append(data)
# 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, 'message18')
return pkgcode
def get_udi(type=1): # 退货出库扫条码 def get_udi(type=1): # 退货出库扫条码
# type=1低值 2高值 3试剂 # type=1低值 2高值 3试剂
module = "b5_spd3_core_business_flow" module = "b5_spd3_core_business_flow"
...@@ -897,8 +971,8 @@ def get_udi(type=1): # 退货出库扫条码 ...@@ -897,8 +971,8 @@ def get_udi(type=1): # 退货出库扫条码
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)
code=commonFuc().analysis_json('code',result) code = commonFuc().analysis_json('code', result)
if code==1001: if code == 1001:
commonFuc().check_text_exist_result_text('error', 'succees') commonFuc().check_text_exist_result_text('error', 'succees')
# # 将条码信息写入文件 # # 将条码信息写入文件
data = commonFuc().analysis_json('data', result) data = commonFuc().analysis_json('data', result)
...@@ -1546,6 +1620,7 @@ def SaveCacheBatch2(headers): ...@@ -1546,6 +1620,7 @@ def SaveCacheBatch2(headers):
result = commonFuc().http_post(url, request_body4, headers) result = commonFuc().http_post(url, request_body4, headers)
print('result', result) print('result', result)
def set_dept_lead1(): # 设置一级科室负责人 def set_dept_lead1(): # 设置一级科室负责人
module = 'b2_herp3_bs' module = 'b2_herp3_bs'
username = FileUtils().r_info8(module, '用户名信息', 'message3')["username1"] username = FileUtils().r_info8(module, '用户名信息', 'message3')["username1"]
...@@ -1584,6 +1659,7 @@ def set_dept_lead1(): # 设置一级科室负责人 ...@@ -1584,6 +1659,7 @@ def set_dept_lead1(): # 设置一级科室负责人
else: else:
commonFuc().check_text_exist('error', result) commonFuc().check_text_exist('error', result)
def set_dept_lead(): # 设置二级科室负责人 def set_dept_lead(): # 设置二级科室负责人
module = 'b2_herp3_bs' module = 'b2_herp3_bs'
username = FileUtils().r_info8(module, '用户名信息', 'message3')["username1"] username = FileUtils().r_info8(module, '用户名信息', 'message3')["username1"]
...@@ -1882,12 +1958,13 @@ def get_stockAreaId_new(dept_id, deptName, type=1): ...@@ -1882,12 +1958,13 @@ def get_stockAreaId_new(dept_id, deptName, type=1):
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '库区信息', titlename, 'message22') FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '库区信息', titlename, 'message22')
return shelfCode return shelfCode
def get_stockAreaId_new_fromDb(deptName, type=1): def get_stockAreaId_new_fromDb(deptName, type=1):
module = "b2_herp3_bs" module = "b2_herp3_bs"
stockId = 'stockId' stockId = 'stockId'
# 获取库房id========= 开始==== # 获取库房id========= 开始====
if type == 1: if type == 1:
# 中心库房名称 # 中心库房名称
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"] branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId = get_stockId_fromdb(branch_name + '中心库房') stockId = get_stockId_fromdb(branch_name + '中心库房')
deptName = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] deptName = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
...@@ -1903,17 +1980,18 @@ def get_stockAreaId_new_fromDb(deptName, type=1): ...@@ -1903,17 +1980,18 @@ def get_stockAreaId_new_fromDb(deptName, type=1):
# ====获取库区id===== 开始========== # ====获取库区id===== 开始==========
sql="select shelf_code from mcms_stock_shelf where stock_Id='%s'and address='%s';"%(stockId,deptName) sql = "select shelf_code from mcms_stock_shelf where stock_Id='%s'and address='%s';" % (stockId, deptName)
print(sql) print(sql)
shelfCode=get_id(sql) shelfCode = get_id(sql)
return shelfCode return shelfCode
def get_stockAreaId2_new_fromDb(deptName, type=1): def get_stockAreaId2_new_fromDb(deptName, type=1):
module = "b2_herp3_bs" module = "b2_herp3_bs"
stockId = 'stockId' stockId = 'stockId'
# 获取库房id========= 开始==== # 获取库房id========= 开始====
if type == 1: if type == 1:
# 中心库房名称 # 中心库房名称
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"] branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId = get_stockId_fromdb(branch_name + '中心库房') stockId = get_stockId_fromdb(branch_name + '中心库房')
# 二级库房名称 # 二级库房名称
...@@ -1927,11 +2005,13 @@ def get_stockAreaId2_new_fromDb(deptName, type=1): ...@@ -1927,11 +2005,13 @@ def get_stockAreaId2_new_fromDb(deptName, type=1):
# 获取库房id==========结束============ # 获取库房id==========结束============
# ====获取库区id===== 开始========== # ====获取库区id===== 开始==========
sql="select stock_Id from mcms_stock_shelf where stock_Id='%s'and address='%s' order by create_time desc LIMIT 1;"%(stockId,deptName) sql = "select stock_Id from mcms_stock_shelf where stock_Id='%s'and address='%s' order by create_time desc LIMIT 1;" % (
stockId, deptName)
print(sql) print(sql)
shelfCode=get_id(sql) shelfCode = get_id(sql)
return shelfCode return shelfCode
def herpService_mcmsDeptGoodsInfo_getByProvIdPage(): # 高值跟台获取产品信息 def herpService_mcmsDeptGoodsInfo_getByProvIdPage(): # 高值跟台获取产品信息
module = "b5_spd3_core_business_flow" module = "b5_spd3_core_business_flow"
username = FileUtils().r_info8('b2_herp3_bs', '用户名信息', 'message3')["username1"] username = FileUtils().r_info8('b2_herp3_bs', '用户名信息', 'message3')["username1"]
...@@ -2490,7 +2570,7 @@ def reGetString(String, leftBinary="^", rightBinary="$"): ...@@ -2490,7 +2570,7 @@ def reGetString(String, leftBinary="^", rightBinary="$"):
return "没有匹配到内容,请检查左右边界" return "没有匹配到内容,请检查左右边界"
def set_stockShelf_Linkman(deptId,stockAreaId): def set_stockShelf_Linkman(deptId, stockAreaId):
print('设置库区联系人') print('设置库区联系人')
# # 登录获取用户id等信息,使用创建的用户登录===========开始 # # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3') info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
...@@ -2502,7 +2582,7 @@ def set_stockShelf_Linkman(deptId,stockAreaId): ...@@ -2502,7 +2582,7 @@ def set_stockShelf_Linkman(deptId,stockAreaId):
# # 获取token和projectCode # # 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token() token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束 # 登录获取用户id等信息,使用创建的用户登录============结束
module='b2_herp3_bs' module = 'b2_herp3_bs'
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockShelf_page_url") url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockShelf_page_url")
# # 获取请求头信息 # # 获取请求头信息
...@@ -2685,8 +2765,8 @@ def pickScan2(PICK_ID, udi_code, type=1): # 二级库出库拣货扫码 ...@@ -2685,8 +2765,8 @@ def pickScan2(PICK_ID, udi_code, type=1): # 二级库出库拣货扫码
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
# import pdb # import pdb
# pdb.set_trace() # pdb.set_trace()
code=commonFuc().analysis_json('code',result) code = commonFuc().analysis_json('code', result)
if code=='14030053': if code == '14030053':
commonFuc().check_text_exist_result_text('error', 'SUCCESS') commonFuc().check_text_exist_result_text('error', 'SUCCESS')
print('获取条码信息result', result) print('获取条码信息result', result)
# 获取必要信息 # 获取必要信息
...@@ -2789,10 +2869,10 @@ def pickScan2(PICK_ID, udi_code, type=1): # 二级库出库拣货扫码 ...@@ -2789,10 +2869,10 @@ def pickScan2(PICK_ID, udi_code, type=1): # 二级库出库拣货扫码
# # # # 发送请求 # # # # 发送请求
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result', '拣货扫码', result) print('result', '拣货扫码', result)
code=commonFuc().analysis_json('code',result) code = commonFuc().analysis_json('code', result)
if code==0: if code == 0:
print('拣货扫码','ok') print('拣货扫码', 'ok')
elif code==14030001: elif code == 14030001:
print('单据已被扫码,请刷新页面数据', 'ok') print('单据已被扫码,请刷新页面数据', 'ok')
else: else:
commonFuc().check_text_exist_result_text('error', 'succees') commonFuc().check_text_exist_result_text('error', 'succees')
...@@ -3197,9 +3277,9 @@ def second_dept_one_key_in(type=2): ...@@ -3197,9 +3277,9 @@ def second_dept_one_key_in(type=2):
while True: while True:
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result)) total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result))
if total>=1: if total >= 1:
break break
elif total==0: elif total == 0:
return return
else: else:
continue continue
...@@ -3258,11 +3338,11 @@ def second_dept_one_key_in(type=2): ...@@ -3258,11 +3338,11 @@ def second_dept_one_key_in(type=2):
# # # # 发送请求 # # # # 发送请求
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)
code=commonFuc().analysis_json('code',result) code = commonFuc().analysis_json('code', result)
if code==1010: if code == 1010:
commonFuc().check_text_exist_result_text('error', 'succees') commonFuc().check_text_exist_result_text('error', 'succees')
elif len(data)>=1: elif len(data) >= 1:
commonFuc().check_text_exist_result_text('succees', 'succees') commonFuc().check_text_exist_result_text('succees', 'succees')
return data return data
else: else:
...@@ -3506,6 +3586,7 @@ def dept_goods_distribute(detpid): # 科室添加产品信息(产品是从外 ...@@ -3506,6 +3586,7 @@ def dept_goods_distribute(detpid): # 科室添加产品信息(产品是从外
else: else:
commonFuc().check_text_exist('error', result) commonFuc().check_text_exist('error', result)
def get_login_user_uxid(): def get_login_user_uxid():
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始 # 登录获取用户id等信息,使用创建的用户登录===========开始
...@@ -3521,6 +3602,7 @@ def get_login_user_uxid(): ...@@ -3521,6 +3602,7 @@ def get_login_user_uxid():
token1, projectCode1, uxid1, corpId1, info1 = login_system(username, password).get_token() token1, projectCode1, uxid1, corpId1, info1 = login_system(username, password).get_token()
return uxid1 return uxid1
def get_login_user_uxid2(): def get_login_user_uxid2():
module = "b5_spd3_core_business_flow" module = "b5_spd3_core_business_flow"
# 登录获取用户id等信息,使用创建的用户登录===========开始 # 登录获取用户id等信息,使用创建的用户登录===========开始
...@@ -3533,10 +3615,11 @@ def get_login_user_uxid2(): ...@@ -3533,10 +3615,11 @@ def get_login_user_uxid2():
password = commonFuc().get_business_data(module, "password1") password = commonFuc().get_business_data(module, "password1")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode # 获取token和projectCode
token1, projectCode1, uxid1, corpId1, info1 = login(username, password,1) token1, projectCode1, uxid1, corpId1, info1 = login(username, password, 1)
return uxid1 return uxid1
def comparison_result(actual,expected):
def comparison_result(actual, expected):
actual_value1 = get_process_list2(actual) actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected) expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "") actual_value2 = actual_value1.replace(" ", "")
...@@ -3554,19 +3637,25 @@ def comparison_result(actual,expected): ...@@ -3554,19 +3637,25 @@ def comparison_result(actual,expected):
else: else:
print('error') print('error')
commonFuc().check_text_exist_result_text('error', 'succees') commonFuc().check_text_exist_result_text('error', 'succees')
def get_prov_id(): def get_prov_id():
return FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"] return FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"]
def get_prov_name(): def get_prov_name():
return FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"] return FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"]
def get_rec_org_id(type=1): def get_rec_org_id(type=1):
if type==1: if type == 1:
return FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] return FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
elif type==2: elif type == 2:
return FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'] return FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
def get_rec_org_name(type=1): def get_rec_org_name(type=1):
if type==1: if type == 1:
return FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] return FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
elif type==2: elif type == 2:
return FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'] return FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
\ No newline at end of file
...@@ -142,12 +142,15 @@ class delData(object): ...@@ -142,12 +142,15 @@ class delData(object):
# print('多余库房信息删除成功 ') # print('多余库房信息删除成功 ')
cursor.close() cursor.close()
def Delete_probeInfo_other(self): def Delete_probeInfo_other(self,type=1):
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2", connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
charset="utf8") charset="utf8")
cursor = connection.cursor() cursor = connection.cursor()
# 删除多余库房信息 # 删除多余库房信息
sql = "delete from mcms_stock_info where stock_name like '%东土城路院区_____中心库房';" if type==1:
sql = "delete from mcms_stock_info where stock_name like '%东土城路院区_____中心库房';"
else:
sql = "delete from mcms_stock_info where stock_name like '%东土城路院区______中心库房';"
print(sql) print(sql)
cursor.execute(sql) cursor.execute(sql)
cursor.execute("commit;") cursor.execute("commit;")
......
验收单号: 验收单号:
CHECK_NO1: CHECKh03472024080100006 CHECK_NO1: CHECKh03472024080100018
CHECK_NO2: CHECKh03472024080100006 CHECK_NO2: CHECKh03472024080100018
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