未完成采购申请单无法再次下推,无法行业务单反关闭如何解决?

作者: seamus 分类: 金蝶 发布时间: 2019-08-26 15:36

问题:金蝶 14.3 wise实施中采购根据采购申请单数量完全下推了采购订单后发现供应商无法完成订单,反审核修改订单后采购申请单无法行业务反关闭,单张单据异常,采购申请单19070016对应行号34的物料显示还有未下单数量,但是该分录反关闭提示已超出申请数量( 如图),实际还有未下推数量。

处理SQL语句:

分析:按下面语句查询异常单据,以及修复。可先查询确认单据是否有问题
查询执行数量不等于订单数量的申请单
select t0.FBillNo from POrequestEntry ta
join POrequest t0 on ta.FInterID=t0.FInterID
join (select FSourceInterId,FSourceEntryID,sum(FQty) as fqty from POOrder t1
join POOrderEntry t2 on t1.finterid=t2.FInterID
where t1.FStatus>0 and t1.FCancellation=0
group by FSourceInterId,FSourceEntryID) tb on ta.FInterID=tb.FSourceInterId and ta.FEntryID=tb.FSourceEntryID
where FOrderQty<>tb.fqty

修改申请单的执行数量=订单数量
update ta
set ta.FOrderQty=tb.fqty
from POrequestEntry ta
join POrequest t0 on ta.FInterID=t0.FInterID
join (select FSourceInterId,FSourceEntryID,sum(FQty) as fqty from POOrder t1
join POOrderEntry t2 on t1.finterid=t2.FInterID
where t1.FStatus>0 and t1.FCancellation=0
group by FSourceInterId,FSourceEntryID) tb on ta.FInterID=tb.FSourceInterId and ta.FEntryID=tb.FSourceEntryID
where FOrderQty<>tb.fqty