parent
dfac07da3f
commit
f7abd88d90
|
|
@ -129,17 +129,26 @@ public class ApplyAdjustBillControler {
|
||||||
BigDecimal amount = add.getBigDecimal("e_applyamount");
|
BigDecimal amount = add.getBigDecimal("e_applyamount");
|
||||||
int comparisonResult = amount.compareTo(amounts);
|
int comparisonResult = amount.compareTo(amounts);
|
||||||
|
|
||||||
if (comparisonResult <= 0) {
|
if (comparisonResult < 0) {
|
||||||
return handleErrorAndReturn(apiResultExt, "同步失败, 调整单号:" + fkBillNum +
|
return handleErrorAndReturn(apiResultExt, "同步失败, 调整单号:" + fkBillNum +
|
||||||
"的调整金额大于等于分录未调整过的申请金额", fkBillNum, jsonBodyString +"\n" + sappzs.toJSONString());
|
"的调整金额大于分录未调整过的申请金额", fkBillNum, jsonBodyString +"\n" + sappzs.toJSONString());
|
||||||
|
}
|
||||||
|
if (comparisonResult == 0) {
|
||||||
|
// 首行打标记 修改金额
|
||||||
|
add.set("e_applyamount", amounts); // 相等,直接将调整金额覆盖首行申请金额
|
||||||
|
add.set("e_approvedamt", amounts); // 同步核准金额
|
||||||
|
add.set("shjh_applyadjustcode", applyAdjustbill.getFkBillNum()); // 付款调整单号
|
||||||
}
|
}
|
||||||
// 分录申请金额大于调整金额,可拆 由于新增,所以不需要考虑状态直接拆 difference(拆完剩余金额)
|
// 分录申请金额大于调整金额,可拆 由于新增,所以不需要考虑状态直接拆 difference(拆完剩余金额)
|
||||||
BigDecimal difference = amount.subtract(amounts);
|
if (comparisonResult > 0) {
|
||||||
add.set("e_applyamount", difference); // 拆完剩余金额
|
//拆
|
||||||
add.set("e_approvedamt", difference); // 同步核准金额
|
BigDecimal difference = amount.subtract(amounts);
|
||||||
|
add.set("e_applyamount", difference); // 拆完剩余金额
|
||||||
|
add.set("e_approvedamt", difference); // 同步核准金额
|
||||||
|
|
||||||
// 复制行 ,不考虑重复拆()
|
// 复制行 ,不考虑重复拆()
|
||||||
cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum());
|
cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum());
|
||||||
|
}
|
||||||
|
|
||||||
// 标记付款申请___来源调整单
|
// 标记付款申请___来源调整单
|
||||||
ap_payapply.set("shjh_sourceadjustment", true);
|
ap_payapply.set("shjh_sourceadjustment", true);
|
||||||
|
|
@ -188,6 +197,17 @@ public class ApplyAdjustBillControler {
|
||||||
BigDecimal amount = add.getBigDecimal("e_applyamount");
|
BigDecimal amount = add.getBigDecimal("e_applyamount");
|
||||||
int comparisonResult = amount.compareTo(amounts);
|
int comparisonResult = amount.compareTo(amounts);
|
||||||
|
|
||||||
|
if (comparisonResult < 0) {
|
||||||
|
return handleErrorAndReturn(apiResultExt, "同步失败, 调整单号:" + fkBillNum +
|
||||||
|
"的调整金额大于分录未调整过的申请金额", fkBillNum, jsonBodyString);
|
||||||
|
}
|
||||||
|
if (comparisonResult == 0) {
|
||||||
|
// 首行打标记 修改金额
|
||||||
|
add.set("e_applyamount", amounts); // 相等,直接将调整金额覆盖首行申请金额
|
||||||
|
add.set("e_approvedamt", amounts); // 同步核准金额
|
||||||
|
add.set("shjh_applyadjustcode", applyAdjustbill.getFkBillNum()); // 付款调整单号
|
||||||
|
}
|
||||||
|
|
||||||
if (comparisonResult > 0) {
|
if (comparisonResult > 0) {
|
||||||
// 分录申请金额大于调整金额,可拆 由于新增,所以不需要考虑状态直接拆 difference(拆完剩余金额)
|
// 分录申请金额大于调整金额,可拆 由于新增,所以不需要考虑状态直接拆 difference(拆完剩余金额)
|
||||||
BigDecimal difference = amount.subtract(amounts);
|
BigDecimal difference = amount.subtract(amounts);
|
||||||
|
|
@ -196,22 +216,17 @@ public class ApplyAdjustBillControler {
|
||||||
|
|
||||||
// 复制行 ,不考虑重复拆()
|
// 复制行 ,不考虑重复拆()
|
||||||
DynamicObject add1 = cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum());
|
DynamicObject add1 = cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum());
|
||||||
|
|
||||||
// 标记付款申请___来源调整单
|
|
||||||
ap_payapply.set("shjh_sourceadjustment", true);
|
|
||||||
|
|
||||||
// 保存付款申请单
|
|
||||||
String string = processPayApplys(ap_payapply, fkBillNum, jsonBodyString);
|
|
||||||
if (StringUtils.isNotEmpty(string)) {
|
|
||||||
return handleErrorAndReturn(apiResultExt, string, fkBillNum, jsonBodyString);
|
|
||||||
|
|
||||||
}
|
|
||||||
//成功
|
|
||||||
return handleSuccessAndReturn(ap_payapply, apiResultExt,fkBillNum, jsonBodyString);
|
|
||||||
} else {
|
|
||||||
// 调整金额大于分录未调整过的申请金额,反馈无法处理
|
|
||||||
return handleErrorAndReturn(apiResultExt, "同步失败, 调整单号:" + fkBillNum + "的调整金额大于等于分录未调整过的申请金额", fkBillNum, jsonBodyString);
|
|
||||||
}
|
}
|
||||||
|
// 标记付款申请___来源调整单
|
||||||
|
ap_payapply.set("shjh_sourceadjustment", true);
|
||||||
|
// 保存付款申请单
|
||||||
|
String string = processPayApplys(ap_payapply, fkBillNum, jsonBodyString);
|
||||||
|
if (StringUtils.isNotEmpty(string)) {
|
||||||
|
return handleErrorAndReturn(apiResultExt, string, fkBillNum, jsonBodyString);
|
||||||
|
|
||||||
|
}
|
||||||
|
//成功
|
||||||
|
return handleSuccessAndReturn(ap_payapply, apiResultExt,fkBillNum, jsonBodyString);
|
||||||
} else {
|
} else {
|
||||||
// 已标记 付款申请单剩余未调整金额? seq根据size优化,根据单号为空的分录行进行拆分(根据首行拆分)
|
// 已标记 付款申请单剩余未调整金额? seq根据size优化,根据单号为空的分录行进行拆分(根据首行拆分)
|
||||||
// CNY20>剩余未调整,反馈无法处理
|
// CNY20>剩余未调整,反馈无法处理
|
||||||
|
|
@ -225,6 +240,17 @@ public class ApplyAdjustBillControler {
|
||||||
BigDecimal eApplyamount = add.getBigDecimal("e_applyamount");//80
|
BigDecimal eApplyamount = add.getBigDecimal("e_applyamount");//80
|
||||||
int comparisonResult = eApplyamount.compareTo(amounts);
|
int comparisonResult = eApplyamount.compareTo(amounts);
|
||||||
|
|
||||||
|
if (comparisonResult < 0) {
|
||||||
|
return handleErrorAndReturn(apiResultExt, "同步失败, 调整单号:" + fkBillNum +
|
||||||
|
"的调整金额大于分录未调整过的申请金额", fkBillNum, jsonBodyString);
|
||||||
|
}
|
||||||
|
if (comparisonResult == 0) {
|
||||||
|
// 首行打标记 修改金额
|
||||||
|
add.set("e_applyamount", amounts); // 相等,直接将调整金额覆盖首行申请金额
|
||||||
|
add.set("e_approvedamt", amounts); // 同步核准金额
|
||||||
|
add.set("shjh_applyadjustcode", applyAdjustbill.getFkBillNum()); // 付款调整单号
|
||||||
|
}
|
||||||
|
|
||||||
if (comparisonResult > 0) {
|
if (comparisonResult > 0) {
|
||||||
// 分录未调整过的申请金额大于调整金额,可拆
|
// 分录未调整过的申请金额大于调整金额,可拆
|
||||||
BigDecimal difference = eApplyamount.subtract(amounts);
|
BigDecimal difference = eApplyamount.subtract(amounts);
|
||||||
|
|
@ -232,25 +258,19 @@ public class ApplyAdjustBillControler {
|
||||||
add.set("e_applyamount", difference); // 拆完剩余金额
|
add.set("e_applyamount", difference); // 拆完剩余金额
|
||||||
add.set("e_approvedamt", difference); // 同步核准金额
|
add.set("e_approvedamt", difference); // 同步核准金额
|
||||||
}
|
}
|
||||||
|
|
||||||
// 复制行
|
// 复制行
|
||||||
DynamicObject add1 = cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum());
|
DynamicObject add1 = cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum());
|
||||||
|
|
||||||
// 标记付款申请___来源调整单
|
|
||||||
ap_payapply.set("shjh_sourceadjustment", true);
|
|
||||||
|
|
||||||
// 保存付款申请单
|
|
||||||
String string = processPayApplys(ap_payapply, fkBillNum, jsonBodyString);
|
|
||||||
if (StringUtils.isNotEmpty(string)) {
|
|
||||||
return handleErrorAndReturn(apiResultExt, string, fkBillNum, jsonBodyString);
|
|
||||||
}
|
|
||||||
|
|
||||||
//成功
|
|
||||||
return handleSuccessAndReturn(ap_payapply, apiResultExt,fkBillNum, jsonBodyString);
|
|
||||||
} else {
|
|
||||||
// 调整金额大于分录未调整过的申请金额,反馈无法处理
|
|
||||||
return handleErrorAndReturn(apiResultExt, "同步失败, 调整单号:" + fkBillNum + "的调整金额大于分录未调整过的申请金额", fkBillNum, jsonBodyString);
|
|
||||||
}
|
}
|
||||||
|
// 标记付款申请___来源调整单
|
||||||
|
ap_payapply.set("shjh_sourceadjustment", true);
|
||||||
|
// 保存付款申请单
|
||||||
|
String string = processPayApplys(ap_payapply, fkBillNum, jsonBodyString);
|
||||||
|
if (StringUtils.isNotEmpty(string)) {
|
||||||
|
return handleErrorAndReturn(apiResultExt, string, fkBillNum, jsonBodyString);
|
||||||
|
}
|
||||||
|
//成功
|
||||||
|
return handleSuccessAndReturn(ap_payapply, apiResultExt,fkBillNum, jsonBodyString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -306,7 +326,6 @@ public class ApplyAdjustBillControler {
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo:应付凭证锁定接口,日志
|
|
||||||
OperationResult submitResult = OperationServiceHelper.executeOperate("submit", AP_PAYAPPLY, new DynamicObject[]{ap_payapply}, option);
|
OperationResult submitResult = OperationServiceHelper.executeOperate("submit", AP_PAYAPPLY, new DynamicObject[]{ap_payapply}, option);
|
||||||
if (!submitResult.isSuccess()) {
|
if (!submitResult.isSuccess()) {
|
||||||
// 提交失败,将保存的数据删除,记录日志
|
// 提交失败,将保存的数据删除,记录日志
|
||||||
|
|
@ -400,7 +419,7 @@ public class ApplyAdjustBillControler {
|
||||||
String orgNum = it_list.getString("BUKRS");//公司编号,"公司代码
|
String orgNum = it_list.getString("BUKRS");//公司编号,"公司代码
|
||||||
String voucheryear = it_list.getString("GJAHR");//会计年度,会计年度
|
String voucheryear = it_list.getString("GJAHR");//会计年度,会计年度
|
||||||
String voucherentrynum = it_list.getString("BUZEI");//会计科目行项目号,行编号
|
String voucherentrynum = it_list.getString("BUZEI");//会计科目行项目号,行编号
|
||||||
String accountingsubject = it_list.getString("SAKNR");//todo:会计科目:1001,总帐科目编号
|
String accountingsubject = it_list.getString("SAKNR");//会计科目:1001,总帐科目编号
|
||||||
BigDecimal outstandingamount = new BigDecimal(it_list.getString("WRBTR"));//未清金额,凭证货币金额
|
BigDecimal outstandingamount = new BigDecimal(it_list.getString("WRBTR"));//未清金额,凭证货币金额
|
||||||
BigDecimal KURSF = new BigDecimal(it_list.getString("KURSF"));
|
BigDecimal KURSF = new BigDecimal(it_list.getString("KURSF"));
|
||||||
if (KURSF.compareTo(BigDecimal.ZERO) == 0) {
|
if (KURSF.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
|
@ -441,8 +460,8 @@ public class ApplyAdjustBillControler {
|
||||||
}
|
}
|
||||||
// String assacct = it_list.getString("BVTYP");//合作银行类型.合作银行类型 A
|
// String assacct = it_list.getString("BVTYP");//合作银行类型.合作银行类型 A
|
||||||
String assacct = "A";//合作银行类型.合作银行类型 A
|
String assacct = "A";//合作银行类型.合作银行类型 A
|
||||||
String reasoncode = "014";//todo:原因码 014
|
String reasoncode = it_list.getString("RSTGR");//原因码 014
|
||||||
String shjh_classificationoffund = "资金计划分类";//todo:资金计划分类
|
// String shjh_classificationoffund = "资金计划分类";//资金计划分类
|
||||||
String shjh_secondarydept = it_list.getString("ZREQ_DEPT");//二级部门,需求部门
|
String shjh_secondarydept = it_list.getString("ZREQ_DEPT");//二级部门,需求部门
|
||||||
String procurementeam = it_list.getString("EKGRP");//采购组
|
String procurementeam = it_list.getString("EKGRP");//采购组
|
||||||
Boolean isselfprocurment = Boolean.valueOf(it_list.getString("ZZXCG_FLAG"));//是否自行采购
|
Boolean isselfprocurment = Boolean.valueOf(it_list.getString("ZZXCG_FLAG"));//是否自行采购
|
||||||
|
|
@ -452,11 +471,11 @@ public class ApplyAdjustBillControler {
|
||||||
}
|
}
|
||||||
String paymentcurrency = WAERS;//付款币别编号CNY,货币码
|
String paymentcurrency = WAERS;//付款币别编号CNY,货币码
|
||||||
String settlementcurrency = WAERS;//结算币别编号,货币码
|
String settlementcurrency = WAERS;//结算币别编号,货币码
|
||||||
String applycause = it_list.getString("BKTXT");// TODO:摘要_凭证抬头文本
|
String applycause = it_list.getString("BKTXT");// 摘要_凭证抬头文本
|
||||||
String vouchernum = it_list.getString("BELNR");//外部系统编号_会计凭证编号
|
String vouchernum = it_list.getString("BELNR");//外部系统编号_会计凭证编号
|
||||||
String vouchertype = it_list.getString("BLART");// 凭证类型_凭证类型
|
String vouchertype = it_list.getString("BLART");// 凭证类型_凭证类型
|
||||||
String paymentterms = it_list.getString("ZTERM");// 付款条件_付款条件代码
|
String paymentterms = it_list.getString("ZTERM");// 付款条件_付款条件代码
|
||||||
String refertoinvoicenumber = "发票号001";// TODO:参照发票号
|
String refertoinvoicenumber = "";// TODO:参照发票号
|
||||||
|
|
||||||
// 防重校验
|
// 防重校验
|
||||||
QFilter Q5 = new QFilter("shjh_vouchernum", QCP.equals, vouchernum);
|
QFilter Q5 = new QFilter("shjh_vouchernum", QCP.equals, vouchernum);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue