From fff338d889eb9fe426ced8a965f72f08fedeaa65 Mon Sep 17 00:00:00 2001 From: yuxueliang0813 <407010292@qq.com> Date: Wed, 14 May 2025 12:19:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E6=AC=BEsap=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E3=80=81=E7=BA=A2=E5=8D=95=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E5=B7=B2=E6=8E=A8=E9=80=81sap=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fi/plugin/form/ClearBillFormPlugin.java | 4 +- .../form/RecBillChangeListExtendPlugin.java | 76 ++++++++++--------- .../plugin/operate/RecBillSaveOperation.java | 9 +-- 3 files changed, 45 insertions(+), 44 deletions(-) diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearBillFormPlugin.java b/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearBillFormPlugin.java index 46b7b2b..1a2a12c 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearBillFormPlugin.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearBillFormPlugin.java @@ -106,8 +106,8 @@ public class ClearBillFormPlugin extends AbstractBillPlugIn implements Plugin { //上述两句应该可以跳过权限验证 //如下代码设置目标界面打开时的高度和宽度 StyleCss styleCss = new StyleCss(); - styleCss.setWidth("80%"); - styleCss.setHeight("60%"); + styleCss.setWidth("85%"); + styleCss.setHeight("75%"); showParameter.getOpenStyle().setInlineStyleCss(styleCss); //设置页面ID diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillChangeListExtendPlugin.java b/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillChangeListExtendPlugin.java index bd9300a..1065613 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillChangeListExtendPlugin.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillChangeListExtendPlugin.java @@ -88,7 +88,7 @@ public class RecBillChangeListExtendPlugin extends AbstractListPlugin implements // 凭证号非空 if (SapUtils.isEmpty(voucherNum)) { - this.getView().showTipNotification("所选单据不满足变更条件,SAP凭证号≠空。"); + this.getView().showTipNotification("所选单据未推送SAP,不需要变更。"); evt.setCancel(true); return; } @@ -118,6 +118,7 @@ public class RecBillChangeListExtendPlugin extends AbstractListPlugin implements } } } else { + //未关联下游业务时 this.getView().showTipNotification("所选单据不满足变更条件,下游未关联清账单。"); evt.setCancel(true); return; @@ -136,54 +137,55 @@ public class RecBillChangeListExtendPlugin extends AbstractListPlugin implements evt.setCancel(true); return; } - - // SAP 清账状态校验 - String billNumber = recBill.getString("billno"); String companyCode = recBill.getString("org.number"); String sapFiscalYear = recBill.getString("shjh_sapfiscalyear");//SAP收款凭证会计年度 -// String sapLineNumber = recBill.getString("shjh_sapline"); - //此时不传行号给sap,sap返回这个凭证下的所有行清账标识,我方解析,只要有一行是已清账,就提示 - String response = SapUtils.querySapClearAccountsState(billNumber, companyCode, voucherNum, sapFiscalYear); - if (response != null) { - try { - JSONObject json = JSONObject.parseObject(response); - String code = json.getString("code"); - if (!"0".equals(code)) { - this.getView().showTipNotification("SAP收款凭证清账状态查询接口调用失败,错误信息:"+json.getString("msg")); - 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; - } + if(!"A".equals(qzState)){ + //SAP清账状态校验-如果是无需金蝶清账时,不用去调用sap校验接口 + String billNumber = recBill.getString("billno"); + //String sapLineNumber = recBill.getString("shjh_sapline"); + //此时不传行号给sap,sap返回这个凭证下的所有行清账标识,我方解析,只要有一行是已清账,就提示 + String response = SapUtils.querySapClearAccountsState(billNumber, companyCode, voucherNum, sapFiscalYear); + if (response != null) { + try { + JSONObject json = JSONObject.parseObject(response); + String code = json.getString("code"); + if (!"0".equals(code)) { + this.getView().showTipNotification("SAP收款凭证清账状态查询接口调用失败,错误信息:"+json.getString("msg")); + 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{ - this.getView().showTipNotification("SAP收款凭证清账状态查询接口返回值未包含IT_ITEMS"); + }else{ + 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); return; } - } catch (Exception e) { - logger.error("SAP收款凭证清账状态查询接口解析异常:" + e.getMessage(), e); - this.getView().showTipNotification("SAP收款凭证清账状态查询接口查询失败,无法完成校验"); + }else{ + this.getView().showTipNotification("SAP收款凭证清账状态查询接口返回值为空"); evt.setCancel(true); return; } - }else{ - this.getView().showTipNotification("SAP收款凭证清账状态查询接口返回值为空"); - evt.setCancel(true); - return; } - // 是否存在付款申请单 + //校验当前收款单是否存在付款申请单,防止退票后再次付款的情况 QFilter[] filters = new QFilter[]{ new QFilter("applyorg.number", QCP.equals, companyCode), new QFilter("shjh_vouchernum", QCP.equals, voucherNum),//sap应付凭证号 diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java index b6a08e2..fdcc7cc 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java @@ -13,7 +13,6 @@ import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.sdk.plugin.Plugin; -import java.math.BigDecimal; import java.util.*; /** @@ -37,7 +36,6 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme } bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(),"cas_recbill"); - // DynamicObject planClass = bill.getDynamicObject("shjh_planclass"); // if (null == planClass) { //根据配置表携带资金计划科目 @@ -49,10 +47,11 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme carryCustomer(bill); SaveServiceHelper.save(new DynamicObject[]{bill}); - //若源单为收款处理,清空单据头.SAP凭证号;单据头.是否已推送SAP;单据头.SAP会计年度 cas_recbill + //若源单为收款处理 认领通知单,清空单据头.是否已推送SAP;单据头.SAP凭证号;单据头.SAP会计年度任保留方便后续推红冲凭证 cas_recbill String sourcebilltype = bill.getString("sourcebilltype"); - if ("cas_recbill".equals(sourcebilltype) || "收款单".equals(sourcebilltype)) { - BigDecimal sourcebillid = bill.getBigDecimal("sourcebillid"); + if ("cas_recbill".equals(sourcebilltype) || "cas_claimcenterbill".equals(sourcebilltype) || + "收款单".equals(sourcebilltype) || "认领通知单".equals(sourcebilltype)) { + long sourcebillid = bill.getLong("sourcebillid"); QFilter q1 = new QFilter("id", QCP.equals, sourcebillid); DynamicObject[] load = BusinessDataServiceHelper.load("cas_recbill", "id,billno,shjh_vouchernum,shjh_sapfiscalyear,shjh_ispushsap,shjh_issourceblue", q1.toArray());