对应版本:用友U8.61对应产品线:供应链对应模块:库存管理模块问题现象:数据从U821升级到U861过程中,发现06年的库存期初数据跟升级前的数据对不上问题原因:因821版本的库存期初数据均取自st_totalaccount表,因此在调整您的861数据的时候,是参照您861中的st_totalaccount表来进行修改的。经查,018账套为2005-7月份启用的,升级到861版本后,库存总账是正确的,您可通过如下语句对比得出:useufdata_018_2006/*收发记录主子表中的期初数据*/selectsum(casewhenbrdflag=1theniquantityelse-iquantityend)fromrdrecordainnerjoinrdrecordsbona.id=b.idwherebisstqc=1/*库存总账表中的期初数据*/selectsum(ibeginquantity)fromst_totalaccountwhereimonth=1解决方案:但升级到861后,2006年的库存期初是有错误的。您可通过下面的语句进行调整:updaterdrecordsetbisstqc=0wherecvouchtype’34’andbisstqc=1updateasetbisstqc=0fromrdrecordainnerjoinrdrecordsbona.id=b.idwherebisstqc=1and(cmemonotlike(’850补丁调整工具调整数据’)orcmemoisnull)selectcwhcode,cinvcode,max(a.id)asidintotmp02fromrdrecordainnerjoinrdrecordsbona.id=b.idwherebisstqc=1andcmemolike(’850补丁调整工具调整数据’)groupbycwhcode,cinvcodedeletefromrdrecordswhereidin(selecta.idfromrdrecordainnerjoinrdrecordsbona.id=b.idleftjointmp02cona.id=c.idwherebisstqc=1andcmemolike(’850补丁调整工具调整数据’)andc.idisnull)deletefromrdrecordwhereidin(selecta.idfromrdrecordaleftjointmp02cona.id=c.idwherebisstqc=1andcmemolike(’850补丁调整工具调整数据’)andc.idisnull)selecta.autoid,a.cwhcode,a.cinvcode,a.iquantity,b.stquantityintotmp03from(selectautoid,cwhcode,cinvcode,iquantityfromrdrecordainnerjoinrdrecordsbona.id=b.idwherebisstqc=1andcmemolike(’850补丁调整工具调整数据’))ainnerjoin(selectcwhcode,cinvcode,sum(ibeginquantity)asstquantityfromst_totalaccountwhereimonth=1groupbycwhcode,cinvcode)bona.cwhcode=b.cwhcodeanda.cinvcode=b.cinvcodeupdateasetiquantity=b.stquantityfromrdrecordsainnerjointmp03bona.autoid=b.autoid调整后,通过下面的语句查询期初合计即可:/*收发记录主子表中的期初数据*/selectsum(casewhenbrdflag=1theniquantityelse-iquantityend)fromrdrecordainnerjoinrdrecordsbona.id=b.idwherebisstqc=1/*库存总账表中的期初数据*/selectsum(ibeginquantity)fromst_totalaccountwhereimonth=1【注意事项】执行脚本前请务必做好数据备份!!!

微信号:yyrjlls
技术咨询,有偿服务!
复制微信号
本文链接:https://www.bbsufida.com/u8/46160.html