删除上下查数据原创
8人赞赏了该文章
417次浏览
编辑于2023年02月06日 11:28:42
单据上下查的关联关系是放在 T_BF_INSTANCE (流程实例表)
LK表主要用于反写规则使用
所以需要删除上下查数据的时候应该去T_BF_INSTANCEENTRY删,仅仅删除lk表是无用的
【生产订单-工序计划】
--删除T_SFC_OPERPLANNING_LK select t.FLINKID from T_SFC_OPERPLANNING_LK t left join T_PRD_MOENTRY t1 on t.FSID=t1.FENTRYID left join T_PRD_MO t2 on t2.FID=t1.FID where t.FID in (select FID from T_SFC_OPERPLANNING where FBILLNO='OP012081') and t2.FBILLNO<>'WORK192584' --delete from T_SFC_OPERPLANNING_LK where FLINKID in (select t.FLINKID --from T_SFC_OPERPLANNING_LK t --left join T_PRD_MOENTRY t1 on t.FSID=t1.FENTRYID --left join T_PRD_MO t2 on t2.FID=t1.FID --where t.FID in (select FID from T_SFC_OPERPLANNING where FBILLNO='OP012081') --and t2.FBILLNO<>'WORK192584') --删除T_BF_INSTANCEENTRY select * from T_BF_INSTANCEENTRY where FSTABLENAME='T_PRD_MOENTRY' --下游明细表 and ftid in (select FID from T_SFC_OPERPLANNING where FBILLNO='OP012081') and FSID not in (select FSID from T_SFC_OPERPLANNING_LK t left join T_PRD_MOENTRY t1 on t.FSID=t1.FENTRYID left join T_PRD_MO t2 on t2.FID=t1.FID where t.FID in (select FID from T_SFC_OPERPLANNING where FBILLNO='OP012081')) --delete from T_BF_INSTANCEENTRY --where FSTABLENAME='T_PRD_MOENTRY' --and ftid in (select FID from T_SFC_OPERPLANNING where FBILLNO='OP012081') --and FSID not in (select FSID --from T_SFC_OPERPLANNING_LK t --left join T_PRD_MOENTRY t1 on t.FSID=t1.FENTRYID --left join T_PRD_MO t2 on t2.FID=t1.FID --where t.FID in (select FID from T_SFC_OPERPLANNING where FBILLNO='OP012081'))