解决方案: |
1、库存系统在进行与存货时,其中库存系统的期初数据是按如下逻辑统计出来的(假设该帐套启用日期为:2005-10-01): select Str((SUM((Case When IsNull(bIsSTQc,0)= 1 OR dDate <'2005-10-01' Then ((CASE WHEN bRdFlag <> 0 then 1 else -1 end) * RdRecords.iQuantity ) ELSE 0 END )))) as 库存期初数量 ,RdRecord.cWhCode ,RdRecords.cInvCode ,Inventory.cInvName ,Inventory.cInvStd, Str(Sum(Case When dDate >='2005-10-01' And dDate <='2005-10-31' And bRdFlag <> 0 And IsNull(bIsSTQc,0) = 0 Then RdRecords.iQuantity Else 0 End) ,30,2) AS iIQuantity , Str(Sum(Case When dDate >='2005-10-01' And dDate <='2005-10-31' And bRdFlag <> 1 And IsNull(bIsSTQc,0) = 0 Then RdRecords.iQuantity Else 0 End) ,30 ,2 ) As iOQuantity FROM RdRecord INNER JOIN RdRecords ON RdRecord.Id = RdRecords.Id INNER JOIN Inventory ON RdRecords.cInvCode = Inventory.cInvCode WHERE ((RdRecord.dDate < '2005-10-01' And IsNull(RdRecord.bIsSTQc,0) = 1) Or (RdRecord.dDate >= '2005-10-01' And IsNull(RdRecord.bPUFirst,0) = 0 And IsNull(RdRecord.bIAFirst,0) = 0 And IsNull(RdRecord.bOMFirst,0) = 0 And (not (RdRecord.cBusType = '假退料'and RdRecord.cVouchType = 11)) ) ) and (isnull(RdRecord.cbustype,'')<>N'预留出库' and isnull(RdRecord.cbustype,'')<>N'预留入库') GROUP BY RdRecord.cWhCode, RdRecords.cInvCode, Inventory.cInvName,Inventory.cInvStd 2、存货系统的期初数据是按如下逻辑统计出来的: SELECT Str(isnull(sum(iNum),0),30,2) AS 存货期初数量, IA_Summary.cWhCode, IA_Summary.cInvCode, Inventory.cInvName, Inventory.cInvStd, Str(isnull(sum(IA_Summary.iINum),0),30,2) AS iIncomeQuantity, Str(isnull(sum(IA_Summary.iONum),0),30,2) AS iSentOutQuantity FROM IA_Summary INNER JOIN Inventory ON IA_Summary.cInvCode = Inventory.cInvCode Where iMonth = 10 GROUP BY IA_Summary.cWhCode, IA_Summary.cInvCode, Inventory.cInvName,Inventory.cInvStd 请根据以上脚本或借助SQL事件探查器检查分析进一步原因,如果是由于存货明细与存货总帐数据不一致造成的,可用修复存货总帐的工具修复后看问题能否解决,或提供远程环境进一步分析处理。 |