Commit 5ef8e4c4 by 宋祥

1.结算单明细累计结算工程量计算错误问题修复

parent becb1f21
...@@ -207,6 +207,8 @@ public class ServiceHGCW008 extends ServiceBase { ...@@ -207,6 +207,8 @@ public class ServiceHGCW008 extends ServiceBase {
DaoUtils.update(HGCW008.DELETE, hgcw008); DaoUtils.update(HGCW008.DELETE, hgcw008);
// 更新累计金额 // 更新累计金额
HGCWTools.HgCw008.updateCumulativeSettlement(hgcw008.getContractNumber()); HGCWTools.HgCw008.updateCumulativeSettlement(hgcw008.getContractNumber());
// 删除明细
HGCWTools.HgCw009.deleteBySettlement(hgcw008.getSettlementNumber());
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
......
...@@ -154,6 +154,11 @@ ...@@ -154,6 +154,11 @@
DELETE FROM ${hggpSchema}.HGCW009 WHERE ID = #id# DELETE FROM ${hggpSchema}.HGCW009 WHERE ID = #id#
</delete> </delete>
<!-- 根据结算单号删除 -->
<delete id="deleteBySettlement">
DELETE FROM ${hggpSchema}.HGCW009 WHERE SETTLEMENT_NUMBER = #settlementNumber#
</delete>
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGCW009 UPDATE ${hggpSchema}.HGCW009
SET SET
...@@ -177,8 +182,10 @@ ...@@ -177,8 +182,10 @@
WHERE ID = #id# WHERE ID = #id#
</update> </update>
<select id="queryEngineeringQuantity" resultClass="int"> <select id="queryEngineeringQuantity" resultClass="float">
SELECT IFNULL(SUM( THIS_ENGINEERING_QUANTITY ),0) as "sumEngineeringQuantity" FROM ${hggpSchema}.HGCW009 WHERE 1=1 SELECT IFNULL(SUM(THIS_ENGINEERING_QUANTITY ),0) as "sumEngineeringQuantity"
FROM ${hggpSchema}.HGCW009
WHERE 1=1
AND SETTLEMENT_NUMBER IN ( AND SETTLEMENT_NUMBER IN (
SELECT SETTLEMENT_NUMBER FROM ${hggpSchema}.HGCW008 WHERE CONTRACT_NUMBER = #contractNumber# SELECT SETTLEMENT_NUMBER FROM ${hggpSchema}.HGCW008 WHERE CONTRACT_NUMBER = #contractNumber#
) )
......
...@@ -646,15 +646,31 @@ public class HGCWTools { ...@@ -646,15 +646,31 @@ public class HGCWTools {
} }
/**
*
* @author:songx
* @date:2024/9/25,16:45
*/
public static class HgCw009 { public static class HgCw009 {
/**
* 根据结算单删除
*
* @param settlementNumber
*/
public static void deleteBySettlement(String settlementNumber) {
Map paramMap = new HashMap();
paramMap.put("settlementNumber", settlementNumber);
DaoUtils.update("HGCW009.deleteBySettlement", paramMap);
}
public static void save(List<Map> rows, String settlementNumber, HGCW008 hgcw008) { public static void save(List<Map> rows, String settlementNumber, HGCW008 hgcw008) {
AssertUtils.isNull(settlementNumber, "结算单号不能为空!"); AssertUtils.isNull(settlementNumber, "结算单号不能为空!");
rows.forEach(row -> { rows.forEach(row -> {
HGCW009 hgcw009 = new HGCW009(); HGCW009 hgcw009 = new HGCW009();
hgcw009.fromMap(row); hgcw009.fromMap(row);
hgcw009.setCompanyCode(hgcw008.getCompanyCode()); hgcw009.setCompanyCode(hgcw008.getCompanyCode());
hgcw009.setCompanyName(hgcw008.getCompanyCode()); hgcw009.setCompanyName(hgcw008.getCompanyName());
hgcw009.setSettlementNumber(settlementNumber); hgcw009.setSettlementNumber(settlementNumber);
DaoUtils.insert(HGCW009.INSERT, hgcw009); DaoUtils.insert(HGCW009.INSERT, hgcw009);
}); });
......
...@@ -244,6 +244,7 @@ public class HGSCTools { ...@@ -244,6 +244,7 @@ public class HGSCTools {
AssertUtils.isNull(code, "项目Code不能为空!"); AssertUtils.isNull(code, "项目Code不能为空!");
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put(HGSC001.FIELD_proj_code, code); queryMap.put(HGSC001.FIELD_proj_code, code);
queryMap.put("notAuth", true);
List<HGSC001> results = DaoBase.getInstance().query(HgScSqlConstant.HgSc001.GET_BY_CODE, queryMap); List<HGSC001> results = DaoBase.getInstance().query(HgScSqlConstant.HgSc001.GET_BY_CODE, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0); return CollectionUtils.isEmpty(results) ? null : results.get(0);
} }
......
...@@ -48,7 +48,10 @@ $(function() { ...@@ -48,7 +48,10 @@ $(function() {
loadComplete: function (grid) { loadComplete: function (grid) {
$("#BTN_CHOICE").on("click",choiceFunc); $("#BTN_CHOICE").on("click",choiceFunc);
grid.dataSource.bind("change", function (e) { grid.dataSource.bind("change", function (e) {
if (e.field == "thisEngineeringQuantity" || e.field == "unitPrice") { if (e.field == "unitPrice") {
calcTotalPrice(e, 3);
}
if (e.field == "thisEngineeringQuantity") {
calcTotalPrice(e, 2); calcTotalPrice(e, 2);
} }
if (e.field == "totalTaxPrice") { if (e.field == "totalTaxPrice") {
...@@ -374,27 +377,31 @@ let refreshRowNo = function () { ...@@ -374,27 +377,31 @@ let refreshRowNo = function () {
detail1Grid.refresh(); detail1Grid.refresh();
} }
} }
function queryCumulativeEngineeringQuantity(inventoryId,item) {
if (inventoryId) { function queryCumulativeEngineeringQuantity(item) {
var thisEngineeringQuantity = parseFloat(item.thisEngineeringQuantity) || 0; // 工程量 let inventoryId = item.inventoryId;
var info = new EiInfo(); if (isBlank(inventoryId)) {
info.set("inventoryId", inventoryId); return;
EiCommunicator.send("HGCW009", "queryEngineeringQuantity", info, { }
onSuccess: function (ei) { var thisEngineeringQuantity = parseFloat(item.thisEngineeringQuantity) || 0; // 工程量
if (ei.getStatus() >= 0) { var info = new EiInfo();
var cumulativeEngineeringQuantity = ei.extAttr.result || 0; info.set("inventoryId", inventoryId);
detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity + cumulativeEngineeringQuantity); info.set("contractNumber", $("#result-0-contractNumber").val());
} else { EiCommunicator.send("HGCW009", "queryEngineeringQuantity", info, {
NotificationUtil(ei, "error"); onSuccess: function (ei) {
detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity); if (ei.getStatus() >= 0) {
} var cumulativeEngineeringQuantity = ei.extAttr.result || 0;
}, detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity + cumulativeEngineeringQuantity);
onFail: function (ei) { } else {
// 发生异常 NotificationUtil(ei, "error");
NotificationUtil("操作失败,原因[" + ei + "]", "error"); detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity);
} }
}); },
} onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
} }
/** /**
...@@ -430,6 +437,10 @@ function calcTotalPrice(e, type) { ...@@ -430,6 +437,10 @@ function calcTotalPrice(e, type) {
let totalPrice = isBlank(taxPoints) ? totalTaxPrice : totalTaxPrice / (1 + taxPoints / 100); let totalPrice = isBlank(taxPoints) ? totalTaxPrice : totalTaxPrice / (1 + taxPoints / 100);
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice)); detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
detail1Grid.setCellValue(item, 'totalTaxPrice', parseFloat(totalTaxPrice)); detail1Grid.setCellValue(item, 'totalTaxPrice', parseFloat(totalTaxPrice));
// 累计工程量
if (type == 2) {
queryCumulativeEngineeringQuantity(item);
}
} }
// 计算总金额 // 计算总金额
calculateAmount(detail1Grid.getDataItems()); calculateAmount(detail1Grid.getDataItems());
...@@ -458,6 +469,10 @@ function calculateAmount(rows) { ...@@ -458,6 +469,10 @@ function calculateAmount(rows) {
} else { } else {
deductionPrice += parseFloat(row.totalPrice); deductionPrice += parseFloat(row.totalPrice);
} }
// 计算累计至本次的工程量
if (isBlank(row.cumulativeEngineeringQuantity)) {
queryCumulativeEngineeringQuantity(row);
}
}); });
// 累计结算工程量 // 累计结算工程量
let cumulativeEngineeringQuantity = sumCumulativeEngineeringQuantity + thisEngineeringQuantity; let cumulativeEngineeringQuantity = sumCumulativeEngineeringQuantity + thisEngineeringQuantity;
......
...@@ -77,9 +77,9 @@ ...@@ -77,9 +77,9 @@
<EF:EFColumn ename="settlementBasis" cname="结算依据" enable="false" width="100" align="center"/> <EF:EFColumn ename="settlementBasis" cname="结算依据" enable="false" width="100" align="center"/>
<EF:EFColumn ename="taskName" cname="任务名称" align="left"/> <EF:EFColumn ename="taskName" cname="任务名称" align="left"/>
<EF:EFColumn ename="engineeringContent" cname="工程内容" align="left"/> <EF:EFColumn ename="engineeringContent" cname="工程内容" align="left"/>
<EF:EFColumn ename="thisEngineeringQuantity" cname="本次结算工程量" format="{0:N3}" align="right"/> <EF:EFColumn ename="thisEngineeringQuantity" cname="本次结算工程量" width="120" format="{0:N3}" align="right"/>
<EF:EFColumn ename="cumulativeEngineeringQuantity" cname="至本次累计结算工程量" enable="false" width="140" <EF:EFColumn ename="cumulativeEngineeringQuantity" cname="至本次累计结算工程量" enable="false" width="140"
format="{0:N3}" align="right" hidden="true"/> format="{0:N3}" align="right"/>
<EF:EFColumn ename="unit" cname="单位" align="center"/> <EF:EFColumn ename="unit" cname="单位" align="center"/>
<EF:EFColumn ename="unitPrice" cname="含税单价" format="{0:N2}" align="right"/> <EF:EFColumn ename="unitPrice" cname="含税单价" format="{0:N2}" align="right"/>
<EF:EFColumn ename="totalPrice" cname="不含税总价" enable="false" format="{0:N2}" align="right"/> <EF:EFColumn ename="totalPrice" cname="不含税总价" enable="false" format="{0:N2}" align="right"/>
......
...@@ -43,7 +43,10 @@ $(function() { ...@@ -43,7 +43,10 @@ $(function() {
loadComplete: function (grid) { loadComplete: function (grid) {
$("#BTN_CHOICE").on("click", choiceFunc); $("#BTN_CHOICE").on("click", choiceFunc);
grid.dataSource.bind("change", function (e) { grid.dataSource.bind("change", function (e) {
if (e.field == "thisEngineeringQuantity" || e.field == "unitPrice") { if (e.field == "unitPrice") {
calcTotalPrice(e, 3);
}
if (e.field == "thisEngineeringQuantity") {
calcTotalPrice(e, 2); calcTotalPrice(e, 2);
} }
if (e.field == "totalTaxPrice") { if (e.field == "totalTaxPrice") {
...@@ -280,7 +283,8 @@ function choiceCallbackFunc(result1, result2) { ...@@ -280,7 +283,8 @@ function choiceCallbackFunc(result1, result2) {
detail1Grid.refresh(); detail1Grid.refresh();
}) })
} }
// 计算总金额
calculateAmount(detail1Grid.getDataItems())
JSColorbox.close(); JSColorbox.close();
} }
function cancelFunc() { function cancelFunc() {
...@@ -354,6 +358,10 @@ function calcTotalPrice(e, type) { ...@@ -354,6 +358,10 @@ function calcTotalPrice(e, type) {
let totalPrice = isBlank(taxPoints) ? totalTaxPrice : totalTaxPrice / (1 + taxPoints / 100); let totalPrice = isBlank(taxPoints) ? totalTaxPrice : totalTaxPrice / (1 + taxPoints / 100);
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice)); detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
detail1Grid.setCellValue(item, 'totalTaxPrice', parseFloat(totalTaxPrice)); detail1Grid.setCellValue(item, 'totalTaxPrice', parseFloat(totalTaxPrice));
// 累计工程量
if (type == 2) {
queryCumulativeEngineeringQuantity(item);
}
} }
// 计算总金额 // 计算总金额
calculateAmount(detail1Grid.getDataItems()); calculateAmount(detail1Grid.getDataItems());
...@@ -378,6 +386,10 @@ function calculateAmount(rows) { ...@@ -378,6 +386,10 @@ function calculateAmount(rows) {
thisAmount += parseFloat(row.totalPrice); thisAmount += parseFloat(row.totalPrice);
thisTaxAmount += parseFloat(row.totalTaxPrice); thisTaxAmount += parseFloat(row.totalTaxPrice);
thisQuantity += parseFloat(row.thisEngineeringQuantity); thisQuantity += parseFloat(row.thisEngineeringQuantity);
// 计算累计至本次的工程量
if (isBlank(row.cumulativeEngineeringQuantity)) {
queryCumulativeEngineeringQuantity(row);
}
}); });
// 累计结算工程量 // 累计结算工程量
var sumQuantity = $("#main-0-thisEngineeringQuantity").val(); var sumQuantity = $("#main-0-thisEngineeringQuantity").val();
......
...@@ -63,9 +63,9 @@ ...@@ -63,9 +63,9 @@
<EF:EFColumn ename="settlementBasis" cname="结算依据" enable="false" width="100" align="center"/> <EF:EFColumn ename="settlementBasis" cname="结算依据" enable="false" width="100" align="center"/>
<EF:EFColumn ename="taskName" cname="任务名称" align="left"/> <EF:EFColumn ename="taskName" cname="任务名称" align="left"/>
<EF:EFColumn ename="engineeringContent" cname="工程内容" align="left"/> <EF:EFColumn ename="engineeringContent" cname="工程内容" align="left"/>
<EF:EFColumn ename="thisEngineeringQuantity" cname="本次结算工程量" format="{0:N3}" align="right"/> <EF:EFColumn ename="thisEngineeringQuantity" cname="本次结算工程量" width="120" format="{0:N3}" align="right"/>
<EF:EFColumn ename="cumulativeEngineeringQuantity" cname="至本次累计结算工程量" enable="false" width="140" <EF:EFColumn ename="cumulativeEngineeringQuantity" cname="至本次累计结算工程量" enable="false" width="140"
format="{0:N3}" align="right" hidden="true"/> format="{0:N3}" align="right"/>
<EF:EFColumn ename="unit" cname="单位" align="center"/> <EF:EFColumn ename="unit" cname="单位" align="center"/>
<EF:EFColumn ename="unitPrice" cname="含税单价" format="{0:N2}" align="right"/> <EF:EFColumn ename="unitPrice" cname="含税单价" format="{0:N2}" align="right"/>
<EF:EFColumn ename="totalPrice" cname="不含税总价" enable="false" format="{0:N2}" align="right"/> <EF:EFColumn ename="totalPrice" cname="不含税总价" enable="false" format="{0:N2}" align="right"/>
......
...@@ -60,9 +60,10 @@ ...@@ -60,9 +60,10 @@
<EF:EFColumn ename="settlementBasis" cname="结算依据" enable="false" align="center"/> <EF:EFColumn ename="settlementBasis" cname="结算依据" enable="false" align="center"/>
<EF:EFColumn ename="taskName" cname="任务名称" enable="false" align="center"/> <EF:EFColumn ename="taskName" cname="任务名称" enable="false" align="center"/>
<EF:EFColumn ename="engineeringContent" cname="工程内容" enable="false" align="center"/> <EF:EFColumn ename="engineeringContent" cname="工程内容" enable="false" align="center"/>
<EF:EFColumn ename="thisEngineeringQuantity" cname="本次结算工程量" enable="false" format="{0:N3}" align="right"/> <EF:EFColumn ename="thisEngineeringQuantity" cname="本次结算工程量" enable="false" width="120" format="{0:N3}"
align="right"/>
<EF:EFColumn ename="cumulativeEngineeringQuantity" cname="至本次累计结算工程量" enable="false" width="140" <EF:EFColumn ename="cumulativeEngineeringQuantity" cname="至本次累计结算工程量" enable="false" width="140"
align="right" format="{0:N3}" hidden="true"/> align="right" format="{0:N3}"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" align="center"/> <EF:EFColumn ename="unit" cname="单位" enable="false" align="center"/>
<EF:EFColumn ename="unitPrice" cname="含税单价" enable="false" format="{0:N2}" align="right"/> <EF:EFColumn ename="unitPrice" cname="含税单价" enable="false" format="{0:N2}" align="right"/>
<EF:EFColumn ename="totalPrice" cname="不含税总价" enable="false" format="{0:N2}" align="right"/> <EF:EFColumn ename="totalPrice" cname="不含税总价" enable="false" format="{0:N2}" align="right"/>
......
...@@ -4,11 +4,10 @@ $(function () { ...@@ -4,11 +4,10 @@ $(function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
}); });
IPLATUI.EFGrid.result = { IPLATUI.EFGrid.result = {
pageable: { pageable: {
pageSize: 20, pageSize: 20,
pageSizes: [10, 20, 50, 70, 100], pageSizes: [20, 80, 150, 300]
}, },
columns: [{ columns: [{
field: "operator", field: "operator",
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" showCount="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="200" align="center" /> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="200" align="center" />
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" readOnly="true"/>
......
...@@ -10,7 +10,7 @@ $(function () { ...@@ -10,7 +10,7 @@ $(function () {
IPLATUI.EFGrid.result = { IPLATUI.EFGrid.result = {
pageable: { pageable: {
pageSize: 20, pageSize: 20,
pageSizes: [10, 20, 50, 70, 100], pageSizes: [20, 80, 150, 300],
}, },
columns: [{ columns: [{
field: "operator", field: "operator",
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" showCount="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="160" align="center" /> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="160" align="center" />
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="left"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="left"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="left"/> <EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="left"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="left"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="220" align="left"/> <EF:EFColumn ename="projName" cname="项目名称" enable="false" width="220" align="left"/>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
......
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