问题版本: |
76-用友通标准版10.3 |
问题模块: |
9-购销存 |
所属行业: |
0-通用 |
问题状态: |
1-UU通注册用户 |
关 键 字: |
发货单弃审 |
适用产品: |
|
补 丁 号: |
|
开放状态: |
0-UU通注册用户 |
原问题号: |
|
提交时间: |
2008-4-28 20:48:00 |
问题名称: |
发货单弃审失败 |
问题现象: |
在对发货单弃审时出现错误提示:000001号单据弃审失败!过程'SA_CancelsureFHD'需要参数'@VouchID',但未提供该参数。 |
原因分析: |
存储过程被改写 |
解决方案: |
针对报错账套,请执行如下语句:SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO ALTER PROC SA_CancelSureFHD( @VouchType as varchar(3), @VouchID As Int) AS --删除出库单、删除货位、修改现存量 Declare @AutoID As Int Declare @cWhCode As Varchar(10) Declare @cInvCode As Varchar(20) Declare @cFree1 As Varchar(20) Declare @cFree2 As Varchar(20) Declare @iQuantity As Float Declare @iNum As Float Declare @iDispQuantity As Float Declare @iDispNum As Float --弃审时如果生成的是红字销售出库单则如果指定了货位,就不能弃审 --在删除货位结存时要判断不等于‘货位调整’ --SET @AutoID=(SELECT Count(AutoID) FROM RdRecord INNER JOIN RdRecords ON RdRecord.ID=RdRecords.ID -- WHERE cVouchType='32' AND bRdFlag=0 AND iQuantity<0 AND RdRecord.cDLCode = @VouchID -- AND AutoID IN (SELECT RdsID FROM InvPosition WHERE IsNull(cSource,'')='')) --If IsNull(@AutoID,0)=0 -- Begin --删除货位 if @VouchType='FHD' OR @VouchType='WT' if @VouchType='FHD' DELETE FROM InvPosition WHERE IsNull(cSource,'')='' AND RdsID IN (SELECT RdRecords.AutoID FROM (RdRecord INNER JOIN RdRecords ON RdRecord.ID=RdRecords.ID) inner join dispatchlists on rdrecords.idlsid=dispatchlists.idlsid WHERE DLID = @VouchID AND cVouchType='32') Else DELETE FROM InvPosition WHERE IsNull(cSource,'')='' AND RdsID IN (SELECT RdRecords.AutoID FROM (RdRecord INNER JOIN RdRecords ON RdRecord.ID=RdRecords.ID) inner join EnDispatchs on rdrecords.iEnsid=EnDispatchs.AutoID WHERE EDID = @VouchID AND cVouchType='32') else DELETE FROM InvPosition WHERE IsNull(cSource,'')='' AND RdsID IN (SELECT RdRecords.AutoID FROM (RdRecord INNER JOIN RdRecords ON RdRecord.ID=RdRecords.ID) inner join salebillvouchs on rdrecords.isbsid=salebillvouchs.autoid WHERE sbvid = @VouchID AND cVouchType='32') --修改现存量表 if @VouchType='FHD' OR @VouchType='WT' if @VouchType='FHD' DECLARE cur_CurrentStock CURSOR FOR SELECT DispatchLists.cWhCode,DispatchLists.cInvCode,DispatchLists.cFree1,DispatchLists.cFree2,Rdrecords.iQuantity,RdRecords.iNum,DispatchLists.iQuantity,DispatchLists.iNum FROM (RdRecord INNER JOIN RdRecords ON RdRecord.ID = RdRecords.ID) inner join DispatchLists on dispatchlists.idlsid=rdrecords.idlsid WHERE DLID = @VouchID AND cVouchType='32' AND cBusType<>'委托代销' FOR READ ONLY Else DECLARE cur_CurrentStock CURSOR FOR SELECT EnDispatchs.cWhCode,EnDispatchs.cInvCode,EnDispatchs.cFree1,EnDispatchs.cFree2,Rdrecords.iQuantity,RdRecords.iNum,EnDispatchs.iQuantity,EnDispatchs.iNum FROM (RdRecord INNER JOIN RdRecords ON RdRecord.ID = RdRecords.ID) inner join EnDispatchs on EnDispatchs.AutoID=rdrecords.iEnsid WHERE EDID = @VouchID AND cVouchType='32' FOR READ ONLY else DECLARE cur_CurrentStock CURSOR FOR SELECT Salebillvouchs.cWhCode,Salebillvouchs.cInvCode,Salebillvouchs.cFree1,Salebillvouchs.cFree2,Rdrecords.iQuantity,RdRecords.iNum,Salebillvouchs.iQuantity,Salebillvouchs.iNum FROM (RdRecord INNER JOIN RdRecords ON RdRecord.ID = RdRecords.ID) inner join Salebillvouchs on Salebillvouchs.autoid=rdrecords.isbsid WHERE sbvid = @VouchID AND cVouchType='32' FOR READ ONLY OPEN cur_CurrentStock FETCH NEXT FROM cur_CurrentStock INTO @cWhCode,@cInvCode,@cFree1,@cFree2,@iQuantity,@iNum,@iDispQuantity,@iDispNum WHILE @@FETCH_STATUS>=0 Begin -- If @VouchType='WT' -- UPDATE CurrentStock SET fOutQuantity=cast(isnull(fOutQuantity,0)+@iDispQuantity as decimal(20,6)),fOutNum=cast(isnull(fOutNum,0)+@iDispNum as decimal(20,6)), -- iQuantity=cast(isnull(iQuantity,0)+@iQuantity as decimal(20,6)),iNum=cast(isnull(iNum,0)+@iNum as decimal(20,6)) -- WHERE cWhCode = @cWhCode AND cInvCode = @cInvCode AND IsNull(cFree1,'') = IsNull(@cFree1,'') AND IsNull(cFree2,'') = IsNull(@cFree2,'') -- Else If @iDispQuantity>0 UPDATE CurrentStock SET fOutQuantity=cast(isnull(fOutQuantity,0)+@iDispQuantity as decimal(20,6)),fOutNum=cast(isnull(fOutNum,0)+@iDispNum as decimal(20,6)), iQuantity=cast(isnull(iQuantity,0)+@iQuantity as decimal(20,6)),iNum=cast(isnull(iNum,0)+@iNum as decimal(20,6)) WHERE cWhCode = @cWhCode AND cInvCode = @cInvCode AND IsNull(cFree1,'') = IsNull(@cFree1,'') AND IsNull(cFree2,'') = IsNull(@cFree2,'') Else UPDATE CurrentStock SET fInQuantity=cast(isnull(fInQuantity,0)+Abs(@iDispQuantity) as decimal(20,6)),fInNum=cast(isnull(fInNum,0)+Abs(@iDispNum) as decimal(20,6)), iQuantity=cast(isnull(iQuantity,0)-Abs(@iQuantity) as decimal(20,6)),iNum=cast(isnull(iNum,0)-Abs(@iNum) as decimal(20,6)) WHERE cWhCode = @cWhCode AND cInvCode = @cInvCode AND IsNull(cFree1,'') = IsNull(@cFree1,'') AND IsNull(cFree2,'') = IsNull(@cFree2,'') If @@Error<>0 Begin SELECT 0 AS iRet,'修改现存量错!' AS Info Return End FETCH NEXT FROM cur_CurrentStock INTO @cWhCode,@cInvCode,@cFree1,@cFree2,@iQuantity,@iNum,@iDispQuantity,@iDispNum End CLOSE cur_CurrentStock DEALLOCATE cur_CurrentStock if @VouchType='FHD' OR @VouchType='WT' if @VouchType='FHD' DELETE FROM RdRecords WHERE IsNull(iEnsID,0)=0 And iDLsID IN (SELECT iDLsID FROM DispatchLists WHERE DLID=@VouchID) Else DELETE FROM RdRecords WHERE IsNull(iEnsID,0)<>0 And iEnsID IN (SELECT AutoID FROM EnDispatchs WHERE EDID=@VouchID) else DELETE FROM RdRecords WHERE iSBsid IN (SELECT autoid FROM salebillvouchs WHERE sbvid=@VouchID) If @@Error<>0 Begin SELECT 0 AS iRet,'删除出库单表体记录错!' AS Info Return End --if @VouchType='FHD' delete from rdrecord where id in (select rdrecord.id from rdrecord left join rdrecords on rdrecord.id=rdrecords.id where rdrecords.id is null) --else -- DELETE FROM RdRecord WHERE cBillCode = @VouchID AND cVouchType='32' If @@Error<>0 Begin SELECT 0 AS iRet,'删除出库单表头记录错!' AS Info Return End -- End --Else -- Begin -- SELECT 0 AS iRet,'号发货单对应的红字出库单已经指定货位,不能弃审!' AS Info -- Return -- End if @VouchType='FHD' OR @VouchType='WT' if @VouchType='FHD' UPDATE DispatchList SET cSaleOut='' WHERE DLID=@VouchID Else UPDATE EnDispatch SET cSaleOut='' WHERE EDID=@VouchID else UPDATE Salebillvouch SET cSaleOut='' WHERE SBVID=@VouchID If @@Error<>0 Begin SELECT 0 AS iRet,'修改发货单错!' AS Info Return End SELECT 1 AS iRet,'' As Info Return GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO | |