Commit f2c30acc authored by 肖 和生's avatar 肖 和生
Browse files

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

parents 05591d3e 19f7f9f6
......@@ -7,7 +7,7 @@ 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_buyOrderNo, \
get_PICK_order_no, 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
get_goods_code1, get_pkg_def_id, check_batch_id, check_barcode_id, get_DRId, get_DN_no
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
......@@ -212,8 +212,8 @@ def check_mcms_psi_dept_batch_in(DR_ID,type,order_no):
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
source_detail_id = get_DRId(branch_id,type)+"0001"
pick_detail_id=None
if type == 16:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
......@@ -239,7 +239,7 @@ def check_mcms_psi_dept_batch_in(DR_ID,type,order_no):
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')['deptid3']
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)
......@@ -247,7 +247,7 @@ def check_mcms_psi_dept_batch_in(DR_ID,type,order_no):
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
'mcms_psi_dept_batch_tkrk1', 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
......@@ -255,7 +255,7 @@ def check_mcms_psi_dept_batch_in(DR_ID,type,order_no):
)
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
'mcms_psi_dept_batch_tkrk2', 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
......@@ -263,7 +263,7 @@ def check_mcms_psi_dept_batch_in(DR_ID,type,order_no):
)
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
'mcms_psi_dept_batch_tkrk3',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
......@@ -305,8 +305,9 @@ def check_mcms_psi_dept_in(type1=16):
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
target_stock_id = get_stockId_fromdb(target_dept_name + '库房')
target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 2)
PICK_id = get_PICK_id(branch_id, type1)
source_id = PICK_id
source_id = get_DRId(branch_id,type1)
source_no=get_DN_no(branch_id,type1)
source_corp_id = get_hosid()
source_branch_id = get_branch_id()
source_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3']
......@@ -317,51 +318,51 @@ def check_mcms_psi_dept_in(type1=16):
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
psiDeptOutBillId = source_id
psiDeptOutOrderNo = source_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))
psiDeptInBillId=DR_ID
psiDeptInOrderNo=order_no
if type1 == 16:
# 子表检查
check_mcms_psi_dept_batch_in(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', DR_ID, order_no, target_corp_id, target_branch_id,
'mcms_psi_dept_tkrk1', 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,
, target_area_code, source_id, source_no,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
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo,psiDeptInBillId,psiDeptInOrderNo
, create_user, create_time, last_modified, last_modified_user
)
elif type1 == 20:
# 子表检查
check_mcms_psi_dept_batch_in(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_tkck2', DR_ID, order_no, target_corp_id, target_branch_id,
'mcms_psi_dept_tkrk2', 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,
, target_area_code, source_id, source_no,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)
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo,psiDeptInBillId,psiDeptInOrderNo
, create_user, create_time, last_modified, last_modified_user
)
else:
# 子表检查
check_mcms_psi_dept_batch_in(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_tkck3', DR_ID, order_no, target_corp_id, target_branch_id,
'mcms_psi_dept_tkrk3', 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,
, target_area_code, source_id, source_no,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
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo,psiDeptInBillId,psiDeptInOrderNo
, create_user, create_time, last_modified, last_modified_user
)
......@@ -390,19 +391,20 @@ sys.path.append(pro_path + r'/air_case/b5_spd3_core_business_flow/a_b8流程十
using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_b8流程十五退库业务_三级库向二级库退库.air')
from a_b8流程十五退库业务_三级库向二级库退库 import second_dept_return_Out_Stock
try:
# updateUserLoginDefaultRange(get_listUserMgrRangePage1(3)) # 设置登录账号默认权限是三级库
# second_dept_return_Out_Stock(2) # 高值耗材退货出库
# time.sleep(6)
# check_mcms_psi_dept_out(20)#检查出库单(包括主表和子表)
# time.sleep(6)
# second_dept_return_Out_Stock(1) # 低值耗材退货出库
# time.sleep(6)
# check_mcms_psi_dept_out(16) # 检查出库单(包括主表和子表)
# second_dept_return_Out_Stock(3) # 试剂耗材退货出库
# check_mcms_psi_dept_out(66) # 检查出库单(包括主表和子表)
# second_dept_one_key_in(2)
# second_dept_one_key_in(2)
# second_dept_one_key_in(2)
updateUserLoginDefaultRange(get_listUserMgrRangePage1(3)) # 设置登录账号默认权限是三级库
second_dept_return_Out_Stock(2) # 高值耗材退货出库
time.sleep(6)
check_mcms_psi_dept_out(20)#检查出库单(包括主表和子表)
time.sleep(6)
second_dept_return_Out_Stock(1) # 低值耗材退货出库
time.sleep(6)
check_mcms_psi_dept_out(16) # 检查出库单(包括主表和子表)
second_dept_return_Out_Stock(3) #试剂耗材退货出库
check_mcms_psi_dept_out(66) # 检查出库单(包括主表和子表)
second_dept_one_key_in(2)
second_dept_one_key_in(2)
second_dept_one_key_in(2)
time.sleep(6)
check_mcms_psi_dept_in(16) # 检查入库单(包括主表和子表)
check_mcms_psi_dept_in(20) # 检查入库单(包括主表和子表)
check_mcms_psi_dept_in(66) # 检查入库单(包括主表和子表)
......
......@@ -7,7 +7,7 @@ from common.fileUtls import FileUtils
def get_db():
# 打开数据库连接
db = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
charset="utf8")
charset="utf8")
return db
......@@ -103,32 +103,46 @@ def main2(hos_goods_id):
use_frequency,
charge_unit FROM mcms_goods_info WHERE id ='%s';""" % hos_goods_id
res_dict = get_dict_data_sql(cursor, sql)
print('res_dict',res_dict)
print('res_dict', res_dict)
return res_dict
def check_mcms_dept_buy_car_sql(sql):
db, cursor = get_sql_conn()
res_dict = get_dict_data_sql(cursor, sql)
print('res_dict', res_dict)
cursor.close()
db.close()
return res_dict
def check_mcms_dept_buy_sql(sql):
db, cursor = get_sql_conn()
res_dict = get_dict_data_sql(cursor, sql)
print('res_dict', res_dict)
cursor.close()
db.close()
return res_dict
def check_mcms_pur_plan_sql(sql):
db, cursor = get_sql_conn()
res_dict = get_dict_data_sql(cursor, sql)
print('res_dict', res_dict)
cursor.close()
db.close()
return res_dict
def check_mcms_pur_sql(sql):
db, cursor = get_sql_conn()
res_dict = get_dict_data_sql(cursor, sql)
print('res_dict', res_dict)
cursor.close()
db.close()
return res_dict
def get_create_time(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
......@@ -139,7 +153,10 @@ def get_create_time(sql):
# new_str1 = new_str1.replace(',', '')
# print(new_str1)
cursor.close()
db.close()
return new_str1
def get_expdt_date(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
......@@ -150,13 +167,19 @@ def get_expdt_date(sql):
# new_str1 = new_str1.replace(',', '')
# print(new_str1)
cursor.close()
db.close()
return new_str1
def get_expdt_date1(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
results = cursor.fetchone()
cursor.close()
db.close()
return results
def get_account_date(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
......@@ -168,14 +191,19 @@ def get_account_date(sql):
new_str1 = new_str1.replace("'", '')
# print(new_str1)
cursor.close()
db.close()
return new_str1
def set_goods_coding_type(branch_id):#设置科室产品为赋码管理0为赋码管理1是非赋码
def set_goods_coding_type(branch_id): # 设置科室产品为赋码管理0为赋码管理1是非赋码
db, cursor = get_sql_conn()
sql="UPDATE mcms_dept_goods_info SET coding_type = 0 WHERE branch_id=%s;"
cursor.execute(sql,(branch_id))
sql = "UPDATE mcms_dept_goods_info SET coding_type = 0 WHERE branch_id=%s;"
cursor.execute(sql, (branch_id))
db.commit()
cursor.close()
db.close()
def get_id(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
......@@ -187,11 +215,43 @@ def get_id(sql):
new_str1 = new_str1.replace("'", '')
# print(new_str1)
cursor.close()
db.close()
return new_str1
def get_DRId(branch_id, type):
db, cursor = get_sql_conn()
cursor.execute(
"select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_LYTK' order by CREATE_TIME desc LIMIT 1;"%(branch_id,type))
results = cursor.fetchone()
str1 = str(results)
new_str1 = str1.replace(',)', '')
new_str1 = new_str1.replace('(', '')
new_str1 = new_str1.replace(',', '')
new_str1 = new_str1.replace("'", '')
# print(new_str1)
cursor.close()
db.close()
return new_str1
def get_DN_no(branch_id, type):
DR_id=get_DRId(branch_id, type)
db, cursor = get_sql_conn()
cursor.execute(
"select order_no from mcms_psi_dept where id='%s';" % (
DR_id))
results = cursor.fetchone()
str1 = str(results)
new_str1 = str1.replace(',)', '')
new_str1 = new_str1.replace('(', '')
new_str1 = new_str1.replace(',', '')
new_str1 = new_str1.replace("'", '')
# print(new_str1)
cursor.close()
db.close()
return new_str1
def get_login_user_uxid_bydb(username):
db, cursor = get_sql_conn()
cursor.execute("select id from sys_user where user_code='%s'"%username)
cursor.execute("select id from sys_user where user_code='%s'" % username)
results = cursor.fetchone()
str1 = str(results)
new_str1 = str1.replace(',)', '')
......@@ -200,14 +260,19 @@ def get_login_user_uxid_bydb(username):
new_str1 = new_str1.replace("'", '')
# print(new_str1)
cursor.close()
db.close()
return new_str1
def get_dept_buy_id(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
results = cursor.fetchall()
cursor.close()
db.close()
return results
def process_tuple(tuple1):
str1 = str(tuple1)
new_str1 = str1.replace(',)', '')
......@@ -215,126 +280,175 @@ def process_tuple(tuple1):
new_str1 = new_str1.replace(',', '')
new_str1 = new_str1.replace("'", '')
return new_str1
def get_mdm_goods_code1(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select mdm_goods_code from mcms_goods_info where id='%s'"%hos_goods_id)
cursor.execute("select mdm_goods_code from mcms_goods_info where id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
db.close()
return process_tuple(results)
def get_goods_code1(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select hos_goods_code from mcms_goods_info where id='%s'"%hos_goods_id)
cursor.execute("select hos_goods_code from mcms_goods_info where id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
db.close()
return process_tuple(results)
def get_goods_name(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select goods_name from mcms_goods_info where id='%s'"%hos_goods_id)
cursor.execute("select goods_name from mcms_goods_info where id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
db.close()
return process_tuple(results)
def get_goods_gg(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select goods_spec from mcms_goods_info where id='%s'"%hos_goods_id)
cursor.execute("select goods_spec from mcms_goods_info where id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
db.close()
return process_tuple(results)
def get_supply_id(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select id from supply_prov_hos_goods where hos_goods_id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
db.close()
return process_tuple(results)
def get_pkg_def_id(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select pkg_def_id from mcms_pkg where hos_goods_id='%s'" % hos_goods_id)
results = cursor.fetchone()
cursor.close()
db.close()
return process_tuple(results)
def get_pkg_def_Name(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select pkg_def_name from mcms_pkg where hos_goods_id='%s'" % hos_goods_id)
results = cursor.fetchone()
cursor.close()
db.close()
return process_tuple(results)
def get_goods_name1(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select goods_name from mcms_goods_info where id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
db.close()
return process_tuple(results)
def get_mdm_goods_code(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
results = cursor.fetchall()
cursor.close()
db.close()
return results
def get_goods_mfrs_id(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select goods_mfrs_id from mcms_goods_info where id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
db.close()
return process_tuple(results)
def check_source_id(hos_goods_id,source_id):
def check_source_id(hos_goods_id, source_id):
db, cursor = get_sql_conn()
cursor.execute("select hos_goods_id from mcms_pur_plan_detail where id='%s'" % (source_id))
results1 = cursor.fetchall()
cursor.close()
hos_goods_id2= process_tuple(results1)
if hos_goods_id2==hos_goods_id:
return True
db.close()
hos_goods_id2 = process_tuple(results1)
if hos_goods_id2 == hos_goods_id:
return True
else:
return False
return False
def check_batch_id(source_batch_id):
db, cursor = get_sql_conn()
cursor.execute("select id from mcms_hos_batch where id='%s'" % (source_batch_id))
results1 = cursor.fetchall()
cursor.close()
batch_id= process_tuple(results1)
if batch_id!=None:
return True
db.close()
batch_id = process_tuple(results1)
if batch_id != None:
return True
else:
return False
return False
def check_barcode_id(barcode_id):
db, cursor = get_sql_conn()
cursor.execute("select id from hdi_barcode where id='%s'" % (barcode_id))
results1 = cursor.fetchall()
cursor.close()
batch_id= process_tuple(results1)
if batch_id!=None:
return True
db.close()
batch_id = process_tuple(results1)
if batch_id != None:
return True
else:
return False
def get_PICK_id(branch_id,bill_mode):
return False
def get_PICK_id(branch_id, bill_mode):
sql = "select id from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
print(sql)
return process_tuple(get_dept_buy_id(sql))
def get_pick_detail_id(branch_id,bill_mode):
main_id=get_PICK_id(branch_id,bill_mode)
def get_pick_detail_id(branch_id, bill_mode):
main_id = get_PICK_id(branch_id, bill_mode)
sql = "select id from mcms_pick_detail where pid='%s';" % (
main_id)
print(sql)
return process_tuple(get_dept_buy_id(sql))
def get_PICK_order_no(branch_id,bill_mode):
PICK_id=get_PICK_id(branch_id,bill_mode)
def get_PICK_order_no(branch_id, bill_mode):
PICK_id = get_PICK_id(branch_id, bill_mode)
sql = "select order_no from mcms_pick where id='%s' order by CREATE_TIME desc LIMIT 1;" % (
PICK_id)
print(sql)
return process_tuple(get_dept_buy_id(sql))
def get_buyBillId(branch_id,bill_mode):
def get_buyBillId(branch_id, bill_mode):
sql = "select id from spd3_herp_test2.mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, bill_mode)
print(sql)
return process_tuple(get_dept_buy_id(sql))
def get_buyOrderNo(branch_id,bill_mode):
def get_buyOrderNo(branch_id, bill_mode):
sql = "select order_no from spd3_herp_test2.mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, bill_mode)
print(sql)
return process_tuple(get_dept_buy_id(sql))
def get_purOrderNo(branch_id,bill_mode):
def get_purOrderNo(branch_id, bill_mode):
sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, bill_mode)
# print(sql)
......@@ -343,27 +457,31 @@ def get_purOrderNo(branch_id,bill_mode):
branch_id, bill_mode, id1)
print(sql)
return process_tuple(get_dept_buy_id(sql))
def get_purBillId(branch_id,bill_mode):
def get_purBillId(branch_id, bill_mode):
sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, bill_mode)
# print(sql)
return process_tuple(get_dept_buy_id(sql))
def get_planBillId(hos_goods_id):
planBillId = process_tuple(
get_id(
"select pid from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % (
hos_goods_id)))
return planBillId
def get_planOrderNo(hos_goods_id):
return process_tuple(
get_id(
"select order_no from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % (
hos_goods_id)))
def get_planOrderNo(hos_goods_id):
return process_tuple(
get_id(
"select order_no from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % (
hos_goods_id)))
def get_ext_info(branch_id,bill_mode):
def get_ext_info(branch_id, bill_mode):
distr_main_key = get_id(
"select id from hdi_distr a where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, bill_mode))
......@@ -373,7 +491,8 @@ def get_ext_info(branch_id,bill_mode):
# print(bill_relation_json)
return ext_info
def get_purBillDate(branch_id,bill_mode):
def get_purBillDate(branch_id, bill_mode):
distr_main_key = get_id(
"select id from hdi_distr a where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, bill_mode))
......@@ -382,7 +501,9 @@ def get_purBillDate(branch_id,bill_mode):
distr_main_key, bill_mode))
# print(bill_relation_json)
return ext_info
def get_purBillDate2(branch_id,bill_mode):
def get_purBillDate2(branch_id, bill_mode):
main_key = get_id(
"select id from mcms_psi a where target_branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, bill_mode))
......@@ -391,7 +512,9 @@ def get_purBillDate2(branch_id,bill_mode):
main_key, bill_mode))
# print(bill_relation_json)
return bill_relation_json
def get_mcms_chek_purBillDate(branch_id,bill_mode):
def get_mcms_chek_purBillDate(branch_id, bill_mode):
main_key = get_id(
"select id from mcms_check a where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, bill_mode))
......@@ -400,44 +523,59 @@ def get_mcms_chek_purBillDate(branch_id,bill_mode):
main_key, bill_mode))
# print(bill_relation_json)
return bill_relation_json
def get_distrBillId(branch_id,bill_mode):
def get_distrBillId(branch_id, bill_mode):
distr_main_key = get_id(
"select id from hdi_distr a where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, bill_mode))
return distr_main_key
def get_distr_detail_id(branch_id,bill_mode):
distr_main_key=get_distrBillId(branch_id,bill_mode)
distr_detail_id=get_id(
def get_distr_detail_id(branch_id, bill_mode):
distr_main_key = get_distrBillId(branch_id, bill_mode)
distr_detail_id = get_id(
"select id from hdi_distr_detail a where pid='%s' order by create_time desc LIMIT 1;" % (
distr_main_key))
return distr_detail_id
def get_distrOrderNo(branch_id,bill_mode):
def get_distrOrderNo(branch_id, bill_mode):
# 查询配送单order_no
distr_order_no = get_id(
"select order_no from hdi_distr a where id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
get_distrBillId(branch_id,bill_mode), bill_mode))
get_distrBillId(branch_id, bill_mode), bill_mode))
return distr_order_no
def get_checkBillId(branch_id,bill_mode):
checkBillId=get_id(
def get_checkBillId(branch_id, bill_mode):
checkBillId = get_id(
"select id from mcms_check where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id,bill_mode))
branch_id, bill_mode))
return checkBillId
def get_checkOrderNo(branch_id,bill_mode):
checkOrderNo=get_id(
def get_checkOrderNo(branch_id, bill_mode):
checkOrderNo = get_id(
"select order_no from mcms_check a where id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
get_checkBillId(branch_id,bill_mode), bill_mode))
get_checkBillId(branch_id, bill_mode), bill_mode))
return checkOrderNo
def get_psiInBillId(branch_id,bill_mode):
psiInBillId=get_id(
def get_psiInBillId(branch_id, bill_mode):
psiInBillId = get_id(
"select id from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_YS' order by create_time desc LIMIT 1;" % (
branch_id,bill_mode))
branch_id, bill_mode))
return psiInBillId
def get_psiInOrderNo(branch_id,bill_mode):
psiInOrderNo=get_id(
def get_psiInOrderNo(branch_id, bill_mode):
psiInOrderNo = get_id(
"select order_no from mcms_psi a where id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
get_psiInBillId(branch_id,bill_mode), bill_mode))
get_psiInBillId(branch_id, bill_mode), bill_mode))
return psiInOrderNo
def check_in_check_mcms_purchase(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
......@@ -449,7 +587,10 @@ def check_in_check_mcms_purchase(sql):
new_str1 = new_str1.replace("'", '')
# print(new_str1)
cursor.close()
db.close()
return new_str1
def process_date(str1):
# str1 = "datetime.datetime(2024, 9, 17, 15, 32, 58)"
str2 = str1.replace('datetime.datetime(', "")
......@@ -479,9 +620,10 @@ def process_date(str1):
print(date) # 输出: 2023-03-14
return date
def get_last_auditor(order_no):
db, cursor = get_sql_conn()
cursor.execute("select last_auditor from mcms_pur_plan where order_no='%s';"%order_no)
cursor.execute("select last_auditor from mcms_pur_plan where order_no='%s';" % order_no)
results = cursor.fetchone()
str1 = str(results)
new_str1 = str1.replace(',)', '')
......@@ -490,6 +632,7 @@ def get_last_auditor(order_no):
new_str1 = new_str1.replace("'", '')
# print(new_str1)
cursor.close()
db.close()
return new_str1
# hos_goods_id = 'h034700004220'
# main2(hos_goods_id)
......
......@@ -189,3 +189,13 @@
"mcms_psi_dept_tkck1": '{"id":"%s","order_no":"%s","bill_mode":"16","rec_type":"YND","psi_flag":-1,"psi_kind":"208","stock_kind":"CK_LYTK","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":%s,"target_area_name":null,"source_id":"%s","source_no":null,"source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":0,"patient_id":null,"patient_name":null,"machine_id":null,"machine_name":null,"his_charge_no":null,"remark":"","tb_status":20,"accounter":%s,"account_date":%s,"bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":0,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":0}'
"mcms_psi_dept_tkck2": '{"id":"%s","order_no":"%s","bill_mode":"20","rec_type":"YND","psi_flag":-1,"psi_kind":"208","stock_kind":"CK_LYTK","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":%s,"target_area_name":null,"source_id":"%s","source_no":null,"source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":0,"patient_id":null,"patient_name":null,"machine_id":null,"machine_name":null,"his_charge_no":null,"remark":"","tb_status":20,"accounter":%s,"account_date":%s,"bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":0,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":0}'
"mcms_psi_dept_tkck3": '{"id":"%s","order_no":"%s","bill_mode":"66","rec_type":"YND","psi_flag":-1,"psi_kind":"208","stock_kind":"CK_LYTK","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":%s,"target_area_name":null,"source_id":"%s","source_no":null,"source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":0,"patient_id":null,"patient_name":null,"machine_id":null,"machine_name":null,"his_charge_no":null,"remark":"","tb_status":20,"accounter":%s,"account_date":%s,"bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":0,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":0}'
#三级科室退库出库,二级科室入库子表
"mcms_psi_dept_batch_tkrk1": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "pick_detail_id": %s, "pur_mode": 10, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "source_batch_id": "%s", "target_batch_id": "%s", "settle_flag": 0, "psi_price": Decimal("99.9999"), "qty": Decimal("100.00"), "unit_name": "100支/100", "barcode_id": "%s", "sub_barcode_id": None, "shelf_code": "%s-A-01-01", "tb_status": 0, "charge_flag": null, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}'
"mcms_psi_dept_batch_tkrk2": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "pick_detail_id": %s, "pur_mode": 20, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "source_batch_id": "%s", "target_batch_id": "%s", "settle_flag": 0, "psi_price": Decimal("99.9999"), "qty": Decimal("1.00"), "unit_name": "1支", "barcode_id": "%s", "sub_barcode_id": None, "shelf_code": "%s-A-01-01", "tb_status": 0, "charge_flag": null, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}'
"mcms_psi_dept_batch_tkrk3": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "pick_detail_id": %s, "pur_mode": 60, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "source_batch_id": "%s", "target_batch_id": "%s", "settle_flag": 0, "psi_price": Decimal("99.9999"), "qty": Decimal("100.00"), "unit_name": "100支/100", "barcode_id": "%s", "sub_barcode_id": None, "shelf_code": "%s-A-01-01", "tb_status": 0, "charge_flag": null, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}'
#三级科室退库出库,二级科室入库主表
"mcms_psi_dept_tkrk1": '{"id":"%s","order_no":"%s","bill_mode":"16","rec_type":"YND","psi_flag":1,"psi_kind":"109","stock_kind":"RK_LYTK","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":"%s","target_area_name":"默认库区","source_id":"%s","source_no":"%s","source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":0,"patient_id":null,"patient_name":null,"machine_id":null,"machine_name":null,"his_charge_no":null,"remark":null,"tb_status":30,"accounter":"%s","account_date":"%s","bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s","psiDeptInBillId":"%s","psiDeptInOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":1,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":null}'
"mcms_psi_dept_tkrk2": '{"id":"%s","order_no":"%s","bill_mode":"20","rec_type":"YND","psi_flag":1,"psi_kind":"109","stock_kind":"RK_LYTK","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":"%s","target_area_name":"默认库区","source_id":"%s","source_no":"%s","source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":0,"patient_id":null,"patient_name":null,"machine_id":null,"machine_name":null,"his_charge_no":null,"remark":null,"tb_status":30,"accounter":"%s","account_date":"%s","bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s","psiDeptInBillId":"%s","psiDeptInOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":1,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":null}'
"mcms_psi_dept_tkrk3": '{"id":"%s","order_no":"%s","bill_mode":"66","rec_type":"YND","psi_flag":1,"psi_kind":"109","stock_kind":"RK_LYTK","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":"%s","target_area_name":"默认库区","source_id":"%s","source_no":"%s","source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":0,"patient_id":null,"patient_name":null,"machine_id":null,"machine_name":null,"his_charge_no":null,"remark":null,"tb_status":30,"accounter":"%s","account_date":"%s","bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s","psiDeptInBillId":"%s","psiDeptInOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":1,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":null}'
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