电子回单查询、收款单是否需要下推清账

This commit is contained in:
yuxueliang0813 2025-05-12 10:44:12 +08:00
parent 4a58f7f3eb
commit 6270a9f153
4 changed files with 63 additions and 56 deletions

View File

@ -26,7 +26,7 @@ import shjh.jhzj7.fi.fi.utils.JhzjUtils;
import java.util.*;
/**
* 动态表单插件-科目初始化 shjh_init_account
* 表单插件-科目初始化 shjh_kjacctinit
* @author yuxueliang
*/
public class InitAccountFormPlugin extends AbstractFormPlugin {
@ -74,7 +74,7 @@ public class InitAccountFormPlugin extends AbstractFormPlugin {
acctInfo.set("dc", 1);//余额方向 默认为借
acctInfo.set("level", 1);//级次 默认为1
acctInfo.set("isleaf", false);//明细科目 默认为否
acctInfo.set("startdate", new Date());//版本化日期
acctInfo.set("startdate", TypeUtils.castToDate("2024-01-01"));//版本化日期
acctInfo.set("enddate", TypeUtils.castToDate("2999-12-31"));//失效日期
acctInfo.set("accrualdirection", "nocontrol");//科目录入方向控制 不控制nocontrol 借方debit 贷方credit
acctInfo.set("orgcontrollevel", 1);//控制级次 默认为1
@ -169,7 +169,7 @@ public class InitAccountFormPlugin extends AbstractFormPlugin {
acctInfo.set("dc", 1);//余额方向 默认为借
acctInfo.set("level", 2);//级次 默认为2
acctInfo.set("isleaf", true);//明细科目 默认为是
acctInfo.set("startdate", new Date());//版本化日期
acctInfo.set("startdate", TypeUtils.castToDate("2024-01-01"));//版本化日期
acctInfo.set("enddate", TypeUtils.castToDate("2999-12-31"));//失效日期
acctInfo.set("accrualdirection", "nocontrol");//科目录入方向控制 不控制nocontrol 借方debit 贷方credit
acctInfo.set("orgcontrollevel", 1);//控制级次 默认为1
@ -471,7 +471,7 @@ public class InitAccountFormPlugin extends AbstractFormPlugin {
newAcctInfo.set("dc", 1);//余额方向 默认为借
newAcctInfo.set("level", olddo.getInt("level"));//级次 根据源科目来设置
newAcctInfo.set("isleaf", true);//明细科目 默认为是
newAcctInfo.set("startdate", new Date());//版本化日期
newAcctInfo.set("startdate", TypeUtils.castToDate("2024-01-01"));//版本化日期
newAcctInfo.set("enddate", TypeUtils.castToDate("2999-12-31"));//失效日期
newAcctInfo.set("accrualdirection", "nocontrol");//科目录入方向控制 不控制nocontrol 借方debit 贷方credit
newAcctInfo.set("orgcontrollevel", 1);//控制级次 默认为1

View File

@ -2,12 +2,8 @@ package shjh.jhzj7.fi.fi.plugin.form;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.entity.LocaleString;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.EntityMetadataCache;
import kd.bos.entity.ValueMapItem;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.entity.property.ComboProp;
import kd.bos.form.control.events.BeforeItemClickEvent;
import kd.bos.form.events.ClosedCallBackEvent;
import kd.bos.form.plugin.AbstractFormPlugin;
@ -18,7 +14,6 @@ import kd.sdk.plugin.Plugin;
import shjh.jhzj7.fi.fi.plugin.form.info.RecFieldsInfo;
import java.util.EventObject;
import java.util.List;
/**
* 表单插件-收款单
@ -159,8 +154,18 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin {
//监听分录客户
//当客户拆分=是时,使用分录行客户入账
else if (StringUtils.equals(fieldKey, "shjh_entrycustomer")) {
//结构性清账客户+业务小类同时满足允许下推清账明细判断 yxl 20250512
DynamicObject bizSmall = (DynamicObject) this.getModel().getValue("shjh_bizsmall");
boolean isdpdqz = false;
if (null != bizSmall) {
//当收款单业务小类清账方式字段=待判断清账
if ("dpdqz".equals(bizSmall.getString("shjh_qzfs"))) {
isdpdqz = true;
}
}
DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entry");
if (null != entryEntity) {
if (null != entryEntity && isdpdqz) {
for (int i = 0; i < entryEntity.size(); i++) {
QFilter number = new QFilter("shjh_customer.number", QCP.equals, entryEntity.get(i).getString("shjh_entrycustomer.number"));
DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", number.toArray());

View File

@ -28,7 +28,6 @@ import shjh.jhzj7.fi.fi.utils.JhzjUtils;
import shjh.jhzj7.fi.fi.webapi.model.AccountModel;
import javax.validation.Valid;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -162,7 +161,7 @@ public class AspAccountControler {
acctInfo.set("dc", 1);//余额方向 默认为借
acctInfo.set("level", 2);//级次 默认为2
acctInfo.set("isleaf", true);//明细科目 默认为是
acctInfo.set("startdate", new Date());//版本化日期
acctInfo.set("startdate", TypeUtils.castToDate("2024-01-01"));//版本化日期
acctInfo.set("enddate", TypeUtils.castToDate("2999-12-31"));//失效日期
acctInfo.set("accrualdirection", "nocontrol");//科目录入方向控制 不控制nocontrol 借方debit 贷方credit
acctInfo.set("orgcontrollevel", 1);//控制级次 默认为1
@ -372,7 +371,7 @@ public class AspAccountControler {
newAcctInfo.set("dc", 1);//余额方向 默认为借
newAcctInfo.set("level", olddo.getInt("level"));//级次 根据源科目来设置
newAcctInfo.set("isleaf", true);//明细科目 默认为是
newAcctInfo.set("startdate", new Date());//版本化日期
newAcctInfo.set("startdate", TypeUtils.castToDate("2024-01-01"));//版本化日期
newAcctInfo.set("enddate", TypeUtils.castToDate("2999-12-31"));//失效日期
newAcctInfo.set("accrualdirection", "nocontrol");//科目录入方向控制 不控制nocontrol 借方debit 贷方credit
newAcctInfo.set("orgcontrollevel", 1);//控制级次 默认为1
@ -457,7 +456,7 @@ public class AspAccountControler {
acctInfo.set("dc", 1);//余额方向 默认为借
acctInfo.set("level", 1);//级次 默认为1
acctInfo.set("isleaf", false);//明细科目 默认为否
acctInfo.set("startdate", new Date());//版本化日期
acctInfo.set("startdate", TypeUtils.castToDate("2024-01-01"));//版本化日期
acctInfo.set("enddate", TypeUtils.castToDate("2999-12-31"));//失效日期
acctInfo.set("accrualdirection", "nocontrol");//科目录入方向控制 不控制nocontrol 借方debit 贷方credit
acctInfo.set("orgcontrollevel", 1);//控制级次 默认为1

View File

@ -68,7 +68,7 @@ public class PayreceiptQueryControler {
DynamicObject org = loadOrgByCompanyNum(companyNum);
if (org == null) {
return handleErrorAndReturn("查询失败,费控单据编号:" + fkBillNumber + "的组织编码不存在", fkBillNumber, jsonBodyString,apiResultExt);
handleError("查询失败,费控单据编号:" + fkBillNumber + "的组织编码不存在", fkBillNumber, jsonBodyString);
}
QFilter q1 = new QFilter("openorg.number", QCP.equals, companyNum);//公司编号
@ -81,24 +81,29 @@ public class PayreceiptQueryControler {
q1 = addFilterIfNotEmpty(q1, "shjh_credentialnum", voucherNum);//付款凭证号
q1 = addFilterIfNotEmpty(q1, "shjh_sapfiscalyear", voucherYear);//付款凭证年份
DynamicObject paybill = BusinessDataServiceHelper.loadSingle(paybillName, new QFilter[]{q1});
if (null == paybill) {
return handleErrorAndReturn("查询失败:付款单不存在", fkEntryID, jsonBodyString,apiResultExt);
}
//申明此次查询的返回值
ApiResultExt.EntryBean entryBean = new ApiResultExt.EntryBean();
entryBean.setCompanyNum(companyNum);//公司编号
entryBean.setKdPayBillID(String.valueOf(paybill.getPkValue()));//金蝶付款单ID
entryBean.setFkBillID(paybill.getString("shjh_fkbillid"));//费控单据主表ID
entryBean.setFkEntryID(paybill.getString("shjh_fkentryid"));//费控单据分录ID
entryBean.setKdPayBillID(kdPayBillID);//金蝶付款单ID
entryBean.setFkBillID(fkBillID);//费控单据主表ID
entryBean.setFkEntryID(fkEntryID);//费控单据分录ID
entryBean.setFkBillNumber(fkBillNumber);//费控单据编号
entryBean.setVoucherNum(voucherNum);//付款凭证号
entryBean.setVoucherYear(voucherYear);//付款凭证会计年度
entryBean.setReceipturl("");//电子回单路径
entryBeans.add(entryBean);
if (null == paybill) {
handleError("查询失败:付款单不存在", fkEntryID, jsonBodyString);
continue;
}
//查询电子回单,返回pdf url
//1.付款单查询明细
DynamicObjectCollection bankcheckentity = paybill.getDynamicObjectCollection("bankcheckentity");//交易明细分录
if (!bankcheckentity.isEmpty()) {
for (DynamicObject dynamicObject : bankcheckentity) {
String edetailbillno = dynamicObject.getString("edetailbillno");//交易明细编号
// for (DynamicObject dynamicObject : bankcheckentity) {
// }
String edetailbillno = bankcheckentity.get(0).getString("edetailbillno");//交易明细编号
QFilter qFilter = new QFilter("billno", QCP.equals, edetailbillno);
//被动付款入账-交易明细
DynamicObject beiIntelpay = BusinessDataServiceHelper.loadSingle(detailName,
@ -136,26 +141,24 @@ public class PayreceiptQueryControler {
// }
} catch (Exception var11) {
logger.error("电子回单获取文件路径异常: " + var11.getMessage());
return handleErrorAndReturn("查询失败:电子回单获取文件路径异常", receiptNo, jsonBodyString,apiResultExt);
handleError("查询失败:电子回单获取文件路径异常", receiptNo, jsonBodyString);
}
} else {
logger.warn(receiptNo + "回单为非文件类回单");
return handleErrorAndReturn("查询失败:回单为非文件类回单", receiptNo, jsonBodyString,apiResultExt);
handleError("查询失败:回单为非文件类回单", receiptNo, jsonBodyString);
}
}else{
return handleErrorAndReturn("查询失败:电子回单不存在", eReceiptid+"", jsonBodyString,apiResultExt);
handleError("查询失败:电子回单不存在", eReceiptid+"", jsonBodyString);
}
}else{
return handleErrorAndReturn("查询失败:交易明细未关联电子回单", edetailbillno, jsonBodyString,apiResultExt);
handleError("查询失败:交易明细未关联电子回单", edetailbillno, jsonBodyString);
}
}else{
return handleErrorAndReturn("查询失败:交易明细编号不存在", edetailbillno, jsonBodyString,apiResultExt);
}
handleError("查询失败:交易明细编号不存在", edetailbillno, jsonBodyString);
}
}else{
return handleErrorAndReturn("查询失败:付款单未关联交易明细", fkEntryID, jsonBodyString,apiResultExt);
handleError("查询失败:付款单未关联交易明细", fkEntryID, jsonBodyString);
}
entryBeans.add(entryBean);
}
return handleSuccessAndReturn(apiResultExt, entryBeans);
}