Commit 33e7b5aa by liuyang

2024-07-23 采购开票删除逻辑bug修复

parent a815ac35
...@@ -70,6 +70,7 @@ public class HGCW013 extends DaoEPBase { ...@@ -70,6 +70,7 @@ public class HGCW013 extends DaoEPBase {
public static final String INSERT = "HGCW013.insert"; public static final String INSERT = "HGCW013.insert";
public static final String UPDATE = "HGCW013.update"; public static final String UPDATE = "HGCW013.update";
public static final String DELETE = "HGCW013.delete"; public static final String DELETE = "HGCW013.delete";
public static final String DELETE_MAIN = "HGCW013.deleteMain";
private Long id = new Long(0); private Long id = new Long(0);
private Long mainId = new Long(0); /* 主表ID*/ private Long mainId = new Long(0); /* 主表ID*/
......
...@@ -3,10 +3,13 @@ package com.baosight.hggp.hg.cw.service; ...@@ -3,10 +3,13 @@ package com.baosight.hggp.hg.cw.service;
import com.baosight.eplat.utils.StringUtils; import com.baosight.eplat.utils.StringUtils;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.domain.HGCW006;
import com.baosight.hggp.hg.cw.domain.HGCW008;
import com.baosight.hggp.hg.cw.domain.HGCW012; import com.baosight.hggp.hg.cw.domain.HGCW012;
import com.baosight.hggp.hg.cw.domain.HGCW013; import com.baosight.hggp.hg.cw.domain.HGCW013;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
...@@ -23,10 +26,8 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -23,10 +26,8 @@ import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Arrays; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
/** /**
* @author yukang * @author yukang
...@@ -141,8 +142,29 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -141,8 +142,29 @@ public class ServiceHGCW012 extends ServiceBase {
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) { for (Map resultRow : resultRows) {
DaoUtils.update(HGCW012.DELETE, resultRows.get(i)); HGCW012 hgcw012 = new HGCW012();
hgcw012.fromMap(resultRow);
if (hgcw012.getReviewStatus() == 1) {
throw new PlatException("该数据已审核,不能删除!");
}
String[] settlementNumbers = hgcw012.getSettlementNumber().split(",");
List<HGCW013> results = HGCWTools.HgCw013.getMainId(hgcw012.getId());
for (String settlementNumber : settlementNumbers) {
Map<String, BigDecimal> parmap = results.stream().filter(item-> Objects.equals(item.getSettlementNumber(), settlementNumber)).collect(Collectors.toMap(HGCW013::getSettlementNumber, HGCW013::getTotalContractPriceIncluding,(v1, v2) -> v2));
if (hgcw012.getContractType() == 1) {
HGCGTools.HgCg003.updateIsInvoicing(settlementNumber, HGConstant.CgIsInvoicing.S_0);
DaoUtils.update(HGCW013.DELETE_MAIN, hgcw012);
}else if (hgcw012.getContractType() == 2){
HGCWTools.HgCw008.deductionAmount(settlementNumber,parmap.get(settlementNumber).multiply(new BigDecimal(-1)));
}else if (hgcw012.getContractType() == 3){
HGCWTools.HgCw006.deductionAmount(settlementNumber,parmap.get(settlementNumber).multiply(new BigDecimal(-1)));
}
}
DaoUtils.update(HGCW012.DELETE, hgcw012);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
...@@ -173,6 +195,8 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -173,6 +195,8 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyName(userVO.getUsername()); hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(0);
hgcw012.setBillState(1); hgcw012.setBillState(1);
hgcw012.setBillTybe(1);
hgcw012.setContractType(2);
//hgcw012.setSigningDate(DateUtils.shortDate()); //hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate()); hgcw012.setReceiveDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
...@@ -271,6 +295,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -271,6 +295,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(0);
hgcw012.setBillState(1); hgcw012.setBillState(1);
hgcw012.setBillTybe(1); hgcw012.setBillTybe(1);
hgcw012.setContractType(1);
//hgcw012.setSigningDate(DateUtils.shortDate()); //hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate()); hgcw012.setReceiveDate(DateUtils.shortDate());
hgcw012.setPartyA(hgcw013List.get(0).getPartyA()); hgcw012.setPartyA(hgcw013List.get(0).getPartyA());
...@@ -366,6 +391,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -366,6 +391,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(0);
hgcw012.setBillState(1); hgcw012.setBillState(1);
hgcw012.setBillTybe(1); hgcw012.setBillTybe(1);
hgcw012.setContractType(3);
//hgcw012.setSigningDate(DateUtils.shortDate()); //hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate()); hgcw012.setReceiveDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
......
...@@ -218,8 +218,11 @@ ...@@ -218,8 +218,11 @@
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM ${hggpSchema}.HGCW013 WHERE DELETE FROM ${hggpSchema}.HGCW013 WHERE ID = #id#
ID = #id# </delete>
<delete id="deleteMain">
DELETE FROM ${hggpSchema}.HGCW013 WHERE MAIN_ID = #id#
</delete> </delete>
<update id="update"> <update id="update">
......
...@@ -229,9 +229,13 @@ $(function () { ...@@ -229,9 +229,13 @@ $(function () {
headerTemplate: "<span style='color: '>收票总额 </span>", headerTemplate: "<span style='color: '>收票总额 </span>",
format:"{0:N2}", format:"{0:N2}",
locked: false, locked: false,
template: function (date) { template: function (item) {
date.thisSettlementAmount = date.amount; if (isBlank(item.thisSettlementAmount)){
return date.amount item.thisSettlementAmount = item.amount;
resultGrid.setCellValue(item, "thisSettlementAmount", item.amount)
}
return item.thisSettlementAmount
} }
}], }],
loadComplete: function(grid) { loadComplete: function(grid) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment