用友U8 销售普通发票现结时,提示“单据编号重复”。 如果换成不同的操作日期,可以结算,但结算几张后又会提示“单据编号重复”。今过SQL跟踪,发现系统生成的结算单号在结算表中确实存在.用友U8 销售普通发票现结时,提示“单据编号重复”。 如果换成不同的操作日期,可以结算,但结算几张后又会提示“单据编号重复”。今过SQL跟踪,发现系统生成的结算单号在结算表中确实存在.
问题原因:收款单是按日期流水的,流水位数只有3位。当当天做的单据比较多,超过999张后现结生成的收款单将与前面生成的收款重号。如下面语句查询的收款单单据流水号就达到了999,在增加同一日期的单据将会报‘单据号重复’错误。 select * from ap_closebill where ccancelno is not null and left(ccancelno,2)='xj' and cast(right(cvouchid,3) as int)=999 解决方法:在单据编号设置中,将单据流水位数根据实际情况增加。 【注意事项】 由于您给发过来的数据只有年度帐,在保存发票及现结时提示主键约束错误,该错误可以通过以下脚本修改。若用户出也出现同样的错误,也可以用下面的语句修改。 update ufsystem..ua_identity set ifatherid=(select max(cast(substring(ccancelno,3,len(ccancelno)) as int)) from ap_closebill where ccancelno is not null and left(ccancelno,2)='xj'),ichildid=(select max(id) from ap_closebills) where cacc_id='666' and cvouchtype='xj' update ufsystem..ua_identity set ifatherid=(select max(sbvid) from salebillvouch),ichildid=(select max(autoid) from salebillvouchs) where cacc_id='666' and cvouchtype='billvouch' update ufsystem..ua_identity set ifatherid=(select max(iid) from ap_closebill),ichildid=(select max(id) from ap_closebills) where cacc_id='666' and cvouchtype='sk'
解决方案:
问题原因:收款单是按日期流水的,流水位数只有3位。当当天做的单据比较多,超过999张后现结生成的收款单将与前面生成的收款重号。如下面语句查询的收款单单据流水号就达到了999,在增加同一日期的单据将会报‘单据号重复’错误。 select * from ap_closebill where ccancelno is not null and left(ccancelno,2)='xj' and cast(right(cvouchid,3) as int)=999 解决方法:在单据编号设置中,将单据流水位数根据实际情况增加。 【注意事项】 由于您给发过来的数据只有年度帐,在保存发票及现结时提示主键约束错误,该错误可以通过以下脚本修改。若用户出也出现同样的错误,也可以用下面的语句修改。 update ufsystem..ua_identity set ifatherid=(select max(cast(substring(ccancelno,3,len(ccancelno)) as int)) from ap_closebill where ccancelno is not null and left(ccancelno,2)='xj'),ichildid=(select max(id) from ap_closebills) where cacc_id='666' and cvouchtype='xj' update ufsystem..ua_identity set ifatherid=(select max(sbvid) from salebillvouch),ichildid=(select max(autoid) from salebillvouchs) where cacc_id='666' and cvouchtype='billvouch' update ufsystem..ua_identity set ifatherid=(select max(iid) from ap_closebill),ichildid=(select max(id) from ap_closebills) where cacc_id='666' and cvouchtype='sk'