用友T6出库跟踪入库型存货处理通用脚本用友T6出库跟踪入库型存货处理通用脚本
存货2102080在仓库01有现存量,录出库单时也可选择批次,但在出库单表体对应入库单号的参照界面中却没有记录。2102080存货的不能参照入库单的原因是:存货对应入库单的累计出库数量错误以及出入库跟踪表记录错误。以下是通用的脚本,可直接修改出库跟踪入库型存货的入库单子表累计出库数量与对应出入库跟踪表出空标识,脚本如下:–查询出库跟踪入库型存货的入库单“累计出库数量”不等于对应出库单“实际出库数量”(不包含辅助计量单位、存货自由项)
select rds.autoid,rd.cwhcode,rds.cinvcode,(case when bRdFlag=1 then rds.iQuantity else -rds.iQuantity end) as iinQuantity,rds.isoutquantity,a.ifoutquantity
from rdrecord rd inner join RdRecords rds on rd.ID=rds.id right join (select cvouchcode,cwhcode,cinvcode,sum(iquantity) as ifoutquantity from rdrecord rd left join RdRecords rds on rd.ID=rds.id where cwhcode=’01′ and cinvcode=’2102080′ and brdflag=0 and cvouchcode is not null group by cvouchcode,cwhcode,cinvcode) a on a.cvouchcode=rds.autoid and a.cwhcode=rd.cwhcode and a.cInvCode=rds.cInvCode
where (brdflag=1 or(brdflag=0 and rds.cVouchCode is null)) and rds.isoutquantity<>a.ifoutquantity and (case when bRdFlag=1 then rds.iQuantity else -rds.iQuantity end)>a.ifoutquantity –最后rds.isoutquantity>a.ifoutquantity考虑到有可能实际出库数量大于入库单据累计入库数量
–查询出入库跟踪表“是否出空”记录(不包含辅助计量单位、存货自由项)
select MainBatch.rdid,MainBatch.cwhcode,MainBatch.cinvcode,MainBatch.bisnull,a.iinQuantity,a.isoutquantity
from MainBatch right join (select rds.autoid,rd.cwhcode,rds.cinvcode,(case when bRdFlag=1 then rds.iQuantity else -rds.iQuantity end) as iinQuantity,rds.isoutquantity from rdrecord rd left join RdRecords rds on rd.ID=rds.id where (brdflag=1 or(brdflag=0 and cVouchCode is null))) a on a.AutoID=MainBatch.RdID and a.cWhCode=MainBatch.cWhCode and a.cInvCode=MainBatch.cInvCode
where MainBatch.cwhcode=’01′ and MainBatch.cInvCode =’2102080′ and a.iinQuantity<>a.iSOutQuantity and MainBatch.bisnull<>0
如确定上述问题,修改脚本如下:
–修改出库跟踪入库型存货的入库单“累计出库数量”不等于对应出库单“实际出库数量”(不包含辅助计量单位、存货自由项)
update RdRecords set iSOutQuantity=a.ifoutquantity
from rdrecord rd inner join RdRecords rds on rd.ID=rds.id right join (select cvouchcode,cwhcode,cinvcode,sum(iquantity) as ifoutquantity from rdrecord rd left join RdRecords rds on rd.ID=rds.id where cwhcode=’01′ and cinvcode=’2102080′ and brdflag=0 and cvouchcode is not null group by cvouchcode,cwhcode,cinvcode) a on a.cvouchcode=rds.autoid and a.cwhcode=rd.cwhcode and a.cInvCode=rds.cInvCode
where (brdflag=1 or(brdflag=0 and rds.cVouchCode is null)) and rds.isoutquantity<>a.ifoutquantity and (case when bRdFlag=1 then rds.iQuantity else -rds.iQuantity end)>a.ifoutquantity –最后rds.isoutquantity>a.ifoutquantity考虑到有可能实际出库数量大于入库单据累计入库数量
–修改出入库跟踪表“是否出空”记录(不包含辅助计量单位、存货自由项)
update MainBatch set bIsNull=0
from MainBatch right join (select rds.autoid,rd.cwhcode,rds.cinvcode,(case when bRdFlag=1 then rds.iQuantity else -rds.iQuantity end) as iinQuantity,rds.isoutquantity from rdrecord rd left join RdRecords rds on rd.ID=rds.id where (brdflag=1 or(brdflag=0 and cVouchCode is null))) a on a.AutoID=MainBatch.RdID and a.cWhCode=MainBatch.cWhCode and a.cInvCode=MainBatch.cInvCode
where MainBatch.cwhcode=’01′ and MainBatch.cInvCode =’2102080′ and a.iinQuantity<>a.iSOutQuantity and MainBatch.bisnull<>0
如有用友T6其它问题,请在下面回复疑问,我们将第一时间与您联系,帮助您解决问题。同时您也可以联系用友畅捷服务联盟用友4S店-用友天龙瑞德软件有限公司。用友天龙瑞德软件专业销售用友软件,用友财务软件,寻找用友T6服务商,咨询用友T6价格,用友T6多少钱,用友T6报价,联系电话:010-59798025。网址:http://yun.kuaiji66.com