parent
9b5d6f5cc2
commit
c446c04f89
|
|
@ -18,9 +18,14 @@ public class CasPaybillFormPlugin extends AbstractFormPlugin {
|
|||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
super.afterBindData(e);
|
||||
//由于this,不可static
|
||||
carryCustomer();
|
||||
|
||||
String sourcebilltype = (String)this.getModel().getValue("sourcebilltype");//源单类型:被动付款入账(bei_intelpay)
|
||||
if (!"bei_intelpay".equals(sourcebilltype)) {
|
||||
}
|
||||
|
||||
private void carryCustomer(){
|
||||
String sourcebilltypes = (String)this.getModel().getValue("sourcebilltype");//源单类型:被动付款入账(bei_intelpay)
|
||||
if (!"bei_intelpay".equals(sourcebilltypes)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +64,5 @@ public class CasPaybillFormPlugin extends AbstractFormPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import shjh.jhzj7.fi.fi.plugin.form.info.RecFieldsInfo;
|
||||
|
||||
|
|
@ -26,6 +29,51 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin {
|
|||
if (null != entry && entry.size() != 0) {
|
||||
setClosingStatus(entry);
|
||||
}
|
||||
|
||||
//携带规则分录的业务大类,业务小类,成本中心,利润中心到收款处理单头
|
||||
carryCustomer();
|
||||
}
|
||||
private void carryCustomer(){
|
||||
String sourcebilltype = (String)this.getModel().getValue("sourcebilltype");//源单类型:被动付款入账(bei_intelpay)
|
||||
if (!"bei_intelrec".equals(sourcebilltype)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String sourcebillnumber = (String)this.getModel().getValue("sourcebillnumber");//源单编码:被动付款单号(bei_intelpay)
|
||||
QFilter q1 = new QFilter("billno", QCP.equals, sourcebillnumber);
|
||||
DynamicObject beiIntelpay = BusinessDataServiceHelper.loadSingle("bei_intelrec", q1.toArray());
|
||||
if (null != beiIntelpay) {
|
||||
String rulename = beiIntelpay.getString("rulename");//适配规则名称
|
||||
//根据适配规则名称查询适配规则 (cas_recpayrule)
|
||||
// 单据:生单/通知规则(shjh_cas_recpayrule_ext) 单据体:入账规则(entryentity) 字段:规则项名称(e_rulesname)
|
||||
QFilter q2 = new QFilter("entryentity.e_rulesname", QCP.equals, rulename);
|
||||
DynamicObject rule = BusinessDataServiceHelper.loadSingle("cas_recpayrule",q2.toArray());
|
||||
if (null != rule) {
|
||||
//根据适配规则携带对应分录的业务大类,业务小类,成本中心,利润中心
|
||||
DynamicObjectCollection collection = rule.getDynamicObjectCollection("entryentity");
|
||||
for (DynamicObject entry : collection) {
|
||||
if (rulename.equals(entry.getString("e_rulesname"))) {
|
||||
DynamicObject shjhBizbig = (DynamicObject)this.getModel().getValue("shjh_bizebig");
|
||||
if (null == shjhBizbig) {
|
||||
this.getModel().setValue("shjh_bizebig", entry.getDynamicObject("shjh_e_bizbig"));
|
||||
}
|
||||
DynamicObject shjhBizsmall = (DynamicObject)this.getModel().getValue("shjh_bizsmall");
|
||||
if (null == shjhBizsmall) {
|
||||
this.getModel().setValue("shjh_bizsmall", entry.getDynamicObject("shjh_e_bizsmall"));
|
||||
}
|
||||
DynamicObject shjhCostcenter = (DynamicObject)this.getModel().getValue("shjh_costcenter");
|
||||
if (null == shjhCostcenter) {
|
||||
this.getModel().setValue("shjh_costcenter", entry.getDynamicObject("shjh_e_cc"));
|
||||
}
|
||||
DynamicObject shjhPc = (DynamicObject)this.getModel().getValue("shjh_profitcenter");
|
||||
if (null == shjhPc) {
|
||||
this.getModel().setValue("shjh_profitcenter", entry.getDynamicObject("shjh_e_pc"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
package shjh.jhzj7.fi.fi.plugin.form;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 排程处理单插件
|
||||
* shjh_psd_schebillcalc_ext
|
||||
*/
|
||||
public class SchebillcalcFormPlugin extends AbstractFormPlugin {
|
||||
|
||||
@Override
|
||||
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||
super.afterDoOperation(afterDoOperationEventArgs);
|
||||
|
||||
String operateKey = afterDoOperationEventArgs.getOperateKey();
|
||||
if ("submit".equals(operateKey)) {
|
||||
// 排程处理单提交后,执行相关业务校验
|
||||
// 1、 当【排票金额】>0 and 【排票支付方式】=票据背书时,票据到期日均需大于付款排程单到期日信息。应大于
|
||||
|
||||
// 付款排程明细(entryentity) 排票金额(e_draftamt) 排票支付方式(e_draftpaymethod) 付款排程单号(e_billno)
|
||||
// 付款排程单(psd_schedulebill, billno, 到期日:shjh_duedate)
|
||||
Map<String, Date> dateMap = new HashMap<>();
|
||||
DynamicObjectCollection entrys = this.getModel().getEntryEntity("entryentity");
|
||||
for (DynamicObject entry : entrys) {
|
||||
BigDecimal eDraftamt = entry.getBigDecimal("e_draftamt");
|
||||
String eDraftpaymethod = entry.getString("e_draftpaymethod");
|
||||
String eBillno = entry.getString("e_billno");
|
||||
if(eDraftamt.compareTo(BigDecimal.ZERO) > 0 && "票据背书".equals(eDraftpaymethod)){
|
||||
QFilter qFilter = new QFilter("billno", QCP.equals, eBillno);
|
||||
DynamicObject psdSchedulebill = BusinessDataServiceHelper.loadSingle("psd_schedulebill", qFilter.toArray());
|
||||
if (null != psdSchedulebill) {
|
||||
Date shjhDuedate = psdSchedulebill.getDate("shjh_duedate");
|
||||
dateMap.put(eBillno, shjhDuedate);
|
||||
}
|
||||
}
|
||||
}
|
||||
Date minDate = null;
|
||||
for (Map.Entry<String, Date> entry : dateMap.entrySet()) {
|
||||
if (minDate == null || entry.getValue().before(minDate)) {
|
||||
minDate = entry.getValue();
|
||||
}
|
||||
}
|
||||
// minDate 是 dateMap 中日期最小的那个
|
||||
if (minDate != null) {
|
||||
//遍历票面信息(draftinfoentry ) 票据到期日(de_draftbillexpiredate) 结算号(de_draftinfo , cdm_draftbillf7 draftbillexpiredate)
|
||||
DynamicObjectCollection draftinfoentry = this.getModel().getEntryEntity("draftinfoentry");
|
||||
for (int i = 0; i < draftinfoentry.size(); i++) {
|
||||
DynamicObject dynamicObject = draftinfoentry.get(i);
|
||||
DynamicObject draftinfo = dynamicObject.getDynamicObject("de_draftinfo");
|
||||
if (null != draftinfo) {
|
||||
draftinfo = BusinessDataServiceHelper.loadSingle(draftinfo.getPkValue(), "cdm_draftbillf7");
|
||||
Date draftbillexpiredate = draftinfo.getDate("draftbillexpiredate");
|
||||
if (draftbillexpiredate.before(minDate)) {
|
||||
this.getView().showErrorNotification("遍历票面信息第"+ i +"行,票据到期日均需大于付款排程单到期日信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue