Commit 4950663e by liuyang

2024-08-02 合同管理清单增加导入功能,暂定工程量、除税单价/元、不含税总价、含税总价为必填项

parent 3a4830b3
......@@ -137,6 +137,14 @@ public class ServiceHGCW002 extends ServiceBase {
for (int i = 0; i < detail1Rows.size(); i++) {
HGCW003 hgcw003 = new HGCW003();
hgcw003.fromMap(detail1Rows.get(i));
if (hgcw003.getId() == null || hgcw003.getId() == 0){
hgcw003.setCompanyCode(HGCW002.getCompanyCode());
hgcw003.setCompanyName(HGCW002.getCompanyName());
hgcw003.setContractNumber(HGCW002.getContractNumber());
DaoUtils.insert(HGCW003.INSERT, hgcw003);
}else {
DaoUtils.update(HGCW003.UPDATE, hgcw003);
}
totalContractPriceExcluding = totalContractPriceExcluding.add(hgcw003.getTotalPriceExcluding());
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw003.getTotalPriceIncluding());
}
......
......@@ -5,26 +5,27 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cw.domain.HGCW002;
import com.baosight.hggp.hg.cw.domain.HGCW003;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.pz.domain.HGPZ002;
import com.baosight.hggp.hg.pz.domain.HGPZ003;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.ExcelUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
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.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -39,7 +40,7 @@ public class ServiceHGCW002A extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "查询",operDesc = "初始化")
@OperationLogAnnotation(operModul = "合同清单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJECT_CODE_BOX_BLOCK_ID), null, false);
......@@ -127,4 +128,18 @@ public class ServiceHGCW002A extends ServiceBase {
}
return inInfo;
}
@OperationLogAnnotation(operModul = "合同清单",operType = "导入",operDesc = "导入操作")
public EiInfo importDate(EiInfo inInfo) {
try {
Map<String, Object> params = new HashMap<>(2);
String fileName = inInfo.getString(ACConstants.FILE_NAME);
//解析文件,将文件中数据传入到inInfo中
inInfo = ExcelUtils.importFromExcel(inInfo, fileName, params, new HGCW003());
}catch (Exception e){
inInfo.setStatus(EiConstant.STATUS_FAILURE);
LogUtils.setDetailMsg(inInfo, e, "导入失败");
}
return inInfo;
}
}
......@@ -257,6 +257,25 @@ public class ExcelUtils {
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("导入成功" + arrayList.size() + "条");
break;
case "HGCW003":
for (Map row: arrayList) {
if ("0.000".equals(row.get("provisionalQuantity"))) {
AssertUtils.isTrue(false, "暂定工程量不能为0");
}
if ("0.000".equals(row.get("unitPriceExcludingTax"))) {
AssertUtils.isTrue(false, "除税单价不能为0");
}
if ("0.000".equals(row.get("totalPriceExcluding"))) {
AssertUtils.isTrue(false, "不含税总价不能为0");
}
if ("0.000".equals(row.get("totalPriceIncluding"))) {
AssertUtils.isTrue(true, "含税总价不能为0");
}
}
EiBlock block = new EiBlock("detail1");
block.setRows(arrayList);
inInfo.setBlock(block);
break;
default:
}
......
......@@ -4,7 +4,9 @@
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="合同管理">
<EF:EFRegion id="inqu" title="查询条件">
......@@ -54,7 +56,7 @@
<EF:EFColumn ename="companyName" cname="所属公司" align="center" enable="false"/>
<EF:EFColumn ename="projCode" cname="项目编号" align="center" enable="false"/>
<EF:EFColumn ename="projName" cname="项目名称" align="center" enable="false"/>
<EF:EFColumn ename="signingDate" cname="签订日期" align="center" enable="false"/>
<EF:EFColumn ename="signingDate" cname="签订日期" align="center" enable="false" editType="date" parseFormats="['yyyyMMdd']" parseFormat="yyyy-MM-dd"/>
<EF:EFColumn ename="contractNumber" cname="合同号" align="center" enable="false"/>
<EF:EFColumn ename="contractName" cname="合同名称" align="center" enable="false"/>
<EF:EFColumn ename="partyA" cname="甲方名称" align="center" enable="false"/>
......@@ -89,7 +91,4 @@
</EF:EFRegion>
</EF:EFPage>
<%--
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HG/CW/HGCW002.js"></script>--%>
......@@ -407,7 +407,7 @@ $(function() {
}
})
$("#IMPORT").on("click", function (e) {
/*$("#IMPORT").on("click", function (e) {
let status = $("#inqu_status-0-status").val();
if (status == 2){
IPLAT.alert({
......@@ -418,31 +418,10 @@ $(function() {
});
return false;
}
var logic = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId ? false : true;
if (logic) { // 通过业务逻辑判断, 控制是否进行新增
IPLAT.alert({
message: '<b>请选择项目列表</b>',
okFn: function (e) {
},
title: '提示'
});
return false;
}
var logicLv = IPLATUI.EFTree.materialTree.selectTreeNode.lv === '1';
if (logicLv) { // 通过业务逻辑判断, 控制是否进行新增
IPLAT.alert({
message: '<b>请选择项目或产品层级</b>',
okFn: function (e) {
},
title: '提示'
});
return false;
}
openFileWindow.open();
});
});*/
//grush.openImportBox();
grush.openImportBox();
IPLATUI.EFUpload = {
fileUpload: {
showFileList: false,
......@@ -452,17 +431,10 @@ $(function() {
},
success: function (e) {
var src = e.response.docUrl;
let selectTreeNode = IPLATUI.EFTree.materialTree.selectTreeNode;
var eiInfo = new EiInfo();
let notIsExcelFile = isExcelFile(src);
eiInfo.set("fileName", src);
eiInfo.set("projCode", selectTreeNode.projCode);
eiInfo.set("projName", selectTreeNode.projName);
eiInfo.set("parentProdCode", selectTreeNode.nodeId);
eiInfo.set("parentProdName", selectTreeNode.pName);
eiInfo.set("lv", selectTreeNode.lv);
eiInfo.set("materialId", $("#inqu_status-0-materialId").val())
EiCommunicator.send("HGSC004A", "importDate", eiInfo, {
EiCommunicator.send("HGCW002A", "importDate", eiInfo, {
onSuccess(ei) {
if (notIsExcelFile) {
NotificationUtil("请导入xls或xlsx文件", "error");
......@@ -473,8 +445,21 @@ $(function() {
{msg: ei.msg, detailMsg: ei.detailMsg}, "error");
} else {
NotificationUtil(ei.msg);
refreshTree();
query();
let rows = ei.getBlock("detail1").getMappedRows();
detail1Grid.addRows(rows);
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
rows.forEach(function (row, index) {
totalPriceExcluding += parseFloat(row.totalPriceExcluding);
totalPriceIncluding += parseFloat(row.totalPriceIncluding);
});
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(totalPriceExcluding.toFixed(3))
$("#result-0-totalContractPriceIncluding").val(totalPriceIncluding.toFixed(3))
$("#result-0-remainingAmount").val(totalPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
//detail1Grid.setEiInfo(ei);
}
},
onFail(ei) {
......@@ -492,7 +477,7 @@ $(function() {
}
}
grush.downloadFile(`${ctx}\\common\\template\\SC\\HGSC004A_物料清单.xls`);
grush.downloadFile(`${ctx}\\common\\template\\CW\\HGCW002A_合同清单.xls`);
});
function saveResult1Func() {
......
......@@ -4,7 +4,9 @@
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="新增合同">
<EF:EFRegion id="inqu1" title="基本信息">
<div class="row">
......@@ -119,7 +121,7 @@
</EF:EFRegion>
<EF:EFRegion id="detail1" title="合同清单">
<EF:EFGrid blockId="detail1" autoDraw="override" checkMode="row" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="rowNo" cname="行号" hidden="true"/>
<%--<EF:EFColumn ename="rowNo" cname="行号" hidden="true"/>--%>
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="inventory" cname="清单" align="center" />
<EF:EFColumn ename="unit" cname="单位" align="center" />
......@@ -148,9 +150,13 @@
</div>
</EF:EFPage>
<EF:EFWindow id="openFile">
<EF:EFRegion id="upload" title="文件导入区">
<div id="button"></div>
<EF:EFUpload ename="fileUpload" cname="导入" docTag="HGCW002A" path="cw"/>
</EF:EFRegion>
</EF:EFWindow>
<%--
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HG/CW/HGCW002A.js"></script>--%>
......@@ -353,42 +353,7 @@ $(function() {
}
})
$("#IMPORT").on("click", function (e) {
let status = $("#inqu_status-0-status").val();
if (status == 2){
IPLAT.alert({
message: '<b>物料清单全部提交,无法导入!</b>',
okFn: function (e) {
},
title: '提示'
});
return false;
}
var logic = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId ? false : true;
if (logic) { // 通过业务逻辑判断, 控制是否进行新增
IPLAT.alert({
message: '<b>请选择项目列表</b>',
okFn: function (e) {
},
title: '提示'
});
return false;
}
var logicLv = IPLATUI.EFTree.materialTree.selectTreeNode.lv === '1';
if (logicLv) { // 通过业务逻辑判断, 控制是否进行新增
IPLAT.alert({
message: '<b>请选择项目或产品层级</b>',
okFn: function (e) {
},
title: '提示'
});
return false;
}
openFileWindow.open();
});
//grush.openImportBox();
grush.openImportBox();
IPLATUI.EFUpload = {
fileUpload: {
showFileList: false,
......@@ -398,17 +363,10 @@ $(function() {
},
success: function (e) {
var src = e.response.docUrl;
let selectTreeNode = IPLATUI.EFTree.materialTree.selectTreeNode;
var eiInfo = new EiInfo();
let notIsExcelFile = isExcelFile(src);
eiInfo.set("fileName", src);
eiInfo.set("projCode", selectTreeNode.projCode);
eiInfo.set("projName", selectTreeNode.projName);
eiInfo.set("parentProdCode", selectTreeNode.nodeId);
eiInfo.set("parentProdName", selectTreeNode.pName);
eiInfo.set("lv", selectTreeNode.lv);
eiInfo.set("materialId", $("#inqu_status-0-materialId").val())
EiCommunicator.send("HGSC004A", "importDate", eiInfo, {
EiCommunicator.send("HGCW002A", "importDate", eiInfo, {
onSuccess(ei) {
if (notIsExcelFile) {
NotificationUtil("请导入xls或xlsx文件", "error");
......@@ -419,8 +377,22 @@ $(function() {
{msg: ei.msg, detailMsg: ei.detailMsg}, "error");
} else {
NotificationUtil(ei.msg);
refreshTree();
query();
let rows = ei.getBlock("detail1").getMappedRows();
detail1Grid.addRows(rows);
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
var allRows = detail1Grid.getDataItems();
allRows.forEach(function (row, index) {
totalPriceExcluding += parseFloat(row.totalPriceExcluding);
totalPriceIncluding += parseFloat(row.totalPriceIncluding);
});
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(totalPriceExcluding.toFixed(3))
$("#result-0-totalContractPriceIncluding").val(totalPriceIncluding.toFixed(3))
$("#result-0-remainingAmount").val(totalPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
//detail1Grid.setEiInfo(ei);
}
},
onFail(ei) {
......@@ -438,7 +410,7 @@ $(function() {
}
}
grush.downloadFile(`${ctx}\\common\\template\\SC\\HGSC004A_物料清单.xls`);
grush.downloadFile(`${ctx}\\common\\template\\CW\\HGCW002A_合同清单.xls`);
});
function initDate() {
......
......@@ -4,6 +4,9 @@
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script>
var ctx = "${ctx}";
</script>
<head>
</head>
<EF:EFPage title="修改合同">
......@@ -151,8 +154,9 @@
</div>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HG/CW/HGCW002B.js"></script>
\ No newline at end of file
<EF:EFWindow id="openFile">
<EF:EFRegion id="upload" title="文件导入区">
<div id="button"></div>
<EF:EFUpload ename="fileUpload" cname="导入" docTag="HGCW002A" path="cw"/>
</EF:EFRegion>
</EF:EFWindow>
\ No newline at end of file
......@@ -4,6 +4,9 @@
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script>
var ctx = "${ctx}";
</script>
<head>
</head>
<EF:EFPage title="合同详情">
......@@ -50,6 +53,10 @@
<div class="row">
<EF:EFInput ename="result-0-signingDate" cname="签约日期" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-mainContractNumber" cname="主合同号" readonly="true" enable="false"/>
<EF:EFSelect cname="付款方式" ename="result-0-paymentMethod" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.paymentMethod"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFInput type="textarea" ename="result-0-contractContent" cname="合同内容" colWidth="8" ratio="2:10" readonly="true" enable="false"/>
......@@ -58,24 +65,18 @@
<EF:EFRegion id="inqu2" title="承包方式及合同价款">
<div class="row">
<EF:EFInput ename="result-0-contractingMethod" cname="承包方式" colWidth="4" readonly="true" enable="false"/>
<EF:EFSelect cname="付款方式" ename="result-0-paymentMethod" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.paymentMethod"/>
</EF:EFSelect>
<EF:EFSelect cname="计价方式" ename="result-0-pricingMethod" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.pricingMethod"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="税率" ename="result-0-taxPoints" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-totalContractPriceExcluding" cname="合同总价(不含税)" colWidth="4" readonly="true" enable="false"/>
<EF:EFInput ename="result-0-valueAddedTax" cname="税额" colWidth="4" readonly="true" enable="false"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-totalContractPriceExcluding" cname="合同总价(不含税)" colWidth="4" readonly="true" enable="false"/>
<EF:EFInput ename="result-0-valueAddedTax" cname="税额" colWidth="4" readonly="true" enable="false"/>
<EF:EFInput ename="result-0-totalContractPriceIncluding" cname="合同总价(含税)" colWidth="4" readonly="true" enable="false"/>
</div>
</EF:EFRegion>
......@@ -104,10 +105,4 @@
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HG/CW/HGCW002C.js"></script>
\ No newline at end of file
</EF:EFPage>
\ No newline at end of file
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