- [ ] 认领单取消成本中心默认携带的值
- [ ] 调整单分录赋值新增两个字段(结算方式,往来账号名称) - [ ] 优化被动付款入账报错(携带资金计划科目映射表标识错误) - [ ] 付款调整单接口新增付款调整日期字段 --s
This commit is contained in:
parent
7fa5811bd1
commit
a216e84095
|
|
@ -242,7 +242,7 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
|||
qFilter = qFilter.and(q2).and(q3).and(q4);
|
||||
}
|
||||
|
||||
DynamicObject[] accounts = BusinessDataServiceHelper.load("shjh_request_account", "id," +
|
||||
DynamicObject[] accounts = BusinessDataServiceHelper.load("shjh_pay_account", "id," +
|
||||
"shjh_membersubject,shjh_bhcgz,shjh_bbhcgz", qFilter.toArray());
|
||||
if (accounts.length > 1) {
|
||||
// 根据生效日期,失效日期区间,判断当前时间满足的数据
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
|||
* 3若没有,取"1042086_不明确客户"为默认值,携带到收款单的收款人名称,id字段,
|
||||
* 4.并且将对方户名携带到收款单备注字段中
|
||||
*/
|
||||
long payer = bill.getLong("payer");//付款人id
|
||||
if (payer == 0) {
|
||||
// long payer = bill.getLong("payer");//付款人id
|
||||
// if (payer == 0) {
|
||||
boolean shjhEGetcustomer = entry.getBoolean("shjh_e_getcustomer");//取规则得映射表客户标记
|
||||
if (shjhEGetcustomer) {
|
||||
String oppunit = beiIntelpay.getString("oppunit");//收款入账中心的对方户名
|
||||
|
|
@ -131,7 +131,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
DynamicObject shjhBizbig = (DynamicObject) bill.get("shjh_bizebig");//收款单的业务大类
|
||||
if (null == shjhBizbig) {
|
||||
bill.set("shjh_bizebig", entry.getDynamicObject("shjh_e_bizbig"));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
package shjh.jhzj7.fi.fi.plugin.operate;
|
||||
|
||||
import kd.bos.dataentity.OperateOption;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.operate.OperateOptionConst;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
public class SchedulebillCHOperation extends AbstractOperationServicePlugIn {
|
||||
|
||||
private final static Log logger = LogFactory.getLog(SchedulebillCHOperation.class);
|
||||
|
||||
@Override
|
||||
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
|
||||
super.beforeExecuteOperationTransaction(e);
|
||||
//排程单撤回,调用对应付款单的预占释放操作
|
||||
if ("shjh_ch".equals(e.getOperationKey())) {
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||||
for (DynamicObject dynamicObject : dataEntities1) {
|
||||
dynamicObject = BusinessDataServiceHelper.loadSingle(dynamicObject.getLong("id"), "psd_schedulebill");
|
||||
//付款单信息
|
||||
DynamicObjectCollection entrys = dynamicObject.getDynamicObjectCollection("entrys");
|
||||
if (!entrys.isEmpty()) {
|
||||
DynamicObject entry = entrys.get(0);
|
||||
long ePayid = entry.getLong("e_payid");
|
||||
DynamicObject paybill = BusinessDataServiceHelper.loadSingle(ePayid, "cas_paybill");
|
||||
if (null != paybill) {
|
||||
ids.add(ePayid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<Object, DynamicObject> payBillMap = BusinessDataServiceHelper.loadFromCache(ids.toArray(), "cas_paybill");
|
||||
OperateOption operateOption = createOperateOption();
|
||||
for (DynamicObject dynamicObject : payBillMap.values()) {
|
||||
DynamicObject[] billArray = new DynamicObject[]{dynamicObject};
|
||||
OperationResult operationResult = OperationServiceHelper.executeOperate("donothing9", "cas_paybill", billArray, operateOption);
|
||||
if (operationResult.isSuccess()) {
|
||||
logger.info("执行 donothing9 成功,单据id:" + dynamicObject.getPkValue());
|
||||
} else {
|
||||
logger.error("执行 donothing9 失败,单据id:"+operationResult.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||
super.afterExecuteOperationTransaction(e);
|
||||
//排程单id
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
OperateOption operateOption = createOperateOption();
|
||||
//二开撤回后执行标品的撤回
|
||||
if ("shjh_ch".equals(e.getOperationKey())) {
|
||||
|
||||
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||||
for (DynamicObject dynamicObject : dataEntities1) {
|
||||
ids.add(dynamicObject.getLong("id"));
|
||||
}
|
||||
//排程但对应付款单id
|
||||
ArrayList<Long> idss = new ArrayList<>();
|
||||
Map<Object, DynamicObject> scheduleBillMap = BusinessDataServiceHelper.loadFromCache(ids.toArray(), "psd_schedulebill");
|
||||
for (DynamicObject dynamicObject : scheduleBillMap.values()) {
|
||||
DynamicObject[] billArray = new DynamicObject[]{dynamicObject};
|
||||
OperationResult operationResult = OperationServiceHelper.executeOperate("cancelpay", "psd_schedulebill", billArray, operateOption);
|
||||
if (operationResult.isSuccess()) {
|
||||
logger.info("执行 cancelpay 成功,单据id:" + dynamicObject.getPkValue());
|
||||
} else {
|
||||
//付款单信息
|
||||
DynamicObjectCollection entrys = dynamicObject.getDynamicObjectCollection("entrys");
|
||||
if (!entrys.isEmpty()) {
|
||||
DynamicObject entry = entrys.get(0);
|
||||
long ePayid = entry.getLong("e_payid");
|
||||
DynamicObject paybill = BusinessDataServiceHelper.loadSingle(ePayid, "cas_paybill");
|
||||
if (null != paybill) {
|
||||
idss.add(ePayid);
|
||||
}
|
||||
}
|
||||
logger.error("执行 cancelpay 失败,单据id:"+operationResult.getMessage());
|
||||
}
|
||||
}
|
||||
//撤回失败的排程单据,执行对应付款单的正向预占操作
|
||||
Map<Object, DynamicObject> payBillMap = BusinessDataServiceHelper.loadFromCache(idss.toArray(), "cas_paybill");
|
||||
for (DynamicObject dynamicObject : payBillMap.values()) {
|
||||
DynamicObject[] billArray = new DynamicObject[]{dynamicObject};
|
||||
OperationResult operationResult = OperationServiceHelper.executeOperate("donothing3", "cas_paybill", billArray, operateOption);
|
||||
if (operationResult.isSuccess()) {
|
||||
logger.info("执行 donothing3 成功,单据id:" + dynamicObject.getPkValue());
|
||||
} else {
|
||||
logger.error("执行 donothing3 失败,单据id:"+operationResult.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private OperateOption createOperateOption() {
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
operateOption.setVariableValue(OperateOptionConst.IGNOREWARN, String.valueOf(true));
|
||||
operateOption.setVariableValue(OperateOptionConst.IGNOREINTERACTION, String.valueOf(true));
|
||||
operateOption.setVariableValue(OperateOptionConst.STRICTVALIDATION, String.valueOf(true));
|
||||
operateOption.setVariableValue(OperateOptionConst.MUTEX_ISSTRICT, String.valueOf(true));
|
||||
return operateOption;
|
||||
}
|
||||
}
|
||||
|
|
@ -76,6 +76,7 @@ public class ApplyAdjustBillControler {
|
|||
String year = applyAdjustbill.getVoucherYear(); // 会计年度
|
||||
String companyNum = applyAdjustbill.getCompanyNum(); // 公司编号
|
||||
String fkBillNum = applyAdjustbill.getFkBillNum(); // 调整单号
|
||||
Date bizDate = applyAdjustbill.getBizDate();//付款调整日期
|
||||
|
||||
DynamicObject org = loadOrgByCompanyNum(companyNum);
|
||||
if (org == null) {
|
||||
|
|
@ -138,6 +139,7 @@ public class ApplyAdjustBillControler {
|
|||
add.set("e_applyamount", amounts); // 相等,直接将调整金额覆盖首行申请金额
|
||||
add.set("e_approvedamt", amounts); // 同步核准金额
|
||||
add.set("shjh_applyadjustcode", applyAdjustbill.getFkBillNum()); // 付款调整单号
|
||||
add.set("shjh_fktzrq", bizDate); // 付款调整日期
|
||||
}
|
||||
// 分录申请金额大于调整金额,可拆 由于新增,所以不需要考虑状态直接拆 difference(拆完剩余金额)
|
||||
if (comparisonResult > 0) {
|
||||
|
|
@ -147,7 +149,7 @@ public class ApplyAdjustBillControler {
|
|||
add.set("e_approvedamt", difference); // 同步核准金额
|
||||
|
||||
// 复制行 ,不考虑重复拆()
|
||||
cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum());
|
||||
cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum(), bizDate);
|
||||
}
|
||||
|
||||
// 标记付款申请___来源调整单
|
||||
|
|
@ -206,6 +208,7 @@ public class ApplyAdjustBillControler {
|
|||
add.set("e_applyamount", amounts); // 相等,直接将调整金额覆盖首行申请金额
|
||||
add.set("e_approvedamt", amounts); // 同步核准金额
|
||||
add.set("shjh_applyadjustcode", applyAdjustbill.getFkBillNum()); // 付款调整单号
|
||||
add.set("shjh_fktzrq", bizDate); // 付款调整日期
|
||||
}
|
||||
|
||||
if (comparisonResult > 0) {
|
||||
|
|
@ -215,7 +218,7 @@ public class ApplyAdjustBillControler {
|
|||
add.set("e_approvedamt", difference); // 同步核准金额
|
||||
|
||||
// 复制行 ,不考虑重复拆()
|
||||
DynamicObject add1 = cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum());
|
||||
DynamicObject add1 = cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum(), bizDate);
|
||||
}
|
||||
// 标记付款申请___来源调整单
|
||||
ap_payapply.set("shjh_sourceadjustment", true);
|
||||
|
|
@ -249,6 +252,7 @@ public class ApplyAdjustBillControler {
|
|||
add.set("e_applyamount", amounts); // 相等,直接将调整金额覆盖首行申请金额
|
||||
add.set("e_approvedamt", amounts); // 同步核准金额
|
||||
add.set("shjh_applyadjustcode", applyAdjustbill.getFkBillNum()); // 付款调整单号
|
||||
add.set("shjh_fktzrq", bizDate); // 付款调整日期
|
||||
}
|
||||
|
||||
if (comparisonResult > 0) {
|
||||
|
|
@ -259,7 +263,7 @@ public class ApplyAdjustBillControler {
|
|||
add.set("e_approvedamt", difference); // 同步核准金额
|
||||
}
|
||||
// 复制行
|
||||
DynamicObject add1 = cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum());
|
||||
DynamicObject add1 = cloneEntryRow(add, collection, amounts, applyAdjustbill.getFkBillNum(), bizDate);
|
||||
|
||||
}
|
||||
// 标记付款申请___来源调整单
|
||||
|
|
@ -372,7 +376,7 @@ public class ApplyAdjustBillControler {
|
|||
* @param fkBillNum 付款调整单号
|
||||
* @return 复制后的分录行
|
||||
*/
|
||||
private DynamicObject cloneEntryRow(DynamicObject source, DynamicObjectCollection collection, BigDecimal amounts, String fkBillNum) {
|
||||
private DynamicObject cloneEntryRow(DynamicObject source, DynamicObjectCollection collection, BigDecimal amounts, String fkBillNum,Date bizDate) {
|
||||
int size = collection.size();
|
||||
DynamicObject newRow = collection.addNew();
|
||||
|
||||
|
|
@ -388,13 +392,15 @@ public class ApplyAdjustBillControler {
|
|||
newRow.set("e_freezestate", source.get("e_freezestate"));
|
||||
newRow.set("e_creator", source.get("e_creator"));
|
||||
newRow.set("e_closestatus", source.get("e_closestatus"));
|
||||
newRow.set("shjh_asstactrealname", source.get("shjh_asstactrealname"));//往来账号名称
|
||||
newRow.set("e_settlementtype", source.get("e_settlementtype"));//结算方式
|
||||
|
||||
// 设置特定属性
|
||||
newRow.set("seq", size + 1);
|
||||
newRow.set("e_applyamount", amounts); // 调整金额
|
||||
newRow.set("e_approvedamt", amounts); // 核准金额
|
||||
newRow.set("shjh_applyadjustcode", fkBillNum); // 付款调整单号
|
||||
|
||||
newRow.set("shjh_fktzrq", bizDate); // 付款调整日期
|
||||
return newRow;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue