解决方案: |
请在2004年度执行以下脚本,更正关联关系。清空2005年数据后再执行年结。
update ia_valuationass
set dikeepdate=dkeepdate,inid=ia_subsidiary.id
from ia_valuationass
left join ia_subsidiary
on ia_valuationass.cwhcode=ia_subsidiary.cwhcode and ia_valuationass.cinvcode=ia_subsidiary.cinvcode
left join warehouse
on ia_subsidiary.cwhcode=warehouse.cwhcode
where ia_subisiary.cvoutype='34'
and ia_valuationass.dkeepdate<'2004-1-1'
and isnull(iainquantity,0)>0
and b.cwhvaluestyle in ('先进先出法','后进先出法')
update ia_valuationass
set dokeepdate=dkeepdate,outid=ia_subsidiary.id
from ia_valuationass
left join ia_subsidiary
on ia_valuationass.cwhcode=ia_subsidiary.cwhcode and ia_valuationass.cinvcode=ia_subsidiary.cinvcode
left join warehouse
on ia_subsidiary.cwhcode=warehouse.cwhcode
where ia_subisiary.cvoutype='34'
and ia_valuationass.dkeepdate<'2004-1-1'
and isnull(iainquantity,0) |