开票登记保存、删除、确认出票反写付款单信息
This commit is contained in:
parent
c63652467b
commit
ceea1a3df8
|
|
@ -11,7 +11,6 @@ import kd.bos.entity.operate.result.OperationResult;
|
||||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
|
||||||
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
|
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
|
||||||
import kd.bos.entity.validate.AbstractValidator;
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
import kd.bos.i18n.mservice.I18nServiceHelper;
|
import kd.bos.i18n.mservice.I18nServiceHelper;
|
||||||
|
|
@ -87,6 +86,7 @@ public class InterestAccrualGenPaymentOperationPlugin extends AbstractOperationS
|
||||||
@Override
|
@Override
|
||||||
public void validate() {
|
public void validate() {
|
||||||
ExtendedDataEntity[] extBills = this.getDataEntities();
|
ExtendedDataEntity[] extBills = this.getDataEntities();
|
||||||
|
|
||||||
StringBuilder logInfo = new StringBuilder();
|
StringBuilder logInfo = new StringBuilder();
|
||||||
for (ExtendedDataEntity extBill : extBills) {
|
for (ExtendedDataEntity extBill : extBills) {
|
||||||
DynamicObject bill = extBill.getDataEntity();
|
DynamicObject bill = extBill.getDataEntity();
|
||||||
|
|
@ -146,7 +146,7 @@ public class InterestAccrualGenPaymentOperationPlugin extends AbstractOperationS
|
||||||
writeLkInfo(bill,selectRows,result.getSuccessPkIds().get(0));
|
writeLkInfo(bill,selectRows,result.getSuccessPkIds().get(0));
|
||||||
}else {
|
}else {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
str.append("------计息单:"+billNo).append("生成付款单失败。");
|
str.append("------计息单:").append(billNo).append("生成付款单失败。");
|
||||||
List<IOperateInfo> allErrorOrValidateInfo = result.getAllErrorOrValidateInfo();
|
List<IOperateInfo> allErrorOrValidateInfo = result.getAllErrorOrValidateInfo();
|
||||||
if (allErrorOrValidateInfo != null){
|
if (allErrorOrValidateInfo != null){
|
||||||
str.append("message:\n");
|
str.append("message:\n");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
package kdsz.zyf25.tmc.cfm.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 付款单-开票申请-开票登记 路径的开票登记 取消出票插件
|
||||||
|
*/
|
||||||
|
public class PayableBillCancelTicketOperationPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
@Override
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_billid");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
// DynamicObject[] bills = e.getDataEntities();
|
||||||
|
// for (DynamicObject bill : bills) {
|
||||||
|
// Map<String, HashSet<Long>> srcBillMap = BFTrackerServiceHelper.findSourceBills("cdm_payablebill",
|
||||||
|
// new Long[]{bill.getLong("id")});
|
||||||
|
// //srcBillMap<单据标识,单据id>,只有上游有开票申请的才处理
|
||||||
|
// if (!srcBillMap.containsKey("cdm_payablebill_ap_manual")){
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// HashSet<Long> payBillIds = srcBillMap.get("cas_paybill");
|
||||||
|
// if (payBillIds == null || payBillIds.size() == 0){
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// DynamicObjectCollection relationEntries = bill.getDynamicObjectCollection("releatedcasbillentrys");
|
||||||
|
// HashSet<Long> payBillIdSet = new HashSet<>();
|
||||||
|
// for (DynamicObject relationEntry : relationEntries) {
|
||||||
|
// Long payBillId = relationEntry.getLong("rel_billid");
|
||||||
|
// payBillIdSet.add(payBillId);
|
||||||
|
// }
|
||||||
|
// Long targetBillId = bill.getLong("id");
|
||||||
|
// DynamicObject[] payBills = BusinessDataServiceHelper.load("cas_paybill",
|
||||||
|
// "billstatus,draftbill,cas_draftinfo.draftbillinfo",
|
||||||
|
// new QFilter[]{new QFilter("id", QCP.in, payBillIdSet)});
|
||||||
|
// for (DynamicObject payBill : payBills) {
|
||||||
|
// payBill.set("billstatus", "J");//单据状态:票据处理中
|
||||||
|
// DynamicObjectCollection draftBills = payBill.getDynamicObjectCollection("draftbill");//结算号
|
||||||
|
// if (draftBills != null){
|
||||||
|
// Iterator<DynamicObject> payIterator = draftBills.iterator();
|
||||||
|
// while (payIterator.hasNext()){
|
||||||
|
// DynamicObject draftBill = payIterator.next();
|
||||||
|
// if(draftBill != null){
|
||||||
|
// Long draftBillId = draftBill.getLong("id");
|
||||||
|
// if (draftBillId.equals(targetBillId)){
|
||||||
|
// payIterator.remove();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// DynamicObjectCollection draftInfoEntries = payBill.getDynamicObjectCollection("cas_draftinfo");
|
||||||
|
// if (draftInfoEntries != null){
|
||||||
|
// Iterator<DynamicObject> draftInfoIterator = draftInfoEntries.iterator();
|
||||||
|
// while (draftInfoIterator.hasNext()){
|
||||||
|
// DynamicObject draftInfo = draftInfoIterator.next();
|
||||||
|
// DynamicObject draftBillInfo = draftInfo.getDynamicObject("draftbillinfo");
|
||||||
|
// if (draftBillInfo == null)continue;
|
||||||
|
// Long draftBillId = draftBillInfo.getLong("id");
|
||||||
|
// if (draftBillId.equals(targetBillId)){
|
||||||
|
// draftInfoIterator.remove();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// SaveServiceHelper.save(payBills);
|
||||||
|
// //开票登记清空关联收付款单分录
|
||||||
|
// relationEntries.clear();
|
||||||
|
// }
|
||||||
|
// SaveServiceHelper.save(bills);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package kdsz.zyf25.tmc.cfm.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款单-开票申请-开票登记 路径的开票登记 删除插件 反写付款单单据状态
|
||||||
|
*/
|
||||||
|
public class PayableBillDeleteOperationPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
@Override
|
||||||
|
public void beginOperationTransaction(BeginOperationTransactionArgs e) {
|
||||||
|
super.beginOperationTransaction(e);
|
||||||
|
DynamicObject[] bills = e.getDataEntities();
|
||||||
|
for (DynamicObject bill : bills) {
|
||||||
|
Map<String, HashSet<Long>> srcBillMap = BFTrackerServiceHelper.findSourceBills("cdm_payablebill",
|
||||||
|
new Long[]{bill.getLong("id")});
|
||||||
|
//srcBillMap<单据标识,单据id>,只有上游有开票申请的才处理
|
||||||
|
if (!srcBillMap.containsKey("cdm_payablebill_ap_manual")){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
HashSet<Long> payBillIds = srcBillMap.get("cas_paybill");
|
||||||
|
if (payBillIds == null || payBillIds.size() == 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DynamicObject[] payBills = BusinessDataServiceHelper.load("cas_paybill", "billstatus",
|
||||||
|
new QFilter[]{new QFilter("id", QCP.in, payBillIds)});
|
||||||
|
for (DynamicObject payBill : payBills) {
|
||||||
|
payBill.set("billstatus","C");//单据状态改为:已审核
|
||||||
|
}
|
||||||
|
SaveServiceHelper.update(payBills);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package kdsz.zyf25.tmc.cfm.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款单-开票申请-开票登记 路径的开票登记 保存插件 反写付款单单据状态
|
||||||
|
*/
|
||||||
|
public class PayableBillSaveOperationPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
@Override
|
||||||
|
public void endOperationTransaction(EndOperationTransactionArgs e) {
|
||||||
|
super.endOperationTransaction(e);
|
||||||
|
DynamicObject[] bills = e.getDataEntities();
|
||||||
|
for (DynamicObject bill : bills) {
|
||||||
|
Map<String, HashSet<Long>> srcBillMap = BFTrackerServiceHelper.findSourceBills("cdm_payablebill",
|
||||||
|
new Long[]{bill.getLong("id")});
|
||||||
|
//srcBillMap<单据标识,单据id>,只有上游有开票申请的才处理
|
||||||
|
if (!srcBillMap.containsKey("cdm_payablebill_ap_manual")){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
HashSet<Long> payBillIds = srcBillMap.get("cas_paybill");
|
||||||
|
if (payBillIds == null || payBillIds.size() == 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DynamicObject[] payBills = BusinessDataServiceHelper.load("cas_paybill", "billstatus",
|
||||||
|
new QFilter[]{new QFilter("id", QCP.in, payBillIds)});
|
||||||
|
for (DynamicObject payBill : payBills) {
|
||||||
|
payBill.set("billstatus","J");//单据状态改为:票据处理中
|
||||||
|
}
|
||||||
|
SaveServiceHelper.update(payBills);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,136 @@
|
||||||
|
package kdsz.zyf25.tmc.cfm.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款单-开票申请-开票登记 路径的开票登记确认出票插件
|
||||||
|
*/
|
||||||
|
public class PayableBillSureTicketOperationPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
@Override
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.seq");
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_billtype");
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_billno");
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_billid");
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_bizdate");
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_billamount");
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_createtime");
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_modifytime");
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_isrefuse");
|
||||||
|
e.getFieldKeys().add("releatedcasbillentrys.rel_batchuseflag");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
// DynamicObject[] bills = e.getDataEntities();
|
||||||
|
// for (DynamicObject bill : bills) {
|
||||||
|
// Map<String, HashSet<Long>> srcBillMap = BFTrackerServiceHelper.findSourceBills("cdm_payablebill",
|
||||||
|
// new Long[]{bill.getLong("id")});
|
||||||
|
// //srcBillMap<单据标识,单据id>,只有上游有开票申请的才处理
|
||||||
|
// if (!srcBillMap.containsKey("cdm_payablebill_ap_manual")){
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// HashSet<Long> payBillIds = srcBillMap.get("cas_paybill");
|
||||||
|
// if (payBillIds == null || payBillIds.size() == 0){
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// DynamicObjectCollection relationEntries = bill.getDynamicObjectCollection("releatedcasbillentrys");
|
||||||
|
// DynamicObject[] payBills = BusinessDataServiceHelper.load("cas_paybill",
|
||||||
|
// "billno,bizdate,actpayamt,billstatus,draftbill,cas_draftinfo.seq,cas_draftinfo.transamount,cas_draftinfo.paybillcurrency,cas_draftinfo.draftbillinfo",
|
||||||
|
// new QFilter[]{new QFilter("id", QCP.in, payBillIds)});
|
||||||
|
// for (int i = 0; i < payBills.length; i++) {
|
||||||
|
// //将付款信息写入开票登记
|
||||||
|
// DynamicObject relationEntry = relationEntries.addNew();
|
||||||
|
// relationEntry.set("seq", i);
|
||||||
|
// relationEntry.set("rel_billtype", "cas_paybill");
|
||||||
|
// relationEntry.set("rel_billno", payBills[i].getString("billno"));
|
||||||
|
// relationEntry.set("rel_billid", payBills[i].getLong("id"));
|
||||||
|
// relationEntry.set("rel_bizdate", payBills[i].getDate("bizdate"));
|
||||||
|
// relationEntry.set("rel_billamount", payBills[i].getBigDecimal("actpayamt"));
|
||||||
|
// relationEntry.set("rel_createtime", new Date());
|
||||||
|
// relationEntry.set("rel_modifytime", new Date());
|
||||||
|
// relationEntry.set("rel_isrefuse", false);
|
||||||
|
// //票据信息反写付款单
|
||||||
|
// DynamicObjectCollection draftBills = payBills[i].getDynamicObjectCollection("draftbill");
|
||||||
|
// draftBills.addNew().set("fbasedataid",bill);//结算号
|
||||||
|
// payBills[i].set("billstatus","D");//单据状态改为:已付款
|
||||||
|
//// payBills[i].set("draftbill", draftBills);
|
||||||
|
// DynamicObjectCollection draftInfo = payBills[i].getDynamicObjectCollection("cas_draftinfo");
|
||||||
|
// int draftInfoSize = draftInfo.size();
|
||||||
|
// DynamicObject draftInfoDetail = draftInfo.addNew();
|
||||||
|
// draftInfoDetail.set("seq", draftInfoSize);
|
||||||
|
// draftInfoDetail.set("transamount",bill.getBigDecimal("amount"));
|
||||||
|
// draftInfoDetail.set("paybillcurrency", bill.getDynamicObject("currency"));
|
||||||
|
// draftInfoDetail.set("draftbillinfo", bill);
|
||||||
|
// }
|
||||||
|
// SaveServiceHelper.save(payBills);
|
||||||
|
// }
|
||||||
|
// SaveServiceHelper.save(bills);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void endOperationTransaction(EndOperationTransactionArgs e) {
|
||||||
|
super.endOperationTransaction(e);
|
||||||
|
DynamicObject[] bills = e.getDataEntities();
|
||||||
|
for (DynamicObject bill : bills) {
|
||||||
|
Map<String, HashSet<Long>> srcBillMap = BFTrackerServiceHelper.findSourceBills("cdm_payablebill",
|
||||||
|
new Long[]{bill.getLong("id")});
|
||||||
|
//srcBillMap<单据标识,单据id>,只有上游有开票申请的才处理
|
||||||
|
if (!srcBillMap.containsKey("cdm_payablebill_ap_manual")){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
HashSet<Long> payBillIds = srcBillMap.get("cas_paybill");
|
||||||
|
if (payBillIds == null || payBillIds.size() == 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DynamicObjectCollection relationEntries = bill.getDynamicObjectCollection("releatedcasbillentrys");
|
||||||
|
DynamicObject[] payBills = BusinessDataServiceHelper.load("cas_paybill",
|
||||||
|
"billno,bizdate,actpayamt,billstatus,draftbill,cas_draftinfo.seq,cas_draftinfo.transamount,cas_draftinfo.paybillcurrency,cas_draftinfo.draftbillinfo",
|
||||||
|
new QFilter[]{new QFilter("id", QCP.in, payBillIds)});
|
||||||
|
for (int i = 0; i < payBills.length; i++) {
|
||||||
|
//将付款信息写入开票登记
|
||||||
|
DynamicObject relationEntry = relationEntries.addNew();
|
||||||
|
relationEntry.set("seq", i);
|
||||||
|
relationEntry.set("rel_billtype", "cas_paybill");
|
||||||
|
relationEntry.set("rel_billno", payBills[i].getString("billno"));
|
||||||
|
relationEntry.set("rel_billid", payBills[i].getLong("id"));
|
||||||
|
relationEntry.set("rel_bizdate", payBills[i].getDate("bizdate"));
|
||||||
|
relationEntry.set("rel_billamount", payBills[i].getBigDecimal("actpayamt"));
|
||||||
|
relationEntry.set("rel_createtime", new Date());
|
||||||
|
relationEntry.set("rel_modifytime", new Date());
|
||||||
|
relationEntry.set("rel_isrefuse", false);
|
||||||
|
//票据信息反写付款单
|
||||||
|
DynamicObjectCollection draftBills = payBills[i].getDynamicObjectCollection("draftbill");
|
||||||
|
draftBills.addNew().set("fbasedataid",bill);//结算号
|
||||||
|
payBills[i].set("billstatus","D");//单据状态改为:已付款
|
||||||
|
// payBills[i].set("draftbill", draftBills);
|
||||||
|
DynamicObjectCollection draftInfo = payBills[i].getDynamicObjectCollection("cas_draftinfo");
|
||||||
|
int draftInfoSize = draftInfo.size();
|
||||||
|
DynamicObject draftInfoDetail = draftInfo.addNew();
|
||||||
|
draftInfoDetail.set("seq", draftInfoSize);
|
||||||
|
draftInfoDetail.set("transamount",bill.getBigDecimal("amount"));
|
||||||
|
draftInfoDetail.set("paybillcurrency", bill.getDynamicObject("currency"));
|
||||||
|
draftInfoDetail.set("draftbillinfo", bill);
|
||||||
|
}
|
||||||
|
SaveServiceHelper.save(payBills);
|
||||||
|
}
|
||||||
|
SaveServiceHelper.save(bills);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue