解决方案: |
如果用户非要和存货档案中的一致,可以提供如下语句更改,更改语句供参考:建议用户根据具体单据手工修改:
--- 收发主子表
update rdrecords
set inum=CONVERT(DECIMAL(20,6),iquantity/bb.iInvExchRate)
from rdrecords inner join ( select aa.*,inventory.iInvExchRate ,abs(aa.iex-iInvExchRate) as tt
from ( select rdrecords.autoid,rdrecords.id,rdrecords.cinvcode,
(iquantity/inum ) as iex from rdrecords --,rdrecords.* ) aa
inner join inventory on inventory.cinvcode=aa.cinvcode
where abs(aa.iex-iInvExchRate)>0.01 --order by aa.cinvcode ) bb
on bb.autoid=rdrecords.autoid
其他单据请自己写更新语句。 |