2、收款单的收款人变更后,触发下推标记更新 3、手动定时拉取sap应付凭证 合作银行类型为空带供应商一条银行(多条也需要测试) 4、收款单下推清账单自动生成清账明细单

This commit is contained in:
yuxueliang0813 2025-07-04 18:39:42 +08:00
parent 02e9989768
commit 317edd2a6c
6 changed files with 114 additions and 5 deletions

View File

@ -170,8 +170,50 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin {
} }
} }
} }
//结构性清账客户+业务小类全部金蝶清账同时满足时才允许下推清账明细判断 yxl 20250512
DynamicObject bizSmall = (DynamicObject) this.getModel().getValue("shjh_bizsmall");
boolean iskdqbqz = false;//全部金蝶清账标识
if (null != bizSmall) {
//当收款单业务小类清账方式字段=全部金蝶清账
if ("qbjdqz".equals(bizSmall.getString("shjh_qzfs"))) {
iskdqbqz = true;
}
}
DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entry");
if(iskdqbqz){
for (int i = 0; i < entryEntity.size(); i++) {
this.getModel().setValue("shjh_needpushbill", false, i);//不需要下推清账单
this.getModel().setValue("shjh_closingstatus", "A", i);//无需金蝶清账
}
if (null != value && "bd_customer".equals(type)) {
DynamicObject currentorg = (DynamicObject) this.getModel().getValue("org");//单据所属当前公司
QFilter mapnumber = new QFilter("shjh_customer.id", QCP.equals, value);
mapnumber.and("enable", QCP.equals, "1");//是否可用
mapnumber.and("shjh_org.id", QCP.equals, currentorg.getLong("id"));//公司
DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", mapnumber.toArray());
if (null != mappingObj) {
for (int i = 0; i < entryEntity.size(); i++) {
this.getModel().setValue("shjh_needpushbill", true, i);//需要下推清账单
this.getModel().setValue("shjh_closingstatus", "B", i);//待清账
}
} else {
for (int i = 0; i < entryEntity.size(); i++) {
this.getModel().setValue("shjh_needpushbill", false, i);//不需要下推清账单
this.getModel().setValue("shjh_closingstatus", "A", i);//无需金蝶清账
}
}
}
}else{
//业务小类清账方式字段 != 全部金蝶清账
for (int i = 0; i < entryEntity.size(); i++) {
this.getModel().setValue("shjh_needpushbill", false, i);//不需要下推清账单
this.getModel().setValue("shjh_closingstatus", "A", i);//无需金蝶清账
}
}
this.getView().updateView(); this.getView().updateView();
} }
}else if (StringUtils.equals(fieldKey, "shjh_bizsmall")) { }else if (StringUtils.equals(fieldKey, "shjh_bizsmall")) {
//监听业务小类 //监听业务小类
//付款人类型=客户或者其他都可以根据业务小类的清账方式来判断 //付款人类型=客户或者其他都可以根据业务小类的清账方式来判断

View File

@ -607,7 +607,7 @@ public class SappzFormPlugin extends AbstractFormPlugin {
ap_payapply_entry.set("e_bebank", bank);//开户银行 ap_payapply_entry.set("e_bebank", bank);//开户银行
ap_payapply_entry.set("shjh_asstactrealname", accountname);//账户名称 ap_payapply_entry.set("shjh_asstactrealname", accountname);//账户名称
ispp = true; ispp = true;
}else if(!EsbUtils.isEmpty(assacct) && bankentrys.size() > 1){ }else if(!EsbUtils.isEmpty(assacct)){
for (DynamicObject bankentry : bankentrys) { for (DynamicObject bankentry : bankentrys) {
if (assacct.equals(bankentry.getString("shjh_banktype"))) { if (assacct.equals(bankentry.getString("shjh_banktype"))) {
String bankaccount = bankentry.getString("bankaccount"); String bankaccount = bankentry.getString("bankaccount");

View File

@ -37,6 +37,8 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
//更新单据状态为作废 //更新单据状态为作废
private static final String updateInvalidStatus = "update tk_shjh_clear_account set fbillstatus='D' where fid=?;"; private static final String updateInvalidStatus = "update tk_shjh_clear_account set fbillstatus='D' where fid=?;";
//更新下推明细单结果
private static final String updatePushStatus = "update tk_shjh_clear_account set fk_shjh_pushdetail=? where fid=?;";
//更新单据状态为已提交 //更新单据状态为已提交
private static final String updateSubmitStatus = "update tk_shjh_clear_account set fbillstatus='B' where fid=?;"; private static final String updateSubmitStatus = "update tk_shjh_clear_account set fbillstatus='B' where fid=?;";
//手动修改清账状态 //手动修改清账状态
@ -126,6 +128,9 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
super.afterExecuteOperationTransaction(e); super.afterExecuteOperationTransaction(e);
String eok = e.getOperationKey(); String eok = e.getOperationKey();
switch (eok) { switch (eok) {
case "save":
handleClear(e);//保存-触发下推清账明细单
break;
case "clearacctount": case "clearacctount":
handleClear(e);//清账-下推清账明细单 handleClear(e);//清账-下推清账明细单
break; break;
@ -320,6 +325,11 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
List<Long> receivers = new ArrayList<>(1); List<Long> receivers = new ArrayList<>(1);
for (int i = 0; i < dos.length; i++) { for (int i = 0; i < dos.length; i++) {
prinfo = BusinessDataServiceHelper.loadSingle(dos[i].getPkValue(), dos[i].getDataEntityType().getName()); prinfo = BusinessDataServiceHelper.loadSingle(dos[i].getPkValue(), dos[i].getDataEntityType().getName());
//判断下推明细单结果如果不是下推成功则处理否则不处理
if("A".equals(prinfo.getString("shjh_pushdetail"))){
continue;
}
//判断当前清账单是否由收款单补推如果是则根据清账单上的被通知人进行通知否则根据配置表 //判断当前清账单是否由收款单补推如果是则根据清账单上的被通知人进行通知否则根据配置表
userinfo = prinfo.getDynamicObject("shjh_noticeuser"); userinfo = prinfo.getDynamicObject("shjh_noticeuser");
if(userinfo != null){ if(userinfo != null){
@ -344,6 +354,8 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
qFilter.and("shjh_org", QCP.equals, prinfo.getDynamicObject("org").getLong("id")); qFilter.and("shjh_org", QCP.equals, prinfo.getDynamicObject("org").getLong("id"));
pzbs = BusinessDataServiceHelper.load(pzbName, "id", qFilter.toArray(), "modifytime desc"); pzbs = BusinessDataServiceHelper.load(pzbName, "id", qFilter.toArray(), "modifytime desc");
if (pzbs.length == 0) { if (pzbs.length == 0) {
//更新清账单下推明细单结果
DB.update(DBRoute.of("fi"), updatePushStatus, new Object[]{"B", prinfo.getPkValue()});
addErrorInfo(prinfo,"根据结构性清账客户映射表未找到对应通知人,无法下推清账明细单"); addErrorInfo(prinfo,"根据结构性清账客户映射表未找到对应通知人,无法下推清账明细单");
continue; continue;
} }
@ -364,6 +376,8 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
String pcurl = JhzjUtils.getBillPCURL(detailinfo); String pcurl = JhzjUtils.getBillPCURL(detailinfo);
JhzjUtils.sendEmail("请登录资金系统操作清账明细单", detailinfo.getString("billno") + JhzjUtils.sendEmail("请登录资金系统操作清账明细单", detailinfo.getString("billno") +
"<br> 详情页面 <a href='"+pcurl+"' target='_blank'>"+pcurl+"</a>", receivers, detailinfo); "<br> 详情页面 <a href='"+pcurl+"' target='_blank'>"+pcurl+"</a>", receivers, detailinfo);
//更新清账单下推明细单结果
DB.update(DBRoute.of("fi"), updatePushStatus, new Object[]{"A", prinfo.getPkValue()});
} }
} }
} }
@ -799,6 +813,56 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
} }
private void handleNotice(AfterOperationArgs e) { private void handleNotice(AfterOperationArgs e) {
//通知具体实现 //通知具体实现 防止OA待办未发送成功的情况
DynamicObject[] dos = e.getDataEntities();
DynamicObject prinfo;//清账单
DynamicObject detailinfo;//清账明细单
QFilter qFilter;
DynamicObject[] pzbs;
DynamicObject pzbinfo;//配置表
DynamicObject userinfo;//被通知用户
DynamicObjectCollection users;//配置表中的被通知人集合
for (int i = 0; i < dos.length; i++) {
prinfo = BusinessDataServiceHelper.loadSingle(dos[i].getPkValue(), dos[i].getDataEntityType().getName());
//判断当前清账单是否由收款单补推如果是则根据清账单上的被通知人进行通知否则根据配置表
userinfo = prinfo.getDynamicObject("shjh_noticeuser");
if(userinfo != null){
//根据清账单id和创建人id判断清账明细单是否已生成
qFilter = new QFilter("shjh_clearbillid", QCP.equals, prinfo.getString("id"));
qFilter.and("creator", QCP.equals, userinfo.getLong("id"));
detailinfo = BusinessDataServiceHelper.loadSingle(entityName, qFilter.toArray());
if (detailinfo != null) {
//发送清账明细单的OA待办
JhzjUtils.handleOA(detailinfo, "0", "0");
}
}else{
//根据客户公司是否可用找到对应的被通知人员可能多个
qFilter = new QFilter("enable", QCP.equals, "1");
qFilter.and("shjh_customer", QCP.equals, prinfo.getDynamicObject("shjh_customer").getLong("id"));
qFilter.and("shjh_org", QCP.equals, prinfo.getDynamicObject("org").getLong("id"));
pzbs = BusinessDataServiceHelper.load(pzbName, "id", qFilter.toArray(), "modifytime desc");
if (pzbs.length == 0) {
//更新清账单下推明细单结果
addErrorInfo(prinfo,"根据结构性清账客户映射表未找到对应通知人无法发送OA待办");
continue;
}
pzbinfo = BusinessDataServiceHelper.loadSingle(pzbs[0].getLong("id"), pzbName);
users = pzbinfo.getDynamicObjectCollection("shjh_users");
for (DynamicObject user : users) {
userinfo = user.getDynamicObject("fbasedataid");//fbasedataid
//根据清账单id和创建人id判断清账明细单是否已生成
qFilter = new QFilter("shjh_clearbillid", QCP.equals, prinfo.getString("id"));
qFilter.and("creator", QCP.equals, userinfo.getLong("id"));
detailinfo = BusinessDataServiceHelper.loadSingle(entityName, qFilter.toArray());
if (detailinfo != null) {
//发送清账明细单的OA待办
JhzjUtils.handleOA(detailinfo, "0", "0");
}
}
}
//处理完成提示
this.operationResult.addSuccessPkId(prinfo.getPkValue());
}
} }
} }

View File

@ -599,6 +599,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
*/ */
private void carryCustomerRule(DynamicObject entry,DynamicObject bill,String oppunit,Long companyId){ private void carryCustomerRule(DynamicObject entry,DynamicObject bill,String oppunit,Long companyId){
//1.先看取映射表按钮是否打开打开>取映射表中客户 //1.先看取映射表按钮是否打开打开>取映射表中客户
//20250704 经过和建彪沟通先注释根据标记来判断的代码
// boolean shjhEGetcustomer = entry.getBoolean("shjh_e_getcustomer"); //取规则得映射表客户标记 // boolean shjhEGetcustomer = entry.getBoolean("shjh_e_getcustomer"); //取规则得映射表客户标记
// if (shjhEGetcustomer) { // if (shjhEGetcustomer) {
QFilter qFilter = new QFilter("shjh_dfhm", QCP.equals, oppunit); QFilter qFilter = new QFilter("shjh_dfhm", QCP.equals, oppunit);

View File

@ -54,7 +54,9 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
int daysBefore = Integer.parseInt(lq1);//临期_前 int daysBefore = Integer.parseInt(lq1);//临期_前
int daysAfter = Integer.parseInt(lq);//临期_后 int daysAfter = Integer.parseInt(lq);//临期_后
int totalDays = daysBefore + daysAfter;//总天数后面按照每30天调用一次接口 int totalDays = daysBefore + daysAfter;//总天数后面按照每30天调用一次接口
//计算按照30天为一个循环需要循环的次数 int callInterval = 30; // 调用间隔天数
// 计算调用次数向上取整
int callCount = (int) Math.ceil((double) totalDays / callInterval);
// 计算开始日期临期_前表示今天之前的天数 // 计算开始日期临期_前表示今天之前的天数
LocalDate startDate = currentDate; LocalDate startDate = currentDate;
@ -357,7 +359,7 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
ap_payapply_entry.set("e_bebank", bank);//开户银行 ap_payapply_entry.set("e_bebank", bank);//开户银行
ap_payapply_entry.set("shjh_asstactrealname", accountname);//账户名称 ap_payapply_entry.set("shjh_asstactrealname", accountname);//账户名称
ispp = true; ispp = true;
}else if(!EsbUtils.isEmpty(assacct) && bankentrys.size() > 1){ }else if(!EsbUtils.isEmpty(assacct)){
for (DynamicObject bankentry : bankentrys) { for (DynamicObject bankentry : bankentrys) {
if (assacct.equals(bankentry.getString("shjh_banktype"))) { if (assacct.equals(bankentry.getString("shjh_banktype"))) {
String bankaccount = bankentry.getString("bankaccount"); String bankaccount = bankentry.getString("bankaccount");

View File

@ -730,7 +730,7 @@ public class ApplyAdjustBillControler {
ap_payapply_entry.set("e_bebank", bank);//开户银行 ap_payapply_entry.set("e_bebank", bank);//开户银行
ap_payapply_entry.set("shjh_asstactrealname", accountname);//账户名称 ap_payapply_entry.set("shjh_asstactrealname", accountname);//账户名称
ispp = true; ispp = true;
}else if(!EsbUtils.isEmpty(assacct) && bankentrys.size() > 1){ }else if(!EsbUtils.isEmpty(assacct)){
for (DynamicObject bankentry : bankentrys) { for (DynamicObject bankentry : bankentrys) {
if (assacct.equals(bankentry.getString("shjh_banktype"))) { if (assacct.equals(bankentry.getString("shjh_banktype"))) {
String bankaccount = bankentry.getString("bankaccount"); String bankaccount = bankentry.getString("bankaccount");