付款单-收款方需要显示编码+名称

收款单-付款方需要显示编码+名称
数据采集校验&&重新赋值申请下拨金额
优化付款单推送凭证(优化凭证中弹性域中文本的获取逻辑)
s
This commit is contained in:
weiyunlong 2025-05-20 18:01:51 +08:00
parent 1ef40d66a2
commit 2d9d99ff63
5 changed files with 187 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.control.Label;
import kd.bos.form.control.events.BeforeItemClickEvent;
import kd.bos.form.events.BeforeClosedEvent;
import kd.bos.form.events.ClosedCallBackEvent;
@ -36,6 +37,17 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin {
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
//携带付款人编码
String payerformid = ""+this.getView().getModel().getValue("payerformid");//付款人类型标识ID
Long payer = Long.valueOf(""+this.getView().getModel().getValue("payer"));//付款人ID
if (!"other".equals(payerformid)) {
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(payer, payerformid);
if (null != dynamicObject) {
Label label1 = this.getView().getControl("shjh_positionbr4");
label1.setText(dynamicObject.getString("number"));
}
}
//携带生单规则分录的业务大类,业务小类,成本中心,利润中心到收款处理单头__逻辑迁移到单据保存操作插件
// carryCustomer();
//根据分录清账状态去默认表头的清账状态

View File

@ -24,6 +24,18 @@ public class TextFieldDemo extends AbstractFormPlugin {
Label label = this.getView().getControl("shjh_sjskfs");
label.setText(""+this.getView().getModel().getValue("shjh_asstactrealname"));
//携带收款人编码
String payeeformid = ""+this.getView().getModel().getValue("payeeformid");//收款人基础资料标识
Long payee = Long.valueOf(""+this.getView().getModel().getValue("payee"));//收款人ID
if (payee != 0 && payeeformid!= null &&!payeeformid.isEmpty()) {
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(payee, payeeformid);
if (null != dynamicObject) {
Label label1 = this.getView().getControl("shjh_positionbr4");
label1.setText(dynamicObject.getString("number"));
}
}
// 获取成本中心和利润中心的控件
BasedataEdit shjh_costcenter = this.getView().getControl("shjh_costcenter");

View File

@ -0,0 +1,143 @@
package shjh.jhzj7.fi.fi.plugin.operate;
import com.alibaba.fastjson.JSONObject;
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.plugin.args.AfterOperationArgs;
import kd.bos.entity.plugin.args.BeforeOperationArgs;
import kd.bos.entity.validate.AbstractValidator;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.DeleteServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.sdk.plugin.Plugin;
import kd.tmc.fbp.common.bean.BizBalanceModelBean;
import kd.tmc.fbp.common.enums.TmcAppEnum;
import kd.tmc.fbp.common.helper.TmcParameterHelper;
import kd.tmc.fbp.service.model.BalanceModelService;
import shjh.jhzj7.fi.fi.utils.domin.ResponseData;
import java.math.BigDecimal;
/**
* 请款单保存操作插件
*/
public class ApplyTransBillSaveOperation extends AbstractOperationServicePlugIn implements Plugin {
private static final Log log = LogFactory.getLog(ApplyTransBillSaveOperation.class);
@Override
public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e);
e.addValidator(new AbstractValidator() {
@Override
public void validate() {
String operateKey = this.getOperateKey();
//数据采集校验&&重新赋值申请下拨金额
if ("save".equals(operateKey)){
ExtendedDataEntity[] entities = this.getDataEntities();
for (ExtendedDataEntity entity : entities) {
DynamicObject aDo = entity.getDataEntity();
DynamicObject currency = aDo.getDynamicObject("currency");
Long currencyId = currency.getLong("id");
DynamicObject org = aDo.getDynamicObject("company");
Long orgId = org.getLong("id");
String balanceType = TmcParameterHelper.getAppStringParameter(TmcAppEnum.FCS.getId(), orgId, "balancevalue");
BalanceModelService balanceModelService = new BalanceModelService();
DynamicObjectCollection entrys = aDo.getDynamicObjectCollection("entrys");
for (DynamicObject entry : entrys) {
DynamicObject bankAcct = entry.getDynamicObject("subacct");
BizBalanceModelBean bizBalanceModelBean = balanceModelService.getRunningBalance(balanceType, bankAcct.getLong("id"), currencyId);
BigDecimal subcurbalance = bizBalanceModelBean.getAmount();//子账户即时余额
BigDecimal applyamt = entry.getBigDecimal("applyamt");//申请下拨金额
// 如果subcurbalance小于applyamt则调整applyamt的值
if (subcurbalance.compareTo(applyamt) >= 0) {
this.addMessage(entity,"子账户即时余额 >= 申请下拨金额,不允许生成请款单!");
}
}
}
}
}
});
}
@Override
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
super.beforeExecuteOperationTransaction(e);
//数据采集校验&&重新赋值申请下拨金额
String eok = e.getOperationKey();
if("save".equals(eok)){
DynamicObject[] dos = e.getDataEntities();
for (DynamicObject aDo : dos) {
DynamicObject currency = aDo.getDynamicObject("currency");
Long currencyId = currency.getLong("id");
DynamicObject org = aDo.getDynamicObject("company");
Long orgId = org.getLong("id");
String balanceType = TmcParameterHelper.getAppStringParameter(TmcAppEnum.FCS.getId(), orgId, "balancevalue");
BalanceModelService balanceModelService = new BalanceModelService();
DynamicObjectCollection entrys = aDo.getDynamicObjectCollection("entrys");
for (DynamicObject entry : entrys) {
DynamicObject bankAcct = entry.getDynamicObject("subacct");
BizBalanceModelBean bizBalanceModelBean = balanceModelService.getRunningBalance(balanceType, bankAcct.getLong("id"), currencyId);
BigDecimal subcurbalance = bizBalanceModelBean.getAmount();//子账户即时余额
// BigDecimal subcurbalance = entry.getBigDecimal("subcurbalance");//子账户即时余额
BigDecimal applyamt = entry.getBigDecimal("applyamt");//申请下拨金额
// 如果subcurbalance小于applyamt则调整applyamt的值
if (subcurbalance.compareTo(applyamt) < 0) {
applyamt = applyamt.subtract(subcurbalance);
entry.set("applyamt", applyamt);//重新赋值--申请下拨金额
}
}
}
}
}
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
//数据采集校验&&重新赋值申请下拨金额
String eok = e.getOperationKey();
// if("save".equals(eok)){
// DynamicObject[] dos = e.getDataEntities();
// DynamicObject prinfo;
// for (DynamicObject aDo : dos) {
// boolean isdelete = false;
// DynamicObject currency = aDo.getDynamicObject("currency");
// Long currencyId = currency.getLong("id");
// DynamicObject org = aDo.getDynamicObject("company");
// Long orgId = org.getLong("id");
// String balanceType = TmcParameterHelper.getAppStringParameter(TmcAppEnum.FCS.getId(), orgId, "balancevalue");
// BalanceModelService balanceModelService = new BalanceModelService();
//
// prinfo = BusinessDataServiceHelper.loadSingle(aDo.getPkValue(), aDo.getDataEntityType().getName());
// DynamicObjectCollection entrys = prinfo.getDynamicObjectCollection("entrys");
// for (DynamicObject entry : entrys) {
//
// DynamicObject bankAcct = entry.getDynamicObject("subacct");
// BizBalanceModelBean bizBalanceModelBean = balanceModelService.getRunningBalance(balanceType, bankAcct.getLong("id"), currencyId);
// BigDecimal subcurbalance = bizBalanceModelBean.getAmount();//子账户即时余额
//
//// BigDecimal subcurbalance = entry.getBigDecimal("subcurbalance");//子账户即时余额
// BigDecimal applyamt = entry.getBigDecimal("applyamt");//申请下拨金额
// // 如果subcurbalance小于applyamt则调整applyamt的值
// if (subcurbalance.compareTo(applyamt) >= 0) {
// isdelete = true;
// }
// }
// if(isdelete){
// DeleteServiceHelper.delete(aDo.getDataEntityType(),new Object[]{prinfo.getPkValue()});
// }
// }
// }
}
}

