//转换关系 botp

select * from T_BOT_Relation where FSRCENTITYID='E65FED21' and FDESTOBJECTID in ( select fid from T_AR_OtherBill where fid not in( select FPARENTID from T_AR_OtherBillentry ) ) and FBOTMAPPINGID='QrGpe/zIRS+RnC8CfoUhiARRIsQ='

//先删除转换关系
delete from T_BOT_Relation where FSRCENTITYID='E65FED21' and FDESTOBJECTID in ( select fid from T_AR_OtherBill where fid not in( select FPARENTID from T_AR_OtherBillentry ) ) and FBOTMAPPINGID='QrGpe/zIRS+RnC8CfoUhiARRIsQ='


//没有分录的错误的 应收单 单据头
select * from T_AR_OtherBill where fid not in( select FPARENTID from T_AR_OtherBillentry )

delete from T_AR_OtherBill where FID in ( select fid from T_AR_OtherBill where fid not in( select FPARENTID from T_AR_OtherBillentry ) )