产品版本: | 1089-T6-企业管理软件V6.0 | 适用产品: | T6系列 |
产品模块: | 18-库存管理 | 提交时间: | 2012-06-12 |
问题现象: | 同一张到货单上,同一个存货编码有四行记录,只有一行记录在采购入库单参照到货单生单界面可以显示;检查发现该存货档案未启用质检,到货单也未入库,删除到货单提示单据已被其他单据引用无法删除。询问客户得知这张到货单做过入库后来删除了入库单后就出现故障。 | ||
原因分析: |
因为客户做过入库后又删除了,所以怀疑是后台数据错掉导致入库无法显示完全。数据库后台跟踪采购入库单参照到货单生单时使用的脚本:select distinct pu_ArrHead.caccountpdate,pu_ArrHead.caccountpid,pu_ArrHead.caccountpname,pu_ArrHead.cpayname,pu_ArrHead.cpaycode,pu_ArrHead.ivtid, pu_ArrHead.ufts, pu_ArrHead.ccode, pu_ArrHead.ddate, pu_ArrHead.id, pu_ArrHead.cptcode, pu_ArrHead.cptname,pu_ArrHead.cbustype, pu_ArrHead.cvencode, pu_ArrHead.cvenabbname, pu_ArrHead.cdepcode, pu_ArrHead.cdepname, pu_ArrHead.cpersoncode, pu_ArrHead.cpersonname, pu_ArrHead.cpaycode, pu_ArrHead.cpayname, pu_ArrHead.cexch_name, pu_ArrHead.cexch_code, pu_ArrHead.iexchrate, pu_ArrHead.cmemo,pu_ArrHead.cmaker, pu_ArrHead.bnegative, cvendefine1,cvendefine2,cvendefine3,cvendefine4,cvendefine5,cvendefine6,cvendefine7,cvendefine8,cvendefine9,cvendefine10,cvendefine11,cvendefine12,cvendefine13,cvendefine14,cvendefine15,cvendefine16, pu_ArrHead.cdefine1,pu_ArrHead.cdefine2, pu_ArrHead.cdefine3, pu_ArrHead.cdefine4, pu_ArrHead.cdefine5, pu_ArrHead.cdefine6, pu_ArrHead.cdefine7, pu_ArrHead.cdefine8, pu_ArrHead.cdefine9, pu_ArrHead.cdefine10, pu_ArrHead.cdefine11, pu_ArrHead.cdefine12, pu_ArrHead.cdefine13, pu_ArrHead.cdefine14, pu_ArrHead.cdefine15, pu_ArrHead.cdefine16, pu_ArrHead.iTaxRate , pu_ArrHead.csccode, pu_ArrHead.cscname, pu_ArrHead.cauthid,convert(char,convert(money,pu_arrhead.ufts),2) as coufts from pu_arrhead inner join pu_arrbody on pu_arrhead.id=pu_arrbody.id left outer join qm_ncheckvouchers on pu_arrbody.autoid=qm_ncheckvouchers.isourceautoid and pu_arrbody.bgsp='是' left outer join qm_ncheckvoucher on qm_ncheckvouchers.id=qm_ncheckvoucher.id and (qm_ncheckvoucher.cvouchtype='qm10' and qm_ncheckvoucher.csourcecardnumber='26') where ( ( isnull(pu_arrbody.irejid,'')='' and pu_arrbody.bgsp='否' and (abs(isnull(pu_arrbody.iQuantity,0))>abs(isnull(pu_arrbody.fValidInQuan,0)) or (pu_arrbody.igrouptype=2 and abs(isnull(pu_arrbody.inum,0))>abs(isnull(pu_arrbody.fValidInnum,0)))) ) or (isnull(pu_arrbody.irejid,'')='' and pu_arrbody.bgsp='是' and isnull(qm_ncheckvoucher.cverifier,'')<>'' and ( (case when isnull(pu_arrbody.fvalidQuantity,0)>isnull(pu_arrbody.iquantity,0) then abs(isnull(pu_arrbody.iquantity,0)) else abs(isnull(pu_arrbody.fvalidquantity,0)) end ) > abs(isnull(pu_arrbody.fValidInQuan,0)) or (pu_arrbody.igrouptype=2 and ( case when isnull(pu_arrbody.fvalidnum,0)>isnull(pu_arrbody.inum,0) then abs(isnull(pu_arrbody.inum,0)) else abs(isnull(pu_arrbody.fvalidnum,0)) end )>abs(isnull(pu_arrbody.fValidInnum,0)))) ) ) And pu_ArrHead.cCode = 'th201108004' order by pu_arrHead.ccode 逐个检查where条件后面的字段值,发现该张入库单的fvalidinquan和fvalidinnum都是负数且分别是iQuantity和inum的相反数,所以导致abs(isnull(pu_arrbody.iQuantity,0))>abs(isnull(pu_arrbody.fValidInQuan,0)和abs(isnull(pu_arrbody.inum,0))>abs(isnull(pu_arrbody.fValidInnum,0))这样的条件不符合。 | ||
解决方案: | 因为该张入库单的fvalidinquan和fvalidinnum都是负数且分别是iQuantity和inum的相反数导致查询条件不符所以采购入库时无法过滤出到货单记录,该到货单未入库,所以修改iQuantity和inum的值为0,pu_arrbody是根据表pu_arrivalvouchs 创建的视图,备份账套后执行以下语句问题解决:update pu_arrivalvouchs set fvalidinquan=0,fvalidinnum=0 where id=(select id from pu_arrivalvouch where ccode='0000008324') |