View File

@ -43,8 +43,12 @@ public class PayBillSubmitOperation extends AbstractOperationServicePlugIn imple
ExtendedDataEntity[] entities = this.getDataEntities();
for (ExtendedDataEntity entity : entities) {
DynamicObject bill = entity.getDataEntity();
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(),"cas_paybill");
String sourcesystem = bill.getString("shjh_sourcesystem");//来源系统:SAP_A 费控_B
String sourcesystem = "";
try {
sourcesystem = bill.getString("shjh_sourcesystem");//来源系统:SAP_A 费控_B
}catch (Exception e){
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(),"cas_paybill");
}
boolean shjhSapvalidate = bill.getBoolean("shjh_sapvalidate");//SAP校验是否通过
//付款单提交时调用SAP应付凭证数据校验接口校验不通过弹框提示用户具体原因如果校验通过则标记后续再提交时无需校验
if ("A".equals(sourcesystem) && !shjhSapvalidate) {

View File

@ -315,12 +315,23 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl
hsxminfo = QueryServiceHelper.queryOne("bos_costcenter", "id,name,number",
new QFilter[]{new QFilter("id", QCP.equals, glassistbd.getLong("assval"))});//维度值
IT_ITEMS.put("KOSTL",hsxminfo.getString("number"));//成本中心_成本中心
}else if("f000054".equals(asstype)){
//原因码 f000054
IT_ITEMS.put("RSTGR",glassistbd.getString("assval"));//成本中心_成本中心
}
}
gl_assist_bd = QueryServiceHelper.query("gl_assist_txt", "asstype,assval",
new QFilter[]{new QFilter("hg.id", QCP.equals, assgrpinfo.getPkValue())});//核算项目组合纵表-文本
for (int j = 0; j < gl_assist_bd.size(); j++) {
glassistbd = gl_assist_bd.get(j);
asstype = glassistbd.getString("asstype");//核算项目类型-对应核算维度的字段名
if("f000054".equals(asstype)){
//原因码 f000054
IT_ITEMS.put("RSTGR",glassistbd.getString("assval"));
}else if("f000056".equals(asstype)){
//分配编号 f000056
IT_ITEMS.put("ZUONR",glassistbd.getString("assval"));
}
}
}
// 获取借方金额