供应商"个人支付类",在付款单收款人中显示名称
付款处理单,选择“票据”时,添加过滤:“票据到期日”小于排程付款日期(修改排程入款日期返回校验提醒"排程付款日期大于票据到期日" 优化排程合并提示 优化资金计划科目(申请单复选框逻辑) 付款单推送费控新增校验 定时调用SAP应付凭证接口生成付款申请单,过滤参数仅为临期(开始日期,结束日期逻辑优化) s
This commit is contained in:
parent
0fe09139c2
commit
34304bd911
|
|
@ -22,51 +22,51 @@ public class SchebillcalcFormPlugin extends AbstractFormPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||||
super.afterDoOperation(afterDoOperationEventArgs);
|
super.afterDoOperation(afterDoOperationEventArgs);
|
||||||
|
//逻辑迁移到shjh.jhzj7.fi.fi.plugin.operate.SchebillcalcSubmitOperation
|
||||||
String operateKey = afterDoOperationEventArgs.getOperateKey();
|
// String operateKey = afterDoOperationEventArgs.getOperateKey();
|
||||||
if ("submit".equals(operateKey)) {
|
// if ("presubmit".equals(operateKey)) {
|
||||||
// 排程处理单提交后,执行相关业务校验
|
// // 排程处理单提交后,执行相关业务校验
|
||||||
// 1、 当【排票金额】>0 and 【排票支付方式】=票据背书时,票据到期日均需大于付款排程单到期日信息。应大于
|
// // 1、 当【排票金额】>0 and 【排票支付方式】=票据背书时,票据到期日均需大于付款排程单到期日信息。应大于
|
||||||
|
//
|
||||||
// 付款排程明细(entryentity) 排票金额(e_draftamt) 排票支付方式(e_draftpaymethod) 付款排程单号(e_billno)
|
// // 付款排程明细(entryentity) 排票金额(e_draftamt) 排票支付方式(e_draftpaymethod) 付款排程单号(e_billno)
|
||||||
// 付款排程单(psd_schedulebill, billno, 到期日:shjh_duedate)
|
// // 付款排程单(psd_schedulebill, billno, 到期日:shjh_duedate)
|
||||||
Map<String, Date> dateMap = new HashMap<>();
|
// Map<String, Date> dateMap = new HashMap<>();
|
||||||
DynamicObjectCollection entrys = this.getModel().getEntryEntity("entryentity");
|
// DynamicObjectCollection entrys = this.getModel().getEntryEntity("entryentity");
|
||||||
for (DynamicObject entry : entrys) {
|
// for (DynamicObject entry : entrys) {
|
||||||
BigDecimal eDraftamt = entry.getBigDecimal("e_draftamt");
|
// BigDecimal eDraftamt = entry.getBigDecimal("e_draftamt");
|
||||||
String eDraftpaymethod = entry.getString("e_draftpaymethod");
|
// String eDraftpaymethod = entry.getString("e_draftpaymethod");
|
||||||
String eBillno = entry.getString("e_billno");
|
// String eBillno = entry.getString("e_billno");
|
||||||
if(eDraftamt.compareTo(BigDecimal.ZERO) > 0 && "票据背书".equals(eDraftpaymethod)){
|
// if(eDraftamt.compareTo(BigDecimal.ZERO) > 0 && "draftbook".equals(eDraftpaymethod)){
|
||||||
QFilter qFilter = new QFilter("billno", QCP.equals, eBillno);
|
// QFilter qFilter = new QFilter("billno", QCP.equals, eBillno);
|
||||||
DynamicObject psdSchedulebill = BusinessDataServiceHelper.loadSingle("psd_schedulebill", qFilter.toArray());
|
// DynamicObject psdSchedulebill = BusinessDataServiceHelper.loadSingle("psd_schedulebill", qFilter.toArray());
|
||||||
if (null != psdSchedulebill) {
|
// if (null != psdSchedulebill) {
|
||||||
Date shjhDuedate = psdSchedulebill.getDate("shjh_duedate");
|
// Date shjhDuedate = psdSchedulebill.getDate("shjh_duedate");
|
||||||
dateMap.put(eBillno, shjhDuedate);
|
// dateMap.put(eBillno, shjhDuedate);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
Date minDate = null;
|
// Date minDate = null;
|
||||||
for (Map.Entry<String, Date> entry : dateMap.entrySet()) {
|
// for (Map.Entry<String, Date> entry : dateMap.entrySet()) {
|
||||||
if (minDate == null || entry.getValue().before(minDate)) {
|
// if (minDate == null || entry.getValue().before(minDate)) {
|
||||||
minDate = entry.getValue();
|
// minDate = entry.getValue();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// minDate 是 dateMap 中日期最小的那个
|
// // minDate 是 dateMap 中日期最小的那个
|
||||||
if (minDate != null) {
|
// if (minDate != null) {
|
||||||
//遍历票面信息(draftinfoentry ) 票据到期日(de_draftbillexpiredate) 结算号(de_draftinfo , cdm_draftbillf7 draftbillexpiredate)
|
// //遍历票面信息(draftinfoentry ) 票据到期日(de_draftbillexpiredate) 结算号(de_draftinfo , cdm_draftbillf7 draftbillexpiredate)
|
||||||
DynamicObjectCollection draftinfoentry = this.getModel().getEntryEntity("draftinfoentry");
|
// DynamicObjectCollection draftinfoentry = this.getModel().getEntryEntity("draftinfoentry");
|
||||||
for (int i = 0; i < draftinfoentry.size(); i++) {
|
// for (int i = 0; i < draftinfoentry.size(); i++) {
|
||||||
DynamicObject dynamicObject = draftinfoentry.get(i);
|
// DynamicObject dynamicObject = draftinfoentry.get(i);
|
||||||
DynamicObject draftinfo = dynamicObject.getDynamicObject("de_draftinfo");
|
// DynamicObject draftinfo = dynamicObject.getDynamicObject("de_draftinfo");
|
||||||
if (null != draftinfo) {
|
// if (null != draftinfo) {
|
||||||
draftinfo = BusinessDataServiceHelper.loadSingle(draftinfo.getPkValue(), "cdm_draftbillf7");
|
// draftinfo = BusinessDataServiceHelper.loadSingle(draftinfo.getPkValue(), "cdm_draftbillf7");
|
||||||
Date draftbillexpiredate = draftinfo.getDate("draftbillexpiredate");
|
// Date draftbillexpiredate = draftinfo.getDate("draftbillexpiredate");
|
||||||
if (draftbillexpiredate.before(minDate)) {
|
// if (draftbillexpiredate.before(minDate)) {
|
||||||
this.getView().showErrorNotification("遍历票面信息第"+ i +"行,票据到期日均需大于付款排程单到期日信息");
|
// this.getView().showErrorNotification("遍历票面信息第"+ i +"行,票据到期日均需大于付款排程单到期日信息");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package shjh.jhzj7.fi.fi.plugin.form;
|
package shjh.jhzj7.fi.fi.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.form.control.Label;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
import kd.bos.form.ClientProperties;
|
import kd.bos.form.ClientProperties;
|
||||||
|
|
@ -19,6 +20,10 @@ public class TextFieldDemo extends AbstractFormPlugin {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterBindData(EventObject e) {
|
public void afterBindData(EventObject e) {
|
||||||
|
//供应商"个人支付类",在付款单收款人中显示名称
|
||||||
|
Label label = this.getView().getControl("shjh_sjskfs");
|
||||||
|
label.setText(""+this.getView().getModel().getValue("shjh_asstactrealname"));
|
||||||
|
|
||||||
|
|
||||||
// 获取成本中心和利润中心的控件
|
// 获取成本中心和利润中心的控件
|
||||||
BasedataEdit shjh_costcenter = this.getView().getControl("shjh_costcenter");
|
BasedataEdit shjh_costcenter = this.getView().getControl("shjh_costcenter");
|
||||||
|
|
|
||||||
|
|
@ -156,10 +156,11 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
|
||||||
JhzjUtils.saveLog(bill.getString("billno"), "付款申请携带资金计划科目(原因码)",""
|
JhzjUtils.saveLog(bill.getString("billno"), "付款申请携带资金计划科目(原因码)",""
|
||||||
,queryDyobj(qFilter), true, String.valueOf(BusinessDataServiceHelper.load("shjh_request_account",
|
,queryDyobj(qFilter), true, String.valueOf(BusinessDataServiceHelper.load("shjh_request_account",
|
||||||
"id,shjh_membersubject", qFilter.toArray()).length));
|
"id,shjh_membersubject", qFilter.toArray()).length));
|
||||||
|
//单子为true 对应配置表是/否 为false 对应配置表否
|
||||||
//是否充值类
|
//是否充值类
|
||||||
boolean shjhWhetherrechargecateg = bill.getBoolean("shjh_whetherrechargecateg");
|
boolean shjhWhetherrechargecateg = bill.getBoolean("shjh_whetherrechargecateg");
|
||||||
if (shjhWhetherrechargecateg) {
|
if (!shjhWhetherrechargecateg) {
|
||||||
QFilter q2 = new QFilter("shjh_czl", QCP.equals, shjhWhetherrechargecateg);
|
QFilter q2 = new QFilter("shjh_czl", QCP.equals, false);
|
||||||
qFilter = qFilter.and(q2);
|
qFilter = qFilter.and(q2);
|
||||||
}
|
}
|
||||||
JhzjUtils.saveLog(bill.getString("billno"), "付款申请携带资金计划科目(是否充值类)",""
|
JhzjUtils.saveLog(bill.getString("billno"), "付款申请携带资金计划科目(是否充值类)",""
|
||||||
|
|
@ -167,8 +168,8 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
|
||||||
"id,shjh_membersubject", qFilter.toArray()).length));
|
"id,shjh_membersubject", qFilter.toArray()).length));
|
||||||
//是否自行采购
|
//是否自行采购
|
||||||
boolean shjhZxcg = bill.getBoolean("shjh_zxcg");
|
boolean shjhZxcg = bill.getBoolean("shjh_zxcg");
|
||||||
if (shjhZxcg) {
|
if (!shjhZxcg) {
|
||||||
QFilter q3 = new QFilter("shjh_zxcg", QCP.equals, shjhZxcg);
|
QFilter q3 = new QFilter("shjh_zxcg", QCP.equals, false);
|
||||||
qFilter = qFilter.and(q3);
|
qFilter = qFilter.and(q3);
|
||||||
}
|
}
|
||||||
JhzjUtils.saveLog(bill.getString("billno"), "付款申请携带资金计划科目(是否自行采购)",""
|
JhzjUtils.saveLog(bill.getString("billno"), "付款申请携带资金计划科目(是否自行采购)",""
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,12 @@ public class PaybillOperation extends AbstractOperationServicePlugIn implements
|
||||||
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), "cas_paybill");
|
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), "cas_paybill");
|
||||||
if (null != bill) {
|
if (null != bill) {
|
||||||
DynamicObject paymentidentify = bill.getDynamicObject("paymentidentify");//付款标识
|
DynamicObject paymentidentify = bill.getDynamicObject("paymentidentify");//付款标识
|
||||||
|
//SAP付款凭证号为空,不允许推送费控,请先推送sap
|
||||||
|
String credentialnum = bill.getString("shjh_credentialnum");//SAP付款凭证号
|
||||||
|
if (StringUtils.isEmpty(credentialnum)) {
|
||||||
|
addErrorInfo(bill, "SAP付款凭证号为空,不允许推送费控,请先推送sap");
|
||||||
|
isSuccess = false;
|
||||||
|
}
|
||||||
if (null != paymentidentify) {
|
if (null != paymentidentify) {
|
||||||
if (!"FKBS02".equals(paymentidentify.getString("number"))) {
|
if (!"FKBS02".equals(paymentidentify.getString("number"))) {
|
||||||
addErrorInfo(bill, "付款标识不为被动付款");
|
addErrorInfo(bill, "付款标识不为被动付款");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排程处理单操作插件
|
||||||
|
* shjh_psd_schebillcalc_ext
|
||||||
|
*/
|
||||||
|
public class SchebillcalcSubmitOperation extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(SchebillcalcSubmitOperation.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
e.addValidator(new AbstractValidator() {
|
||||||
|
@Override
|
||||||
|
public void validate() {
|
||||||
|
String operateKey = this.getOperateKey();
|
||||||
|
if ("presubmit".equals(operateKey)) {
|
||||||
|
// 付款排程明细(entryentity) 排票金额(e_draftamt) 排票支付方式(e_draftpaymethod) 付款排程单号(e_billno)
|
||||||
|
// 付款排程单(psd_schedulebill, billno, 到期日:shjh_duedate)
|
||||||
|
ExtendedDataEntity[] entities = this.getDataEntities();
|
||||||
|
for (ExtendedDataEntity entity : entities) {
|
||||||
|
DynamicObject bill = entity.getDataEntity();
|
||||||
|
DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entryentity");
|
||||||
|
for (DynamicObject entry : entrys) {
|
||||||
|
BigDecimal eDraftamt = entry.getBigDecimal("e_draftamt");//排票金额
|
||||||
|
String eBillno = entry.getString("e_billno");//付款排程单号
|
||||||
|
Date shjhDuedate = null;
|
||||||
|
//当【排票金额】>0 and 废弃:【排票支付方式】=票据背书时
|
||||||
|
if (eDraftamt.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
QFilter qFilter = new QFilter("billno", QCP.equals, eBillno);
|
||||||
|
//付款排程单
|
||||||
|
DynamicObject psdSchedulebill = BusinessDataServiceHelper.loadSingle("psd_schedulebill", qFilter.toArray());
|
||||||
|
if (null != psdSchedulebill) {
|
||||||
|
shjhDuedate = psdSchedulebill.getDate("shjh_duedate");//到期日
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Date minDate = null;
|
||||||
|
if (shjhDuedate != null) {
|
||||||
|
//票据到期日中最小的日期均需大于付款排程单到期日信息
|
||||||
|
DynamicObjectCollection eDraftno = entry.getDynamicObjectCollection("e_draftno");
|
||||||
|
//票据号
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for (DynamicObject dynamicObject : eDraftno) {
|
||||||
|
DynamicObject fbasedataid = dynamicObject.getDynamicObject("fbasedataid");
|
||||||
|
str.append(fbasedataid.getString("billno")).append(",");
|
||||||
|
Date currentDate = fbasedataid.getDate("draftbillexpiredate");
|
||||||
|
// 跳过 null 日期
|
||||||
|
if (currentDate == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 如果是第一个有效日期,或者当前日期比已记录的最小日期更早
|
||||||
|
if (minDate == null || currentDate.before(minDate)) {
|
||||||
|
minDate = currentDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (str.length() > 0) {
|
||||||
|
str.deleteCharAt(str.length() - 1); // 删除最后一个逗号
|
||||||
|
}
|
||||||
|
//risk:如果没有有效票据,则不进行校验
|
||||||
|
if (minDate != null && minDate.before(shjhDuedate)) {
|
||||||
|
// 格式化日期为 yyyy-MM-dd 字符串
|
||||||
|
String f1;
|
||||||
|
String f2;
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
f1 = sdf.format(minDate);
|
||||||
|
f2 = sdf.format(shjhDuedate);
|
||||||
|
this.addErrorMessage(entity, "付款排程单号为" + eBillno +
|
||||||
|
"的付款排程明细,票据号:"+str+"。票据最小到期日"+ f1 + "应大于付款排程单到期日" + f2); // 票据到期日中最小的日期均需大于付款排程单到期日信息
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// //遍历票面信息(draftinfoentry ) 票据到期日(de_draftbillexpiredate) 结算号(de_draftinfo , cdm_draftbillf7 draftbillexpiredate)
|
||||||
|
// DynamicObjectCollection draftinfoentry = bill.getDynamicObjectCollection("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(shjhDuedate)) {
|
||||||
|
// this.addErrorMessage(entity, "遍历票面信息第"+ i+1 +"行,票据到期日均需大于付款排程单到期日信息");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
@ -42,20 +42,19 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
|
||||||
@Override
|
@Override
|
||||||
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
||||||
|
|
||||||
String lq = (String)map.get("临期");
|
// 获取临期天数并转换
|
||||||
// int daysToAdd = Integer.parseInt(lq);
|
String lq = (String) map.get("临期");
|
||||||
int daysToAdd = 365;//1600000001 1600000009
|
if (StringUtils.isEmpty(lq)) {
|
||||||
|
return;
|
||||||
String dateStr = "2025-01-01";
|
}
|
||||||
DateTimeFormatter format = DateTimeFormatter.ISO_LOCAL_DATE;
|
int daysToAdd = Integer.parseInt(lq); // 将临期字符串转为整数天数
|
||||||
LocalDate currentDate = LocalDate.parse(dateStr, format);// 获取当前日期
|
// 获取当前日期
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
// LocalDate currentDate = LocalDate.now();// 获取当前日期
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||||
LocalDate newDate = currentDate.plusDays(daysToAdd);// 计算新日期
|
LocalDate endDate = currentDate.plusDays(daysToAdd);
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");// 格式化日期
|
// 格式化日期
|
||||||
|
String formattedoldDate = currentDate.format(formatter); //开始日期 当前日期
|
||||||
String formattedoldDate = currentDate.format(formatter);//开始日期
|
String formattedNewDate = endDate.format(formatter); //结束日期(当前日期 + 临期天数)
|
||||||
String formattedNewDate = newDate.format(formatter);//结束日期
|
|
||||||
|
|
||||||
JSONArray IT_LIST = new JSONArray();
|
JSONArray IT_LIST = new JSONArray();
|
||||||
// 添加SAP应付凭到期日过滤条件
|
// 添加SAP应付凭到期日过滤条件
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue