收款sap校验接口、红单清除已推送sap标记

This commit is contained in:
yuxueliang0813 2025-05-14 12:19:47 +08:00
parent a7905fb2df
commit fff338d889
3 changed files with 45 additions and 44 deletions

View File

@ -106,8 +106,8 @@ public class ClearBillFormPlugin extends AbstractBillPlugIn implements Plugin {
//上述两句应该可以跳过权限验证 //上述两句应该可以跳过权限验证
//如下代码设置目标界面打开时的高度和宽度 //如下代码设置目标界面打开时的高度和宽度
StyleCss styleCss = new StyleCss(); StyleCss styleCss = new StyleCss();
styleCss.setWidth("80%"); styleCss.setWidth("85%");
styleCss.setHeight("60%"); styleCss.setHeight("75%");
showParameter.getOpenStyle().setInlineStyleCss(styleCss); showParameter.getOpenStyle().setInlineStyleCss(styleCss);
//设置页面ID //设置页面ID

View File

@ -88,7 +88,7 @@ public class RecBillChangeListExtendPlugin extends AbstractListPlugin implements
// 凭证号非空 // 凭证号非空
if (SapUtils.isEmpty(voucherNum)) { if (SapUtils.isEmpty(voucherNum)) {
this.getView().showTipNotification("所选单据不满足变更条件SAP凭证号≠空"); this.getView().showTipNotification("所选单据未推送SAP不需要变更");
evt.setCancel(true); evt.setCancel(true);
return; return;
} }
@ -118,6 +118,7 @@ public class RecBillChangeListExtendPlugin extends AbstractListPlugin implements
} }
} }
} else { } else {
//未关联下游业务时
this.getView().showTipNotification("所选单据不满足变更条件,下游未关联清账单。"); this.getView().showTipNotification("所选单据不满足变更条件,下游未关联清账单。");
evt.setCancel(true); evt.setCancel(true);
return; return;
@ -136,54 +137,55 @@ public class RecBillChangeListExtendPlugin extends AbstractListPlugin implements
evt.setCancel(true); evt.setCancel(true);
return; return;
} }
// SAP 清账状态校验
String billNumber = recBill.getString("billno");
String companyCode = recBill.getString("org.number"); String companyCode = recBill.getString("org.number");
String sapFiscalYear = recBill.getString("shjh_sapfiscalyear");//SAP收款凭证会计年度 String sapFiscalYear = recBill.getString("shjh_sapfiscalyear");//SAP收款凭证会计年度
// String sapLineNumber = recBill.getString("shjh_sapline"); if(!"A".equals(qzState)){
//此时不传行号给sapsap返回这个凭证下的所有行清账标识我方解析只要有一行是已清账就提示 //SAP清账状态校验-如果是无需金蝶清账时不用去调用sap校验接口
String response = SapUtils.querySapClearAccountsState(billNumber, companyCode, voucherNum, sapFiscalYear); String billNumber = recBill.getString("billno");
if (response != null) { //String sapLineNumber = recBill.getString("shjh_sapline");
try { //此时不传行号给sapsap返回这个凭证下的所有行清账标识我方解析只要有一行是已清账就提示
JSONObject json = JSONObject.parseObject(response); String response = SapUtils.querySapClearAccountsState(billNumber, companyCode, voucherNum, sapFiscalYear);
String code = json.getString("code"); if (response != null) {
if (!"0".equals(code)) { try {
this.getView().showTipNotification("SAP收款凭证清账状态查询接口调用失败错误信息"+json.getString("msg")); JSONObject json = JSONObject.parseObject(response);
return; String code = json.getString("code");
} if (!"0".equals(code)) {
JSONObject data = json.getJSONObject("data"); this.getView().showTipNotification("SAP收款凭证清账状态查询接口调用失败错误信息"+json.getString("msg"));
JSONArray itItems = data.getJSONArray("IT_ITEMS"); return;
if (itItems != null && !itItems.isEmpty()) {
JSONObject resultItem;
for (int i = 0; i < itItems.size(); i++) {
resultItem = itItems.getJSONObject(i);
if ("Y".equalsIgnoreCase(resultItem.getString("ZCLEARED")) || "C".equalsIgnoreCase(resultItem.getString("ZCLEARED"))) {
//Y 已清账 C 已冲销
this.getView().showTipNotification("该收款单不满足变更条件该收款单对应的凭证已在SAP清账或冲销");
evt.setCancel(true);
return;
}
} }
JSONObject data = json.getJSONObject("data");
JSONArray itItems = data.getJSONArray("IT_ITEMS");
if (itItems != null && !itItems.isEmpty()) {
JSONObject resultItem;
for (int i = 0; i < itItems.size(); i++) {
resultItem = itItems.getJSONObject(i);
if ("Y".equalsIgnoreCase(resultItem.getString("ZCLEARED")) || "C".equalsIgnoreCase(resultItem.getString("ZCLEARED"))) {
//Y 已清账 C 已冲销
this.getView().showTipNotification("该收款单不满足变更条件该收款单对应的凭证已在SAP清账或冲销");
evt.setCancel(true);
return;
}
}
}else{ }else{
this.getView().showTipNotification("SAP收款凭证清账状态查询接口返回值未包含IT_ITEMS"); this.getView().showTipNotification("SAP收款凭证清账状态查询接口返回值未包含IT_ITEMS");
evt.setCancel(true);
return;
}
} catch (Exception e) {
logger.error("SAP收款凭证清账状态查询接口解析异常" + e.getMessage(), e);
this.getView().showTipNotification("SAP收款凭证清账状态查询接口查询失败无法完成校验");
evt.setCancel(true); evt.setCancel(true);
return; return;
} }
} catch (Exception e) { }else{
logger.error("SAP收款凭证清账状态查询接口解析异常" + e.getMessage(), e); this.getView().showTipNotification("SAP收款凭证清账状态查询接口返回值为空");
this.getView().showTipNotification("SAP收款凭证清账状态查询接口查询失败无法完成校验");
evt.setCancel(true); evt.setCancel(true);
return; return;
} }
}else{
this.getView().showTipNotification("SAP收款凭证清账状态查询接口返回值为空");
evt.setCancel(true);
return;
} }
// 是否存在付款申请单 //校验当前收款单是否存在付款申请单防止退票后再次付款的情况
QFilter[] filters = new QFilter[]{ QFilter[] filters = new QFilter[]{
new QFilter("applyorg.number", QCP.equals, companyCode), new QFilter("applyorg.number", QCP.equals, companyCode),
new QFilter("shjh_vouchernum", QCP.equals, voucherNum),//sap应付凭证号 new QFilter("shjh_vouchernum", QCP.equals, voucherNum),//sap应付凭证号

View File

@ -13,7 +13,6 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.sdk.plugin.Plugin; import kd.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
/** /**
@ -37,7 +36,6 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
} }
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(),"cas_recbill"); bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(),"cas_recbill");
// DynamicObject planClass = bill.getDynamicObject("shjh_planclass"); // DynamicObject planClass = bill.getDynamicObject("shjh_planclass");
// if (null == planClass) { // if (null == planClass) {
//根据配置表携带资金计划科目 //根据配置表携带资金计划科目
@ -49,10 +47,11 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
carryCustomer(bill); carryCustomer(bill);
SaveServiceHelper.save(new DynamicObject[]{bill}); SaveServiceHelper.save(new DynamicObject[]{bill});
//若源单为收款处理,清空单据头.SAP凭证号;单据头.是否已推送SAP;单据头.SAP会计年度 cas_recbill //若源单为收款处理 认领通知单,清空单据头.是否已推送SAP;单据头.SAP凭证号;单据头.SAP会计年度任保留方便后续推红冲凭证 cas_recbill
String sourcebilltype = bill.getString("sourcebilltype"); String sourcebilltype = bill.getString("sourcebilltype");
if ("cas_recbill".equals(sourcebilltype) || "收款单".equals(sourcebilltype)) { if ("cas_recbill".equals(sourcebilltype) || "cas_claimcenterbill".equals(sourcebilltype) ||
BigDecimal sourcebillid = bill.getBigDecimal("sourcebillid"); "收款单".equals(sourcebilltype) || "认领通知单".equals(sourcebilltype)) {
long sourcebillid = bill.getLong("sourcebillid");
QFilter q1 = new QFilter("id", QCP.equals, sourcebillid); QFilter q1 = new QFilter("id", QCP.equals, sourcebillid);
DynamicObject[] load = BusinessDataServiceHelper.load("cas_recbill", DynamicObject[] load = BusinessDataServiceHelper.load("cas_recbill",
"id,billno,shjh_vouchernum,shjh_sapfiscalyear,shjh_ispushsap,shjh_issourceblue", q1.toArray()); "id,billno,shjh_vouchernum,shjh_sapfiscalyear,shjh_ispushsap,shjh_issourceblue", q1.toArray());