- [x] 优化付款申请单携带资金计划科目的逻辑(不包含业务大类)

- [x] 优化付款申请单携带资金计划科目的逻辑(不包含采购组)
- [ ] 优化收款单携带资金计划科目的逻辑
- [x] 优化生单规则生成付款单携带业务小类及其包含的会计科目(被动)
- [x] 认领中心点击未认领入账,弹出的收款业务信息,选择收款,携带,客户和不明确客户

--s
This commit is contained in:
weiyunlong 2025-05-27 17:54:18 +08:00
parent c53f1ce0c4
commit 641aaf9e36
3 changed files with 90 additions and 22 deletions

View File

@ -0,0 +1,43 @@
package shjh.jhzj7.fi.fi.plugin.form;
import kd.bos.dataentity.entity.DynamicObject;
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 java.util.EventObject;
/**
* 收款业务信息
* shjh_cas_recbizinfo_ext
*/
public class RecbizinfoFormPlugin extends AbstractFormPlugin {
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String name = e.getProperty().getName();
if ("receivingtype".equals(name)) {
DynamicObject receivingtype = (DynamicObject)this.getModel().getValue("receivingtype");
if (null != receivingtype) {
String number = receivingtype.getString("number");
QFilter qFilter1 = new QFilter("number", QCP.equals, "1042086");//4000042
DynamicObject bdCustomer = BusinessDataServiceHelper.loadSingle("bd_customer", qFilter1.toArray());
if ("JH002".equals(number)) {
this.getModel().setValue("payertype", "bd_customer");
this.getModel().setValue("e_payerbasetype", "bd_customer");
this.getModel().setValue("e_payerid", bdCustomer);
this.getView().updateView();
}
}else {
this.getModel().setValue("payertype", null);
this.getModel().setValue("e_payerbasetype", null);
this.getModel().setValue("e_payerid", null);
this.getView().updateView();
}
}
}
}

View File

@ -19,7 +19,10 @@ import kd.sdk.plugin.Plugin;
import shjh.jhzj7.fi.fi.utils.JhzjUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import static shjh.jhzj7.fi.fi.utils.SapUtils.unlocked_status;
@ -252,24 +255,7 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
JhzjUtils.saveLog(bill.getString("billno"), "付款申请携带资金计划科目(供应商/客户)",""
,queryDyobj(qFilter), true, String.valueOf(BusinessDataServiceHelper.load("shjh_request_account",
"id,shjh_membersubject", qFilter.toArray()).length));
//采购组shjh_procurementteam && 不包含采购组
String shjhBhcgz = bill.getString("shjh_procurementteam");
QFilter filter = new QFilter("number", QCP.equals, shjhBhcgz);
DynamicObject shjh_cgz = BusinessDataServiceHelper.loadSingle("shjh_cgz", filter.toArray());
if (null != shjh_cgz) {
Long cgzid = shjh_cgz.getLong("id");
QFilter q11 = new QFilter("shjh_cgz.fbasedataid", QCP.equals, cgzid);//包含采购粗
QFilter q22 = new QFilter("shjh_cgz.fbasedataid", QCP.equals, null);
QFilter q33 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, cgzid);//不包含采购粗
QFilter q44 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q11.or(q22)).and(q33.or(q44));
}else {
QFilter q22 = new QFilter("shjh_cgz.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q22);
}
JhzjUtils.saveLog(bill.getString("billno"), "付款申请携带资金计划科目(采购组)",""
,queryDyobj(qFilter), true, String.valueOf(BusinessDataServiceHelper.load("shjh_request_account",
"id,shjh_membersubject", qFilter.toArray()).length));
//外部系统单据类型_多选下拉 && 不包含单据类型
String shjhExternalsystemdocume = bill.getString("shjh_externalsystemdocume");
if (StringUtil.isNotEmpty(shjhExternalsystemdocume)) {
@ -313,7 +299,9 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
,queryDyobj(qFilter), true, String.valueOf(BusinessDataServiceHelper.load("shjh_request_account",
"id,shjh_membersubject", qFilter.toArray()).length));
DynamicObject[] accounts = BusinessDataServiceHelper.load("shjh_request_account", "id,shjh_membersubject", qFilter.toArray());
DynamicObject[] accounts = BusinessDataServiceHelper.load("shjh_request_account", "id,shjh_membersubject,shjh_cgz,shjh_bbhcgz", qFilter.toArray());
if (accounts.length > 1) {
// 根据生效日期,失效日期区间,判断当前时间满足的数据
Date currentDate = bill.getDate("applydate");//申请日期
@ -321,11 +309,47 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
QFilter endDateFilter = new QFilter("shjh_enddate", QCP.large_equals, currentDate);
QFilter newFilter = qFilter.and(startDateFilter).and(endDateFilter);
//优先级为高的
accounts = BusinessDataServiceHelper.load("shjh_request_account", "id", newFilter.toArray(),"shjh_priority");
accounts = BusinessDataServiceHelper.load("shjh_request_account", "id,shjh_cgz,shjh_bbhcgz", newFilter.toArray(),"shjh_priority");
}
if (accounts.length > 0) {
// 转换为 List 以便支持 remove 操作
List<DynamicObject> configList = new ArrayList<>(Arrays.asList(accounts));
//采购组shjh_procurementteam && 不包含采购组
String shjhBhcgz = bill.getString("shjh_procurementteam");
QFilter filter = new QFilter("number", QCP.equals, shjhBhcgz);
DynamicObject shjh_cgz = BusinessDataServiceHelper.loadSingle("shjh_cgz", filter.toArray());
if (null != shjh_cgz) {
boolean isbh = false;
Long cgzid = shjh_cgz.getLong("id");
for (DynamicObject account : accounts) {
DynamicObjectCollection shjh_cgzs = account.getDynamicObjectCollection("shjh_cgz");//采购组
for (DynamicObject shjhCgz : shjh_cgzs) {
DynamicObject fbasedataid = shjhCgz.getDynamicObject("fbasedataid");
if (null != fbasedataid) {
long id = fbasedataid.getLong("id");
if (id == cgzid) {
isbh = true;
}
}
}
if (!isbh && !shjh_cgzs.isEmpty()) {
configList.remove(account);
}
DynamicObjectCollection shjh_bbhcgzs = account.getDynamicObjectCollection("shjh_bbhcgz");//不包含采购组
for (DynamicObject shjhBbhcgz : shjh_bbhcgzs) {
DynamicObject fbasedataid = shjhBbhcgz.getDynamicObject("fbasedataid");
if (null != fbasedataid) {
long id = fbasedataid.getLong("id");
if (id == cgzid) {
configList.remove(account);
}
}
}
}
}
if (!configList.isEmpty()) {
// 处理找到符合条件的账户
DynamicObject account = accounts[0];
DynamicObject account = configList.get(0);
account = BusinessDataServiceHelper.loadSingle(account.getPkValue(), "shjh_request_account");
return account.getDynamicObject("shjh_membersubject");
} else {

View File

@ -94,6 +94,7 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme
if (null != shjhEBizsmall) {
shjhEBizsmall = BusinessDataServiceHelper.loadSingle(shjhEBizsmall.getPkValue(),"shjh_bizsmalltype");
entryss.set("shjh_yym", shjhEBizsmall.getDynamicObject("shjh_yym"));//规则--小类--原因码
entryss.set("shjh_sapkjkm", shjhEBizsmall.getDynamicObject("shjh_accountview"));//规则--小类--会计科目
}
}
}