收款sap校验接口、红单清除已推送sap标记
This commit is contained in:
		
							parent
							
								
									a7905fb2df
								
							
						
					
					
						commit
						fff338d889
					
				|  | @ -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 | ||||
|  |  | |||
|  | @ -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应付凭证号 | ||||
|  |  | |||
|  | @ -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()); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue