- 优化todo

- 优化付款单/申请单携带资金计划科目
--s
This commit is contained in:
weiyunlong 2025-04-16 16:33:42 +08:00
parent 2a32872d31
commit 306c32d86e
8 changed files with 293 additions and 166 deletions

View File

@ -68,6 +68,5 @@ public class SchebillcalcFormPlugin extends AbstractFormPlugin {
}
}
}
//todo:增加校验源单类型是费控的不允许拆分;不允许合并
}
}

View File

@ -1,5 +1,6 @@
package shjh.jhzj7.fi.fi.plugin.operate;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sap.db.jdbc.packet.ErrorLevel;
@ -15,6 +16,7 @@ import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.util.StringUtils;
import kd.sdk.plugin.Plugin;
import shjh.jhzj7.fi.fi.webapi.PayreceiptQueryControler;
@ -88,13 +90,42 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
private DynamicObject xdMembersubject(DynamicObject bill){
//SAP应付凭证生成付款申请单后系统自动根据配置表(shjh_request_account)带出资金计划科目
QFilter qFilter = new QFilter("id",QCP.is_notnull,null);
//公司范围_多选基础资料
//公司范围_多选基础资料 && 不包含公司
DynamicObject applyorg = bill.getDynamicObject("applyorg");
if (null != applyorg) {
Long orgid = applyorg.getLong("id");
QFilter q1 = new QFilter("shjh_companys.fbasedataid", QCP.equals, orgid);
qFilter = qFilter.and(q1);
QFilter q2 = new QFilter("shjh_companys.fbasedataid", QCP.equals, null);//in 或者配置表公司为空
qFilter = qFilter.and(q1.or(q2));
}
//业务大类 && 不包含业务大类
DynamicObject shjhBizbig = bill.getDynamicObject("shjh_bizbig");
if (null != shjhBizbig) {
Long shjhBizbigid = shjhBizbig.getLong("id");
QFilter q1 = new QFilter("shjh_bizbig.fbasedataid", QCP.equals, shjhBizbigid);//包含业务大类
QFilter q2 = new QFilter("shjh_bizbig.fbasedataid", QCP.equals, null);
QFilter q3 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, shjhBizbigid);//不包含业务大类
QFilter q4 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4));
}
//业务小类
DynamicObject shjhbizsmall = bill.getDynamicObject("shjh_basedatafield");
if (null != shjhbizsmall) {
Long shjhbizsmallid = shjhbizsmall.getLong("id");
QFilter q1 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, shjhbizsmallid);
QFilter q2 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2));
}
//原因码_多选基础资料
DynamicObject shjhYym = bill.getDynamicObject("shjh_yym");
if (null != shjhYym) {
Long yymid = shjhYym.getLong("id");
QFilter q9 = new QFilter("shjh_yym.fbasedataid", QCP.equals, yymid);
qFilter = qFilter.and(q9);
}
//是否充值类
boolean shjhWhetherrechargecateg = bill.getBoolean("shjh_whetherrechargecateg");
QFilter q2 = new QFilter("shjh_czl", QCP.equals, shjhWhetherrechargecateg);
@ -105,11 +136,6 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
QFilter q3 = new QFilter("shjh_zxcg", QCP.equals, shjhZxcg);
qFilter = qFilter.and(q3);
//外部系统单据类型_多选下拉
String shjhExternalsystemdocume = bill.getString("shjh_externalsystemdocume");
QFilter q4 = new QFilter("shjh_billtype", QCP.like, "%"+shjhExternalsystemdocume+"%");
qFilter = qFilter.and(q4);
//事业部_多选基础资料,通过申请单的二级部门去映射表查询(shjh_ejbm_syb)
DynamicObject shjhSecondarydept = bill.getDynamicObject("shjh_secondarydept");
if (null != shjhSecondarydept) {
@ -122,39 +148,11 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
if (null != shjhDivision) {
Long divisionid = shjhDivision.getLong("id");
QFilter q6 = new QFilter("shjh_division.fbasedataid", QCP.equals, divisionid);
qFilter = qFilter.and(q6);
QFilter q7 = new QFilter("shjh_division.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q6.or(q7));
}
}
}
//todo:PO号是否为空
//采购组_文本
String procurementteam = bill.getString("shjh_procurementteam");
QFilter q7 = new QFilter("shjh_purgroup", QCP.like, "%"+procurementteam+"%");
qFilter = qFilter.and(q7);
//供应商_多选基础资料
DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entry");
if (!entrys.isEmpty()) {
DynamicObject entry = entrys.get(0);
String eAsstacttype = entry.getString("e_asstacttype");
if ("bd_supplier".equals(eAsstacttype)) {
DynamicObject eAsstact = entry.getDynamicObject("e_asstact");//往来户
if (null != eAsstact) {
Long eAsstactid = eAsstact.getLong("id");
QFilter q8 = new QFilter("shjh_supplier.fbasedataid", QCP.equals, eAsstactid);
qFilter = qFilter.and(q8);
}
}
}
//原因码_多选基础资料
DynamicObject shjhYym = bill.getDynamicObject("shjh_yym");
if (null != shjhYym) {
Long yymid = shjhYym.getLong("id");
QFilter q9 = new QFilter("shjh_yym.fbasedataid", QCP.equals, yymid);
qFilter = qFilter.and(q9);
}
//会计科目_多选基础资料
DynamicObject shjhSapkjkm = bill.getDynamicObject("shjh_sapkjkm");
@ -164,6 +162,73 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
qFilter = qFilter.and(q10);
}
//供应商_多选基础资料 分录
DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entry");
if (!entrys.isEmpty()) {
DynamicObject entry = entrys.get(0);
String eAsstacttype = entry.getString("e_asstacttype");
if ("bd_supplier".equals(eAsstacttype)) {
//供应商 && 不包含供应商
DynamicObject eAsstact = entry.getDynamicObject("e_asstact");//往来户
if (null != eAsstact) {
Long eAsstactid = eAsstact.getLong("id");
QFilter q11 = new QFilter("shjh_supplier.fbasedataid", QCP.equals, eAsstactid);//包含供应商
QFilter q22 = new QFilter("shjh_supplier.fbasedataid", QCP.equals, null);
QFilter q33 = new QFilter("shjh_bbhgys.fbasedataid", QCP.equals, eAsstactid);//不包含供应商
QFilter q44 = new QFilter("shjh_bbhgys.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q11.or(q22)).and(q33.or(q44));
}
}
//客户(bd_customer)||供应商(bd_supplier)
if ("bd_customer".equals(eAsstacttype)) {
//客户 && 不包含客户
DynamicObject eAsstact = entry.getDynamicObject("e_asstact");//往来户
if (null != eAsstact) {
Long eAsstactid = eAsstact.getLong("id");
QFilter q11 = new QFilter("shjh_kh.fbasedataid", QCP.equals, eAsstactid);//包含客户
QFilter q22 = new QFilter("shjh_kh.fbasedataid", QCP.equals, null);
QFilter q33 = new QFilter("shjh_bbhkh.fbasedataid", QCP.equals, eAsstactid);//不包含客户
QFilter q44 = new QFilter("shjh_bbhkh.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q11.or(q22)).and(q33.or(q44));
}
}
}
//采购组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));
}
//外部系统单据类型_多选下拉 && 不包含单据类型
String shjhExternalsystemdocume = bill.getString("shjh_externalsystemdocume");
if (StringUtil.isNotEmpty(shjhExternalsystemdocume)) {
QFilter q4 = new QFilter("shjh_billtype", QCP.like, "%"+shjhExternalsystemdocume+"%");
QFilter q5 = new QFilter("shjh_billtype", QCP.equals, null);
QFilter q6 = new QFilter("shjh_bbhdjlx", QCP.like, "%"+shjhExternalsystemdocume+"%");
QFilter q7 = new QFilter("shjh_bbhdjlx", QCP.equals, null);
qFilter = qFilter.and(q4.or(q5)).and(q6.or(q7));
}
//不包含币种 currency
DynamicObject currency = bill.getDynamicObject("paycurrency");
if (null != currency) {
Long currencyid = currency.getLong("id");
QFilter q11 = new QFilter("shjh_bbhbz.fbasedataid", QCP.equals, currencyid);//不包含币种
QFilter q22 = new QFilter("shjh_bbhbz.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q11.or(q22));
}
//todo:PO号是否为空
DynamicObject[] accounts = BusinessDataServiceHelper.load("shjh_request_account", "id,shjh_membersubject", qFilter.toArray());
if (accounts.length > 1) {
// 根据生效日期,失效日期区间,判断当前时间满足的数据
@ -171,7 +236,8 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
QFilter startDateFilter = new QFilter("shjh_begindate", QCP.less_equals, currentDate);
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());
//优先级为高的
accounts = BusinessDataServiceHelper.load("shjh_pay_account", "id", newFilter.toArray(),"shjh_priority");
}
if (accounts.length > 0) {
// 处理找到符合条件的账户

View File

@ -0,0 +1,179 @@
package shjh.jhzj7.fi.fi.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.args.AfterOperationArgs;
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.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.util.StringUtils;
import kd.sdk.plugin.Plugin;
import java.util.Date;
/**
* 付款单保存操作
* shjh_cas_paybill_ext
*/
public class PayBillSaveOperation extends AbstractOperationServicePlugIn implements Plugin {
private static final Log log = LogFactory.getLog(PayBillSaveOperation.class);
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
String eok = e.getOperationKey();
if ("save".equals(eok)) {
//付款单保存之后 付款标识为被动付款,并且资金计划科目为空,从配置表(shjh_pay_account)携带资金计划科目
DynamicObject[] dataEntities = e.getDataEntities();
for (DynamicObject bill : dataEntities) {
// bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(),"cas_paybill");
DynamicObject paymentidentify = bill.getDynamicObject("paymentidentify");
DynamicObject shjhMembersubject = bill.getDynamicObject("shjh_membersubject");
if (null != paymentidentify && null == shjhMembersubject) {
String paymentidentifyNumber = paymentidentify.getString("number");
if ("FKBS02".equals(paymentidentifyNumber)) {
//根据配置表携带资金计划科目
bill.set("shjh_membersubject", xdMembersubject(bill));
SaveServiceHelper.save(new DynamicObject[]{bill});
}
}
}
}
}
private DynamicObject xdMembersubject(DynamicObject bill){
//付款单系统自动根据配置表(shjh_pay_account)带出资金计划科目
QFilter qFilter = new QFilter("shjh_biztype", QCP.equals,"A");//业务类型:付款
//公司范围_多选基础资料 && 不包含公司范围
DynamicObject openorg = bill.getDynamicObject("openorg");
if (null != openorg) {
Long orgid = openorg.getLong("id");
QFilter q1 = new QFilter("shjh_companys.fbasedataid", QCP.equals, orgid);//包含公司
QFilter q2 = new QFilter("shjh_companys.fbasedataid", QCP.equals, null);//in 或者配置表公司为空
QFilter q3 = new QFilter("shjh_bbhzz.fbasedataid", QCP.equals, orgid);//不包含公司
QFilter q4 = new QFilter("shjh_bbhzz.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4));
}
//业务大类 && 不包含业务大类
DynamicObject shjhBizbig = bill.getDynamicObject("shjh_bizbig");
if (null != shjhBizbig) {
Long shjhBizbigid = shjhBizbig.getLong("id");
QFilter q1 = new QFilter("shjh_bizbig.fbasedataid", QCP.equals, shjhBizbigid);//包含业务大类
QFilter q2 = new QFilter("shjh_bizbig.fbasedataid", QCP.equals, null);
QFilter q3 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, shjhBizbigid);//不包含业务大类
QFilter q4 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4));
}
//业务小类
DynamicObject shjhbizsmall = bill.getDynamicObject("shjh_bizsmall");
if (null != shjhbizsmall) {
Long shjhbizsmallid = shjhbizsmall.getLong("id");
QFilter q1 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, shjhbizsmallid);
QFilter q2 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2));
}
//成本中心 shjh_costcenter
DynamicObject shjhCostcenter = bill.getDynamicObject("shjh_costcenter");
if (null != shjhCostcenter) {
Long costcenterid = shjhCostcenter.getLong("id");
QFilter q1 = new QFilter("shjh_cc.fbasedataid", QCP.equals, costcenterid);
QFilter q2 = new QFilter("shjh_cc.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2));
}
//客户(bd_customer)||供应商(bd_supplier) 收款人id:payee
String payeetype = bill.getString("payeetype");//收款人类型
if ("bd_customer".equals(payeetype)) {
//客户 && 不包含客户
String payee = bill.getString("payee");
if (!StringUtils.isEmpty(payee)) {
Long customerOrSupplierLong = Long.valueOf(bill.getString("payee"));
QFilter q1 = new QFilter("shjh_bhkh.fbasedataid", QCP.equals, customerOrSupplierLong);//包含客户
QFilter q2 = new QFilter("shjh_bhkh.fbasedataid", QCP.equals, null);
QFilter q3 = new QFilter("shjh_bbhkh.fbasedataid", QCP.equals, customerOrSupplierLong);//不包含客户
QFilter q4 = new QFilter("shjh_bbhkh.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4));
}
}
if ("bd_supplier".equals(payeetype)) {
//供应商 && 不包含供应商
String payee = bill.getString("payee");
if (!StringUtils.isEmpty(payee)) {
Long customerOrSupplierLong = Long.valueOf(bill.getString("payee"));
QFilter q1 = new QFilter("shjh_bhgys.fbasedataid", QCP.equals, customerOrSupplierLong);//包含供应商
QFilter q2 = new QFilter("shjh_bhgys.fbasedataid", QCP.equals, null);
QFilter q3 = new QFilter("shjh_bbhgys.fbasedataid", QCP.equals, customerOrSupplierLong);//不包含供应商
QFilter q4 = new QFilter("shjh_bbhgys.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4));
}
}
//不包含币种 currency
DynamicObject currency = bill.getDynamicObject("currency");
if (null != currency) {
Long currencyid = currency.getLong("id");
QFilter q3 = new QFilter("shjh_bbhbz.fbasedataid", QCP.equals, currencyid);//不包含币种
QFilter q4 = new QFilter("shjh_bbhbz.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q3.or(q4));
}
//分录字段
DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entry");//付款明细
if (!entrys.isEmpty()) {
DynamicObject entry = entrys.get(0);
//会计科目 shjh_sapkjkm
DynamicObject shjhYym = entry.getDynamicObject("shjh_yym");
if (null != shjhYym) {
Long yymid = shjhYym.getLong("id");
QFilter q1 = new QFilter("shjh_yym.fbasedataid", QCP.equals, yymid);
QFilter q2 = new QFilter("shjh_yym.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2));
}
//原因码 shjh_yym
DynamicObject shjhSapkjkm = entry.getDynamicObject("shjh_sapkjkm");
if (null != shjhSapkjkm) {
Long kjkmid = shjhSapkjkm.getLong("id");
QFilter q1 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, kjkmid);
QFilter q2 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2));
}
//采购组shjh_procurementteam && 不包含采购组
String shjhBhcgz = entry.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 q1 = new QFilter("shjh_bhcgz.fbasedataid", QCP.equals, cgzid);//包含采购粗
QFilter q2 = new QFilter("shjh_bhcgz.fbasedataid", QCP.equals, null);
QFilter q3 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, cgzid);//不包含采购粗
QFilter q4 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, null);
qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4));
}
}
DynamicObject[] accounts = BusinessDataServiceHelper.load("shjh_pay_account", "id,shjh_membersubject", qFilter.toArray());
if (accounts.length > 1) {
// 根据生效日期,失效日期区间,判断当前时间满足的数据
Date currentDate = new Date();
QFilter startDateFilter = new QFilter("shjh_begindate", QCP.less_equals, currentDate);
QFilter endDateFilter = new QFilter("shjh_enddate", QCP.large_equals, currentDate);
QFilter newFilter = qFilter.and(startDateFilter).and(endDateFilter);
//优先级为高的
accounts = BusinessDataServiceHelper.load("shjh_pay_account", "id", newFilter.toArray(),"shjh_priority");
}
if (accounts.length > 0) {
// 处理找到符合条件的账户
DynamicObject account = accounts[0];
account = BusinessDataServiceHelper.loadSingle(account.getPkValue(), "shjh_pay_account");
return account.getDynamicObject("shjh_membersubject");
} else {
log.info("没有找到符合条件的资金计划科目");
}
return null;
}
}

View File

@ -5,14 +5,12 @@ 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.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.bos.servicehelper.botp.BFTrackerServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.util.StringUtils;
import kd.sdk.plugin.Plugin;
@ -20,10 +18,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import static shjh.jhzj7.fi.fi.utils.SapUtils.fk_validation;
import static shjh.jhzj7.fi.fi.utils.SapUtils.sap_validation;
@ -198,119 +192,6 @@ public class PayBillSubmitOperation extends AbstractOperationServicePlugIn imple
return data;
}
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
//付款单提交之后 付款标识为被动付款,并且资金计划科目为空,从配置表(shjh_pay_account)携带资金计划科目
DynamicObject[] dataEntities = e.getDataEntities();
for (DynamicObject bill : dataEntities) {
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(),"cas_paybill");
DynamicObject paymentidentify = bill.getDynamicObject("paymentidentify");
DynamicObject shjhMembersubject = bill.getDynamicObject("shjh_membersubject");
if (null != paymentidentify && null == shjhMembersubject) {
String paymentidentifyNumber = paymentidentify.getString("number");
if ("FKBS02".equals(paymentidentifyNumber)) {
//根据配置表携带资金计划科目
bill.set("shjh_membersubject", xdMembersubject(bill));
SaveServiceHelper.save(new DynamicObject[]{bill});
}
}
}
}
private DynamicObject xdMembersubject(DynamicObject bill){
//付款单系统自动根据配置表(shjh_pay_account)带出资金计划科目
QFilter qFilter = new QFilter("shjh_biztype", QCP.equals,"A");//业务类型:付款
//公司范围_多选基础资料
DynamicObject openorg = bill.getDynamicObject("openorg");
if (null != openorg) {
Long orgid = openorg.getLong("id");
QFilter q1 = new QFilter("shjh_companys.fbasedataid", QCP.equals, orgid);
qFilter = qFilter.and(q1);
}
//业务大类
DynamicObject shjhBizbig = bill.getDynamicObject("shjh_bizbig");
if (null != shjhBizbig) {
Long shjhBizbigid = shjhBizbig.getLong("id");
QFilter q2 = new QFilter("shjh_bizbig.fbasedataid", QCP.equals, shjhBizbigid);
qFilter = qFilter.and(q2);
}
//业务小类
DynamicObject shjhbizsmall = bill.getDynamicObject("shjh_bizsmall");
if (null != shjhbizsmall) {
Long shjhbizsmallid = shjhbizsmall.getLong("id");
QFilter q3 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, shjhbizsmallid);
qFilter = qFilter.and(q3);
}
//成本中心 shjh_costcenter
DynamicObject shjhCostcenter = bill.getDynamicObject("shjh_costcenter");
if (null != shjhCostcenter) {
Long costcenterid = shjhCostcenter.getLong("id");
QFilter q4 = new QFilter("shjh_cc.fbasedataid", QCP.equals, costcenterid);
qFilter = qFilter.and(q4);
}
//原因码 shjh_yym
//会计科目 shjh_sapkjkm
DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entry");//付款明细
if (!entrys.isEmpty()) {
DynamicObject entry = entrys.get(0);
DynamicObject shjhYym = entry.getDynamicObject("shjh_yym");
if (null != shjhYym) {
Long yymid = shjhYym.getLong("id");
QFilter q5 = new QFilter("shjh_yym.fbasedataid", QCP.equals, yymid);
qFilter = qFilter.and(q5);
}
DynamicObject shjhSapkjkm = entry.getDynamicObject("shjh_sapkjkm");
if (null != shjhSapkjkm) {
Long kjkmid = shjhSapkjkm.getLong("id");
QFilter q6 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, kjkmid);
qFilter = qFilter.and(q6);
}
}
DynamicObject[] accounts = BusinessDataServiceHelper.load("shjh_pay_account", "id,shjh_membersubject", qFilter.toArray());
if (accounts.length > 1) {
// 根据生效日期,失效日期区间,判断当前时间满足的数据
Date currentDate = new Date();
QFilter startDateFilter = new QFilter("shjh_begindate", QCP.less_equals, currentDate);
QFilter endDateFilter = new QFilter("shjh_enddate", QCP.large_equals, currentDate);
QFilter newFilter = qFilter.and(startDateFilter).and(endDateFilter);
accounts = BusinessDataServiceHelper.load("shjh_pay_account", "id", newFilter.toArray());
}
if (accounts.length > 0) {
// 处理找到符合条件的账户
DynamicObject account = accounts[0];
account = BusinessDataServiceHelper.loadSingle(account.getPkValue(), "shjh_pay_account");
return account.getDynamicObject("shjh_membersubject");
} else {
log.info("没有找到符合条件的资金计划科目");
}
return null;
}
/**
*
* @param entity 当前单据标识
* @param entity1 上查的单据标识
* @param billId 当前单据ID
* @return
*/
private static Long up(String entity,String entity1,Long billId) {
Map<String, HashSet<Long>> sourceBills = BFTrackerServiceHelper.findSourceBills(entity, new Long[]{billId});
HashSet<Long> longs = sourceBills.get(entity1);
if(longs!=null){
for (int i = 0; i < longs.size(); i++) {
Iterator<Long> iterator = longs.iterator();
Long next = iterator.next();
return next;
}
}
return null;
}
}

View File

@ -150,12 +150,12 @@ public class PaybillOperation extends AbstractOperationServicePlugIn implements
}
// header.put("FM_ExpenseTypeCode", FM_ExpenseTypeCode);// 业务大类编码(EQ49,EQ44,EQ1101)
header.put("FM_ExpenseTypeCode", "EQ44");// 业务大类编码(EQ49,EQ44,EQ1101)
//todo:EQ1101 -- QT0401QT0402
// EQ1101 -- QT0401QT0402
// EQ44 -- ZZ1001
// EQ49 -- ZZ1301ZZ1302ZZ1303ZZ1304
header.put("FM_CurrencyCode", "RMB");// 币种编码默认:RMB
header.put("FM_RequestName", bill.getString("description"));// todo:单据主题_拼接
header.put("FM_RequestName", bill.getString("description"));// 单据主题_拼接
header.put("FM_AttachUrl", null);//附件URL地址:array
header.put("FM_BudType", 0);//预算类别0-组织预算,1-全年预算,当前只处理0 int
header.put("Remark", bill.getString("description"));// 事项描述_摘要
@ -221,7 +221,7 @@ public class PaybillOperation extends AbstractOperationServicePlugIn implements
// jsonObject.put("FM_ExpenseItemCode", FM_ExpenseItemCode);// 业务小类编码
jsonObject.put("FM_ExpenseItemCode", "ZZ1001");// todo:业务小类编码
// todo:税率编码(传J0时发票类型选INVOICE003)参考附表 @余学良 根据业务类型来默认吧
// 税率编码(传J0时发票类型选INVOICE003)参考附表 @余学良 根据业务类型来默认吧
// 我们到时候会增加一个 代付款专票这样的大类这个大类传 专票其他大类 默认 其他发票类型税率0
jsonObject.put("FM_InvoiceTypeCode", "INVOICE003");// 发票类型编码(普票:INVOICE001,专票:INVOICE002其它票据:INVOICE003)
jsonObject.put("FM_TaxRateCode", "J0");

View File

@ -34,7 +34,7 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
@Override
public void dealToDo(MessageContext messageContext, ToDoInfo toDoInfo) {
//select * from t_wf_operationlog where fbillno = '测试:待办推送致远(1106-1915)'
//todo 待办推送第三方,节点审批通过或者驳回到某节点时都会进入(dealToDo)方法,代码如何判断该节点是驳回还是审批通过
//待办推送第三方,节点审批通过或者驳回到某节点时都会进入(dealToDo)方法,代码如何判断该节点是驳回还是审批通过
System.out.println("dealToDo");
// 构建第三方数据映射 流程处理状态0:待办,2已办,4办结 流程查看状态0:未读,1已读
Map<String, Object> thirdPartyMap = buildThirdPartyMap(messageContext, toDoInfo, "2", "1");

View File

@ -153,8 +153,6 @@ public class ApplyBillControler {
}
ap_payapply.set(currencyType, currency);
}
//todo:申请金额折结算币别
// 申请金额 , 汇率 , 申请金额折结算币别
BigDecimal amount =BigDecimal.ZERO;
String[][] fieldInfo = {
@ -337,7 +335,7 @@ public class ApplyBillControler {
QFilter qq2 = new QFilter("number", QCP.equals, "JH002");//对私
DynamicObject paytype_g = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{qq1});
DynamicObject paytype_s = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{qq2});
//todo:付款类型 外部系统单据类型
//付款类型 外部系统单据类型
if (fkBillNum.contains("JKY")) {
ap_payapply.set("shjh_externalsystemdocume","A");//员工借款单
ap_payapply_entry.set("e_paymenttype", paytype_s);//对私

View File

@ -52,6 +52,7 @@ public class VouchernumControler {
return handleErrorAndReturn("费控-SAP付款凭证号接口入参异常" + e.getMessage(), Apimenthod, null);
}
List<PaybillVoucherNumModel.EntryBean> items = paybillVouchertbill.getItems();
String fkBillNum = null;
for (PaybillVoucherNumModel.EntryBean item : items) {
String companyNum = item.getCompanyNum();//公司编号_对应金蝶财务组织
String fkBillID = item.getFkBillID();//费控单据主表ID
@ -73,7 +74,7 @@ public class VouchernumControler {
if (org == null) {
return handleErrorAndReturn("同步失败,凭证号:" + voucherNum + "的组织编码不存在", voucherNum, jsonBodyString);
}
//select * from T_CAS_PaymentBill where fk_shjh_fkbillid = 'BC0321B1-4E34-4A1F-B8EF-A6B6480A7D6C'
//获取付款单
QFilter q1 = new QFilter("openorg.number", QCP.equals, companyNum);
QFilter q2 = new QFilter("shjh_fkbillid", QCP.equals, fkBillID);
@ -100,7 +101,10 @@ public class VouchernumControler {
paybill.set("shjh_credentialnum",voucherNum);//SAP付款凭证号
paybill.set("shjh_voucherdate",formattedDateAsDate);//SAP凭证过账日期
fkBillNum = paybill.getString("billno");
SaveServiceHelper.save(new DynamicObject[]{paybill});
// 可以添加更多的错误处理逻辑如记录到数据库等
JhzjUtils.saveLog(fkBillNum, Apimenthod, jsonBodyString, "凭证号反写成功", true, "API");
}
return CustomApiResult.success(null);
}