Commit 93a24d61 by liuyang

2024-09-20

1、增加按钮功能,手工增加销售开票数据,等有合同和结算单时进行勾选,模式跟先收款后开票一样
parent af47b985
package com.baosight.hggp.hg.cw.domain;
import com.baosight.hggp.util.DateUtils;
import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn;
......@@ -653,7 +654,7 @@ public class HGCW010 extends DaoEPBase {
setBillTybe(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_TYBE)), billTybe));
setBillNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BILL_NUMBER)), billNumber));
setBillState(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_STATE)), billState));
setSigningDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SIGNING_DATE)), signingDate));
setSigningDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_SIGNING_DATE))), signingDate));
setPartyA(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARTY_A)), partyA));
setReviewStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REVIEW_STATUS)), reviewStatus));
setThisSettlementTax(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_THIS_SETTLEMENT_TAX)), thisSettlementTax));
......
......@@ -50,7 +50,7 @@ public class ServiceHGCW010 extends ServiceBase {
/*CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID,
DdynamicEnum.PROJ_RECORD_BLOCK_ID), null, false);*/
List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID),
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID),
new HashMap<String,Object>(){{
put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
}}
......@@ -92,22 +92,26 @@ public class ServiceHGCW010 extends ServiceBase {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGCW010 HGCW010 = new HGCW010();
HGCW010.fromMap(resultRows.get(i));
HGCW010 hgcw010 = new HGCW010();
hgcw010.fromMap(resultRows.get(i));
if (StringUtils.isEmpty(hgcw010.getCompanyCode())){
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW010.setCompanyCode(userVO.getUsercode());
HGCW010.setCompanyName(userVO.getUsername());
HGCW010.setBillState(1);
HGCW010.setReviewStatus(0);
HGCW010.setSigningDate(DateUtils.formatShort(HGCW010.getSigningDate()));
hgcw010.setCompanyCode(userVO.getUsercode());
hgcw010.setCompanyName(userVO.getUsername());
}
if (StringUtils.isEmpty(hgcw010.getProjName())){
// 获取项目名称
HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(HGCW010.getProjCode());
AssertUtils.isNull(HGSC001, "项目编码[" + HGCW010.getProjCode() + "]不存在");
HGCW010.setProjName(HGSC001.getProjName());
if (HGCW010.getId() == null || HGCW010.getId() == 0) {
this.add(HGCW010);
HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(hgcw010.getProjCode());
AssertUtils.isNull(HGSC001, "项目编码[" + hgcw010.getProjCode() + "]不存在");
hgcw010.setProjName(HGSC001.getProjName());
}
hgcw010.setBillState(1);
hgcw010.setReviewStatus(0);
hgcw010.setSigningDate(DateUtils.formatShort(hgcw010.getSigningDate()));
if (hgcw010.getId() == null || hgcw010.getId() == 0) {
this.add(hgcw010);
} else {
this.modify(HGCW010);
this.modify(hgcw010);
}
}
inInfo = this.query(inInfo);
......@@ -122,21 +126,22 @@ public class ServiceHGCW010 extends ServiceBase {
/**
* 新增操作
*
* @param HGCW010
* @param hgcw010
* @return
*/
public void add(HGCW010 HGCW010) {
DaoUtils.insert("HGCW010.insert", HGCW010);
public void add(HGCW010 hgcw010) {
hgcw010.setRemainingAmount(hgcw010.getTotalContractPriceIncluding());
DaoUtils.insert(HGCW010.INSERT, hgcw010);
}
/**
* 修改操作
*
* @param HGCW010
* @param hgcw010
* @return
*/
public void modify(HGCW010 HGCW010) {
DaoUtils.update("HGCW010.update", HGCW010);
public void modify(HGCW010 hgcw010) {
DaoUtils.update(HGCW010.UPDATE, hgcw010);
}
/**
......@@ -155,8 +160,18 @@ public class ServiceHGCW010 extends ServiceBase {
List<HGCW011> hgcw011List = HGCWTools.HgCw011.getMainId(HGCW010.getId());
if (CollectionUtils.isNotEmpty(hgcw011List)) {
for (HGCW011 hgcw011 : hgcw011List) {
HGCW002 hgcw002 = HGCWTools.HgCw002.getContractNumber(hgcw011.getSettlementNumber());
HGCW006 hgcw006 = HGCWTools.HgCw006.getContractNumber(hgcw011.getSettlementNumber());
if (StringUtils.isNotNull(hgcw002)){
HGCWTools.HgCw008.remainingAmount(hgcw011.getSettlementNumber(),
hgcw011.getTotalContractPriceIncluding().multiply(new BigDecimal(-1)));
}else if (StringUtils.isNotNull(hgcw006)){
HGCWTools.HgCw006.deductionAmount(hgcw011.getSettlementNumber(),
hgcw011.getTotalContractPriceIncluding().multiply(new BigDecimal(-1)));
}else {
HGCWTools.HgCw008.deductionAmount(hgcw011.getSettlementNumber(),
hgcw011.getTotalContractPriceIncluding().multiply(new BigDecimal(-1)));
}
DaoUtils.update("HGCW011.delete", hgcw011);
}
}
......@@ -213,7 +228,6 @@ public class ServiceHGCW010 extends ServiceBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw010.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw010);
......@@ -229,7 +243,6 @@ public class ServiceHGCW010 extends ServiceBase {
} else {
HGCW010 hgcw010 = HGCWTools.HgCw010.getId(mainId);
Map<String, BigDecimal> rowMap = new HashMap<>();
for (Map m : resultRows) {
String c = m.get("settlementNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
......@@ -245,12 +258,15 @@ public class ServiceHGCW010 extends ServiceBase {
List<HGCW011> hgcw011s = HGCWTools.HgCw011.getMainId(hgcw010.getId());
if (CollectionUtils.isNotEmpty(hgcw011s)) {
// 更新主表
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer settlementNumber = new StringBuffer();
for (HGCW011 hgcw011 : hgcw011s) {
BigDecimal totalContractPriceIncluding = hgcw011s.stream().map(HGCW011::getTotalContractPriceIncluding).reduce(BigDecimal.ZERO,BigDecimal::add);
/*for (HGCW011 hgcw011 : hgcw011s) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw011.getTotalContractPriceIncluding());
settlementNumber.append(hgcw011.getSettlementNumber()).append(",");
}
}*/
hgcw011s.forEach(hpcw004A -> {
settlementNumber.append(hpcw004A.getSettlementNumber()).append(",");
});
hgcw010.setTotalContractPriceIncluding(totalContractPriceIncluding);
hgcw010.setPartyA(hgcw011s.get(0).getPartyA());
hgcw010.setProjCode(hgcw011s.get(0).getProjCode());
......@@ -258,7 +274,6 @@ public class ServiceHGCW010 extends ServiceBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
this.modify(hgcw010);
......@@ -274,6 +289,7 @@ public class ServiceHGCW010 extends ServiceBase {
}
public void addHGCW011(HGCW011 HGCW011) {
HGCW011.setId(null);
DaoUtils.insert("HGCW011.insert", HGCW011);
}
......
......@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.hg.cw.domain.HGCW010;
import com.baosight.hggp.hg.cw.domain.HGCW011;
import com.baosight.hggp.hg.cw.domain.HGCW015;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
......@@ -52,8 +53,8 @@ public class ServiceHGCW010B extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
Map map = EiInfoUtils.getFirstRow(inInfo);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCW010.FIELD_ID, map.get("mainId"));
inInfo = super.query(inInfo, HGCW010.QUERY, new HGCW010());
//inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCW011.FIELD_MAIN_ID, map.get("mainId"));
inInfo = super.query(inInfo, HGCW011.QUERY, new HGCW010());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......
......@@ -115,7 +115,6 @@ public class ServiceHGCW010D extends ServiceEPBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw010.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw010);
......@@ -162,7 +161,6 @@ public class ServiceHGCW010D extends ServiceEPBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
this.modify(hgcw010);
......@@ -185,6 +183,7 @@ public class ServiceHGCW010D extends ServiceEPBase {
}
public void addHGCW011(HGCW011 hgcw011) {
hgcw011.setId(null);
DaoUtils.insert("HGCW011.insert", hgcw011);
}
......
......@@ -114,7 +114,6 @@ public class ServiceHGCW010E extends ServiceEPBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw010.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw010);
......@@ -159,7 +158,6 @@ public class ServiceHGCW010E extends ServiceEPBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
this.modify(hgcw010);
......@@ -182,6 +180,7 @@ public class ServiceHGCW010E extends ServiceEPBase {
}
public void addHGCW011(HGCW011 hgcw011) {
hgcw011.setId(null);
DaoUtils.insert("HGCW011.insert", hgcw011);
}
......
......@@ -382,6 +382,14 @@ public class HGCWTools {
return results.get(0);
}
public static HGCW006 getContractNumber(String contractNumber) {
AssertUtils.isNull(contractNumber, "合同号不能为空!");
List<HGCW006> results = DaoBase.getInstance().query(HGCW006.QUERY,new HashMap<String,Object>(){
{put("contractNumber",contractNumber);}
});
return CollectionUtils.isEmpty(results)? null :results.get(0);
}
public static void deductionAmount(String settlementNumber, BigDecimal deductionAmount) {
AssertUtils.isNull(settlementNumber, "来源单号不能为空!");
// if (deductionAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
......@@ -558,14 +566,14 @@ public class HGCWTools {
new HashMap<String,Object>(){{
put("contractNumber",contractNumber);
}});
List<HGCW010> hgcw011List = DaoBase.getInstance().query(HGCW011.QUERY,
List<HGCW011> hgcw011List = DaoBase.getInstance().query(HGCW011.QUERY,
new HashMap<String,Object>(){{
put("settlementNumber",contractNumber);
}});
//获取项目结算单累计开票金额
BigDecimal totalAmount08 = cw008List.stream().map(HGCW008::getThisPriceTax).reduce(BigDecimal.ZERO,BigDecimal::add);
//获取销售开票累计开票金额
BigDecimal totalAmount11 = hgcw011List.stream().map(HGCW010::getTotalContractPriceIncluding).reduce(BigDecimal.ZERO,BigDecimal::add);
BigDecimal totalAmount11 =hgcw011List.size() == 0 ? BigDecimal.ZERO : hgcw011List.stream().map(HGCW011::getTotalContractPriceIncluding).reduce(BigDecimal.ZERO,BigDecimal::add);
DecimalFormat decimalFormat = new DecimalFormat("#.000");
//合同总金额-(累计开票金额+本次来票金额)
......
......@@ -51,38 +51,50 @@
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="partyA" cname="客户名称" width="200" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" width="200" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFComboColumn ename="projCode" cname="项目名称" blockName="proj_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="210" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="公司名称" hidden="true"/>
<EF:EFComboColumn ename="partyA" cname="客户名称" blockName="customer_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="210" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="140" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" >
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" defaultValue="1">
<EF:EFCodeOption codeName="hggp.cw.billTybe"/>
</EF:EFComboColumn>
<EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="false" readonly="true" align="center"
<EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="true" readonly="true" align="center"
editType="date" parseFormats="['yyyyMMdd']" parseFormat="yyyy-MM-dd"/>
<EF:EFColumn ename="billNumber" cname="发票号" width="120" align="center"/>
<EF:EFComboColumn ename="taxPoints" cname="税率" width="80" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" >
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" defaultValue="13">
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn>
<EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="15" required="false"
<EF:EFColumn ename="totalContractPriceIncluding" cname="开票总额" width="120" enable="true" readonly="true" format="{0:C2}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="15" required="true"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/>
<EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text"
<EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="15" required="false"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="开票总额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text"
<EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="15" required="false"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/>
<EF:EFComboColumn ename="billState" cname="开票状态" width="100" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" >
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="1">
<EF:EFCodeOption codeName="hggp.cw.billState"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="reviewStatus" cname="审批状态" width="100" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" >
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="0">
<EF:EFCodeOption codeName="hggp.cw.reviewStatus"/>
</EF:EFComboColumn>
</EF:EFGrid>
......
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