中船流程推送cms系统

jingwei
wangxuanran 2023-05-11 15:25:53 +08:00
parent daaefd64c2
commit cb02ca6184
2 changed files with 162 additions and 59 deletions

View File

@ -25,20 +25,39 @@ const detail3TaxField = WfForm.convertFieldNameToId("ddhsje", "detail_3");
// 明细3以收票金额 // 明细3以收票金额
const detail3YspField = WfForm.convertFieldNameToId("yspje","detail_3"); const detail3YspField = WfForm.convertFieldNameToId("yspje","detail_3");
const detail3ApplyMoneyField = WfForm.convertFieldNameToId("bcfkje", "detail_3");
const detail3CgId = WfForm.convertFieldNameToId("cgddzbid", "detail_3");
const detail3Bl = WfForm.convertFieldNameToId('bcfkbl', "detail_3");
let detailBlMap = new Map();
const detail1Bl = WfForm.convertFieldNameToId('bcljfkbl', "detail_1");
const detail1CgId = WfForm.convertFieldNameToId("cgddzbid", "detail_1");
WfForm.registerCheckEvent(WfForm.OPER_ADDROW + "3", function (callback) { WfForm.registerCheckEvent(WfForm.OPER_ADDROW + "3", function (callback) {
callback(); callback();
setTimeout(()=>{ setTimeout(()=>{
initDeatail3Date(); initDeatail3Date();
},5) },5)
}); });
// 关联订单变化时将明细四的合同-金额map进行初始化 // // 关联订单变化时将明细四的合同-金额map进行初始化
// WfForm.bindFieldChangeEvent(relationOrder, function(obj,id,value){
// setTimeout(()=>{
// initDetail4Map();
// changeDetail3SpMoney();
// },2000);
// });
WfForm.bindFieldChangeEvent(relationOrder, function (obj, id, value) { WfForm.bindFieldChangeEvent(relationOrder, function (obj, id, value) {
setTimeout(() => { setTimeout(() => {
initDetail4Map(); initDetail4Map();
changeDetail3SpMoney(); changeDetail3SpMoney();
changeDetail1ApplyAMount();
}, 2000);
});
WfForm.bindDetailFieldChangeEvent(detail3ApplyMoneyField, function () {
setTimeout(() => {
changeDetail1ApplyAMount();
}, 2000); }, 2000);
}); });
WfForm.bindFieldChangeEvent(`${yjfksj},${bl}`, function(obj,id,value){ WfForm.bindFieldChangeEvent(`${yjfksj},${bl}`, function(obj,id,value){
initDeatail3Date(); initDeatail3Date();
@ -123,21 +142,27 @@ function initDetail4Map() {
console.log('detail4Map ', detail4Map) console.log('detail4Map ', detail4Map)
} }
const detail3ApplyMoneyField = WfForm.convertFieldNameToId("bcfkje", "detail_3");
const detail3CgId = WfForm.convertFieldNameToId("cgddzbid", "detail_3");
const detail3Bl = WfForm.convertFieldNameToId('bcfkbl', "detail_3");
let detailBlMap = new Map();
const detail1Bl = WfForm.convertFieldNameToId('fkbl', "detail_1");
const detail1CgId = WfForm.convertFieldNameToId("cgddzbid", "detail_1");
WfForm.bindDetailFieldChangeEvent(detail3ApplyMoneyField, (id, rowIndex, value) => { WfForm.bindDetailFieldChangeEvent(detail3ApplyMoneyField, (id, rowIndex, value) => {
setTimeout(()=>{
let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(","); let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(",");
detailBlMap = new Map(); detailBlMap = new Map();
for (let i = 0; i < detail3RowArr.length; i++) { for (let i = 0; i < detail3RowArr.length; i++) {
let rowIndex = detail3RowArr[i]; let rowIndex = detail3RowArr[i];
if (rowIndex !== "") { if (rowIndex !== "") {
let bl = parseFloat(WfForm.getFieldValue(`${detail3Bl}_${rowIndex}`)); let blStr = WfForm.getFieldValue(`${detail3Bl}_${rowIndex}`);
if(blStr == ''){
console.log('111')
continue;
}
let bl = parseFloat(blStr);
console.log('bl => ' , bl);
let cg = WfForm.getFieldValue(`${detail3CgId}_${rowIndex}`); let cg = WfForm.getFieldValue(`${detail3CgId}_${rowIndex}`);
let mapVal = parseFloat(detailBlMap.get(cg) ?? 0) + bl; let mapVal = detailBlMap.get(cg);
if(!mapVal){
mapVal = 0;
}
mapVal+= bl;
detailBlMap.set(cg, mapVal); detailBlMap.set(cg, mapVal);
} }
} }
@ -151,9 +176,87 @@ WfForm.bindDetailFieldChangeEvent(detail3ApplyMoneyField, (id, rowIndex, value)
WfForm.changeFieldValue(`${detail1Bl}_${rowIndex}`, {value: val}) WfForm.changeFieldValue(`${detail1Bl}_${rowIndex}`, {value: val})
} }
} }
},300);
}); });
// 明细3合同总金额
const detail3AmountField = WfForm.convertFieldNameToId("htzje", "detail_3");
// 明细3订单号字段
const detail3OrderField = WfForm.convertFieldNameToId("ddh","detail_3");
// 明细1本次付款金额字段
const detail1ApplyAmountField = WfForm.convertFieldNameToId("bcsqfkje","detail_1");
// 明细1含税金额
const detail1AmountTaxField = WfForm.convertFieldNameToId("ddmxxj","detail_1");
// 明细1订单号
const detail1OrderField = WfForm.convertFieldNameToId("ddh","detail_1");
// 明细1预计付款日期
const detail1ApplyDate = WfForm.convertFieldNameToId("yjfkrq","detail_1");
function changeDetail1ApplyAMount(){
let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(",");
// 明细3 订单号-合同总金额map
let detail3ContractAmountMap = new Map();
let detail3ApplyAmountMap = new Map();
let detail3ApplyMoneyField = WfForm.convertFieldNameToId("bcfkje", "detail_3");
for (let i = 0; i < detail3RowArr.length; i++) {
let rowIndex = detail3RowArr[i];
if (rowIndex !== "") {
let detail3Order = WfForm.getFieldValue(`${detail3OrderField}_${rowIndex}`);
if(!detail3ContractAmountMap.has(detail3Order)){
detail3ContractAmountMap.set(detail3Order, parseFloat(WfForm.getFieldValue(`${detail3AmountField}_${rowIndex}`)));
}
let detail3Amount = parseFloat(WfForm.getFieldValue(`${detail3ApplyMoneyField}_${rowIndex}`));
let sum = detail3ApplyAmountMap.get(detail3Order) ?? 0;
detail3ApplyAmountMap.set(detail3Order, sum + detail3Amount);
}
}
console.log('detail3ContractAmountMap : ', detail3ContractAmountMap);
console.log('detail3ApplyAmountMap : ', detail3ApplyAmountMap);
let detail1RowArr = WfForm.getDetailAllRowIndexStr('detail_1').split(",");
for (let i = 0; i < detail1RowArr.length; i++) {
let rowIndex = detail1RowArr[i];
if (rowIndex !== "") {
let detail1Order =WfForm.getFieldValue(`${detail1OrderField}_${rowIndex}`);
console.log('detail1Order ', detail1Order);
// 含税金额
let detail1AmountTax = parseFloat(WfForm.getFieldValue(`${detail1AmountTaxField}_${rowIndex}`) ?? 0);
console.log('detail1AmountTax ', detail1AmountTax);
// 本次付款金额和
let applySum = parseFloat(detail3ApplyAmountMap.get(detail1Order) ?? 0);
console.log('applySum ', applySum);
// 合同总金额
let contractAmount = parseFloat(detail3ContractAmountMap.get(detail1Order) ?? 0);
console.log('contractAmount ', contractAmount);
let val = (applySum / contractAmount) * detail1AmountTax;
console.log('计算金额 : ', val)
WfForm.changeFieldValue(`${detail1ApplyAmountField}_${rowIndex}`, {value: val})
}
}
}
WfForm.bindDetailFieldChangeEvent(detail3Yqfkrq,()=>{
initDetail1ApplyDate();
});
function initDetail1ApplyDate(){
let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(",");
let detail3DateMap = new Map();
for (let i = 0; i < detail3RowArr.length; i++) {
let rowIndex = detail3RowArr[i];
if (rowIndex !== "") {
let detail3Order = WfForm.getFieldValue(`${detail3OrderField}_${rowIndex}`);
if(!detail3DateMap.has(detail3Order)){
detail3DateMap.set(detail3Order, WfForm.getFieldValue(`${detail3Yqfkrq}_${rowIndex}`));
}
}
}
console.log('detail3DateMap ', detail3DateMap);
let detail1RowArr = WfForm.getDetailAllRowIndexStr('detail_1').split(",");
for (let i = 0; i < detail1RowArr.length; i++) {
let rowIndex = detail1RowArr[i];
if (rowIndex !== "") {
let detail1Order =WfForm.getFieldValue(`${detail1OrderField}_${rowIndex}`);
WfForm.changeFieldValue(`${detail1ApplyDate}_${rowIndex}`, {value: detail3DateMap.get(detail1Order)})
}
}
}

View File

@ -57,7 +57,7 @@ public class WorkflowToCms extends SafeCusBaseAction {
.successField(Util.null2DefaultStr(successField, "success")) .successField(Util.null2DefaultStr(successField, "success"))
.successValue(Util.null2DefaultStr(successVal, "true")) .successValue(Util.null2DefaultStr(successVal, "true"))
.errorMsg(Util.null2DefaultStr(msg, "error")) .errorMsg(Util.null2DefaultStr(msg, "error"))
.dataKey(Util.null2DefaultStr(dataKey, "result.accessToken")) .dataKey(Util.null2DefaultStr(dataKey, ""))
.build(); .build();
log.info(""); log.info("");