销售订单下推报错:“需要预收的实收金额之和等于应收金额之和才能下推...”,但实际上并没有启用预收控制发货
**问题表现:**
销售订单下推发货通知单报错:“通过预收控制发货,需要预收的实收金额之和等于应收金额之和才能下推”
导致无法下推发货通知单,但检查单据,实际上并没有启用预收控制发货
**问题原因:**
根据目前收到的反馈,这种往往是销售订单收款计划为空导致(前台看有一行数据,但实际上数据库中是没有数据的,前台体现的实际是默认显示行,但并无实际数据)
常见于引入、对接、升级工具等导致的数据异常
**解决方案:**
1、**如果是单张订单,可打开销售订单后,重新保存订单即可(请优先使用该方法)**
2、如果有大批量订单存在此种情况,可参考以下脚本修复
```sql
/*
使用前提:
1、SQLserver数据库
2、订单收款条件非按物料明细收款(脚本中已做排除)
3、适用于私有云,该脚本不支持天梯提交
*/
--生成备份语句并备份数据(重要)
DECLARE @BAKTABLE udt_nvarchartable
INSERT INTO @BAKTABLE VALUES('T_SAL_ORDERPLAN')
SELECT 'SELECT * INTO '+FID+'_BAK_'+
REPLACE(SUBSTRING(CONVERT(NVARCHAR,GETDATE(),121),1,10),'-','')+'_'+
REPLACE(SUBSTRING(CONVERT(NVARCHAR,GETDATE(),121),12,5),':','')
+' FROM '+FID
FROM @BAKTABLE
--1、存储过滤无收款计划订单FID备查
SELECT A.FID INTO DR_NOTIN_FID
--SELECT COUNT(1)
FROM
T_SAL_ORDER A
LEFT JOIN T_SAL_ORDERFIN FIN ON A.FID = FIN.FID
LEFT JOIN T_BD_RECCONDITION REC ON FIN.FRECCONDITIONID = REC.FID
LEFT JOIN T_SAL_ORDERPLAN PL ON A.FID = PL.FID
WHERE 1=1
AND ISNULL(REC.FRECMETHOD,0) <> 3 --排除按物料明细收款
AND PL.FID IS NULL
GO
--2、插入空值收款计划
DECLARE @FENTRYID INT
SELECT @FENTRYID = MAX(FENTRYID)+1 FROM T_SAL_ORDERPLAN
INSERT INTO T_SAL_ORDERPLAN
(FENTRYID,FID,FRECEIVETYPE,FNEEDRECADVANCE,FRECADVANCERATE,FRECADVANCEAMOUNT,FRECAMOUNT,FMUSTDATE,FRELBILLNO,FCONTROLSEND,FREMARK,FSEQ,FPREMATCHAMOUNTFOR,FPLANMATERIALID,FMATERIALSEQ,FORDERENTRYID,FASSAMOUNTFOR,FASSDEDAMOUNTFOR,FISOUTSTOCKBYRECAMOUNT,FMATERIALROWID,FAGGRECAMOUNT,FMATERIALTAXPRICE,FMATERIALPRICEUNITQTY,FMATERIALPRICEUNITID,FOVERRECAMOUNT,FXPKID)
select
@FENTRYID + ROW_NUMBER()OVER(ORDER BY A.FID),A.fid
,' ','0',100.000000,0.0000000000,0.00,null,N' ',' ',N' ',1,0.00,0,0,0,0.00,0.00,'0',' ',0.00,0.00,0.00,0,0.00,0
from
T_SAL_ORDER A
LEFT JOIN T_SAL_ORDERPLAN PL ON A.FID = PL.FID
WHERE 1=1
AND A.FID IN (SELECT FID FROM DR_NOTIN_FID)
GO
--3、汇总修复收款计划应收金额
--SELECT
-- FIN.FBILLALLAMOUNT,
-- *
UPDATE PL SET FRECADVANCEAMOUNT = FIN.FBILLALLAMOUNT
FROM
T_SAL_ORDERPLAN PL
INNER JOIN T_SAL_ORDERFIN FIN ON PL.FID = FIN.FID
WHERE
PL.FID IN (SELECT FID FROM DR_NOTIN_FID)
GO
--4、重置种子表
DECLARE @NUM BIGINT
SET @NUM = (SELECT MAX(FENTRYID) FROM T_SAL_ORDERPLAN)
DBCC CHECKIDENT(Z_SAL_ORDERPLAN,RESEED,@NUM)
```
销售订单下推报错:“需要预收的实收金额之和等于应收金额之和才能下推...”,但实际上并没有启用预收控制发货
**问题表现:**销售订单下推发货通知单报错:“通过预收控制发货,需要预收的实收金额之和等于应收金额之和才能下推”导致无法下推发货通知...
点击下载文档
本文2024-09-23 02:47:10发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-154689.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章