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,bill_mode)
actual=check_mcms_dept_buy_sql(sql)
print(actual)
# 获取主键
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,bill_mode))
# 获取source_id
# sql = "select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_XH' order by CREATE_TIME desc LIMIT 1;" % (
# branch_id, bill_mode)
source_id=get_PICK_id_KS_TK(branch_id,bill_mode)
source_no=get_id("select order_no from mcms_psi_dept where id='%s';"%source_id)
# 获取order_no
# sql = " 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;" % (
"select order_no from spd3_herp_test2.mcms_operation_apply where branch_id='%s' order by create_time desc LIMIT 1;"%branch_id)
operationNoticeBillId=get_id(
"select id from spd3_herp_test2.mcms_operation_notice where branch_id='%s' order by create_time desc LIMIT 1;"%branch_id)
operationNoticeOrderNo=get_id(
"select order_no from spd3_herp_test2.mcms_operation_notice where branch_id='%s' order by create_time desc LIMIT 1;"%branch_id)
operationApplyBillId=get_id(
"select id from spd3_herp_test2.mcms_operation_apply where branch_id='%s' order by create_time desc LIMIT 1;"%branch_id)
psiOutBillId=get_id("select id from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_QL' order by CREATE_TIME desc LIMIT 1;"%(branch_id,bill_mode))
psiOutOrderNo=get_id("select order_no from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_QL' order by CREATE_TIME desc LIMIT 1;"%(branch_id,bill_mode))
sql=" select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_XH' 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_XH' order by CREATE_TIME desc LIMIT 1;"%(
branch_id,type1))
sql="select order_no from mcms_psi_dept where id='%s';"%DR_ID
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_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_id("select id from mcms_psi_dept where stock_kind='CK_XH' and target_branch_id='%s' order by CREATE_TIME desc LIMIT 1;"%(branch_id))