结账提示不能插入重复值

栏目:kis知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:2

结账提示不能插入重复值

问题处理1、通过数据库跟踪,提示不能在表T_cc_stock主键插入重复值,开始不知道是哪个键值重复,于是到企业管理器里面修改这个表不受主键约束,结帐通过,通过下面这段代码找出重复值
select fyear,fperiod,fstockid,fitemid,fbatchno,fauxpropid from t_cc_stock group by fyear,fperiod,fstockid,fitemid,fbatchno,fauxpropid having count(*)>1
发现有两条重复,不知道为什么金蝶商贸版在使用日期管理的时候,同一个批号可以录入不同的开始日期和结束日期,也许是金蝶商贸版的一个BUG吧,因为在期抹结帐时提取的分组求和字段有这两个字段fperioddate,fkfdate,
2、找出两个相同的记录,修改批号对应同等的开始和结束日期后,期末结帐通过

select fitemid,fbatchno,fauxpropid,min(fkfdate) as
fkfdate,min(fperioddate) as fperioddate into temp1
from t_cc_stockbillentry
group by fitemid ,fbatchno,fauxpropid

update a set a.fkfdate=b.fkfdate,a.fperioddate=b.fperioddate from
t_cc_stockbillentry a inner join temp1 b on a.fitemid=b.fitemid and a.fbatchno=b.fbatchno and a.fauxpropid=b.fauxpropid

update a set a.fkfdate=isnull(b.fkfdate,'1900-01-01 00:00:00.000'),a.fperioddate=isnull(b.fperioddate,'1900-01-01 00:00:00.000')
from t_cc_stock a inner join temp1 b on a.fitemid=b.fitemid and a.fbatchno=b.fbatchno and a.fauxpropid=b.fauxpropid

drop table temp1

=====================
=====================
update t_icitem set fiskfperiod=0,fkfperiod=0 where ftrack<>80

update a set a.fkfdate=null,a.fperioddate=null,a.fkfperiod=0 from t_cc_stockbillentry a inner join t_icitem b on a.fitemid=b.fitemid where b.ftrack<>80

update c set c.fkfdate='1900-01-01',c.fperioddate='1900-01-01',c.fkfperiod=0 from t_cc_stockbillentry c inner join t_icitem d on c.fitemid=d.fitemid where d.ftrack<>80


非常感谢您的分享,根据您反馈的问题:商品按批号管理+按保质期管理,数据库中存在同一批号、不同开始/结束日期的记录,引起商贸版结账报错。我们做了如下测试:在商品的购货单、估价入库单、其他入库单等入库类单据中,商贸版有控制到同一批号不允许录入不同开始/结束日期,因此无法重现您反馈的现象。
因此,这一问题,我先记录下来,以供开发参考,另一方面,也请您进一步提供重现的操作步骤,只有重现后的BUG才能够生成补丁。非常感谢您为金蝶软件的完善做出的贡献。

结账提示不能插入重复值

问题处理1、通过数据库跟踪,提示不能在表T_cc_stock主键插入重复值,开始不知道是哪个键值重复,于是到企业管理器里面修改这个表不受主键...
点击下载文档
分享:
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息