Commit aa54151b by liuyang

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

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