固定资产变动,查询找不到相应卡片
一、在单位做资产类别变动时,选择不到需要变动的卡片
二、开启后台日志跟踪,提取“卡片查询”时后台执行的sql语句如下
- select *
- from ( select row_fa.*, rownum rownum_
- from (select distinct fa_card.card_code,
- fa_card.asset_code,
- fa_card.asset_name,
- fa_card.pk_card
- from fa_card
- left outer join ( select code
- from fa_log
- where pk_corp = '公司pk'
- and (substr (bill_code, 1, 1) = '0')) fa_log_not_in
- on fa_card.pk_card = fa_log_not_in.code
- left outer join fa_cardhistory
- on fa_card.pk_card = fa_cardhistory.fk_card
- left outer join fa_deptscale
- on fa_cardhistory.fk_usedept =
- fa_deptscale.fk_history_usedept
- left outer join fa_category
- on fa_cardhistory.fk_category = fa_category.pk_category
- where (fa_card.dr = 0 and fa_cardhistory.dr = 0 and
- fa_card.pk_corp = '公司pk' and
- fa_cardhistory.pk_corp = '公司pk' and reduce_flag = 0 and
- laststate_flag = 1 and
- fa_cardhistory.fk_accbook = '公司固定资产账簿pk' and
- fa_cardhistory.reduce_flag = 0 and
- fa_cardhistory.laststate_flag = 1 and
- fa_cardhistory.dr = 0 and
- (fa_card.bill_code is null or
- substr(fa_card.bill_code, 1 , 1) = '1') and
- fa_cardhistory.pk_corp = '公司pk' and
- fk_card in
- ( select code
- from fa_log
- where pk_corp = '公司pk'
- and fa_log.fk_accbook = '公司固定资产账簿pk'
- and (bill_code is null or
- substr(bill_code, 1 , 1) = '1')))) row_fa
- where rownum <= 5000)
- where rownum_ > 0
三、通过对刷选条件进行对比,发现问题出在fa_log表中无对应fk_card主键记录,通过如下sql进行查询
- select *
- from fa_log
- where pk_corp = '1138'
- and fa_log.fk_accbook = '公司固定资产账簿pk'
- and (bill_code is null or substr(bill_code, 1 , 1) = '1')
- and code = '固定资产卡片pk'
四、问题解决办法
a、确认此张卡片是否存在未审核的变动单,在“变动单管理”进行查询确认,或者在卡片中点击附属项”减少记录“查看,若有进行”审核“或者”删除“
b、在固定资产最小结账月,重新进行”折旧与摊销“计提;进行固定资产模块结账操作,然后反结账
这次遇到的问题并没有未确认的资产变动单,通过第二种方法进行了操作后,通过对fa_log表进行查询,发现新增了一条新的记录,增加时间为当天,奇怪的现象


浙公网安备 33010602011771号