Commit 4f3803ec authored by xiao-hesheng's avatar xiao-hesheng
Browse files

脚本优化

parent 18d5a3a8
......@@ -25,48 +25,54 @@ def check_mcms_dept_buy(type):
if type==1:#低值
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
branch_id=get_branch_id()
actual_value1 = tools_check_mcms_dept_buy(branch_id,hos_goods_id)
#获取每次都会变化的字段create_time的值
create_time=get_dynamic_change_value("select create_time from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s';"% (branch_id, hos_goods_id))
id=get_dynamic_change_value("select id from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s';"% (branch_id, hos_goods_id))
print('create_time',create_time,'id',id)
sql = """select * from mcms_dept_buy_car where branch_id='%s' and hos_goods_id='%s' LIMIT 1;
""" % (branch_id, hos_goods_id)
actual_value1 = check_mcms_dept_buy_car(sql)
print(actual_value1)
# print('actual_value2',actual_value1)
actual_value2 = get_process_list2(actual_value1)
print('actual_value2', actual_value2, type(actual_value2))
prov_hos_goods_id = '8d6273b7bca84dd8aace12b9422d7fd6'
expected_value2 = commonFuc().get_business_data('b5_spd3_core_business_flow', 'expected_value2', prov_hos_goods_id)
print('expected_value2', expected_value2, type(expected_value2))
actual_value2 = actual_value2.replace(" ", "")
expected_value2 = expected_value2.replace(" ", "")
print(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('actual_value2', actual_value2, type(actual_value2))
# prov_hos_goods_id = '8d6273b7bca84dd8aace12b9422d7fd6'
expected_value2 = commonFuc().get_business_data('b5_spd3_core_business_flow', 'check_mcms_dept_buy_car', id,get_hosid(),branch_id,dept_id,area_code)
print('expected_value2', expected_value2)
# actual_value2 = actual_value2.replace(" ", "")
# expected_value2 = expected_value2.replace(" ", "")
# print(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')
try:
# set_dept_lead() # 设置二级科室负责人
check_mcms_dept_buy(1)
set_dept_lead() # 设置二级科室负责人
# 科室必须同步到外网,集中管控平台创建边仓才能选择到用户,"deptType":"0"
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_b3流程十请领业务流_二级库向边仓.air')
sys.path.append(pro_path + r'/air_case/b5_spd3_core_business_flow/a_b3流程十请领业务流_二级库向边仓.air')
using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_b3流程十请领业务流_二级库向边仓.air')
# from a_b3流程十请领业务流_二级库向边仓 import add_logic_stock
# add_logic_stock()
from a_b3流程十请领业务流_二级库向边仓 import add_logic_stock
add_logic_stock()
# from a_b3流程十请领业务流_二级库向边仓 import goods_move
# from a_b3流程十请领业务流_二级库向边仓 import second_dept_Request
# from a_b3流程十请领业务流_二级库向边仓 import BuyCarSubmit
# from a_b3流程十请领业务流_二级库向边仓 import check_buyWayText
# add_logic_stock()
#
from a_b3流程十请领业务流_二级库向边仓 import goods_move
from a_b3流程十请领业务流_二级库向边仓 import second_dept_Request
from a_b3流程十请领业务流_二级库向边仓 import BuyCarSubmit
from a_b3流程十请领业务流_二级库向边仓 import check_buyWayText
# # 设置产品出库渠道为边仓
# goods_move()
# updateUserLoginDefaultRange(get_listUserMgrRangePage(2)) # 设置登录账号默认权限是二级库
goods_move()
updateUserLoginDefaultRange(get_listUserMgrRangePage(2)) # 设置登录账号默认权限是二级库
# # # # 低值
# second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'], 1)
# check_mcms_dept_buy(1)
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'], 1)
check_mcms_dept_buy(1)
# # # 高值
# second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId'], 2)
# # # 试剂
......
......@@ -43,6 +43,7 @@ def get_process_list2(request_body):
return request_body_json
def get_branch_id():
return FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
......
......@@ -104,13 +104,24 @@ def main2(hos_goods_id):
res_dict = get_dict_data_sql(cursor, sql)
print('res_dict',res_dict)
return res_dict
def tools_check_mcms_dept_buy(branch_id,hos_goods_id):
def check_mcms_dept_buy_car(sql):
db, cursor = get_sql_conn()
sql = """select * from mcms_dept_buy_car where branch_id='%s' and hos_goods_id='%s';
""" % (branch_id,hos_goods_id)
# sql = """select * from mcms_dept_buy_car where branch_id='%s' and hos_goods_id='%s';
# """ % (branch_id,hos_goods_id)
res_dict = get_dict_data_sql(cursor, sql)
print('res_dict', res_dict)
return res_dict
def get_dynamic_change_value(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
results = cursor.fetchone()
str1 = str(results)
new_str1 = str1.replace('(', '')
new_str1 = new_str1.replace(')', '')
new_str1 = new_str1.replace(',', '')
print(new_str1)
cursor.close()
return new_str1
hos_goods_id = 'h034700004220'
main2(hos_goods_id)
\ No newline at end of file
二级库请领产品信息:
list_a:
- &id001
- hosGoodsId: h034700004501
purMode: 60
- hosGoodsId: h034700004500
purMode: 10
grantRule:
id:
goodsName: 新型冠状病毒检测试剂hO3Tu
goodsName: 一次性注射器_低值wExpg
goodsSpec: G-31891
mdmGoodsCode: '11661454'
goodsCode: '00004501'
mdmGoodsCode: '11661453'
goodsCode: '00004500'
unit:
goodsMfrsName: 德国歌德公司 Geuder AG
miDjmc: ''
......@@ -16,9 +16,9 @@
pkgDefName: '100'
pkgDefQty: 100.0
pkgQty:
qty: 600.0
qty: 500.0
goodsImg: []
pkgDefId: 2d4d3bd0ebe745efa73bb7123cf21f6a
pkgDefId: 34b26233759a4720920cc8328dd1f8d1
buyPkgQty:
unitName: 100支/100
price: 99.9999
......@@ -34,11 +34,11 @@
targetStockName: 东土城路院区IjnkG中心库房
purchaseFlag: 1
tempFlag: 0
grantWay: 3
grantWay: 2
deptGoodsStatus:
codingType: 0
purModeText: 检验试剂
goodsGeneralName: 检测试剂
purModeText: 低值耗材
goodsGeneralName: 一次性注射器
provName: 国药集团公司^n1@F
noRecPkgQty: 15.0
noRecQty: 1500.0
......
......@@ -651,3 +651,5 @@ json_headers2: {
}
"expected_value": "('00004260', 'h0347', 'p1e2ca', '177df1fadf39415ea5ce40e64edf449d', None, '11661208', '11661208', '11661208', '一次性注射器_低值hMY2F','一次性注射器', 'mfrs-11229', '德国歌德公司 Geuder AG', '', None, '', 'ycxzsq_dzhMY2F', None, '支', 'G-31891', Decimal('1.000000'), 2, '3', 10, None, None, '', None, Decimal('99.9999'), None, '德国', None, None, '', 1, None, 0, None, 0, '', '', None, None, 1, 0, 1, 'p1e2ca:UID-051951', datetime.datetime(2024, 6, 26, 7, 1, 39), 'p1e2ca:UID-051951', 0, 0, 1, None)"
"expected_value2": '{"hos_goods_code": "00004249","hos_id": "h0347","prov_id": "p1e2c6","prov_hos_goods_id": "%s","srv_id": null,"mdm_goods_code": "11661197","mdm_goods_spec_code": "11661197","spd_goods_code": "11661197","goods_name": "一次性注射器_低值qPW6a","goods_general_name": "一次性注射器","goods_mfrs_id": "mfrs-11229","goods_mfrs_name": "德国歌德公司 Geuder AG","goods_reg_cert": "","goods_agent_mfrs_id": null,"brand": "","short_pinyin": "ycxzsq_dzqPW6a","kind_sixtyeight_code": null,"unit": "支","goods_spec": "G-31891","goods_package": Decimal("1.000000"),"bar_code_mng": 2,"unique_code_strategy": "3","pur_mode": 10,"sub_pur_mode": null,"erp_code": null,"herp_code": "","hrp": null,"price": Decimal("99.9999"),"abroad_flag": null,"made": "德国","property": null,"mgr_level": null,"goods_desc": "","charge_flag": 1,"focus_control_type": null,"temp_flag": 0,"official_status": null,"focus_control": 0,"storage_conditions": "","transport_conditions": "","into_cost_flag": null,"rfid_flag": null,"purchase_flag": 1,"tb_status": 0,"version": 1,"create_user": "p1e2c6:UID-051946","create_time": datetime.datetime(2024,6,25,7,1,34),"last_modified_user": "p1e2c6:UID-051946","sterilize_flag": 0,"multi_charge_flag": 0,"use_frequency": 1,"charge_unit": null}'
"check_mcms_dept_buy_car": '[{'id': '%s', 'hos_id': '%s', 'branch_id': '%s', 'dept_id': '%s', 'dept_name': '%s', 'area_code': '%s', 'area_name': '%s', 'hos_goods_id': '%s', 'mdm_goods_code': '%s', 'goods_code': '%s', 'pur_mode': 10, 'pkg_def_id': '%s', 'pkg_def_name': '%s', 'pkg_def_qty': Decimal('100.00'), 'buy_pkg_qty': Decimal('1.00'), 'buy_qty': Decimal('100.00'), 'tb_status': 0, 'create_user': '%s', 'create_time': '%s', 'last_modified': '%s', 'last_modified_user': '%s', 'version': 0, 'coding_type': 0}, {'id': '4d163953-edd7-484e-b497-c40e27013ee9', 'hos_id': 'h0347', 'branch_id': 'h0347-3736', 'dept_id': 'b3e6c5f2887148389f8535862f789f0a', 'dept_name': '二级检验科002', 'area_code': 'areah03472676', 'area_name': '默认库区', 'hos_goods_id': 'h034700004500', 'mdm_goods_code': '11661453', 'goods_code': '00004500', 'pur_mode': 10, 'pkg_def_id': '34b26233759a4720920cc8328dd1f8d1', 'pkg_def_name': '100', 'pkg_def_qty': Decimal('100.00'), 'buy_pkg_qty': Decimal('1.00'), 'buy_qty': Decimal('100.00'), 'tb_status': 0, 'create_user': 'h0347_UID-051402', 'create_time': datetime.datetime(2024, 7, 8, 13, 50, 38), 'last_modified': datetime.datetime(2024, 7, 8, 13, 50, 38), 'last_modified_user': 'h0347_UID-051402', 'version': 0, 'coding_type': 0}]'
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment