解决方案: |
执行如下语句即可调整采购期初暂估入库余额表与存货中期初暂估材料余额表的数量不等:
update rdrecords
set isoutquantity=null,dsdate=null
where autoid='2249'
if exists (select * from sysobjects where name='ia')
drop table ia
go
SELECT IA_Subsidiary.id,IA_Subsidiary.cvencode,IA_Subsidiary.cwhcode,IA_Subsidiary.cInvCode,cast(iAInQuantity as float) AS qcQ, cast(ISNULL(iAInPrice,0)+isnull(iDebitDifCost,0)-isnull(iCreditDifCost,0) as float) AS qcP into ia
FROM IA_Subsidiary INNER JOIN Inventory ON IA_Subsidiary.cInvCode=Inventory.cInvCode WHERE IA_Subsidiary.cWhCode IN ('1','2','3','4','5','6','7') AND Inventory.bInvEntrust=0 AND (IA_Subsidiary.cVouType='33') AND IA_Subsidiary.bFlag=1 and IA_Subsidiary.cBusType='普通采购' AND IA_Subsidiary.iMonth <5
update rdrecords
set rdrecords.facost=ia.qcp/qcq
from rdrecords join ia on
ia.ID=rdrecords.AutoID and ia.cInvCode=rdrecords .cInvCode
|