存货问题,现存量不对

技术咨询,有偿服务!
复制微信号
原因分析:您是否使用了非自然会计期间。如果是的话,有可能造成查询现存量不准。有相关的工具。这个工具不能完全解决现存量不对的问题。如果这种情况在此出现,可以再次运行
问题解答:您是否使用了非自然会计期间。如果是的话,有可能造成查询现存量不准。有相关的工具可以解决这个问题。或者执行以下语句。这个语句不能完全解决现存量不对的问题。如果这种情况在此出现,可以再次运行if exists (select * from tempdb..sysobjects where type='u' and name='forcurrentsyz')drop table tempdb..forcurrentsyzgoselect a.cwhcode,a.cinvcode,sum(iquantity) as iquantity, sum(a.iquantity/Inventory.iInvExchRate) as inuminto tempdb..forcurrentsyz from (select cwhcode,cinvcode,iaInquantity as iquantity from ia_subsidiary where cvoutype='34'union allselect cwhcode,cinvcode,( case when brdflag=1 then iquantity else -1*(iquantity) end) as iquantity from rdrecord left join rdrecords on rdrecord.id=rdrecords.id ) a left join Inventoryon a.cinvcode=Inventory.cinvcodegroup by a.cwhcode,a.cinvcode godelete from currentstockgoinsert into currentstock (cwhcode,cinvcode,iquantity,inum) select cwhcode,cinvcode,iquantity,inum from tempdb..forcurrentsyzgoif exists (select * from tempdb..sysobjects where type='u' and name='forcurrentsyz')drop table tempdb..forcurrentsyzgo