全智通A+常见问题汇总解答—A+会员充值明细页面删除失败

90 篇文章 0 订阅
81 篇文章 0 订阅

错误描述:会员充值明细页面点击删除充值单,提示删除失败

错误日志

【错误SQL语句】:update t_member_product set amount=amount-(select amount from t_member_chargproduct  where document_id='HC180820002' and product_id=t_member_product.product_id) ,amount_remain=amount_remain-(select amount from t_member_chargproduct  where document_id='HC180820002' and product_id=t_member_product.product_id) where member_id=(select member_bid from t_member_charg where document_id='HC180820002') and product_id in (select product_id from t_member_chargproduct  where document_id='HC180820002' and amount>0) and paysort='计次消费'

 

错误原因:历史版本导致会员充值允许充重复的项目和货品,删除充值单据时,后台子查询:一个充值单不会存在两条重复的项目编号或者货品编号。

解决方案

查询重复项目和货品

select max(id) as id,member_id,ritem_id from t_member_ritem group by member_id,ritem_id HAVING count(ritem_id)>1

select max(id) as id,member_id,product_id from t_member_product  group by member_id,product_id HAVING count(product_id)>1

select max(id) as id,document_id,ritem_id from t_member_chargritem group by document_id,ritem_id HAVING count(ritem_id)>1

select max(id) as id,document_id,product_id from t_member_chargproduct group by document_id,product_id HAVING count(product_id)>1

注意:删除前请查询重复项目和货品是否有疑问

--删除重复会员卡项目
delete from t_member_ritem where id in (
select max(id) as id from t_member_ritem
 group by member_id,ritem_id HAVING count(ritem_id)>1)

--删除重复会员卡货品
delete from t_member_product where id in (
select max(id) as id from t_member_product
 group by member_id,product_id HAVING count(product_id)>1)

--删除重复会员卡充值项目明细
delete from t_member_chargritem where id in (
select max(id) as id from t_member_chargritem
 group by document_id,ritem_id HAVING count(ritem_id)>1)

--删除重复会员卡充值货品明细
delete from t_member_chargproduct where id in (
select max(id) as id from t_member_chargproduct
 group by document_id,product_id HAVING count(product_id)>1)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值