旗舰版红字出库单审核时提示:单据审核未成功,销售订单第N条物料出库数量为负?
【问题描述】
旗舰版蓝字销售出库单下推生成红字出库单,红字出库单审核时提示:单据审核未成功,销售订单第N条物料出库数量为负!如下图所示:
【场景介绍】
历史程序bug,一般是没有更新过补丁的环境,或者打补丁前出现的历史数据问题。问题原因是销售订单的已出库数量不准确,需要修改销售订单的已出库数量。
【解决方案】
可参考以下方法操作处理:
1、检查数据(查出来的数据大概率是有问题的):
--审核时更新库存
select * from seorder a inner join SEOrderEntry b on a.FInterID=b.FInterID left join (select FOrderInterID,FOrderEntryID,sum(FQty) fqty,sum(FAuxQty) fauxqty from icstockbill a inner join ICStockBillEntry b on a.FInterID=b.FInterID where FStatus>0 and FCancellation<>1 and FTranType=21 group by FOrderInterID,FOrderEntryID) c on b.fentryid=c.FOrderEntryID and a.FInterID=c.FOrderInterID
where b.FStockQty<>c.fqty
go
--保存时更新库存
select * from seorder a inner join SEOrderEntry b on a.FInterID=b.FInterID left join (select FOrderInterID,FOrderEntryID,sum(FQty) fqty,sum(FAuxQty) fauxqty from icstockbill a inner join ICStockBillEntry b on a.FInterID=b.FInterID where FCancellation<>1 and FTranType=21 group by FOrderInterID,FOrderEntryID) c on b.fentryid=c.FOrderEntryID and a.FInterID=c.FOrderInterID
where b.FStockQty<>c.fqty
go
2、更新数据(如果查出来的数据比较多,一定要先备份好账套再更新数据,或者提单给总部由总部技术判断)
--审核时更新库存
update b set b.FStockQty=c.fqty,b.FauxStockQty=c.fauxqty from seorder a inner join SEOrderEntry b on a.FInterID=b.FInterID left join (select FOrderInterID,FOrderEntryID,sum(FQty) fqty,sum(FAuxQty) fauxqty from icstockbill a inner join ICStockBillEntry b on a.FInterID=b.FInterID where FStatus>0 and FCancellation<>1 and FTranType=21 group by FOrderInterID,FOrderEntryID) c on b.fentryid=c.FOrderEntryID and a.FInterID=c.FOrderInterID where b.FStockQty<>c.fqty
go
--保存时更新库存
update b set b.FStockQty=c.fqty,b.FauxStockQty=c.fauxqty from seorder a inner join SEOrderEntry b on a.FInterID=b.FInterID left join (select FOrderInterID,FOrderEntryID,sum(FQty) fqty,sum(FAuxQty) fauxqty from icstockbill a inner join ICStockBillEntry b on a.FInterID=b.FInterID where FCancellation<>1 and FTranType=21 group by FOrderInterID,FOrderEntryID) c on b.fentryid=c.FOrderEntryID and a.FInterID=c.FOrderInterID where b.FStockQty<>c.fqty
go
【注意事项】正式账套执行脚本前请先做好备份,建议待在测试账套中核实无误后再在正式账套中执行。
旗舰版红字出库单审核时提示:单据审核未成功,销售订单第N条物料出库数量为负?
本文2024-09-22 16:37:06发表“kis知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-kis-89112.html