在查询分析工具新建关键字"
@Fnumber@"(不含引号),名称为物料代码,字符串型,再新建直接SQL查询,复制以下代码粘贴,点下一步直到完成,打开后输入相关物料代码即可查询物料被相关业务单据的关联数。可以自己再增加有运作的相关业务单据。以下代码(k/3V10.3上通过测试):
select s1.销售订单,s2.采购申请单,s3.采购订单,s4.生产及委外任务单,s5.生产及委外投料单,s6.投料变更单,s7.计划订单,s8.出入库单据,s9.BOM单,s10.收退料通知 from
(select count(t1.fitemid) 销售订单
from seorderentry t1,t_icitem t11
where t1.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s1,
(select count(t2.fitemid) 采购申请单
from poorderentry t2,t_icitem t11
where t2.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s2,
(select count(t3.fitemid) 采购订单
from porequestentry t3,t_icitem t11
where t3.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s3,
(select count(t4.fitemid) 生产及委外任务单
from icmo t4,t_icitem t11
where t4.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s4,
(select count(t5.fitemid) 生产及委外投料单
from ppbom t5,t_icitem t11
where t5.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s5,
(select count(t6.fitemid) 投料变更单
from ppbomchangeentry t6,t_icitem t11
where t6.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s6,
(select count(t7.fitemid) 计划订单
from icmrpresult t7,t_icitem t11
where t7.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s7,
(select count(t8.fitemid) 出入库单据
from icstockbillentry t8,t_icitem t11
where t8.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s8,
(select count(t9.fitemid) BOM单
from icbomchild t9,t_icitem t11
where t9.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s9,
(select count(t10.fitemid) 收退料通知
from poinstockentry t10,t_icitem t11
where t10.fitemid=t11.fitemid
and t11.Fnumber = '@Fnumber@') s10