Commit c6d36a31 by yukang

收款单修改、删除、反写数据逻辑处理

parent 07e31b43
......@@ -148,6 +148,9 @@ public class HGCW014 extends DaoEPBase {
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_TOTAL_CONTRACT_PRICE_INCLUDING);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("收款总额");
eiMetadata.addMeta(eiColumn);
......
......@@ -127,6 +127,9 @@ public class HGCW015 extends DaoEPBase {
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_TOTAL_CONTRACT_PRICE_INCLUDING);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("收款总额");
eiMetadata.addMeta(eiColumn);
......
......@@ -6,6 +6,7 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
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.tools.HGCWTools;
......@@ -142,7 +143,17 @@ public class ServiceHGCW014 extends ServiceBase {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
DaoUtils.update("HGCW014.delete", resultRows.get(i));
HGCW014 HGCW014 = new HGCW014();
HGCW014.fromMap(resultRows.get(i));
List<HGCW015> hgcw015List = HGCWTools.HgCw015.getMainId(HGCW014.getId());
if (CollectionUtils.isNotEmpty(hgcw015List)) {
for (HGCW015 hgcw015 : hgcw015List) {
HGCWTools.HgCw010.cutAmount(hgcw015.getContractNumber(),
hgcw015.getTotalContractPriceIncluding().multiply(new BigDecimal(-1)));
DaoUtils.update("HGCW015.delete", hgcw015);
}
}
DaoUtils.update("HGCW014.delete", HGCW014);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -246,6 +257,47 @@ public class ServiceHGCW014 extends ServiceBase {
DaoUtils.insert("HGCW015.insert", HGCW015);
}
/**
* 提交操作
* @param inInfo
* @return
*/
public EiInfo submit(EiInfo inInfo){
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGCW014 HGCW014 = new HGCW014();
HGCW014.fromMap(resultRows.get(i));
HGCW014.setReviewStatus(3);
DaoUtils.update("HGCW014.submit", HGCW014);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据提交成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
public EiInfo writeoff(EiInfo inInfo){
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGCW014 HGCW014 = new HGCW014();
HGCW014.fromMap(resultRows.get(i));
HGCW014.setCancelStatus(2);
DaoUtils.update("HGCW014.writeoff", HGCW014);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据提交成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
......
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.HGCW015;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.LogUtils;
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 java.util.Arrays;
/**
* @author yukang
* @date 2024年05月06日 18:22
*/
public class ServiceHGCW014C extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID,
DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.PROJ_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCW015().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGCW015.QUERY, new HGCW015());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
......@@ -56,8 +56,14 @@
<isNotEmpty prepend=" AND " property="signingDate">
SIGNING_DATE = #signingDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateFrom">
SIGNING_DATE &gt;= REPLACE(#signingDateFrom#, '-', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateTo">
SIGNING_DATE &lt;= REPLACE(#signingDateTo#, '-', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partyA">
PARTY_A = #partyA#
PARTY_A = like ('%$partyA$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="cancelStatus">
CANCEL_STATUS = #cancelStatus#
......@@ -254,4 +260,25 @@
ID = #id#
</update>
<update id="submit">
UPDATE ${hggpSchema}.HGCW014
SET
REVIEW_STATUS = #reviewStatus#, <!-- 审核状态 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
WHERE
ID = #id#
</update>
<update id="writeoff">
UPDATE ${hggpSchema}.HGCW014
SET
CANCEL_STATUS = #cancelStatus#, <!-- 审核状态 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
WHERE
ID = #id#
</update>
</sqlMap>
......@@ -12,7 +12,14 @@ $(function() {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="contractDetailFunc(' + item.id + ')">收款清单</a>';
return template;
}
}
],
loadComplete: function (grid) {
$("#BTN_CHOICE").on("click",choiceFunc);
......@@ -25,6 +32,11 @@ $(function() {
e.preventDefault();
saveResult1Func();
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
......@@ -94,6 +106,10 @@ function updateFunc() {
message("请选择一条数据");
return;
}
if (rows[0].cancelStatus == "2") {
message("已经核销的单据不能修改");
return;
}
JSColorbox.open({
href: "HGCW014B?methodName=initLoad&inqu_status-0-mainId=" + rows[0].id + "&efParentFormEname=HGCW014",
title: "<div style='text-align: center;'>收款清单</div>",
......@@ -155,9 +171,15 @@ function submitFunc() {
}
var flag = true;
rows.forEach(function (row) {
if (row.cancelStatus == "1") {
message("勾选的数据中有未核销的单据!");
flag = false;
return;
}
if (row.reviewStatus == "3") {
message("勾选的数据中有已经提交的合同!");
message("勾选的数据中有已经提交的单据!");
flag = false;
return;
}
})
......@@ -166,7 +188,7 @@ function submitFunc() {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HGCW012", "submit", info, {
EiCommunicator.send("HGCW014", "submit", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
......@@ -195,6 +217,84 @@ function submitFunc() {
}
function writeoffFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length != 1) {
message("请选择一条数据");
return;
}
var flag = true;
rows.forEach(function (row) {
if (row.cancelStatus == "2") {
message("勾选的数据中有已经核销的单据!");
flag = false;
return;
}
})
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"核销\"操作? ", {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HGCW014", "writeoff", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
query();
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
});
}
}
function deleteFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let cancelStatus= item.get("cancelStatus");
if(cancelStatus === "2"){
message("选中的第"+(index+1)+"行记录为核销状态,不能删除!");
flag = false;
return;
}
});
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCW014", "delete", true);
}
});
}
}
function contractDetailFunc(id) {
JSColorbox.open({
href: "HGCW014C?methodName=initLoad&inqu_status-0-mainId=" + id + "&efParentFormEname=HGCW002",
title: "<div style='text-align: center;'>合同详情</div>",
width: "90%",
height: "90%",
callbackName: windowCallback
});
}
......@@ -14,10 +14,7 @@
startName="signingDateFrom" endName="signingDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
<EF:EFSelect cname="客户名称" blockId="inqu_status" ename="partyA" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput cname="客户名称" ename="partyA" blockId="inqu_status" row="0" colWidth="3" />
<EF:EFSelect cname="核销状态" ename="inqu_status-0-cancelStatus" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.cw.cancelStatus"/>
......@@ -28,6 +25,7 @@
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFComboColumn ename="partyA" cname="客户名称" width="120" align="left" defaultValue=""
filter="contains" readonly="true">
<EF:EFOptions blockId="sup_record_block_id"
......
......@@ -18,16 +18,11 @@
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
<EF:EFInput cname="客户名称" ename="partyA" blockId="inqu_status" row="0" colWidth="3" />
<EF:EFInput cname="票据类型" ename="billTybe" blockId="inqu_status" row="0" colWidth="3" />
<EF:EFSelect cname="票据类型" ename="inqu_status-0-billTybe" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.cw.billTybe"/>
</EF:EFSelect>
<EF:EFInput cname="发票号" ename="billNumber" blockId="inqu_status" row="0" colWidth="3" />
<EF:EFSelect cname="开票状态" ename="inqu_status-0-billState" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.cw.reviewStatus"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
......
$(function() {
// 查询
$("#QUERY").on("click", function () {
query();
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
saveFunc();
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
}
}
window.document.addEventListener("keyup",function (event) {
if(event.keyCode === 13){
var grid = $("#ef_grid_result").data("kendoGrid");
// 回填
//grid.addRows(returnRows);
grid.closeCell();
}
})
});
$(window).load(function () {
// 查
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
function cancelFunc() {
// 关闭弹窗
parent.JSColorbox.setValueCallback();
}
function saveFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HGCW015", "save", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
query();
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
//JSUtils.submitGridsData("result", "HPSC001", "save", true);
}
});
}
function deleteFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCW015", "delete", true);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
</head>
<EF:EFPage title="收款清单">
<EF:EFInput cname="隐藏条件" ename="mainId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="partyA" cname="客户名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="contractNumber" cname="来源单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="收款总额" width="120" format="{0:N3}" align="center" enable="false" readonly="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
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