Commit 139068fe authored by 肖 和生's avatar 肖 和生
Browse files

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

# Conflicts:
#	data/b5_spd3_core_business_flow/message
#	data/b5_spd3_core_business_flow/message1
#	data/b5_spd3_core_business_flow/message2
parents c04df304 1a0ad915
......@@ -17,6 +17,7 @@ __author__ = "xiaohesheng"
case_tag:api,spd_core,a_b7流程十四退库业务_消耗退库,id2302,id2302-17,sit,on
核心业务流:a_b7流程十四退库业务_消耗退库
python runner_test.py tag id2302-17 debug mdm3
低值产品需要保证2个库存,脚本才能正常
"""
......@@ -174,6 +175,9 @@ def second_dept_consume_Out_Stock(type): # 二级库消耗出库
elif type == 1:
print('低值耗材消耗出库')
udi_code = get_udi2(1,token)
if udi_code=='pkgCodeSee':
print('没有获取到有效条码')
sys.exit(0)
data1 = pickScan4(udi_code)
# 获取必要信息
areaCode = commonFuc().analysis_json('areaCode', data1)
......@@ -389,6 +393,9 @@ def sCan_grant(type=1): # 获取条码and扫码发放高值不能发放
udi_code = get_udi2(3,token) # 获取条码 低值1 高值2 试剂3
else:
udi_code = 'udi_code'
if udi_code=='pkgCodeSee':
print('没有获取有效条码')
sys.exit(0)
if type == 1:
pickScan3(udi_code, 1) # 低值扫码发放
elif type == 3:
......
......@@ -23,7 +23,7 @@ python runner_test.py tag id2302-20 debug mdm3
def second_center_Stock_return_Out(type): # 中心库退供应商
def center_Stock_return_Out(type): # 中心库退供应商
module = "b5_spd3_core_business_flow"
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
......@@ -629,9 +629,9 @@ def second_center_Stock_return_Out(type): # 中心库退供应商
def main():
try:
updateUserLoginDefaultRange(get_listUserMgrRangePage1(1)) # 设置登录账号默认权限是二级库
second_center_Stock_return_Out(2) #高值耗材退货出库
second_center_Stock_return_Out(1) #低值耗材退货出库
second_center_Stock_return_Out(3) #试剂耗材退货出库
center_Stock_return_Out(2) #高值耗材退货出库
center_Stock_return_Out(1) #低值耗材退货出库
center_Stock_return_Out(3) #试剂耗材退货出库
commonFuc().check_text_exist_result_text('succees', 'succees')
print('================流程十七执行完毕====================')
......
......@@ -205,7 +205,8 @@ def check_mcms_dept_buy(type=16):
# area_code = get_stockAreaId_new(deptid2, deptname2, 2)
info = FileUtils().r_info8("b5_spd3_core_business_flow", "库区信息", 'message22')
list_a = info['list_a']
area_code = commonFuc().analysis_json('shelfCode', list_a)
# area_code = commonFuc().analysis_json('shelfCode', list_a)
area_code = get_stockAreaId_new_fromDb(deptname2, 2)
area_name = '默认库区'
# 读取文件中的信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
......@@ -217,7 +218,7 @@ def check_mcms_dept_buy(type=16):
pkgDefId = commonFuc().analysis_json('pkgDefId', list_a)
pkgDefName = commonFuc().analysis_json('pkgDefName', list_a)
# 获取边仓id
time.sleep(3)
time.sleep(6)
target_stock_id = get_id("select logic_id FROM yb_direct WHERE branch_id ='%s' order by create_time desc LIMIT 1;" % branch_id)
bill_expdt_date = get_expdt_date(
"select bill_expdt_date from mcms_dept_buy where branch_id='%s' and bill_mode='%s' and buy_kind='KS' order by create_time desc LIMIT 1;" % (
......@@ -305,7 +306,7 @@ def check_mcms_dept_buy_approval_after(type=16):
# area_code = get_stockAreaId_new(deptid2, deptname2, 2)
info = FileUtils().r_info8("b5_spd3_core_business_flow", "库区信息", 'message22')
list_a = info['list_a']
area_code = commonFuc().analysis_json('shelfCode', list_a)
area_code = get_stockAreaId_new_fromDb(deptname2, 2)
area_name = '默认库区'
# 读取文件中的信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
......@@ -495,6 +496,7 @@ def main():
# # # 试剂
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'], 3)
check_mcms_dept_buy_car(3)
time.sleep(8)
BuyCarSubmit() # 请领车提交
time.sleep(8)
# 调用函数对数据库中的数据进行验证和比对
......
......@@ -218,7 +218,7 @@ def check_mcms_dept_buy(type=16):
# area_code = get_stockAreaId_new(deptid2, deptname2, 2)
info = FileUtils().r_info8("b5_spd3_core_business_flow", "库区信息", 'message22')
list_a = info['list_a']
area_code = commonFuc().analysis_json('shelfCode', list_a)
area_code = get_stockAreaId_new_fromDb(deptname2, 2)
area_name = '默认库区'
# 读取文件中的信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
......@@ -321,7 +321,7 @@ def check_mcms_dept_buy_approval_after(type=16):
# area_code = get_stockAreaId_new(deptid2, deptname2, 2)
info = FileUtils().r_info8("b5_spd3_core_business_flow", "库区信息", 'message22')
list_a = info['list_a']
area_code = commonFuc().analysis_json('shelfCode', list_a)
area_code =get_stockAreaId_new_fromDb(deptname2, 2)
area_name = '默认库区'
# 读取文件中的信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
......@@ -522,7 +522,7 @@ def check_mcms_mcms_pur_plan(type=16):
rec_org_name = dept_name2
info = FileUtils().r_info8("b5_spd3_core_business_flow", "库区信息", 'message22')
list_a = info['list_a']
area_code = commonFuc().analysis_json('shelfCode', list_a)
area_code =get_stockAreaId_new_fromDb(dept_name2, 2)
sql1 = "select area_name from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;" % (
branch_id, id1)
area_name = process_tuple(get_id(sql1))
......@@ -778,7 +778,7 @@ def check_mcms_purchase(type=16):
rec_org_name = dept_name2
info = FileUtils().r_info8("b5_spd3_core_business_flow", "库区信息", 'message22')
list_a = info['list_a']
area_code = commonFuc().analysis_json('shelfCode', list_a)
area_code =get_stockAreaId_new_fromDb(dept_name2, 2)
sql1 = "select area_name from mcms_purchase where branch_id='%s' and id='%s' order by create_time desc LIMIT 1;" % (
branch_id, id1)
area_name = process_tuple(get_id(sql1))
......@@ -2287,6 +2287,7 @@ def check_mcms_hos_batch(type=1): # 检查批次表信息
stock_id = get_stockId_fromdb(stock_name)
src_batch_id = get_id("select src_batch_id from mcms_hos_batch where id='%s';" % id)
src_batch_id = id
hos_goods_id='hos_goods_id'
if type == 1:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 2:
......@@ -2350,7 +2351,8 @@ def check_mcms_hos_batch(type=1): # 检查批次表信息
goodsName, erpCode, create_user, create_time
, last_modified, last_modified_user)
else:
fcatId=get_id("select id from mcms_goods_kind where kind_name='财务试剂';")
# fcatId=get_id("select id from mcms_goods_kind where kind_name='财务试剂';")
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_hos_batch3',
id,
hos_id, branch_id, stock_id, src_batch_id, hos_goods_id,
......@@ -2358,7 +2360,7 @@ def check_mcms_hos_batch(type=1): # 检查批次表信息
, mfrs_id, supply_id, prov_id, prov_name, sub_prov_id,
sub_prov_name, expdt_date, product_date
, distr_id, distr_detail_id, purBillId, in_time, goodsGg, goodsCode,
goodsName, erpCode, fcatId,create_user, create_time
goodsName, erpCode,create_user, create_time
, last_modified, last_modified_user)
# 对比预期值和实际值是否一致
actual_value1 = get_process_list2(actual)
......@@ -2477,7 +2479,7 @@ def main():
second_dept_one_key_in()
second_dept_one_key_in()
second_dept_one_key_in()
time.sleep(6)
# 检查二级库入库单
check_mcms_psi_dept_in(16)
check_mcms_psi_dept_in(20)
......
......@@ -352,6 +352,7 @@ def check_mcms_psi_dept_batch(DR_ID,type,order_no):
)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_batch3',batch_main_key, pid, order_no,source_detail_id
,pick_detail_id,hos_goods_id,mdm_goods_code,goods_code,source_batch_id,
......@@ -396,7 +397,7 @@ def check_mcms_psi_dept(type=16):
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单高值id", 'message26')
DR_ID = info['DR_NO1高值']
else:
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单试剂id", 'message28')
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单试剂id", 'message26')
DR_ID = info['DR_NO1试剂']
DR_ID = ''.join(DR_ID)
sql = "select order_no from mcms_psi_dept where id='%s';" % DR_ID
......@@ -732,13 +733,16 @@ def check_mcms_psi_dept_in(type=16):
branch_id, type)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单id", 'message26')
# info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单id", 'message26')
if type == 16:
source_id = info['DR_NO2']
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单低值id", 'message26')
source_id = info['DR_NO1低值']
elif type == 20:
source_id = info['DR_NO3']
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单高值id", 'message26')
source_id = info['DR_NO1高值']
else:
source_id = info['DR_NO1']
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单试剂id", 'message26')
source_id = info['DR_NO1试剂']
source_id = ''.join(source_id)
source_no=get_id("select order_no from mcms_psi_dept where id='%s';"%source_id)
#获取入库单主键DR_ID
......@@ -899,11 +903,13 @@ def main():
# # 二级科室领用出库
# # 低值拣货执行
pick_execute()
time.sleep(8)
# 检查拣货单
list_data = ['16', '20', '66']
for i in list_data:
check_mcms_pick(int(i))
time.sleep(8)
# 检查出库单
check_mcms_psi_dept(16)
check_mcms_psi_dept(20)
......@@ -911,6 +917,7 @@ def main():
second_dept_one_key_in(5)
second_dept_one_key_in(5)
second_dept_one_key_in(5)
time.sleep(8)
# # 上面暂时注释========================
# 检查入库单
check_mcms_psi_dept_in(16)
......
......@@ -80,6 +80,7 @@ def check_mcms_dept_buy_car(type=1):
goodsCode,
create_user, create_time, last_modified, last_modified_user)
else:
# mdm_goods_code="null"
expected_value2 = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'check_mcms_dept_buy_car3', id, get_hosid(), branch_id,
deptid3,
......
......@@ -136,7 +136,7 @@ def check_mcms_psi_dept_in(type=10):
def check_mcms_psi_dept_batch_in(DR_ID1,DR_ID,type):
branch_id = get_branch_id()
if type==67:
sql = " select * from mcms_psi_dept_batch where pid='%s' order by create_time desc LIMIT 1;" % (
sql = "select * from mcms_psi_dept_batch where pid='%s' order by create_time desc LIMIT 1;" % (
DR_ID1)
count=process_tuple(get_id("select count(*) from mcms_psi_dept_batch where pid='%s'"%DR_ID1))
if count=='100':
......@@ -145,7 +145,7 @@ def check_mcms_psi_dept_batch_in(DR_ID1,DR_ID,type):
else:
commonFuc().check_text_exist_result_text('error', 'SUCCESS')
else:
sql = " select * from mcms_psi_dept_batch where pid='%s';" % (
sql = "select * from mcms_psi_dept_batch where pid='%s';" % (
DR_ID1)
actual = check_mcms_dept_buy_sql(sql)
print('actual', actual)
......@@ -851,7 +851,7 @@ def check_mcms_psi_dept_XH_CK(type1=10,type2=16):
check_mcms_psi_dept_batch_xhrk(DR_ID1,source_id,type2,order_no1)
source_id="-"
source_area_code=None
his_charge_no=get_id(" select his_charge_no from his_order where branch_id='%s' and psi_dept_id='%s' order by create_time desc LIMIT 1;"%(branch_id,DR_ID1))
his_charge_no=get_id("select his_charge_no from his_order where branch_id='%s' and psi_dept_id='%s' order by create_time desc LIMIT 1;"%(branch_id,DR_ID1))
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_out_xhrk1', DR_ID1, order_no1, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
......@@ -867,7 +867,7 @@ def check_mcms_psi_dept_XH_CK(type1=10,type2=16):
source_id = "-"
source_area_code = None
his_charge_no = get_id(
" select his_charge_no from his_order where branch_id='%s' and psi_dept_id='%s' order by create_time desc LIMIT 1;" % (
"select his_charge_no from his_order where branch_id='%s' and psi_dept_id='%s' order by create_time desc LIMIT 1;" % (
branch_id, DR_ID1))
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_out_xhrk2', DR_ID1, order_no1, target_corp_id,
......@@ -920,17 +920,25 @@ from a_b7流程十四退库业务_消耗退库 import sCan_grant,second_dept_con
try:
updateUserLoginDefaultRange(get_listUserMgrRangePage1(2)) # 设置登录账号默认权限是二级库
sCan_grant(1) # 低值扫码发放
time.sleep(8)
check_mcms_psi_dept_out_and_in(16,10)#检查出库单和入库单(包括主表和子表)
sCan_grant(3) # 试剂扫码发放
time.sleep(8)
check_mcms_psi_dept_out_and_in(66,67)#检查出库单和入库单(包括主表和子表)
second_dept_consume_Out_Stock(2) # 高值消耗出库
time.sleep(8)
second_dept_consume_in_Stock(2) # 高值消耗退货入库
time.sleep(8)
check_mcms_psi_dept_out_and_in(20, 20) #检查高值消耗出库单和消耗入库单包括主表和子表)
second_dept_consume_Out_Stock(1) # 低值消耗出库
time.sleep(8)
second_dept_consume_in_Stock(1) # 低值消耗退回入库
time.sleep(8)
check_mcms_psi_dept_XH_CK(10,10)#检查低值消耗出库单和消耗入库单包括主表和子表
second_dept_consume_Out_Stock(3) # 试剂消耗出库
time.sleep(8)
second_dept_consume_in_Stock(3) # 试剂消耗退回入库
time.sleep(8)
check_mcms_psi_dept_XH_CK(67, 67)#检查试剂消耗出库单和消耗入库单包括主表和子表
commonFuc().check_text_exist_result_text('SUCCESS', 'SUCCESS')
except Exception as e:
......
......@@ -331,7 +331,6 @@ def check_mcms_psi_dept_in(type1=16):
if type1 == 16:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID,type1,order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_tkrk1', DR_ID, order_no, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
......@@ -344,7 +343,6 @@ def check_mcms_psi_dept_in(type1=16):
elif type1 == 20:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID,type1,order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_tkrk2', DR_ID, order_no, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
......@@ -352,7 +350,6 @@ def check_mcms_psi_dept_in(type1=16):
source_dept_id, source_dept_name, source_stock_id, source_area_code,accounter,account_date,
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo,psiDeptInBillId,psiDeptInOrderNo
, create_user, create_time, last_modified, last_modified_user
)
else:
# 子表检查
......@@ -364,7 +361,6 @@ def check_mcms_psi_dept_in(type1=16):
source_dept_id, source_dept_name, source_stock_id, source_area_code,accounter,account_date,
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo,psiDeptInBillId,psiDeptInOrderNo
, create_user, create_time, last_modified, last_modified_user
)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
......
......@@ -5,6 +5,10 @@ import traceback
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from air_case.public1.public1.public1 import *
from common.db.sql.sql_del_branch_info import delData
from common.db.sql.sql_tools import check_mcms_dept_buy_sql, get_PICK_id, get_buyBillId, get_PICK_order_no, \
get_buyOrderNo, get_login_user_uxid_bydb, get_create_time, get_pick_detail_id, get_mdm_goods_code1, get_goods_code1, \
get_pkg_def_id, check_batch_id, check_barcode_id, check_mcms_pur_plan_sql, get_distrBillId, get_planBillId, \
get_planOrderNo, get_purOrderNo, get_purBillId, get_purBillDate2, get_distrOrderNo, get_DRID
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
......@@ -19,557 +23,455 @@ case_tag:api,b6_spd3_core_business_flow_database_check,a_b9流程十六退库业
python runner_test.py tag id2303-19 debug mdm3
"""
# 入库上架
def putaway():
module = "b5_spd3_core_business_flow"
updateUserLoginDefaultRange(get_listUserMgrRangePage1(1)) # 设置登录账号默认权限是一级库
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
# print(info)
username = info['username1']
password = commonFuc().get_business_data("b2_herp3_bs", "password")
# 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等信息,使用创建的用户登录============结束
# =====================上架入库列表查询==========================
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "stock_in_page_url")
print(url)
branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
hosId = branch_id[0:5]
request_body = commonFuc().get_business_data(module, "payload6", branch_id, hosId)
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
if total >= 1:
# 将上架入库列表数据写入文件
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, 'message16')
# =====================上架入库列表查询==========================
# =============查看验收单详情========================
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "stock_detail_url")
print('查看验收单详情',url)
deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
areaCode = FileUtils().r_info8('b2_herp3_bs', 'shelfinfo', 'message7')["shelfCode"]
branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
hosId = branch_id[0:5]
# 从message16文件中获取信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "上架入库列表数据", 'message16')
list_a = info['list_a']
print('list_a', list_a)
sourceId = 'sourceId'
sourceType='sourceType'
for i in list_a:
for j in i:
sourceId = j['sourceId']
sourceType = j["sourceType"]
break
request_body = commonFuc().get_business_data(module, "payload4_1", deptid1, areaCode, hosId, sourceId, sourceType)
print('request_body', 'd', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
targetDeptId =commonFuc().analysis_json('targetDeptId',commonFuc().analysis_json('data',result))
# 将验收单详情写入文件
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, 'b5_spd3_core_business_flow', '验收单库存详情信息', titlename, 'message17')
time.sleep(6)
# ============= # =============查看验收单详情================================================
# ================================入库上架===================
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "stock_detail_submit_url")
print(url)
viewId = 'viewId'
shelfCode = 'shelfCode'
sourceId = 'sourceId'
sourceVersion = '1'
targetDeptId = deptid1
targetDeptName = FileUtils().r_info8('b2_herp3_bs', '所有科室name', 'message6')["deptid1"]
targetAreaCode = FileUtils().r_info8('b2_herp3_bs', 'shelfinfo', 'message7')["shelfCode"]
targetAreaName = FileUtils().r_info8('b2_herp3_bs', 'shelfinfo', 'message7')["areaName"]
# 从message17文件中获取信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "验收单库存详情信息", 'message17')
# print('info', info)
list_a = info['list_a']
print('list_a', list_a)
for i in list_a:
print('i', i)
for j in i:
viewId = j["viewId"]
shelfCode = j['shelfCode']
sourceId = j['pid']
break
# # 从message16文件中获取信息
# info = FileUtils().r_info8('b5_spd3_core_business_flow', "上架入库列表数据", 'message16')
# list_a = info['list_a']
# print('list_a', list_a)
# for i in list_a:
# for j in i:
# sourceId = j['sourceId']
# targetAreaName = j['areaName']
# targetAreaCode = j['areaCode']
# break
request_body = commonFuc().get_business_data(module, "payload5", viewId, shelfCode, sourceId, sourceType,
sourceVersion, targetDeptId,
targetDeptName, targetAreaCode, targetAreaName)
print('request_body', request_body)
time.sleep(3)
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# ================================入库上架================================
def check_mcms_psi_dept_out(type1=16):
branch_id = get_branch_id()
sql = " select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type1)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
DR_ID = get_id(
" select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type1))
sql = "select order_no from mcms_psi_dept where id='%s';" % DR_ID
order_no = get_id(sql)
target_corp_id = get_hosid()
target_branch_id = get_branch_id()
target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
target_stock_id = get_stockId_fromdb(get_branch_name() + '中心库房')
target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 1)
PICK_id = get_PICK_id(branch_id, type1)
source_id = PICK_id
source_corp_id = get_hosid()
source_branch_id = get_branch_id()
source_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
source_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
source_stock_id = get_stockId_fromdb(source_dept_name + '库房')
source_area_code = get_stockAreaId_new_fromDb(source_dept_name, 2)
buyBillId = get_buyBillId(branch_id, type1)
pickOrderNo = get_PICK_order_no(branch_id, type1)
buyOrderNo = get_buyOrderNo(branch_id, type1)
pickBillId = get_PICK_id(branch_id, type1)
psiDeptOutBillId = DR_ID
psiDeptOutOrderNo = order_no
create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_time = get_create_time("select create_time from mcms_psi_dept where id='%s';" % DR_ID)
last_modified = get_create_time("select last_modified from mcms_psi_dept where id='%s';" % DR_ID)
last_modified_user = create_user
accounter = create_user
account_date = process_tuple(get_create_time("select account_date from mcms_psi_dept where id='%s';" % DR_ID))
if type1 == 16:
# 子表检查
check_mcms_psi_dept_batch(DR_ID, type1, order_no)
target_area_code = None
accounter = None
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_tkck1_1', DR_ID, order_no, target_corp_id,
target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter, account_date,
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo
, create_user, create_time, last_modified, last_modified_user
)
elif type1 == 20:
# 子表检查
check_mcms_psi_dept_batch(DR_ID, type1, order_no)
target_area_code = None
accounter = None
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_tkck1_2', DR_ID, order_no, target_corp_id,
target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter, account_date,
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo
, create_user, create_time, last_modified, last_modified_user)
else:
# 子表检查
check_mcms_psi_dept_batch(DR_ID, type1, order_no)
target_area_code = None
accounter = None
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_tkck1_3', DR_ID, order_no, target_corp_id,
target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter, account_date,
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo
, create_user, create_time, last_modified, last_modified_user
def second_dept_return_Out_Stock(type): # 二级库退库出库
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"))
)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
print(compare_text_index(actual_value2, expected_value2))
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
if type == 2:
udi_code = get_udi2(2,token) # 获取条码 低值1 高值2 试剂3
# 高值退库出库
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_pick_scan_url")
# 从message18文件中获取信息
info = FileUtils().r_info8(module, "条码信息", 'message18')
# print('info', info)
list_a = info['list_a']
stockId = commonFuc().analysis_json('stockId', list_a)
stockName = commonFuc().analysis_json('stockName', list_a)
areaCode = commonFuc().analysis_json('areaCode', list_a)
areaName = commonFuc().analysis_json('areaName', list_a)
deptId2= FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid2"]
targetDeptId= FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
deptName = get_branch_name()
targetStockId =get_stockId(deptName+'中心库房',1)
def check_mcms_psi_dept_batch(DR_ID, type, order_no):
branch_id = get_branch_id()
sql = " select * from mcms_psi_dept_batch where pid='%s';" % (
DR_ID)
actual = check_mcms_dept_buy_sql(sql)
print('actual', actual)
batch_main_key = get_id("select id from mcms_psi_dept_batch where pid='%s';" % DR_ID)
pid = DR_ID
# order_no = get_id("select order_no from mcms_psi_dept_batch where pid='%s';" % DR_ID)
source_detail_id = get_pick_detail_id(branch_id, type)
pick_detail_id = source_detail_id
request_body = commonFuc().get_business_data(module, "payload65", udi_code, stockId, deptId2,areaCode, areaName,
targetStockId,targetDeptId)
print('request_body',request_body)
result = commonFuc().http_post(url, request_body, headers)
print('退库出库扫码result',result)
# 获取必要信息
deptid2 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid2"]
if type == 16:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 20:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
mdm_goods_code = get_mdm_goods_code1(hos_goods_id)
goods_code = get_goods_code1(hos_goods_id)
pkg_def_id = get_pkg_def_id(hos_goods_id)
picker_name = FileUtils().r_info8("b2_herp3_bs", "用户名信息", 'message3')['username1']
picker = get_login_user_uxid_bydb(picker_name)
source_batch_id = get_id("select source_batch_id from mcms_psi_dept_batch where pid='%s';" % DR_ID)
target_batch_id = source_batch_id
if check_batch_id(source_batch_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist_result_text('error', 'succees')
barcode_id = get_id("select barcode_id from mcms_psi_dept_batch where pid='%s';" % DR_ID)
if check_barcode_id(barcode_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist_result_text('error', 'succees')
dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
shelf_code = get_stockAreaId_new_fromDb(dept_name, 2)
create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_time = get_create_time("select create_time from mcms_psi_dept_batch where pid='%s';" % DR_ID)
last_modified = get_create_time("select last_modified from mcms_psi_dept_batch where pid='%s';" % DR_ID)
last_modified_user = create_user
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_batch1', batch_main_key, pid, order_no, source_detail_id
, pick_detail_id, hos_goods_id, mdm_goods_code, goods_code,
source_batch_id,
target_batch_id, barcode_id, shelf_code, create_user, create_time,
last_modified,
last_modified_user)
elif type == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_batch2', batch_main_key, pid, order_no, source_detail_id
, pick_detail_id, hos_goods_id, mdm_goods_code, goods_code,
source_batch_id,
target_batch_id, barcode_id, shelf_code, create_user, create_time,
last_modified,
last_modified_user)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept_batch3_1', batch_main_key, pid, order_no,
source_detail_id
, pick_detail_id, hos_goods_id, mdm_goods_code, goods_code,
source_batch_id,
target_batch_id, barcode_id, shelf_code, create_user, create_time,
last_modified,
last_modified_user)
data1 = commonFuc().analysis_json('data', result)
areaCode = commonFuc().analysis_json('areaCode', data1)
UTid = commonFuc().analysis_json('id', data1)
createTime = commonFuc().analysis_json('id', data1)
stockId = commonFuc().analysis_json('stockId', data1)
areaCode = commonFuc().analysis_json('areaCode', data1)
areaName = commonFuc().analysis_json('areaName', data1)
shelfCode = commonFuc().analysis_json('shelfCode', data1)
codeType = commonFuc().analysis_json('codeType', data1)
tagType = commonFuc().analysis_json('tagType', data1)
hosGoodsId = commonFuc().analysis_json('hosGoodsId', data1)
mdmGoodsCode = commonFuc().analysis_json('mdmGoodsCode', data1)
goodsCode = commonFuc().analysis_json('goodsCode', data1)
goodsDi = commonFuc().analysis_json('goodsDi', data1)
barName = commonFuc().analysis_json('barName', data1)
batchCode = commonFuc().analysis_json('batchCode', data1)
expdtDate = commonFuc().analysis_json('expdtDate', data1)
productDate = commonFuc().analysis_json('productDate', data1)
pkgCode = commonFuc().analysis_json('pkgCode', data1)
pkgCodeSee = commonFuc().analysis_json('pkgCodeSee', data1)
ssccCode = commonFuc().analysis_json('ssccCode', data1)
tbStatus = commonFuc().analysis_json('tbStatus', data1)
ext = commonFuc().analysis_json('ext', data1)
distrDetailId = commonFuc().analysis_json('distrDetailId', ext)
distrBillId = commonFuc().analysis_json('distrBillId', ext)
purBillId = commonFuc().analysis_json('purBillId', ext)
pkgDefQty = commonFuc().analysis_json('pkgDefQty', ext)
pkgDefId = commonFuc().analysis_json('pkgDefId', ext)
pkgDefName = commonFuc().analysis_json('pkgDefName', ext)
purMode = commonFuc().analysis_json('purMode', data1)
goodsMfrsName = commonFuc().analysis_json('goodsMfrsName', data1)
goodsSpec = commonFuc().analysis_json('goodsSpec', data1)
unit = commonFuc().analysis_json('unit', data1)
goodsName = commonFuc().analysis_json('goodsName', data1)
pkgDefId = commonFuc().analysis_json('pkgDefId', data1)
# pkgDefQty=commonFuc().analysis_json('pkgDefQty',data1)
pkgDefName = commonFuc().analysis_json('pkgDefName', data1)
printNum = commonFuc().analysis_json('printNum', data1)
made = commonFuc().analysis_json('made', data1)
hosGoodsCode = commonFuc().analysis_json('hosGoodsCode', data1)
sourceId = commonFuc().analysis_json('sourceId', data1)
price = commonFuc().analysis_json('price', data1)
purModeText = commonFuc().analysis_json('purModeText', data1)
version = commonFuc().analysis_json('version', data1)
unitName = commonFuc().analysis_json('unitName', data1)
# ==============================获取条码信息
# 从message18文件中获取信息
info = FileUtils().r_info8(module, "条码信息", 'message18')
# print('info', info)
list_a = info['list_a']
extInfo = commonFuc().analysis_json('extInfo', list_a)
print('extInfo', extInfo)
# inStockTime = commonFuc().analysis_json('inStockTime', extInfo)
inStockTime = reGetString(extInfo, r'inStockTime": "', r'", "')
print('inStockTime', inStockTime)
# import pdb
# pdb.set_trace()
# 从message18文件中获取信息
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"dept_stock_out_submit_url")
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
print(compare_text_index(actual_value2, expected_value2))
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
deptName2 = FileUtils().r_info8('b2_herp3_bs', '所有科室name', 'message6')["deptid2"]
stockName2 = deptName2 + "库房"
createTime = timeUtils().get_time_hms(1)
request_body = "request_body"
mgrCorpName = get_hosname()
mgrRangeId = deptid2
mgrRangeName = deptName2
extStr1 = get_branch_name()
extStr3 = get_branch_name()
snCode = UTid
userLoginCode = username
cname = username
orgCode1 = get_orgCode()
orgName1 = get_orgName()
# print(orgCode1, orgName1)
# import pdb
# pdb.set_trace()
def check_mcms_psi_in(type=1):
print('检查中心库入库单')
if type == 1:
bill_mode = 16
elif type == 2:
bill_mode = 20
else:
bill_mode = 66
branch_id = get_branch_id()
sql = "select * from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
sql = "select id from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
id = get_id(sql)
sql = "select order_no from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
order_no = get_id(sql)
target_corp_id = get_hosid()
target_branch_id = get_branch_id()
target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
stock_name = get_branch_name() + "中心库房"
target_stock_id = get_stockId_fromdb(stock_name)
target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 1)
source_id = get_DRID(branch_id, bill_mode)
source_no = None
source_repl_id = None
source_corp_id = get_hosid()
source_branch_id = get_branch_id()
source_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
source_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
source_stock_id = get_stockId_fromdb(source_dept_name + '库房')
source_area_code = get_stockAreaId_new_fromDb(source_dept_name, 2)
accounter = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
account_date = get_create_time("select account_date from mcms_psi where id='%s';" % id)
request_body = commonFuc().get_business_data(module, "payload50_2_3", stockId, deptId2, areaCode,
areaName,targetStockId,targetDeptId,
uxid, userLoginCode, cname, get_hosid(), get_branch_id(),
deptid1,
orgCode1, orgName1, get_hosid(), get_hosid(), mgrCorpName,
get_branch_id(),
get_branch_name(), mgrRangeId, mgrRangeName, extStr1, extStr3,
get_hosid(), stockId,deptId2,
areaCode, areaName, targetStockId, targetDeptId, UTid,createTime,snCode,
get_hosid(), stockId, areaCode, areaName, shelfCode,
codeType, hosGoodsId, mdmGoodsCode, goodsCode, goodsDi,
barName,
batchCode, expdtDate, productDate, pkgCode, pkgCodeSee,
ssccCode,
tbStatus, purBillId,
distrBillId,
inStockTime, distrDetailId, purMode, price, goodsMfrsName,
goodsSpec, unit, goodsName,made, unitName,
hosGoodsCode, purModeText)
print('request_body', '高值退库出库', request_body)
# import pdb
# pdb.set_trace()
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
elif type == 1:
print('低值耗材或者试剂退库出库')
udi_code = get_udi2(1,token) # 获取条码 低值1 高值2 试剂3
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_pick_scan_url")
# 从message18文件中获取信息
info = FileUtils().r_info8(module, "条码信息", 'message18')
# print('info', info)
list_a = info['list_a']
stockId = commonFuc().analysis_json('stockId', list_a)
stockName = commonFuc().analysis_json('stockName', list_a)
areaCode = commonFuc().analysis_json('areaCode', list_a)
areaName = commonFuc().analysis_json('areaName', list_a)
deptId2 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid2"]
targetDeptId = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
deptName = get_branch_name()
targetStockId = get_stockId(deptName + '中心库房', 1)
request_body = commonFuc().get_business_data(module, "payload65", udi_code, stockId, deptId2, areaCode,
areaName,
targetStockId, targetDeptId)
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('退库出库扫码result', result)
# 获取必要信息
deptid2 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid2"]
data1 = commonFuc().analysis_json('data', result)
areaCode = commonFuc().analysis_json('areaCode', data1)
UTid = commonFuc().analysis_json('id', data1)
createTime = commonFuc().analysis_json('id', data1)
stockId = commonFuc().analysis_json('stockId', data1)
areaCode = commonFuc().analysis_json('areaCode', data1)
areaName = commonFuc().analysis_json('areaName', data1)
shelfCode = commonFuc().analysis_json('shelfCode', data1)
codeType = commonFuc().analysis_json('codeType', data1)
tagType = commonFuc().analysis_json('tagType', data1)
hosGoodsId = commonFuc().analysis_json('hosGoodsId', data1)
mdmGoodsCode = commonFuc().analysis_json('mdmGoodsCode', data1)
goodsCode = commonFuc().analysis_json('goodsCode', data1)
goodsDi = commonFuc().analysis_json('goodsDi', data1)
barName = commonFuc().analysis_json('barName', data1)
batchCode = commonFuc().analysis_json('batchCode', data1)
expdtDate = commonFuc().analysis_json('expdtDate', data1)
productDate = commonFuc().analysis_json('productDate', data1)
pkgCode = commonFuc().analysis_json('pkgCode', data1)
pkgCodeSee = commonFuc().analysis_json('pkgCodeSee', data1)
ssccCode = commonFuc().analysis_json('ssccCode', data1)
tbStatus = commonFuc().analysis_json('tbStatus', data1)
ext = commonFuc().analysis_json('ext', data1)
distrDetailId = commonFuc().analysis_json('distrDetailId', ext)
distrBillId = commonFuc().analysis_json('distrBillId', ext)
purBillId = commonFuc().analysis_json('purBillId', ext)
pkgDefQty = commonFuc().analysis_json('pkgDefQty', ext)
pkgDefId = commonFuc().analysis_json('pkgDefId', ext)
pkgDefName = commonFuc().analysis_json('pkgDefName', ext)
purMode = commonFuc().analysis_json('purMode', data1)
goodsMfrsName = commonFuc().analysis_json('goodsMfrsName', data1)
goodsSpec = commonFuc().analysis_json('goodsSpec', data1)
unit = commonFuc().analysis_json('unit', data1)
goodsName = commonFuc().analysis_json('goodsName', data1)
pkgDefId = commonFuc().analysis_json('pkgDefId', data1)
# pkgDefQty=commonFuc().analysis_json('pkgDefQty',data1)
pkgDefName = commonFuc().analysis_json('pkgDefName', data1)
printNum = commonFuc().analysis_json('printNum', data1)
made = commonFuc().analysis_json('made', data1)
hosGoodsCode = commonFuc().analysis_json('hosGoodsCode', data1)
sourceId = commonFuc().analysis_json('sourceId', data1)
price = commonFuc().analysis_json('price', data1)
purModeText = commonFuc().analysis_json('purModeText', data1)
version = commonFuc().analysis_json('version', data1)
unitName = commonFuc().analysis_json('unitName', data1)
# ==============================获取条码信息
# 从message18文件中获取信息
info = FileUtils().r_info8(module, "条码信息", 'message18')
# print('info', info)
list_a = info['list_a']
extInfo = commonFuc().analysis_json('extInfo', list_a)
print('extInfo', extInfo)
# inStockTime = commonFuc().analysis_json('inStockTime', extInfo)
inStockTime = reGetString(extInfo, 'inStockTime\"\: \"', '\"\, \"distrDetailId')
print('inStockTime', inStockTime)
# 从message18文件中获取信息
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"dept_stock_out_submit_url")
deptid2 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid2"]
deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
deptName2 = FileUtils().r_info8('b2_herp3_bs', '所有科室name', 'message6')["deptid2"]
stockName2 = deptName2 + "库房"
createTime = timeUtils().get_time_hms(1)
request_body = "request_body"
mgrCorpName = get_hosname()
mgrRangeId = deptid2
mgrRangeName = deptName2
extStr1 = get_branch_name()
extStr3 = get_branch_name()
snCode = UTid
userLoginCode = username
cname = username
orgCode1 = get_orgCode()
orgName1 = get_orgName()
buyBillId = get_buyBillId(branch_id, bill_mode)
if type == 1:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 2:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
pickOrderNo = get_PICK_order_no(branch_id, bill_mode)
pickBillId = get_PICK_id(branch_id, bill_mode)
planBillId = get_planBillId(hos_goods_id)
psiDeptOutBillId = get_id(
"select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode))
psiDeptOutOrderNo = get_id(
"select order_no from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_TK' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode))
psiInBillId = id
psiInOrderNo = order_no
buyOrderNo = get_buyOrderNo(branch_id, bill_mode)
purOrderNo = get_purOrderNo(branch_id, bill_mode)
purBillId = get_purBillId(branch_id, bill_mode)
bill_relation_json = get_purBillDate2(branch_id, bill_mode)
purBillDate = reGetString(bill_relation_json, r'purBillDate":"', r'""distrBillId')
distrBillId = get_distrBillId(branch_id, bill_mode)
distrOrderNo = get_distrOrderNo(branch_id, bill_mode)
checkBillId = source_id
sql = "select order_no from mcms_check where id='%s';" % checkBillId
checkOrderNo = get_id(sql)
psiInBillId = id
psiInOrderNo = order_no
create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_time = get_create_time("select create_time from mcms_psi where id='%s';" % id)
last_modified = get_create_time("select last_modified from mcms_psi where id='%s';" % id)
last_modified_user = create_user
if type == 1:
# 检查子表
check_mcms_psi_batch_in(id, type, order_no, source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi1_1', id,
order_no, target_corp_id, target_branch_id, target_dept_id,
target_dept_name, target_stock_id
, target_area_code, source_id, source_no, source_repl_id,
source_corp_id, source_branch_id, source_dept_id, source_dept_name
, source_stock_id, source_area_code, accounter, account_date,
pickOrderNo, pickBillId,
psiDeptOutBillId, psiDeptOutOrderNo, psiInBillId, psiInOrderNo,
create_user
, create_time, last_modified, last_modified_user)
elif type == 2:
check_mcms_psi_batch_in(id, type, order_no, source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi1_2', id,
order_no, target_corp_id, target_branch_id, target_dept_id,
target_dept_name, target_stock_id
, target_area_code, source_id, source_no, source_repl_id,
source_corp_id, source_branch_id, source_dept_id, source_dept_name
, source_stock_id, source_area_code, accounter, account_date,
pickOrderNo, pickBillId,
psiDeptOutBillId, psiDeptOutOrderNo, psiInBillId, psiInOrderNo,
create_user
, create_time, last_modified, last_modified_user)
else:
check_mcms_psi_batch_in(id, type, order_no, source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi1_3', id,
order_no, target_corp_id, target_branch_id, target_dept_id,
target_dept_name, target_stock_id
, target_area_code, source_id, source_no, source_repl_id,
source_corp_id, source_branch_id, source_dept_id, source_dept_name
, source_stock_id, source_area_code, accounter, account_date,
pickOrderNo, pickBillId,
psiDeptOutBillId, psiDeptOutOrderNo, psiInBillId, psiInOrderNo,
create_user
, create_time, last_modified, last_modified_user)
# 对比预期值和实际值是否一致
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
result = (compare_text_index(actual_value2, expected_value2))
print('result', result)
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
request_body = commonFuc().get_business_data(module, "payload50_2_4", stockId, deptId2, areaCode,
areaName,targetStockId,targetDeptId,
uxid, userLoginCode, cname, get_hosid(), get_branch_id(),
deptid1,
orgCode1, orgName1, get_hosid(), get_hosid(), mgrCorpName,
get_branch_id(),
get_branch_name(), mgrRangeId, mgrRangeName, extStr1, extStr3,
get_hosid(), stockId,deptId2,
areaCode, areaName, targetStockId, targetDeptId, UTid,createTime,snCode,
get_hosid(), stockId, areaCode, areaName, shelfCode,
codeType, hosGoodsId, mdmGoodsCode, goodsCode, goodsDi,
barName,
batchCode, expdtDate, productDate, pkgCode, pkgCodeSee,
ssccCode,
tbStatus, pkgDefId,purBillId,
distrBillId,
inStockTime, distrDetailId,purMode, price, goodsMfrsName,
goodsSpec, unit, goodsName,pkgDefId,pkgDefName,made, unitName,
hosGoodsCode, purModeText)
print('request_body', request_body)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('低值产品退库出库,result', result)
elif type == 3:
print('试剂产品退库出库')
udi_code = get_udi2(3,token) # 获取条码 低值1 高值2 试剂3
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_pick_scan_url")
# 从message18文件中获取信息
info = FileUtils().r_info8(module, "条码信息", 'message18')
# print('info', info)
list_a = info['list_a']
stockId = commonFuc().analysis_json('stockId', list_a)
stockName = commonFuc().analysis_json('stockName', list_a)
areaCode = commonFuc().analysis_json('areaCode', list_a)
areaName = commonFuc().analysis_json('areaName', list_a)
deptId2 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid2"]
targetDeptId = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
deptName = get_branch_name()
targetStockId = get_stockId(deptName + '中心库房', 1)
def check_mcms_psi_batch_in(DR_ID, type, order_no, source_id1):
if type == 1:
bill_mode = 16
elif type == 2:
bill_mode = 20
else:
bill_mode = 66
branch_id = get_branch_id()
sql = " select * from mcms_psi_batch where pid='%s';" % (
DR_ID)
actual = check_mcms_dept_buy_sql(sql)
print('actual', actual)
batch_main_key = get_id("select id from mcms_psi_batch where pid='%s';" % DR_ID)
pid = DR_ID
# order_no = get_id("select order_no from mcms_psi_dept_batch where pid='%s';" % DR_ID)
source_detail_id = source_id1 + '0001'
pick_detail_id = None
if type == 1:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 2:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
mdm_goods_code = get_mdm_goods_code1(hos_goods_id)
goods_code = get_goods_code1(hos_goods_id)
pkg_def_id = get_pkg_def_id(hos_goods_id)
picker_name = FileUtils().r_info8("b2_herp3_bs", "用户名信息", 'message3')['username1']
picker = get_login_user_uxid_bydb(picker_name)
source_batch_id = get_id("select source_batch_id from mcms_psi_batch where pid='%s';" % DR_ID)
distrBillId = get_distrBillId(branch_id, bill_mode)
target_batch_id = source_batch_id
if check_batch_id(source_batch_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist_result_text('error', 'succees')
barcode_id = get_id("select barcode_id from mcms_psi_batch where pid='%s';" % DR_ID)
if check_barcode_id(barcode_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist_result_text('error', 'succees')
dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
shelf_code = get_stockAreaId_new_fromDb(get_branch_name(), 1)
create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_time = get_create_time("select create_time from mcms_psi_batch where pid='%s';" % DR_ID)
last_modified = get_create_time("select last_modified from mcms_psi_batch where pid='%s';" % DR_ID)
last_modified_user = None
if type == 1:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_batch_in1_1', batch_main_key, pid, order_no, source_detail_id
, hos_goods_id, mdm_goods_code, goods_code, source_batch_id,
target_batch_id, barcode_id, shelf_code, create_user, create_time,
last_modified, last_modified_user
request_body = commonFuc().get_business_data(module, "payload65", udi_code, stockId, deptId2, areaCode,
areaName,
targetStockId, targetDeptId)
print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('退库出库扫码result', result)
)
elif type == 2:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_batch_in1_2', batch_main_key, pid, order_no, source_detail_id
, hos_goods_id, mdm_goods_code, goods_code, source_batch_id,
target_batch_id, barcode_id, shelf_code, create_user, create_time,
last_modified, last_modified_user
# 获取必要信息
deptid2 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid2"]
data1 = commonFuc().analysis_json('data', result)
areaCode = commonFuc().analysis_json('areaCode', data1)
UTid = commonFuc().analysis_json('id', data1)
createTime = commonFuc().analysis_json('id', data1)
stockId = commonFuc().analysis_json('stockId', data1)
areaCode = commonFuc().analysis_json('areaCode', data1)
areaName = commonFuc().analysis_json('areaName', data1)
shelfCode = commonFuc().analysis_json('shelfCode', data1)
codeType = commonFuc().analysis_json('codeType', data1)
tagType = commonFuc().analysis_json('tagType', data1)
hosGoodsId = commonFuc().analysis_json('hosGoodsId', data1)
mdmGoodsCode = commonFuc().analysis_json('mdmGoodsCode', data1)
goodsCode = commonFuc().analysis_json('goodsCode', data1)
goodsDi = commonFuc().analysis_json('goodsDi', data1)
barName = commonFuc().analysis_json('barName', data1)
batchCode = commonFuc().analysis_json('batchCode', data1)
expdtDate = commonFuc().analysis_json('expdtDate', data1)
productDate = commonFuc().analysis_json('productDate', data1)
pkgCode = commonFuc().analysis_json('pkgCode', data1)
pkgCodeSee = commonFuc().analysis_json('pkgCodeSee', data1)
ssccCode = commonFuc().analysis_json('ssccCode', data1)
tbStatus = commonFuc().analysis_json('tbStatus', data1)
ext = commonFuc().analysis_json('ext', data1)
distrDetailId = commonFuc().analysis_json('distrDetailId', ext)
distrBillId = commonFuc().analysis_json('distrBillId', ext)
purBillId = commonFuc().analysis_json('purBillId', ext)
pkgDefQty = commonFuc().analysis_json('pkgDefQty', ext)
pkgDefId = commonFuc().analysis_json('pkgDefId', ext)
pkgDefName = commonFuc().analysis_json('pkgDefName', ext)
purMode = commonFuc().analysis_json('purMode', data1)
goodsMfrsName = commonFuc().analysis_json('goodsMfrsName', data1)
goodsSpec = commonFuc().analysis_json('goodsSpec', data1)
unit = commonFuc().analysis_json('unit', data1)
goodsName = commonFuc().analysis_json('goodsName', data1)
pkgDefId = commonFuc().analysis_json('pkgDefId', data1)
# pkgDefQty=commonFuc().analysis_json('pkgDefQty',data1)
pkgDefName = commonFuc().analysis_json('pkgDefName', data1)
printNum = commonFuc().analysis_json('printNum', data1)
made = commonFuc().analysis_json('made', data1)
hosGoodsCode = commonFuc().analysis_json('hosGoodsCode', data1)
sourceId = commonFuc().analysis_json('sourceId', data1)
price = commonFuc().analysis_json('price', data1)
purModeText = commonFuc().analysis_json('purModeText', data1)
version = commonFuc().analysis_json('version', data1)
unitName = commonFuc().analysis_json('unitName', data1)
# ==============================获取条码信息
# 从message18文件中获取信息
info = FileUtils().r_info8(module, "条码信息", 'message18')
# print('info', info)
list_a = info['list_a']
extInfo = commonFuc().analysis_json('extInfo', list_a)
print('extInfo', extInfo)
# inStockTime = commonFuc().analysis_json('inStockTime', extInfo)
inStockTime = reGetString(extInfo, 'inStockTime\"\: \"', '\"\, \"distrDetailId')
print('inStockTime', inStockTime)
# 从message18文件中获取信息
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"dept_stock_out_submit_url")
)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_batch_in1_3', batch_main_key, pid, order_no, source_detail_id
, hos_goods_id, mdm_goods_code, goods_code, source_batch_id,
target_batch_id, barcode_id, shelf_code, create_user, create_time,
last_modified, last_modified_user
deptid2 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid2"]
deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
deptName2 = FileUtils().r_info8('b2_herp3_bs', '所有科室name', 'message6')["deptid2"]
stockName2 = deptName2 + "库房"
createTime = timeUtils().get_time_hms(1)
request_body = "request_body"
mgrCorpName = get_hosname()
mgrRangeId = deptid2
mgrRangeName = deptName2
extStr1 = get_branch_name()
extStr3 = get_branch_name()
snCode = UTid
userLoginCode = username
cname = username
orgCode1 = get_orgCode()
orgName1 = get_orgName()
)
request_body = commonFuc().get_business_data(module, "payload50_2_4", stockId, deptId2, areaCode,
areaName, targetStockId, targetDeptId,
uxid, userLoginCode, cname, get_hosid(), get_branch_id(),
deptid1,
orgCode1, orgName1, get_hosid(), get_hosid(), mgrCorpName,
get_branch_id(),
get_branch_name(), mgrRangeId, mgrRangeName, extStr1, extStr3,
get_hosid(), stockId, deptId2,
areaCode, areaName, targetStockId, targetDeptId, UTid, createTime,
snCode,
get_hosid(), stockId, areaCode, areaName, shelfCode,
codeType, hosGoodsId, mdmGoodsCode, goodsCode, goodsDi,
barName,
batchCode, expdtDate, productDate, pkgCode, pkgCodeSee,
ssccCode,
tbStatus, pkgDefId, purBillId,
distrBillId,
inStockTime, distrDetailId, purMode, price, goodsMfrsName,
goodsSpec, unit, goodsName, pkgDefId, pkgDefName, made, unitName,
hosGoodsCode, purModeText)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
print(compare_text_index(actual_value2, expected_value2))
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
print('request_body', request_body)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('试剂产品退库出库,result', result)
pro_path = commonFuc().get_pro_path2()
print('pro_path', pro_path)
sys.path.append(pro_path + r'/air_case/b5_spd3_core_business_flow/a_b9流程十六退库业务_二级库向一级库退库.air')
using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_b9流程十六退库业务_二级库向一级库退库.air')
from a_b9流程十六退库业务_二级库向一级库退库 import second_dept_return_Out_Stock, putaway
try:
updateUserLoginDefaultRange(get_listUserMgrRangePage1(2))#设置登录账号默认权限是二级库
second_dept_return_Out_Stock(2)#高值耗材退货出库
time.sleep(6)
check_mcms_psi_dept_out(20)#检查出库单数据库数据
approval_center()#审批
putaway()#中心库上架
updateUserLoginDefaultRange(get_listUserMgrRangePage1(2))#设置登录账号默认权限是二级库
second_dept_return_Out_Stock(1)#低值耗材退货出库
time.sleep(6)
check_mcms_psi_in(2) # 检查中心库入库单数据库数据
updateUserLoginDefaultRange(get_listUserMgrRangePage1(2)) # 设置登录账号默认权限是二级库
second_dept_return_Out_Stock(1) # 低值耗材退货出库
time.sleep(6)
check_mcms_psi_dept_out(16) # 检查出库单数据库数据
approval_center() # 审批
putaway() # 中心库上架
updateUserLoginDefaultRange(get_listUserMgrRangePage1(2))#设置登录账号默认权限是二级库
second_dept_return_Out_Stock(3)#试剂耗材退货出库
approval_center()#审批
putaway()#中心库上架
time.sleep(6)
check_mcms_psi_in(1) # 检查中心库入库单数据库数据
updateUserLoginDefaultRange(get_listUserMgrRangePage1(2)) # 设置登录账号默认权限是二级库
second_dept_return_Out_Stock(3) #试剂耗材退货出库
check_mcms_psi_dept_out(66) # 检查出库单数据库数据
approval_center() # 审批
putaway() # 中心库上架
time.sleep(6)
check_mcms_psi_in(3) # 检查中心库入库单数据库数据
# ===============上面调通了================================
commonFuc().check_text_exist_result_text('succees', 'succees')
except Exception as e:
# 打印错误信息
print(f"发生错误: {e}")
commonFuc().check_text_exist_result_text('error', 'SUCCESS')
\ No newline at end of file
commonFuc().check_text_exist_result_text('error', 'SUCCESS')
......@@ -5,6 +5,10 @@ import traceback
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from air_case.public1.public1.public1 import *
from common.db.sql.sql_del_branch_info import delData
from common.db.sql.sql_tools import check_mcms_pur_plan_sql, get_DRID, get_login_user_uxid_bydb, get_create_time, \
get_buyBillId, get_PICK_order_no, get_PICK_id, get_planBillId, get_buyOrderNo, get_purOrderNo, get_purBillId, \
get_purBillDate2, get_distrBillId, get_distrOrderNo, get_mdm_goods_code1, get_goods_code1, get_pkg_def_id, \
check_mcms_dept_buy_sql, check_batch_id, check_barcode_id, get_pick_detail_id, get_expdt_date
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
......@@ -20,620 +24,400 @@ python runner_test.py tag id2303-20 debug mdm3
"""
def check_mcms_psi_out(type=1):
print('检查中心库出库单')
if type == 1:
bill_mode = 16
elif type == 2:
bill_mode = 20
else:
bill_mode = 66
branch_id = get_branch_id()
sql = "select * from mcms_psi where source_branch_id='%s' and bill_mode='%s' and stock_kind='CK_TH' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
sql = "select id from mcms_psi where source_branch_id='%s' and bill_mode='%s' and stock_kind='CK_TH' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
id = get_id(sql)
sql = "select order_no from mcms_psi where source_branch_id='%s' and bill_mode='%s' and stock_kind='CK_TH' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
order_no = get_id(sql)
target_corp_id = get_hosid()
target_branch_id =None
target_dept_id = FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_corpId']
target_dept_name = FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username']
stock_name = get_branch_name() + "中心库房"
target_stock_id =target_dept_id
target_area_code =None
source_id = get_PICK_id(branch_id, bill_mode)
source_no = None
source_repl_id = None
source_corp_id = get_hosid()
source_branch_id = get_branch_id()
source_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
source_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
source_stock_id = get_stockId_fromdb(get_branch_name()+'中心库房')
source_area_code = get_stockAreaId_new_fromDb(source_dept_name, 1)
accounter = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
account_date = get_create_time("select account_date from mcms_psi where id='%s';" % id)
buyBillId = get_buyBillId(branch_id, bill_mode)
if type == 1:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 2:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
pickOrderNo = get_PICK_order_no(branch_id, bill_mode)
pickBillId = get_PICK_id(branch_id, bill_mode)
planBillId = get_planBillId(hos_goods_id)
psiOutBillId = id
psiOutOrderNo =order_no
buyOrderNo = get_buyOrderNo(branch_id, bill_mode)
purOrderNo = get_purOrderNo(branch_id, bill_mode)
purBillId = get_purBillId(branch_id, bill_mode)
bill_relation_json = get_purBillDate2(branch_id, bill_mode)
purBillDate = reGetString(bill_relation_json, r'purBillDate":"', r'""distrBillId')
distrBillId = get_distrBillId(branch_id, bill_mode)
distrOrderNo = get_distrOrderNo(branch_id, bill_mode)
checkBillId = source_id
sql = "select order_no from mcms_check where id='%s';" % checkBillId
checkOrderNo = get_id(sql)
psiInBillId = id
psiInOrderNo = order_no
create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_time = get_create_time("select create_time from mcms_psi where id='%s';" % id)
last_modified = get_create_time("select last_modified from mcms_psi where id='%s';" % id)
last_modified_user = create_user
if type == 1:
# 检查子表
check_mcms_psi_batch_out(id, type, order_no, source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi_out_1_1', id,
order_no, target_corp_id, target_branch_id, target_dept_id,
target_dept_name, target_stock_id
, target_area_code, source_id, source_no, source_repl_id,
source_corp_id, source_branch_id, source_dept_id, source_dept_name
, source_stock_id, source_area_code, accounter, account_date,
pickOrderNo, pickBillId,
psiOutBillId, psiOutOrderNo,
create_user
, create_time, last_modified, last_modified_user)
elif type == 2:
check_mcms_psi_batch_out(id, type, order_no, source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi_out_1_2', id,
order_no, target_corp_id, target_branch_id, target_dept_id,
target_dept_name, target_stock_id
, target_area_code, source_id, source_no, source_repl_id,
source_corp_id, source_branch_id, source_dept_id, source_dept_name
, source_stock_id, source_area_code, accounter, account_date,
pickOrderNo, pickBillId,
psiOutBillId, psiOutOrderNo,
create_user
, create_time, last_modified, last_modified_user)
else:
check_mcms_psi_batch_out(id, type, order_no, source_id)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi_out_1_3', id,
order_no, target_corp_id, target_branch_id, target_dept_id,
target_dept_name, target_stock_id
, target_area_code, source_id, source_no, source_repl_id,
source_corp_id, source_branch_id, source_dept_id, source_dept_name
, source_stock_id, source_area_code, accounter, account_date,
pickOrderNo, pickBillId,
psiOutBillId, psiOutOrderNo,
create_user
, create_time, last_modified, last_modified_user)
# 对比预期值和实际值是否一致
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
result = (compare_text_index(actual_value2, expected_value2))
print('result', result)
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def second_center_Stock_return_Out(type): # 中心库退供应商
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"))
def check_mcms_psi_batch_out(DR_ID, type, order_no, source_id1):
if type == 1:
bill_mode = 16
elif type == 2:
bill_mode = 20
else:
bill_mode = 66
branch_id = get_branch_id()
sql = " select * from mcms_psi_batch where pid='%s';" % (
DR_ID)
actual = check_mcms_dept_buy_sql(sql)
print('actual', actual)
batch_main_key = get_id("select id from mcms_psi_batch where pid='%s';" % DR_ID)
pid = DR_ID
# order_no = get_id("select order_no from mcms_psi_dept_batch where pid='%s';" % DR_ID)
source_detail_id = get_pick_detail_id(branch_id,bill_mode)
pick_detail_id = source_detail_id
if type == 1:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 2:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
mdm_goods_code = get_mdm_goods_code1(hos_goods_id)
goods_code = get_goods_code1(hos_goods_id)
pkg_def_id = get_pkg_def_id(hos_goods_id)
picker_name = FileUtils().r_info8("b2_herp3_bs", "用户名信息", 'message3')['username1']
picker = get_login_user_uxid_bydb(picker_name)
source_batch_id = get_id("select source_batch_id from mcms_psi_batch where pid='%s';" % DR_ID)
distrBillId = get_distrBillId(branch_id, bill_mode)
target_batch_id = source_batch_id
if check_batch_id(source_batch_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist_result_text('error', 'succees')
barcode_id = get_id("select barcode_id from mcms_psi_batch where pid='%s';" % DR_ID)
if check_barcode_id(barcode_id) == True:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
commonFuc().check_text_exist_result_text('error', 'succees')
dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
shelf_code = get_stockAreaId_new_fromDb(get_branch_name(), 1)
create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_time = get_create_time("select create_time from mcms_psi_batch where pid='%s';" % DR_ID)
last_modified = get_create_time("select last_modified from mcms_psi_batch where pid='%s';" % DR_ID)
last_modified_user = create_user
if type == 1:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_batch_out1_1', batch_main_key, pid, order_no, source_detail_id
, hos_goods_id, mdm_goods_code, goods_code, source_batch_id,pick_detail_id,
target_batch_id, barcode_id, shelf_code, create_user, create_time,
last_modified, last_modified_user
if type == 2:#高值退货出库
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等信息,使用创建的用户登录============结束
# 到库房明细查询,查询产品的udi码
get_udi(2)
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_pick_submit_url")
print('url', 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"))
# 从文件中获取必要信息
info = FileUtils().r_info8(module, "条码信息", 'message18')
# print('info', info)
list_a = info['list_a']
# print('list_a', list_a[0], type(list_a), len(list_a))
UTid = 'UT'
areaCode = 'areaCode'
createTime = 'createTime'
hosId = 'hosId'
stockId = 'stockId'
areaCode = 'areaCode'
areaName = 'areaName'
shelfCode = 'shelfCode'
codeType = 'codeType'
tagType = 'tagType'
hosGoodsId = 'hosGoodsId'
mdmGoodsCode = 'mdmGoodsCode'
goodsCode = 'goodsCode'
goodsDi = 'goodsDi'
barName = 'barName'
batchCode = 'batchCode'
expdtDate = 'expdtDate'
productDate = 'productDate'
pkgCode = 'pkgCode'
pkgCodeSee='pkgCodeSee'
ssccCode='ssccCode'
tbStatus='tbStatus'
pkgDefQty='pkgDefQty'
purBillId='purBillId'
distrBillId='distrBillId'
inStockTime='inStockTime'
distrDetailId='distrDetailId'
purMode='purMode'
goodsMfrsName='goodsMfrsName'
goodsSpec='goodsSpec'
unit='unit'
goodsName='goodsName'
printNum='printNum'
made='made'
provId='provId'
provName='provName'
subProvId='subProvId'
subProvName='subProvName'
hosGoodsCode='hosGoodsCode'
subSendFlag='subSendFlag'
onlyKey='onlyKey'
pkgDefId='pkgDefId'
pkgDefName='pkgDefName'
print('aaaaaaaaaaaaaaaaaaaaaaaaa', list_a[0])
list_b = list_a[0]
for i in list_b:
print(i)
UTid = i['id']
areaCode = i['areaCode']
createTime = i['createTime']
hosId = i['hosId']
stockId = i['stockId']
areaCode = i['areaCode']
areaName = i['areaName']
shelfCode = i['shelfCode']
codeType = i['codeType']
tagType = i['tagType']
hosGoodsId = i['hosGoodsId']
mdmGoodsCode = i['mdmGoodsCode']
goodsCode = i['goodsCode']
goodsDi = i['goodsDi']
barName = i['barName']
batchCode = i['batchCode']
expdtDate = i['expdtDate']
productDate = i['productDate']
pkgCode = i['pkgCode']
pkgCodeSee = i['pkgCodeSee']
ssccCode = i['ssccCode']
tbStatus = i['tbStatus']
onlyKey = i['hosGoodsId']
ext = i['ext']
print('ext', ext)
distrDetailId = ext['distrDetailId']
distrBillId = ext['distrBillId']
purBillId = ext['purBillId']
pkgDefQty = ext['pkgDefQty']
# pkgDefId = ext['pkgDefId']
# pkgDefName = ext['pkgDefName']
purMode = i['purMode']
goodsMfrsName = i['goodsMfrsName']
goodsSpec = i['goodsSpec']
unit = i['unit']
goodsName = i['goodsName']
pkgDefId = i['pkgDefId']
# pkgDefQty = i['pkgDefQty']
pkgDefName = i['pkgDefName']
printNum = i['printNum']
made = i['made']
provId = i['provId']
provName = i['provName']
subProvId = i['subProvId']
subProvName = i['subProvName']
hosGoodsCode = i['hosGoodsCode']
subSendFlag = i['subSendFlag']
areaName = i['areaName']
hosId = i['hosId']
inStockTime=i['inStockTime']
break
# pkgDefQty=1
deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
deptName = FileUtils().r_info8('b2_herp3_bs', '所有科室name', 'message6')["deptid1"]
# # 请求体
request_body = commonFuc().get_business_data(module, "payload66", areaCode, UTid, createTime, UTid, hosId,
stockId,
areaCode, areaName, shelfCode, codeType, tagType, hosGoodsId,
mdmGoodsCode, goodsCode, goodsDi, barName, batchCode, expdtDate,
productDate, pkgCode, pkgCodeSee, ssccCode, tbStatus,pkgDefQty,
purBillId,distrBillId,inStockTime,distrDetailId,
purMode,
goodsMfrsName, goodsSpec, unit, goodsName
, printNum, made, provId, provName, subProvId,
subProvName,
hosGoodsCode, subSendFlag, onlyKey, areaName, hosId,
get_branch_id(),
deptid1, deptName, stockId)
print('request_body', 'ccccccc', request_body)
)
elif type == 2:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_batch_out1_2', batch_main_key, pid, order_no, source_detail_id
, pick_detail_id,hos_goods_id, mdm_goods_code, goods_code, source_batch_id,
target_batch_id, barcode_id, shelf_code, create_user, create_time,
last_modified, last_modified_user
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
PICK_ID = commonFuc().analysis_json('data', result)
# =====================出库复核列表查询获取pickid===============
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_pick_return_page_url")
print('url', url)
request_body = commonFuc().get_business_data(module, "payload20", get_branch_id(), get_hosid(), deptid1)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_batch_out1_3', batch_main_key, pid, order_no, source_detail_id
, hos_goods_id, mdm_goods_code, goods_code, source_batch_id,pick_detail_id,
target_batch_id, barcode_id, shelf_code, create_user, create_time,
last_modified, last_modified_user
# =====================出库复核列表查询获取pickid===============
# =======================查看出库单详细信息===============
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_pick_checkReview_url")
url = url + ' '.join(PICK_ID) + '?pickedFlag=true'
print('url', url)
# # # # 发送请求
result = commonFuc().http_get(url, headers)
print('查看出库单详细信息result', result)
# =======================查看出库单详细信息===============
# ========================扫码复核
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_hdiBarcode_scan_url")
url = url + pkgCode
print('url', url)
# # # # 发送请求
result = commonFuc().http_get(url, headers)
print('扫码复核result', result)
data = commonFuc().analysis_json('data', result)
UT_id = commonFuc().analysis_json('id', data)
createTime = commonFuc().analysis_json('createTime', data)
snCode = commonFuc().analysis_json('snCode', data)
tbStatus = commonFuc().analysis_json('tbStatus', data)
print(UT_id)
# ========================扫码复核
# ========出库复核提交==========
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_review_pass_submit_url")
)
print('url', url)
sourceId = ' '.join(PICK_ID)
# 请求体
request_body = commonFuc().get_business_data(module, "payload21", UT_id, createTime, snCode, hosId, stockId,
areaCode, areaName, shelfCode, codeType, tagType, hosGoodsId,
mdmGoodsCode, goodsCode, goodsDi, barName, batchCode, expdtDate,
productDate, pkgCode, pkgCodeSee, ssccCode, tbStatus,
distrDetailId,
distrBillId, purBillId, pkgDefQty, pkgDefId, pkgDefName, purMode,
goodsMfrsName, goodsSpec, unit, goodsName, pkgDefId, pkgDefQty,
pkgDefName, made, hosGoodsCode, sourceId)
print('request_body', request_body)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('herpService_stock_review_pass_submit_urlresult', result)
# ========出库复核提交
elif type == 1:
print('低值耗材退货出库')
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等信息,使用创建的用户登录============结束
# 到库房明细查询,查询产品的udi码
get_udi(1)
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_pick_submit_url")
print('url', 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"))
# 从文件中获取必要信息
info = FileUtils().r_info8(module, "条码信息", 'message18')
# print('info', info)
list_a = info['list_a']
UTid = 'UT'
areaCode = 'areaCode'
createTime = 'createTime'
hosId = 'hosId'
stockId = 'stockId'
areaCode = 'areaCode'
areaName = 'areaName'
shelfCode = 'shelfCode'
codeType = 'codeType'
tagType = 'tagType'
hosGoodsId = 'hosGoodsId'
mdmGoodsCode = 'mdmGoodsCode'
goodsCode = 'goodsCode'
goodsDi = 'goodsDi'
barName = 'barName'
batchCode = 'batchCode'
expdtDate = 'expdtDate'
productDate = 'productDate'
pkgCode = 'pkgCode'
pkgCodeSee = 'pkgCodeSee'
ssccCode = 'ssccCode'
tbStatus = 'tbStatus'
pkgDefQty = 'pkgDefQty'
purBillId = 'purBillId'
distrBillId = 'distrBillId'
inStockTime = 'inStockTime'
distrDetailId = 'distrDetailId'
purMode = 'purMode'
goodsMfrsName = 'goodsMfrsName'
goodsSpec = 'goodsSpec'
unit = 'unit'
goodsName = 'goodsName'
printNum = 'printNum'
made = 'made'
provId = 'provId'
provName = 'provName'
subProvId = 'subProvId'
subProvName = 'subProvName'
hosGoodsCode = 'hosGoodsCode'
subSendFlag = 'subSendFlag'
onlyKey = 'onlyKey'
pkgDefId = 'pkgDefId'
pkgDefName = 'pkgDefName'
print('aaaaaaaaaaaaaaaaaaaaaaaaa', list_a[0])
list_b = list_a[0]
for i in list_b:
print(i)
UTid = i['id']
areaCode = i['areaCode']
createTime = i['createTime']
hosId = i['hosId']
stockId = i['stockId']
areaCode = i['areaCode']
areaName = i['areaName']
shelfCode = i['shelfCode']
codeType = i['codeType']
tagType = i['tagType']
hosGoodsId = i['hosGoodsId']
mdmGoodsCode = i['mdmGoodsCode']
goodsCode = i['goodsCode']
goodsDi = i['goodsDi']
barName = i['barName']
batchCode = i['batchCode']
expdtDate = i['expdtDate']
productDate = i['productDate']
pkgCode = i['pkgCode']
pkgCodeSee = i['pkgCodeSee']
ssccCode = i['ssccCode']
tbStatus = i['tbStatus']
onlyKey = i['hosGoodsId']
ext = i['ext']
print('ext', ext)
distrDetailId = ext['distrDetailId']
distrBillId = ext['distrBillId']
purBillId = ext['purBillId']
pkgDefQty = ext['pkgDefQty']
pkgDefId = ext['pkgDefId']
pkgDefName = ext['pkgDefName']
purMode = i['purMode']
goodsMfrsName = i['goodsMfrsName']
goodsSpec = i['goodsSpec']
unit = i['unit']
goodsName = i['goodsName']
pkgDefId = i['pkgDefId']
pkgDefQty = i['pkgDefQty']
pkgDefName = i['pkgDefName']
printNum = i['printNum']
made = i['made']
provId = i['provId']
provName = i['provName']
subProvId = i['subProvId']
subProvName = i['subProvName']
hosGoodsCode = i['hosGoodsCode']
subSendFlag = i['subSendFlag']
areaName = i['areaName']
hosId = i['hosId']
break
deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
deptName = FileUtils().r_info8('b2_herp3_bs', '所有科室name', 'message6')["deptid1"]
# # 请求体
request_body = commonFuc().get_business_data(module, "payload19", areaCode, UTid, createTime, UTid, hosId,
stockId,
areaCode, areaName, shelfCode, codeType, tagType, hosGoodsId,
mdmGoodsCode, goodsCode, goodsDi, barName, batchCode, expdtDate,
productDate, pkgCode, pkgCodeSee, ssccCode, tbStatus,
distrDetailId,
distrBillId, purBillId, pkgDefQty, pkgDefId, pkgDefName, purMode,
goodsMfrsName, goodsSpec, unit, goodsName, pkgDefId, pkgDefQty,
pkgDefName, printNum, made, provId, provName, subProvId,
subProvName,
hosGoodsCode, subSendFlag, onlyKey, areaName, hosId,
get_branch_id(),
deptid1, deptName, stockId)
print('request_body', 'ccccccc', request_body)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
print(compare_text_index(actual_value2, expected_value2))
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_pick(type=16):
branch_id = get_branch_id()
print('拣货单验证')
sql = " select * from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
id = get_id(
"select id from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
order_no = get_id(
"select order_no from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
source_id = get_buyBillId(branch_id, type)
dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
stock_id = get_stockId_fromdb(dept_name + '中心库房')
area_code = get_stockAreaId_new_fromDb(dept_name, 1)
target_dept_id = FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_corpId']
target_dept_name = FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username']
target_stock_id = target_dept_id
target_area_code = None
username = FileUtils().r_info8("b2_herp3_bs", "用户名信息", 'message3')['username1']
reviewer = get_login_user_uxid_bydb(username)
review_date = get_expdt_date(
"select review_date from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
buyBillId = get_buyBillId(branch_id, type)
pickOrderNo = order_no
buyOrderNo = get_buyOrderNo(branch_id, type)
pickBillId = id
create_user = reviewer
create_time = get_expdt_date(
"select create_time from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
last_modified = get_expdt_date(
"select last_modified from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type))
last_modified_user=create_user
picker = create_user
picker_name = username
if type == 16:
#检查拣货单子表
check_mcms_pick_detail(id,type,order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_pick1', id, get_hosid(), get_branch_id(), order_no, source_id,
dept_id,
dept_name, stock_id, area_code, target_dept_id, target_dept_name,
target_stock_id, target_area_code, reviewer,
review_date, buyBillId, pickOrderNo, buyOrderNo, pickBillId,
create_user, create_time, last_modified, last_modified_user,picker, picker_name
)
elif type == 20:
# 检查拣货单子表
check_mcms_pick_detail(id,type,order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_pick2', id, get_hosid(), get_branch_id(), order_no, source_id,
dept_id,
dept_name, stock_id, area_code, target_dept_id, target_dept_name,
target_stock_id, target_area_code, reviewer,
review_date, buyBillId, pickOrderNo, buyOrderNo, pickBillId,
create_user, create_time, last_modified, last_modified_user,picker, picker_name
)
else:
# 检查拣货单子表
check_mcms_pick_detail(id, type, order_no)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_pick3', id, get_hosid(), get_branch_id(), order_no, source_id,
dept_id,
dept_name, stock_id, area_code, target_dept_id, target_dept_name,
target_stock_id, target_area_code, reviewer,
review_date, buyBillId, pickOrderNo, buyOrderNo, pickBillId,
create_user, create_time, last_modified, last_modified_user,picker, picker_name
)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
PICK_ID = commonFuc().analysis_json('data', result)
# =====================出库复核列表查询获取pickid===============
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_pick_return_page_url")
print('url', url)
request_body = commonFuc().get_business_data(module, "payload20", get_branch_id(), get_hosid(), deptid1)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
print(compare_text_index(actual_value2, expected_value2))
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_pick_detail(pid,type,order_no):
branch_id = get_branch_id()
print('拣货单子表检查')
sql = " select * from mcms_pick_detail where pid='%s';" % (
pid)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
id=get_id("select id from mcms_pick_detail where pid='%s';" % ( pid))
source_id=get_buyBillId(branch_id,type)
if type == 16:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type == 20:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
mdm_goods_code=get_mdm_goods_code1(hos_goods_id)
goods_code=get_goods_code1(hos_goods_id)
pkg_def_id=get_pkg_def_id(hos_goods_id)
picker_name=FileUtils().r_info8("b2_herp3_bs", "用户名信息", 'message3')['username1']
picker=get_login_user_uxid_bydb(picker_name)
create_user=picker
create_time=get_create_time("select create_time from mcms_pick_detail where pid='%s';" % (pid))
last_modified=get_create_time("select last_modified from mcms_pick_detail where pid='%s';" % (pid))
last_modified_user=create_user
if type == 16:
# =====================出库复核列表查询获取pickid===============
# =======================查看出库单详细信息===============
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_pick_checkReview_url")
url = url + ' '.join(PICK_ID) + '?pickedFlag=true'
print('url', url)
# # # # 发送请求
result = commonFuc().http_get(url, headers)
print('查看出库单详细信息result', result)
# =======================查看出库单详细信息===============
# ========================扫码复核
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_hdiBarcode_scan_url")
url = url + pkgCode
print('url', url)
# # # # 发送请求
result = commonFuc().http_get(url, headers)
print('扫码复核result', result)
data = commonFuc().analysis_json('data', result)
UT_id = commonFuc().analysis_json('id', data)
createTime = commonFuc().analysis_json('createTime', data)
snCode = commonFuc().analysis_json('snCode', data)
tbStatus = commonFuc().analysis_json('tbStatus', data)
print(UT_id)
# ========================扫码复核
# ========出库复核提交==========
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_review_pass_submit_url")
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_pick_detail1', id,pid,order_no,source_id,hos_goods_id
,mdm_goods_code,goods_code,pkg_def_id,picker,picker_name,
create_user,create_time,last_modified,last_modified_user
print('url', url)
sourceId = ' '.join(PICK_ID)
# 请求体
request_body = commonFuc().get_business_data(module, "payload21", UT_id, createTime, snCode, hosId, stockId,
areaCode, areaName, shelfCode, codeType, tagType, hosGoodsId,
mdmGoodsCode, goodsCode, goodsDi, barName, batchCode, expdtDate,
productDate, pkgCode, pkgCodeSee, ssccCode, tbStatus,
distrDetailId,
distrBillId, purBillId, pkgDefQty, pkgDefId, pkgDefName, purMode,
goodsMfrsName, goodsSpec, unit, goodsName, pkgDefId, pkgDefQty,
pkgDefName, made, hosGoodsCode, sourceId)
print('request_body', request_body)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('herpService_stock_review_pass_submit_urlresult', result)
# ========出库复核提交
elif type == 3:
print('试剂产品退库出库')
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等信息,使用创建的用户登录============结束
# 到库房明细查询,查询产品的udi码
get_udi(3)
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_pick_submit_url")
print('url', 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"))
# 从文件中获取必要信息
info = FileUtils().r_info8(module, "条码信息", 'message18')
# print('info', info)
list_a = info['list_a']
# print('list_a', list_a[0], type(list_a), len(list_a))
UTid = 'UT'
areaCode = 'areaCode'
createTime = 'createTime'
hosId = 'hosId'
stockId = 'stockId'
areaCode = 'areaCode'
areaName = 'areaName'
shelfCode = 'shelfCode'
codeType = 'codeType'
tagType = 'tagType'
hosGoodsId = 'hosGoodsId'
mdmGoodsCode = 'mdmGoodsCode'
goodsCode = 'goodsCode'
goodsDi = 'goodsDi'
barName = 'barName'
batchCode = 'batchCode'
expdtDate = 'expdtDate'
productDate = 'productDate'
pkgCode = 'pkgCode'
pkgCodeSee = 'pkgCodeSee'
ssccCode = 'ssccCode'
tbStatus = 'tbStatus'
pkgDefQty = 'pkgDefQty'
purBillId = 'purBillId'
distrBillId = 'distrBillId'
inStockTime = 'inStockTime'
distrDetailId = 'distrDetailId'
purMode = 'purMode'
goodsMfrsName = 'goodsMfrsName'
goodsSpec = 'goodsSpec'
unit = 'unit'
goodsName = 'goodsName'
printNum = 'printNum'
made = 'made'
provId = 'provId'
provName = 'provName'
subProvId = 'subProvId'
subProvName = 'subProvName'
hosGoodsCode = 'hosGoodsCode'
subSendFlag = 'subSendFlag'
onlyKey = 'onlyKey'
pkgDefId = 'pkgDefId'
pkgDefName = 'pkgDefName'
print('aaaaaaaaaaaaaaaaaaaaaaaaa', list_a[0])
list_b = list_a[0]
for i in list_b:
print(i)
UTid = i['id']
areaCode = i['areaCode']
createTime = i['createTime']
hosId = i['hosId']
stockId = i['stockId']
areaCode = i['areaCode']
areaName = i['areaName']
shelfCode = i['shelfCode']
codeType = i['codeType']
tagType = i['tagType']
hosGoodsId = i['hosGoodsId']
mdmGoodsCode = i['mdmGoodsCode']
goodsCode = i['goodsCode']
goodsDi = i['goodsDi']
barName = i['barName']
batchCode = i['batchCode']
expdtDate = i['expdtDate']
productDate = i['productDate']
pkgCode = i['pkgCode']
pkgCodeSee = i['pkgCodeSee']
ssccCode = i['ssccCode']
tbStatus = i['tbStatus']
onlyKey = i['hosGoodsId']
ext = i['ext']
print('ext', ext)
distrDetailId = ext['distrDetailId']
distrBillId = ext['distrBillId']
purBillId = ext['purBillId']
pkgDefQty = ext['pkgDefQty']
pkgDefId = ext['pkgDefId']
pkgDefName = ext['pkgDefName']
purMode = i['purMode']
goodsMfrsName = i['goodsMfrsName']
goodsSpec = i['goodsSpec']
unit = i['unit']
goodsName = i['goodsName']
pkgDefId = i['pkgDefId']
pkgDefQty = i['pkgDefQty']
pkgDefName = i['pkgDefName']
printNum = i['printNum']
made = i['made']
provId = i['provId']
provName = i['provName']
subProvId = i['subProvId']
subProvName = i['subProvName']
hosGoodsCode = i['hosGoodsCode']
subSendFlag = i['subSendFlag']
areaName = i['areaName']
hosId = i['hosId']
break
deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
deptName = FileUtils().r_info8('b2_herp3_bs', '所有科室name', 'message6')["deptid1"]
# # 请求体
request_body = commonFuc().get_business_data(module, "payload19", areaCode, UTid, createTime, UTid, hosId,
stockId,
areaCode, areaName, shelfCode, codeType, tagType, hosGoodsId,
mdmGoodsCode, goodsCode, goodsDi, barName, batchCode, expdtDate,
productDate, pkgCode, pkgCodeSee, ssccCode, tbStatus,
distrDetailId,
distrBillId, purBillId, pkgDefQty, pkgDefId, pkgDefName, purMode,
goodsMfrsName, goodsSpec, unit, goodsName, pkgDefId, pkgDefQty,
pkgDefName, printNum, made, provId, provName, subProvId,
subProvName,
hosGoodsCode, subSendFlag, onlyKey, areaName, hosId,
get_branch_id(),
deptid1, deptName, stockId)
print('request_body', 'ccccccc', request_body)
)
elif type == 20:
pkg_def_id=None
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_pick_detail2', id,pid,order_no,source_id,hos_goods_id
,mdm_goods_code,goods_code,pkg_def_id,picker,picker_name,
create_user,create_time,last_modified,last_modified_user
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
PICK_ID = commonFuc().analysis_json('data', result)
# =====================出库复核列表查询获取pickid===============
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_pick_return_page_url")
print('url', url)
request_body = commonFuc().get_business_data(module, "payload20", get_branch_id(), get_hosid(), deptid1)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_pick_detail3', id,pid,order_no,source_id,hos_goods_id
,mdm_goods_code,goods_code,pkg_def_id,picker,picker_name,
create_user,create_time,last_modified,last_modified_user
# =====================出库复核列表查询获取pickid===============
# =======================查看出库单详细信息===============
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_pick_checkReview_url")
url = url + ' '.join(PICK_ID) + '?pickedFlag=true'
print('url', url)
# # # # 发送请求
result = commonFuc().http_get(url, headers)
print('查看出库单详细信息result', result)
# =======================查看出库单详细信息===============
# ========================扫码复核
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_hdiBarcode_scan_url")
url = url + pkgCode
print('url', url)
# # # # 发送请求
result = commonFuc().http_get(url, headers)
print('扫码复核result', result)
data = commonFuc().analysis_json('data', result)
UT_id = commonFuc().analysis_json('id', data)
createTime = commonFuc().analysis_json('createTime', data)
snCode = commonFuc().analysis_json('snCode', data)
tbStatus = commonFuc().analysis_json('tbStatus', data)
print(UT_id)
# ========================扫码复核
# ========出库复核提交==========
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_stock_review_pass_submit_url")
)
print('url', url)
sourceId = ' '.join(PICK_ID)
# 请求体
request_body = commonFuc().get_business_data(module, "payload21", UT_id, createTime, snCode, hosId, stockId,
areaCode, areaName, shelfCode, codeType, tagType, hosGoodsId,
mdmGoodsCode, goodsCode, goodsDi, barName, batchCode, expdtDate,
productDate, pkgCode, pkgCodeSee, ssccCode, tbStatus,
distrDetailId,
distrBillId, purBillId, pkgDefQty, pkgDefId, pkgDefName, purMode,
goodsMfrsName, goodsSpec, unit, goodsName, pkgDefId, pkgDefQty,
pkgDefName, made, hosGoodsCode, sourceId)
print('request_body', request_body)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('herpService_stock_review_pass_submit_urlresult', result)
# ========出库复核提交
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
actual_value1 = get_process_list2(actual)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
print('expected_value2')
print(expected_value2)
print('actual_value2')
print(actual_value2)
print(compare_text_index(actual_value2, expected_value2))
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
pro_path = commonFuc().get_pro_path2()
print('pro_path', pro_path)
sys.path.append(pro_path + r'/air_case/b5_spd3_core_business_flow/a_c0流程十七退货业务_中心库退供应商.air')
using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_c0流程十七退货业务_中心库退供应商.air')
from a_c0流程十七退货业务_中心库退供应商 import center_Stock_return_Out
try:
updateUserLoginDefaultRange(get_listUserMgrRangePage1(1)) # 设置登录账号默认权限是二级库
second_center_Stock_return_Out(2) #高值耗材退货出库
second_center_Stock_return_Out(1) #低值耗材退货出库
second_center_Stock_return_Out(3) #试剂耗材退货出库
# updateUserLoginDefaultRange(get_listUserMgrRangePage1(1)) #设置登录账号默认权限是1级库
# center_Stock_return_Out(2) #高值耗材退货出库
# time.sleep(6)
check_mcms_psi_out(2)#检查出库单主表和子表
check_mcms_pick(20) #检查拣货单主表和子表
center_Stock_return_Out(1) #低值耗材退货出库
time.sleep(6)
check_mcms_psi_out(1)
center_Stock_return_Out(3) #试剂耗材退货出库
time.sleep(6)
check_mcms_psi_out(3)
commonFuc().check_text_exist_result_text('succees', 'succees')
except Exception as e:
# 打印错误信息
print(f"发生错误: {e}")
commonFuc().check_text_exist_result_text('error', 'SUCCESS')
\ No newline at end of file
commonFuc().check_text_exist_result_text('error', 'SUCCESS')
......@@ -2060,7 +2060,8 @@ def get_stockAreaId_new_fromDb(deptName, type=1):
# 中心库房名称
branch_name = FileUtils().r_info(module, '院区新增')["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']
deptName='自动化测试'
# 二级库房名称
elif type == 2:
stockId = get_stockId_fromdb(deptName + '库房')
......@@ -2072,7 +2073,6 @@ 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)
print(sql)
shelfCode = get_id(sql)
......
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