Commit aa54151b by liuyang

1.采购收票添加收票单号,付款单来源单号逻辑变更

2.销售开票添加开票单号,收款单来源单号逻辑变更
parent c6a22c3a
...@@ -198,6 +198,10 @@ public class HGConstant { ...@@ -198,6 +198,10 @@ public class HGConstant {
//打包单号 //打包单号
public static final String PACK_CODE = "PACK_CODE"; public static final String PACK_CODE = "PACK_CODE";
//采购收票单号
public static final String HGCW12_INVOICE_CODE = "HGCW12_INVOICE_CODE";
//单号
public static final String HGCW10_INVOICE_CODE = "HGCW10_INVOICE_CODE";
} }
/** /**
......
...@@ -52,6 +52,7 @@ public class HGCW010 extends DaoEPBase { ...@@ -52,6 +52,7 @@ public class HGCW010 extends DaoEPBase {
public static final String FIELD_REMAINING_AMOUNT = "remainingAmount"; /* 剩余开票/收票金额*/ public static final String FIELD_REMAINING_AMOUNT = "remainingAmount"; /* 剩余开票/收票金额*/
public static final String FIELD_COMPANY_CODES = "companyCodes"; public static final String FIELD_COMPANY_CODES = "companyCodes";
public static final String FIELD_BRANCH_UNIT = "branchUnit"; public static final String FIELD_BRANCH_UNIT = "branchUnit";
public static final String FIELD_INVOICE_CODE = "invoiceCode";
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
...@@ -114,6 +115,7 @@ public class HGCW010 extends DaoEPBase { ...@@ -114,6 +115,7 @@ public class HGCW010 extends DaoEPBase {
private String depCode = " "; /* 部门编码*/ private String depCode = " "; /* 部门编码*/
private BigDecimal remainingAmount = new BigDecimal("0"); /* 累计结算价税合计金额*/ private BigDecimal remainingAmount = new BigDecimal("0"); /* 累计结算价税合计金额*/
private String branchUnit = " "; private String branchUnit = " ";
private String invoiceCode = " ";
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -240,6 +242,10 @@ public class HGCW010 extends DaoEPBase { ...@@ -240,6 +242,10 @@ public class HGCW010 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_BRANCH_UNIT); eiColumn = new EiColumn(FIELD_BRANCH_UNIT);
eiColumn.setDescName("分支单位"); eiColumn.setDescName("分支单位");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVOICE_CODE);
eiColumn.setDescName("开票单号");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -650,6 +656,14 @@ public class HGCW010 extends DaoEPBase { ...@@ -650,6 +656,14 @@ public class HGCW010 extends DaoEPBase {
this.branchUnit = branchUnit; this.branchUnit = branchUnit;
} }
public String getInvoiceCode() {
return invoiceCode;
}
public void setInvoiceCode(String invoiceCode) {
this.invoiceCode = invoiceCode;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -684,6 +698,7 @@ public class HGCW010 extends DaoEPBase { ...@@ -684,6 +698,7 @@ public class HGCW010 extends DaoEPBase {
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode)); setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setRemainingAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_REMAINING_AMOUNT)), remainingAmount)); setRemainingAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_REMAINING_AMOUNT)), remainingAmount));
setBranchUnit(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("branchUnit")), branchUnit)); setBranchUnit(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("branchUnit")), branchUnit));
setInvoiceCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVOICE_CODE)), invoiceCode));
} }
/** /**
...@@ -719,6 +734,7 @@ public class HGCW010 extends DaoEPBase { ...@@ -719,6 +734,7 @@ public class HGCW010 extends DaoEPBase {
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE))); map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_REMAINING_AMOUNT, StringUtils.toString(remainingAmount, eiMetadata.getMeta(FIELD_REMAINING_AMOUNT))); map.put(FIELD_REMAINING_AMOUNT, StringUtils.toString(remainingAmount, eiMetadata.getMeta(FIELD_REMAINING_AMOUNT)));
map.put(FIELD_BRANCH_UNIT, StringUtils.toString(branchUnit, eiMetadata.getMeta(FIELD_BRANCH_UNIT))); map.put(FIELD_BRANCH_UNIT, StringUtils.toString(branchUnit, eiMetadata.getMeta(FIELD_BRANCH_UNIT)));
map.put(FIELD_INVOICE_CODE, StringUtils.toString(invoiceCode, eiMetadata.getMeta(FIELD_INVOICE_CODE)));
return map; return map;
} }
......
...@@ -59,6 +59,7 @@ public class HGCW012 extends DaoEPBase { ...@@ -59,6 +59,7 @@ public class HGCW012 extends DaoEPBase {
public static final String FIELD_DEPOSIT_QTY = "depositQty"; /* 入库数量*/ public static final String FIELD_DEPOSIT_QTY = "depositQty"; /* 入库数量*/
public static final String FIELD_RECEIVE_WEIGHT = "receiveWeight"; /* 收货重量*/ public static final String FIELD_RECEIVE_WEIGHT = "receiveWeight"; /* 收货重量*/
public static final String FIELD_CONTRACT_NO = "contractNo"; /* 合同号*/ public static final String FIELD_CONTRACT_NO = "contractNo"; /* 合同号*/
public static final String FIELD_INVOICE_CODE = "invoiceCode";
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
...@@ -132,6 +133,7 @@ public class HGCW012 extends DaoEPBase { ...@@ -132,6 +133,7 @@ public class HGCW012 extends DaoEPBase {
private BigDecimal depositQty = new BigDecimal("0"); /* 入库数量*/ private BigDecimal depositQty = new BigDecimal("0"); /* 入库数量*/
private BigDecimal receiveWeight = new BigDecimal("0"); /* 收货重量*/ private BigDecimal receiveWeight = new BigDecimal("0"); /* 收货重量*/
private String contractNo = " "; /* 合同号*/ private String contractNo = " "; /* 合同号*/
private String invoiceCode = " ";
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -288,6 +290,9 @@ public class HGCW012 extends DaoEPBase { ...@@ -288,6 +290,9 @@ public class HGCW012 extends DaoEPBase {
eiColumn.setDescName("合同号"); eiColumn.setDescName("合同号");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVOICE_CODE);
eiColumn.setDescName("开票单号");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -817,6 +822,14 @@ public class HGCW012 extends DaoEPBase { ...@@ -817,6 +822,14 @@ public class HGCW012 extends DaoEPBase {
public void setContractNo(String contractNo) { public void setContractNo(String contractNo) {
this.contractNo = contractNo; this.contractNo = contractNo;
} }
public String getInvoiceCode() {
return invoiceCode;
}
public void setInvoiceCode(String invoiceCode) {
this.invoiceCode = invoiceCode;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -859,6 +872,7 @@ public class HGCW012 extends DaoEPBase { ...@@ -859,6 +872,7 @@ public class HGCW012 extends DaoEPBase {
setDepositQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_DEPOSIT_QTY)), depositQty)); setDepositQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_DEPOSIT_QTY)), depositQty));
setReceiveWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_RECEIVE_WEIGHT)), receiveWeight)); setReceiveWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_RECEIVE_WEIGHT)), receiveWeight));
setContractNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_NO)), contractNo)); setContractNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_NO)), contractNo));
setInvoiceCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVOICE_CODE)), invoiceCode));
} }
/** /**
...@@ -902,6 +916,7 @@ public class HGCW012 extends DaoEPBase { ...@@ -902,6 +916,7 @@ public class HGCW012 extends DaoEPBase {
map.put(FIELD_DEPOSIT_QTY, StringUtils.toString(depositQty, eiMetadata.getMeta(FIELD_DEPOSIT_QTY))); map.put(FIELD_DEPOSIT_QTY, StringUtils.toString(depositQty, eiMetadata.getMeta(FIELD_DEPOSIT_QTY)));
map.put(FIELD_RECEIVE_WEIGHT, StringUtils.toString(receiveWeight, eiMetadata.getMeta(FIELD_RECEIVE_WEIGHT))); map.put(FIELD_RECEIVE_WEIGHT, StringUtils.toString(receiveWeight, eiMetadata.getMeta(FIELD_RECEIVE_WEIGHT)));
map.put(FIELD_CONTRACT_NO, StringUtils.toString(contractNo, eiMetadata.getMeta(FIELD_CONTRACT_NO))); map.put(FIELD_CONTRACT_NO, StringUtils.toString(contractNo, eiMetadata.getMeta(FIELD_CONTRACT_NO)));
map.put(FIELD_INVOICE_CODE, StringUtils.toString(invoiceCode, eiMetadata.getMeta(FIELD_INVOICE_CODE)));
return map; return map;
} }
......
...@@ -164,6 +164,7 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -164,6 +164,7 @@ public class ServiceHGCW010 extends ServiceBase {
*/ */
public void add(HGCW010 hgcw010) { public void add(HGCW010 hgcw010) {
hgcw010.setRemainingAmount(hgcw010.getTotalContractPriceIncluding()); hgcw010.setRemainingAmount(hgcw010.getTotalContractPriceIncluding());
hgcw010.setInvoiceCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGCW10_INVOICE_CODE));
DaoUtils.insert(HGCW010.INSERT, hgcw010); DaoUtils.insert(HGCW010.INSERT, hgcw010);
} }
......
...@@ -26,6 +26,7 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -26,6 +26,7 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -205,6 +206,7 @@ public class ServiceHGCW010D extends ServiceEPBase { ...@@ -205,6 +206,7 @@ public class ServiceHGCW010D extends ServiceEPBase {
} }
public void add(HGCW010 hgcw010) { public void add(HGCW010 hgcw010) {
hgcw010.setInvoiceCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGCW10_INVOICE_CODE));
DaoUtils.insert("HGCW010.insert", hgcw010); DaoUtils.insert("HGCW010.insert", hgcw010);
} }
......
...@@ -4,6 +4,7 @@ import com.baosight.eplat.utils.StringUtils; ...@@ -4,6 +4,7 @@ import com.baosight.eplat.utils.StringUtils;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
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.constant.HGConstant;
import com.baosight.hggp.hg.cw.domain.HGCW006; import com.baosight.hggp.hg.cw.domain.HGCW006;
import com.baosight.hggp.hg.cw.domain.HGCW010; import com.baosight.hggp.hg.cw.domain.HGCW010;
import com.baosight.hggp.hg.cw.domain.HGCW010A; import com.baosight.hggp.hg.cw.domain.HGCW010A;
...@@ -18,6 +19,7 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -18,6 +19,7 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -172,6 +174,7 @@ public class ServiceHGCW010E extends ServiceEPBase { ...@@ -172,6 +174,7 @@ public class ServiceHGCW010E extends ServiceEPBase {
} }
public void add(HGCW010 hgcw010) { public void add(HGCW010 hgcw010) {
hgcw010.setInvoiceCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGCW10_INVOICE_CODE));
DaoUtils.insert("HGCW010.insert", hgcw010); DaoUtils.insert("HGCW010.insert", hgcw010);
} }
......
...@@ -26,6 +26,7 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -26,6 +26,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -138,6 +139,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -138,6 +139,7 @@ public class ServiceHGCW012 extends ServiceBase {
AssertUtils.isEmpty(hgcg003BList, "未找到匹配的采购收货"); AssertUtils.isEmpty(hgcg003BList, "未找到匹配的采购收货");
hgcw012.setRemainingAmount(hgcw012.getTotalContractPriceIncluding()); hgcw012.setRemainingAmount(hgcw012.getTotalContractPriceIncluding());
hgcw012.setContractType(ContractTypeEnum.CGSH.getCode()); hgcw012.setContractType(ContractTypeEnum.CGSH.getCode());
hgcw012.setInvoiceCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGCW12_INVOICE_CODE));
DaoUtils.insert(HGCW012.INSERT, hgcw012); DaoUtils.insert(HGCW012.INSERT, hgcw012);
BigDecimal taxPoints = new BigDecimal(hgcw012.getTaxPoints()); // 假设这是以整数形式给出的税率,比如17表示17% BigDecimal taxPoints = new BigDecimal(hgcw012.getTaxPoints()); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率 转换为小数形式 BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率 转换为小数形式
...@@ -305,6 +307,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -305,6 +307,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setProjCode(hgcw013List.get(0).getProjCode()); hgcw012.setProjCode(hgcw013List.get(0).getProjCode());
hgcw012.setProjName(hgcw013List.get(0).getProjName()); hgcw012.setProjName(hgcw013List.get(0).getProjName());
hgcw012.setInvoiceCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGCW12_INVOICE_CODE));
DaoUtils.insert(HGCW012.INSERT, hgcw012); DaoUtils.insert(HGCW012.INSERT, hgcw012);
//生成明细表 //生成明细表
...@@ -408,7 +411,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -408,7 +411,7 @@ public class ServiceHGCW012 extends ServiceBase {
//hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount()); //hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount());
//hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); //hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
//hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); //hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setInvoiceCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGCW12_INVOICE_CODE));
DaoUtils.insert(HGCW012.INSERT, hgcw012); DaoUtils.insert(HGCW012.INSERT, hgcw012);
List<HGCG003B> hgcg003BList = MapUtils.toDaoEPBases(inInfo, HGCG003B.class); List<HGCG003B> hgcg003BList = MapUtils.toDaoEPBases(inInfo, HGCG003B.class);
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(hgcg003BList); Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(hgcg003BList);
...@@ -510,7 +513,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -510,7 +513,7 @@ public class ServiceHGCW012 extends ServiceBase {
HGCW012 hgcw012 = new HGCW012(); HGCW012 hgcw012 = new HGCW012();
hgcw012.setCompanyCode(hgcw013List.get(0).getCompanyCode()); hgcw012.setCompanyCode(hgcw013List.get(0).getCompanyCode());
hgcw012.setCompanyName(hgcw013List.get(0).getCompanyName()); hgcw012.setCompanyName(hgcw013List.get(0).getCompanyName());
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(ReviewStatusEnum.UNREVIEWED.getCode());
hgcw012.setBillState(0); hgcw012.setBillState(0);
hgcw012.setBillTybe(1); hgcw012.setBillTybe(1);
hgcw012.setContractType(ContractTypeEnum.ZLHT.getCode()); hgcw012.setContractType(ContractTypeEnum.ZLHT.getCode());
...@@ -538,6 +541,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -538,6 +541,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setProjCode(hgcw013List.get(0).getProjCode()); hgcw012.setProjCode(hgcw013List.get(0).getProjCode());
hgcw012.setProjName(hgcw013List.get(0).getProjName()); hgcw012.setProjName(hgcw013List.get(0).getProjName());
hgcw012.setInvoiceCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGCW12_INVOICE_CODE));
DaoUtils.insert(HGCW012.INSERT, hgcw012); DaoUtils.insert(HGCW012.INSERT, hgcw012);
//生成明细表 //生成明细表
......
...@@ -7,10 +7,7 @@ import com.baosight.hggp.common.ReviewStatusEnum; ...@@ -7,10 +7,7 @@ import com.baosight.hggp.common.ReviewStatusEnum;
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.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.domain.HGCW005; import com.baosight.hggp.hg.cw.domain.*;
import com.baosight.hggp.hg.cw.domain.HGCW006;
import com.baosight.hggp.hg.cw.domain.HGCW014;
import com.baosight.hggp.hg.cw.domain.HGCW015;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO; import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.sc.domain.HGSC001; import com.baosight.hggp.hg.sc.domain.HGSC001;
...@@ -34,6 +31,7 @@ import java.util.Arrays; ...@@ -34,6 +31,7 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author yukang * @author yukang
...@@ -189,65 +187,45 @@ public class ServiceHGCW014 extends ServiceBase { ...@@ -189,65 +187,45 @@ public class ServiceHGCW014 extends ServiceBase {
hgcw014.setCompanyCode(userVO.getUsercode()); hgcw014.setCompanyCode(userVO.getUsercode());
hgcw014.setCompanyName(userVO.getUsername()); hgcw014.setCompanyName(userVO.getUsername());
hgcw014.setCancelStatus(1); hgcw014.setCancelStatus(1);
hgcw014.setReviewStatus(0); hgcw014.setReviewStatus(ReviewStatusEnum.UNREVIEWED.getCode());
hgcw014.setIncomeNumber(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_COLLECTION_NO)); hgcw014.setIncomeNumber(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_COLLECTION_NO));
hgcw014.setSigningDate(DateUtils.shortDate()); hgcw014.setSigningDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; BigDecimal totalContractPriceIncluding = hgcw015List.stream().map(HGCW015::getTotalContractPriceIncluding).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
StringBuffer contractNumber = new StringBuffer(); String contractNumbers = hgcw015List.stream().map(HGCW015::getContractNumber).distinct().collect(Collectors.joining(","));
Map<String, BigDecimal> rowMap = new HashMap<>();
for (HGCW015 hgcw015 : hgcw015List) {
contractNumber.append(hgcw015.getContractNumber()).append(",");
}
for (Map m : resultRows) {
String c = m.get("billNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
totalContractPriceIncluding = totalContractPriceIncluding.add(remainingAmount);
}
hgcw014.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); hgcw014.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw014.setPartyA(hgcw015List.get(0).getPartyA()); hgcw014.setPartyA(hgcw015List.get(0).getPartyA());
hgcw014.setProjCode(hgcw015List.get(0).getProjCode()); hgcw014.setProjCode(hgcw015List.get(0).getProjCode());
hgcw014.setProjName(hgcw015List.get(0).getProjName()); hgcw014.setProjName(hgcw015List.get(0).getProjName());
hgcw014.setContractNumber(contractNumber.toString().substring(0, contractNumber.length() - 1)); hgcw014.setContractNumber(contractNumbers);
this.add(hgcw014); this.add(hgcw014);
//生成明细表 //生成明细表
for (HGCW015 hgcw015 : hgcw015List) { for (HGCW015 hgcw015 : hgcw015List) {
hgcw015.setMainId(hgcw014.getId()); hgcw015.setMainId(hgcw014.getId());
// 反写金额 // 反写金额
HGCWTools.HgCw010.cutAmount(hgcw015.getContractNumber(),rowMap.get(hgcw015.getContractNumber())); HGCWTools.HgCw010.cutAmount(hgcw015.getContractNumber(),hgcw015.getTotalContractPriceIncluding());
DaoUtils.insert(HGCW015.INSERT, hgcw015); DaoUtils.insert(HGCW015.INSERT, hgcw015);
} }
} else { } else {
HGCW014 hgcw014 = HGCWTools.HgCw014.getId(mainId); HGCW014 hgcw014 = HGCWTools.HgCw014.getId(mainId);
Map<String, BigDecimal> rowMap = new HashMap<>();
for (Map m : resultRows) {
String c = m.get("billNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
}
// 生成明细表 // 生成明细表
for (HGCW015 hgcw015 : hgcw015List) { for (HGCW015 hgcw015 : hgcw015List) {
hgcw015.setMainId(hgcw014.getId()); hgcw015.setMainId(hgcw014.getId());
// 反写金额 // 反写金额
HGCWTools.HgCw010.cutAmount(hgcw015.getContractNumber(),rowMap.get(hgcw015.getContractNumber())); HGCWTools.HgCw010.cutAmount(hgcw015.getContractNumber(),hgcw015.getTotalContractPriceIncluding());
this.addHGCW015(hgcw015); this.addHGCW015(hgcw015);
} }
List<HGCW015> hgcw015s = HGCWTools.HgCw015.getMainId(hgcw014.getId()); List<HGCW015> hgcw015s = HGCWTools.HgCw015.getMainId(hgcw014.getId());
if (CollectionUtils.isNotEmpty(hgcw015s)) { if (CollectionUtils.isNotEmpty(hgcw015s)) {
// 更新主表 // 更新主表
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; BigDecimal totalContractPriceIncluding = hgcw015s.stream().map(HGCW015::getTotalContractPriceIncluding).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
StringBuffer contractNumber = new StringBuffer(); String contractNumber = hgcw015s.stream().map(HGCW015::getContractNumber).collect(Collectors.joining(","));
for (HGCW015 hgcw015 : hgcw015s) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw015.getTotalContractPriceIncluding());
contractNumber.append(hgcw015.getContractNumber()).append(",");
}
hgcw014.setTotalContractPriceIncluding(totalContractPriceIncluding); hgcw014.setTotalContractPriceIncluding(totalContractPriceIncluding);
hgcw014.setPartyA(hgcw015s.get(0).getPartyA()); hgcw014.setPartyA(hgcw015s.get(0).getPartyA());
hgcw014.setProjCode(hgcw015s.get(0).getProjCode()); hgcw014.setProjCode(hgcw015s.get(0).getProjCode());
hgcw014.setProjName(hgcw015s.get(0).getProjName()); hgcw014.setProjName(hgcw015s.get(0).getProjName());
hgcw014.setContractNumber(contractNumber.toString().substring(0, contractNumber.length() - 1)); hgcw014.setContractNumber(contractNumber);
this.modify(hgcw014); this.modify(hgcw014);
} }
} }
......
...@@ -2,21 +2,18 @@ package com.baosight.hggp.hg.cw.service; ...@@ -2,21 +2,18 @@ package com.baosight.hggp.hg.cw.service;
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.common.ReviewStatusEnum;
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.cw.domain.HGCW010; import com.baosight.hggp.hg.cw.domain.HGCW010;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays; import java.util.Arrays;
...@@ -57,6 +54,8 @@ public class ServiceHGCW014A extends ServiceBase { ...@@ -57,6 +54,8 @@ public class ServiceHGCW014A extends ServiceBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCW010.FIELD_REVIEW_STATUS, ReviewStatusEnum.REVIEWED.getCode());
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "hiddenConditions", 0);
inInfo = super.query(inInfo, HGCW010.QUERY, new HGCW010()); inInfo = super.query(inInfo, HGCW010.QUERY, new HGCW010());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
...@@ -184,63 +184,43 @@ public class ServiceHGCW016 extends ServiceBase { ...@@ -184,63 +184,43 @@ public class ServiceHGCW016 extends ServiceBase {
//hgcw016.setReviewStatus(0); //hgcw016.setReviewStatus(0);
//hgcw016.setIncomeNumber(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_COLLECTION_NO)); //hgcw016.setIncomeNumber(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_COLLECTION_NO));
hgcw016.setSigningDate(DateUtils.shortDate()); hgcw016.setSigningDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; BigDecimal totalContractPriceIncluding = hgcw017List.stream().map(HGCW017::getTotalContractPriceIncluding).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
StringBuffer contractNumber = new StringBuffer(); String contractNumbers = hgcw017List.stream().map(HGCW017::getContractNumber).collect(Collectors.joining(","));
Map<String, BigDecimal> rowMap = new HashMap<>();
for (HGCW017 hgcw017 : hgcw017List) {
contractNumber.append(hgcw017.getContractNumber()).append(",");
}
for (Map m : resultRows) {
String c = m.get(HGCW012.FIELD_BILL_NUMBER).toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
totalContractPriceIncluding = totalContractPriceIncluding.add(remainingAmount);
}
hgcw016.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); hgcw016.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw016.setCompanyCode(hgcw017List.get(0).getCompanyCode()); hgcw016.setCompanyCode(hgcw017List.get(0).getCompanyCode());
hgcw016.setCompanyName(hgcw017List.get(0).getCompanyName()); hgcw016.setCompanyName(hgcw017List.get(0).getCompanyName());
hgcw016.setProjCode(hgcw017List.get(0).getProjCode()); hgcw016.setProjCode(hgcw017List.get(0).getProjCode());
hgcw016.setProjName(hgcw017List.get(0).getProjName()); hgcw016.setProjName(hgcw017List.get(0).getProjName());
hgcw016.setPartyA(hgcw017List.get(0).getPartyA()); hgcw016.setPartyA(hgcw017List.get(0).getPartyA());
hgcw016.setContractNumber(contractNumber.toString().substring(0, contractNumber.length() - 1)); hgcw016.setContractNumber(contractNumbers);
this.add(hgcw016); this.add(hgcw016);
//生成明细表 //生成明细表
for (HGCW017 hgcw017 : hgcw017List) { for (HGCW017 hgcw017 : hgcw017List) {
hgcw017.setMainId(hgcw016.getId()); hgcw017.setMainId(hgcw016.getId());
// 反写金额 // 反写金额
HGCWTools.HgCw012.cutAmount(hgcw017.getContractNumber(),rowMap.get(hgcw017.getContractNumber())); HGCWTools.HgCw012.cutAmount(hgcw017.getContractNumber(),hgcw017.getTotalContractPriceIncluding());
hgcw017.setDepCode(null); hgcw017.setDepCode(null);
DaoUtils.insert(HGCW017.INSERT, hgcw017); DaoUtils.insert(HGCW017.INSERT, hgcw017);
} }
} else { } else {
HGCW016 hgcw016 = HGCWTools.HgCw016.getId(mainId); HGCW016 hgcw016 = HGCWTools.HgCw016.getId(mainId);
Map<String, BigDecimal> rowMap = new HashMap<>();
for (Map m : resultRows) {
String c = m.get(HGCW012.FIELD_BILL_NUMBER).toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
}
// 生成明细表 // 生成明细表
for (HGCW017 hgcw017 : hgcw017List) { for (HGCW017 hgcw017 : hgcw017List) {
hgcw017.setMainId(hgcw016.getId()); hgcw017.setMainId(hgcw016.getId());
// 反写金额 // 反写金额
HGCWTools.HgCw012.cutAmount(hgcw017.getContractNumber(),rowMap.get(hgcw017.getContractNumber())); HGCWTools.HgCw012.cutAmount(hgcw017.getContractNumber(),hgcw017.getTotalContractPriceIncluding());
this.addHGCW017(hgcw017); this.addHGCW017(hgcw017);
} }
List<HGCW017> hgcw017s = HGCWTools.HgCw017.getMainId(hgcw016.getId()); List<HGCW017> hgcw017s = HGCWTools.HgCw017.getMainId(hgcw016.getId());
if (CollectionUtils.isNotEmpty(hgcw017s)) { if (CollectionUtils.isNotEmpty(hgcw017s)) {
// 更新主表 // 更新主表
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; BigDecimal totalContractPriceIncluding = hgcw017s.stream().map(HGCW017::getTotalContractPriceIncluding).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
StringBuffer contractNumber = new StringBuffer(); String contractNumber = hgcw017s.stream().map(HGCW017::getContractNumber).collect(Collectors.joining());
for (HGCW017 hgcw017 : hgcw017s) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw017.getTotalContractPriceIncluding());
contractNumber.append(hgcw017.getContractNumber()).append(",");
}
hgcw016.setTotalContractPriceIncluding(totalContractPriceIncluding); hgcw016.setTotalContractPriceIncluding(totalContractPriceIncluding);
hgcw016.setPartyA(hgcw017s.get(0).getPartyA()); hgcw016.setPartyA(hgcw017s.get(0).getPartyA());
hgcw016.setContractNumber(contractNumber.toString().substring(0, contractNumber.length() - 1)); hgcw016.setContractNumber(contractNumber);
this.modify(hgcw016); this.modify(hgcw016);
} }
} }
......
...@@ -119,6 +119,9 @@ ...@@ -119,6 +119,9 @@
<isNotEmpty prepend=" AND " property="branchUnit"> <isNotEmpty prepend=" AND " property="branchUnit">
BRANCH_UNIT = #branchUnit# BRANCH_UNIT = #branchUnit#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="invoiceCode">
INVOICE_CODE LIKE CONCAT('%',#invoiceCode#,'%')
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
...@@ -149,7 +152,8 @@ ...@@ -149,7 +152,8 @@
UPDATED_NAME as "updatedName", <!-- 记录修改名称 --> UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 --> UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DEP_CODE as "depCode", <!-- 部门编码 --> DEP_CODE as "depCode", <!-- 部门编码 -->
BRANCH_UNIT as "branchUnit" BRANCH_UNIT as "branchUnit",
INVOICE_CODE as "invoiceCode"
FROM ${hggpSchema}.HGCW010 WHERE 1=1 FROM ${hggpSchema}.HGCW010 WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
...@@ -269,12 +273,13 @@ ...@@ -269,12 +273,13 @@
UPDATED_NAME, <!-- 记录修改名称 --> UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 --> UPDATED_TIME, <!-- 记录修改时间 -->
DEP_CODE, <!-- 部门编码 --> DEP_CODE, <!-- 部门编码 -->
BRANCH_UNIT BRANCH_UNIT,
INVOICE_CODE
) )
VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #projName#, #projCode#, #settlementNumber#, VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #projName#, #projCode#, #settlementNumber#,
#billTybe#, #billNumber#, #billState#, #signingDate#, #partyA#, #reviewStatus#, #thisSettlementTax#, #billTybe#, #billNumber#, #billState#, #signingDate#, #partyA#, #reviewStatus#, #thisSettlementTax#,
#thisSettlementAmount#, #taxPoints#, #totalContractPriceIncluding#,#remainingAmount#, #createdBy#, #thisSettlementAmount#, #taxPoints#, #totalContractPriceIncluding#,#remainingAmount#, #createdBy#,
#createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#, #branchUnit#) #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#, #branchUnit#, #invoiceCode#)
<selectKey resultClass="long" keyProperty="id"> <selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCW010 SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCW010
</selectKey> </selectKey>
...@@ -311,7 +316,8 @@ ...@@ -311,7 +316,8 @@
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 --> UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 --> UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
DEP_CODE = #depCode#, <!-- 部门编码 --> DEP_CODE = #depCode#, <!-- 部门编码 -->
BRANCH_UNIT = #branchUnit# BRANCH_UNIT = #branchUnit#,
INVOICE_CODE = #invoiceCode#
WHERE WHERE
ID = #id# ID = #id#
</update> </update>
......
...@@ -72,7 +72,8 @@ ...@@ -72,7 +72,8 @@
SPEC as "spec", <!-- 规格 --> SPEC as "spec", <!-- 规格 -->
DEPOSIT_QTY as "depositQty", <!-- 入库数量 --> DEPOSIT_QTY as "depositQty", <!-- 入库数量 -->
RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 --> RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 -->
CONTRACT_NO as "contractNo" CONTRACT_NO as "contractNo",
INVOICE_CODE as "invoiceCode"
</sql> </sql>
<sql id="condition"> <sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
...@@ -180,6 +181,9 @@ ...@@ -180,6 +181,9 @@
<isNotEmpty prepend=" AND " property="contractNo"> <isNotEmpty prepend=" AND " property="contractNo">
CONTRACT_NO like concat('%' , #contractNo# , '%') CONTRACT_NO like concat('%' , #contractNo# , '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="invoiceCode">
INVOICE_CODE like concat('%' , #invoiceCode# , '%')
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
...@@ -334,13 +338,14 @@ ...@@ -334,13 +338,14 @@
SPEC, <!-- 规格 --> SPEC, <!-- 规格 -->
DEPOSIT_QTY, <!-- 入库数量 --> DEPOSIT_QTY, <!-- 入库数量 -->
RECEIVE_WEIGHT, <!-- 收货重量 --> RECEIVE_WEIGHT, <!-- 收货重量 -->
CONTRACT_NO CONTRACT_NO,
INVOICE_CODE
) )
VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #projCode#, #projName#, #settlementNumber#, VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #projCode#, #projName#, #settlementNumber#,
#billTybe#, #billNumber#, #billState#, #signingDate#, #partyA#, #reviewStatus#, #taxPoints#, #billTybe#, #billNumber#, #billState#, #signingDate#, #partyA#, #reviewStatus#, #taxPoints#,
#thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#, #thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#,
#createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#, #remainingAmount#, #receiveDate#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#, #remainingAmount#, #receiveDate#,
#contractType#, #inventTypeDetail#, #inventCode#, #inventName#, #spec#, #depositQty#, #receiveWeight#,#contractNo#) #contractType#, #inventTypeDetail#, #inventCode#, #inventName#, #spec#, #depositQty#, #receiveWeight#,#contractNo#, #invoiceCode#)
<selectKey resultClass="long" keyProperty="id"> <selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCW012 SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCW012
</selectKey> </selectKey>
...@@ -386,7 +391,8 @@ ...@@ -386,7 +391,8 @@
SPEC = #spec#, <!-- 规格 --> SPEC = #spec#, <!-- 规格 -->
DEPOSIT_QTY = #depositQty#, <!-- 入库数量 --> DEPOSIT_QTY = #depositQty#, <!-- 入库数量 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 --> RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
CONTRACT_NO = #contractNo# CONTRACT_NO = #contractNo#,
INVOICE_CODE = #invoiceCode#
WHERE WHERE
ID = #id# ID = #id#
</update> </update>
......
...@@ -831,25 +831,30 @@ public class HGCWTools { ...@@ -831,25 +831,30 @@ public class HGCWTools {
DaoUtils.update("HGCW010.update", hgcw010); DaoUtils.update("HGCW010.update", hgcw010);
} }
} }
public static void cutAmount(String billNumber, BigDecimal cutAmount) { public static void cutAmount(String invoiceCode, BigDecimal cutAmount) {
AssertUtils.isNull(billNumber, "来源单号不能为空!"); AssertUtils.isNull(invoiceCode, "销售开票单号不能为空!");
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) { // if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!"); // throw new PlatException("扣款金额不能小于等于0!");
// } // }
List<HGCW010> results = DaoBase.getInstance().query(HGCW010.QUERY,new HashMap<String,Object>(){ List<HGCW010> results = DaoBase.getInstance().query(HGCW010.QUERY,new HashMap<String,Object>(){
{put("billNumber",billNumber);} {put(HGCW010.FIELD_INVOICE_CODE,invoiceCode);}
}); });
if (CollectionUtils.isEmpty(results)) { if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的销售开票记录!"); results = DaoBase.getInstance().query(HGCW010.QUERY,new HashMap<String,Object>(){
{put(HGCW010.FIELD_BILL_NUMBER,invoiceCode);}
});
if (CollectionUtils.isEmpty(results)){
throw new PlatException("找不到对应的销售开票记录!");
}
} }
DecimalFormat decimalFormat = new DecimalFormat("#.00"); DecimalFormat decimalFormat = new DecimalFormat("#.00");
HGCW010 HGCW010 = results.get(0); HGCW010 hgcw010 = results.get(0);
BigDecimal remainingAmount = new BigDecimal(decimalFormat.format(HGCW010.getRemainingAmount().subtract(cutAmount))); BigDecimal remainingAmount = new BigDecimal(decimalFormat.format(hgcw010.getRemainingAmount().subtract(cutAmount)));
if (remainingAmount.compareTo(new BigDecimal(BigInteger.ZERO)) < 0) { if (remainingAmount.compareTo(new BigDecimal(BigInteger.ZERO)) < 0) {
throw new PlatException("扣款金额不能大于销售开票剩余金额!"); throw new PlatException("扣款金额不能大于销售开票剩余金额!");
} }
HGCW010.setRemainingAmount(remainingAmount); hgcw010.setRemainingAmount(remainingAmount);
DaoUtils.update("HGCW010.updateDeductionAmount", HGCW010); DaoUtils.update("HGCW010.updateDeductionAmount", hgcw010);
} }
...@@ -970,16 +975,19 @@ public class HGCWTools { ...@@ -970,16 +975,19 @@ public class HGCWTools {
DaoUtils.update("HGCW012.update", HGCW012); DaoUtils.update("HGCW012.update", HGCW012);
} }
} }
public static void cutAmount(String billNumber, BigDecimal cutAmount) { public static void cutAmount(String invoiceCode, BigDecimal cutAmount) {
AssertUtils.isNull(billNumber, "发票号不能为空!"); AssertUtils.isNull(invoiceCode, "采购收票单不能为空!");
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) { // if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!"); // throw new PlatException("扣款金额不能小于等于0!");
// } // }
List<HGCW012> results = DaoBase.getInstance().query(HGCW012.QUERY,new HashMap<String,Object>(){ List<HGCW012> results = DaoBase.getInstance().query(HGCW012.QUERY,new HashMap<String,Object>(){
{put(HGCW012.FIELD_BILL_NUMBER,billNumber);} {put(HGCW010.FIELD_INVOICE_CODE,invoiceCode);}
}); });
if (CollectionUtils.isEmpty(results)) { if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的采购收票记录!"); results = DaoBase.getInstance().query(HGCW012.QUERY,new HashMap<String,Object>(){{put(HGCW012.FIELD_BILL_NUMBER,invoiceCode);}});
if (CollectionUtils.isEmpty(results)){
throw new PlatException("找不到对应的采购收票记录!");
}
} }
DecimalFormat decimalFormat = new DecimalFormat("#.00"); DecimalFormat decimalFormat = new DecimalFormat("#.00");
HGCW012 HGCW012 = results.get(0); HGCW012 HGCW012 = results.get(0);
...@@ -1192,9 +1200,10 @@ public class HGCWTools { ...@@ -1192,9 +1200,10 @@ public class HGCWTools {
rows.forEach(row -> { rows.forEach(row -> {
HGCW015 hgcw015 = new HGCW015(); HGCW015 hgcw015 = new HGCW015();
hgcw015.fromMap(row); hgcw015.fromMap(row);
String contractNumber = row.get("billNumber").toString(); String invoiceCode = row.get(HGCW010.FIELD_INVOICE_CODE).toString();
String billNumber = row.get(HGCW010.FIELD_BILL_NUMBER).toString();
String remainingAmount = row.get("thisAmount").toString(); String remainingAmount = row.get("thisAmount").toString();
hgcw015.setContractNumber(contractNumber); hgcw015.setContractNumber(invoiceCode.isEmpty()?billNumber:invoiceCode);
hgcw015.setTotalContractPriceIncluding(new BigDecimal(remainingAmount)); hgcw015.setTotalContractPriceIncluding(new BigDecimal(remainingAmount));
if (mainId != null) { if (mainId != null) {
hgcw015.setMainId(mainId); hgcw015.setMainId(mainId);
...@@ -1260,9 +1269,10 @@ public class HGCWTools { ...@@ -1260,9 +1269,10 @@ public class HGCWTools {
rows.forEach(row -> { rows.forEach(row -> {
HGCW017 hgcw017 = new HGCW017(); HGCW017 hgcw017 = new HGCW017();
hgcw017.fromMap(row); hgcw017.fromMap(row);
String contractNumber = row.get(HGCW012.FIELD_BILL_NUMBER).toString(); String invoiceCode = row.get(HGCW012.FIELD_INVOICE_CODE).toString();
String billNumber = row.get(HGCW012.FIELD_BILL_NUMBER).toString();
String remainingAmount = row.get("thisAmount").toString(); String remainingAmount = row.get("thisAmount").toString();
hgcw017.setContractNumber(contractNumber); hgcw017.setContractNumber(invoiceCode.isEmpty()?billNumber:invoiceCode);
hgcw017.setTotalContractPriceIncluding(new BigDecimal(remainingAmount)); hgcw017.setTotalContractPriceIncluding(new BigDecimal(remainingAmount));
if (mainId != null) { if (mainId != null) {
hgcw017.setMainId(mainId); hgcw017.setMainId(mainId);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.cw.billTybe"/> <EF:EFCodeOption codeName="hggp.cw.billTybe"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFInput cname="开票单号" ename="invoiceCode" blockId="inqu_status" row="0" colWidth="3" placeholder="模糊查询开票单号"/>
<EF:EFInput cname="发票号" ename="billNumber" blockId="inqu_status" row="0" colWidth="3" placeholder="模糊查询发票号"/> <EF:EFInput cname="发票号" ename="billNumber" blockId="inqu_status" row="0" colWidth="3" placeholder="模糊查询发票号"/>
<EF:EFSelect cname="开票状态" ename="inqu_status-0-billState" colWidth="3" filter="contains"> <EF:EFSelect cname="开票状态" ename="inqu_status-0-billState" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
...@@ -75,6 +76,7 @@ ...@@ -75,6 +76,7 @@
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="140" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="settlementNumber" cname="来源单号" width="140" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="invoiceCode" cname="开票单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true" <EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" defaultValue="1"> columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" defaultValue="1">
<EF:EFCodeOption codeName="hggp.cw.billTybe"/> <EF:EFCodeOption codeName="hggp.cw.billTybe"/>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.cw.billTybe"/> <EF:EFCodeOption codeName="hggp.cw.billTybe"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFInput cname="收票单号" ename="invoiceCode" blockId="inqu_status" row="0" colWidth="3" placeholder="模糊查询收票单号"/>
<EF:EFInput cname="发票号" ename="billNumber" blockId="inqu_status" row="0" colWidth="3" placeholder="模糊发票号"/> <EF:EFInput cname="发票号" ename="billNumber" blockId="inqu_status" row="0" colWidth="3" placeholder="模糊发票号"/>
<EF:EFSelect cname="审核状态" ename="inqu_status-0-billState" colWidth="3" filter="contains"> <EF:EFSelect cname="审核状态" ename="inqu_status-0-billState" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
...@@ -58,6 +59,7 @@ ...@@ -58,6 +59,7 @@
maxLength="16" readonly="true" width="210" required="true" maxLength="16" readonly="true" width="210" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="invoiceCode" cname="收票单号" enable="false" width="120" align="center"/>
<%--<EF:EFColumn ename="partyA" cname="供应商名称" width="220" enable="false" readonly="true" align="center"/>--%> <%--<EF:EFColumn ename="partyA" cname="供应商名称" width="220" enable="false" readonly="true" align="center"/>--%>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="200" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="settlementNumber" cname="来源单号" width="200" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true" defaultValue="1" <EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true" defaultValue="1"
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/" maxLength="15" required="false" data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/" maxLength="15" required="false"
data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/> data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/>
<EF:EFColumn ename="partyA" cname="客户名称" width="200" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="partyA" cname="客户名称" width="200" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="invoiceCode" cname="开票单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="200" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="settlementNumber" cname="来源单号" width="200" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" <EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" >
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
maxLength="16" readonly="true" width="200" required="true" enable="false" maxLength="16" readonly="true" width="200" required="true" enable="false"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="invoiceCode" cname="开票单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="settlementNumber" cname="来源单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" <EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" >
......
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