###
- [x] 优化收款单携带资金计划科目的逻辑 - [x] 优化付款申请单携带资金计划科目的逻辑(不包含单据类型) - [x] 费控推送付款申请增加字段(业务大小类) --s
This commit is contained in:
		
							parent
							
								
									1197af0625
								
							
						
					
					
						commit
						feafef3c15
					
				|  | @ -38,9 +38,6 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem | |||
|         DynamicObject[] dataEntities = e.getDataEntities(); | ||||
|         for (DynamicObject bill : dataEntities) { | ||||
|             bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(),"ap_payapply"); | ||||
| //            DynamicObject shjhMembersubject = xdMembersubject(bill); | ||||
| //            bill.set("shjh_membersubject", shjhMembersubject); | ||||
| //            SaveServiceHelper.save(new DynamicObject[]{bill}); | ||||
| 
 | ||||
|             String sourcesystem = bill.getString("shjh_sourcesystem");//来源系统:SAP | ||||
|             boolean shjhSapwhetherlocking = bill.getBoolean("shjh_sapwhetherlocking");//SAP是否锁定:未锁定 | ||||
|  | @ -78,9 +75,9 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem | |||
|                     //成功:更新状态 | ||||
|                     bill.set("shjh_sapwhetherlocking", true); | ||||
|                     //SAP应付凭证生成付款申请单后,系统自动根据配置表带出资金计划科目 | ||||
|                     DynamicObject shjhMembersubject = xdMembersubject(bill); | ||||
|                     bill.set("shjh_membersubject", shjhMembersubject); | ||||
|                     SaveServiceHelper.save(new DynamicObject[]{bill}); | ||||
| //                    DynamicObject shjhMembersubject = xdMembersubject(bill); | ||||
| //                    bill.set("shjh_membersubject", shjhMembersubject); | ||||
| //                    SaveServiceHelper.save(new DynamicObject[]{bill}); | ||||
|                     this.operationResult.addSuccessPkId(bill.getPkValue()); | ||||
|                 } | ||||
|             } | ||||
|  | @ -351,7 +348,7 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem | |||
| 
 | ||||
|             String bbhdjlx = account.getString("shjh_bbhdjlx"); | ||||
|             // 不包含单据类型_包含剔除 | ||||
|             if (bbhdjlx.contains(shjhExternalsystemdocume)) { | ||||
|             if (bbhdjlx.contains(shjhExternalsystemdocume)&& StringUtils.isNotEmpty(shjhExternalsystemdocume)) { | ||||
|                 iterator.remove(); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ import kd.bos.servicehelper.operation.SaveServiceHelper; | |||
| import kd.bos.util.StringUtils; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.util.Date; | ||||
| import java.util.*; | ||||
| 
 | ||||
| /** | ||||
|  * 付款单保存操作 | ||||
|  | @ -135,7 +135,7 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme | |||
|             Long shjhBizbigid = shjhBizbig.getLong("id"); | ||||
|             QFilter q1 = new QFilter("shjh_bizbig.fbasedataid", QCP.equals, shjhBizbigid);//包含业务大类 | ||||
|             QFilter q2 = new QFilter("shjh_bizbig.fbasedataid", QCP.equals, null); | ||||
|             QFilter q3 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, shjhBizbigid);//不包含业务大类 | ||||
|             QFilter q3 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.not_equals, shjhBizbigid);//不包含业务大类 | ||||
|             QFilter q4 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, null); | ||||
|             qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4)); | ||||
|         }else { | ||||
|  | @ -205,6 +205,7 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme | |||
|             qFilter = qFilter.and(q3.or(q4)); | ||||
|         } | ||||
| 
 | ||||
|         String shjhBhcgz = ""; | ||||
|         //分录字段 | ||||
|         DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entry");//付款明细 | ||||
|         if (!entrys.isEmpty()) { | ||||
|  | @ -223,29 +224,17 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme | |||
|             //会计科目 shjh_sapkjkm | ||||
|             DynamicObject shjhSapkjkm = entry.getDynamicObject("shjh_sapkjkm"); | ||||
|             if (null != shjhSapkjkm) { | ||||
|                 Long kjkmid = shjhSapkjkm.getLong("id"); | ||||
|                 QFilter q1 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, kjkmid); | ||||
|                 QFilter q2 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, null); | ||||
| //                Long kjkmid = shjhSapkjkm.getLong("id"); | ||||
|                 QFilter q1 = new QFilter("shjh_kjkm.fbasedataid.number", QCP.equals, shjhSapkjkm.getString("number")); | ||||
|                 QFilter q2 = new QFilter("shjh_kjkm.fbasedataid.number", QCP.equals, null); | ||||
|                 qFilter = qFilter.and(q1.or(q2)); | ||||
|             }else{ | ||||
|                 QFilter q2 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, null); | ||||
|                 QFilter q2 = new QFilter("shjh_kjkm.fbasedataid.number", QCP.equals, null); | ||||
|                 qFilter = qFilter.and(q2); | ||||
|             } | ||||
|             //采购组shjh_procurementteam && 不包含采购组 | ||||
|             String shjhBhcgz = entry.getString("shjh_procurementteam"); | ||||
|             QFilter filter = new QFilter("number", QCP.equals, shjhBhcgz); | ||||
|             DynamicObject shjh_cgz = BusinessDataServiceHelper.loadSingle("shjh_cgz", filter.toArray()); | ||||
|             if (null != shjh_cgz) { | ||||
|                 Long cgzid = shjh_cgz.getLong("id"); | ||||
|                 QFilter q1 = new QFilter("shjh_bhcgz.fbasedataid", QCP.equals, cgzid);//包含采购粗 | ||||
|                 QFilter q2 = new QFilter("shjh_bhcgz.fbasedataid", QCP.equals, null); | ||||
|                 QFilter q3 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, cgzid);//不包含采购粗 | ||||
|                 QFilter q4 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, null); | ||||
|                 qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4)); | ||||
|             }else{ | ||||
|                 QFilter q2 = new QFilter("shjh_bhcgz.fbasedataid", QCP.equals, null); | ||||
|                 qFilter = qFilter.and(q2); | ||||
|             } | ||||
|             shjhBhcgz = entry.getString("shjh_procurementteam"); | ||||
| 
 | ||||
|         }else { | ||||
|             QFilter q2 = new QFilter("shjh_yym.fbasedataid", QCP.equals, null); | ||||
|             QFilter q3 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, null); | ||||
|  | @ -253,7 +242,8 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme | |||
|             qFilter = qFilter.and(q2).and(q3).and(q4); | ||||
|         } | ||||
| 
 | ||||
|         DynamicObject[] accounts = BusinessDataServiceHelper.load("shjh_pay_account", "id,shjh_membersubject", qFilter.toArray()); | ||||
|         DynamicObject[] accounts = BusinessDataServiceHelper.load("shjh_request_account", "id," + | ||||
|                 "shjh_membersubject,shjh_bhcgz,shjh_bbhcgz", qFilter.toArray()); | ||||
|         if (accounts.length > 1) { | ||||
|             // 根据生效日期,失效日期区间,判断当前时间满足的数据 | ||||
| //            Date currentDate = new Date(); | ||||
|  | @ -264,9 +254,50 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme | |||
|             //优先级为高的 | ||||
|             accounts = BusinessDataServiceHelper.load("shjh_pay_account", "id", newFilter.toArray(),"shjh_priority"); | ||||
|         } | ||||
|         if (accounts.length > 0) { | ||||
| 
 | ||||
|         // 转换为 List 以便支持 remove 操作 | ||||
|         List<DynamicObject> configList = new ArrayList<>(Arrays.asList(accounts)); | ||||
| 
 | ||||
|         // 采购组shjh_procurementteam && 不包含采购组 | ||||
|         QFilter filter = new QFilter("number", QCP.equals, shjhBhcgz); | ||||
|         DynamicObject shjh_cgz = BusinessDataServiceHelper.loadSingle("shjh_cgz", filter.toArray()); | ||||
| 
 | ||||
|         if (shjh_cgz != null) { | ||||
|             long cgzid = shjh_cgz.getLong("id"); | ||||
|             Iterator<DynamicObject> iterator = configList.iterator(); | ||||
|             while (iterator.hasNext()) { | ||||
|                 DynamicObject account = iterator.next(); | ||||
|                 // 检查采购组 | ||||
|                 boolean isbh = false; | ||||
|                 DynamicObjectCollection shjh_cgzs = account.getDynamicObjectCollection("shjh_bhcgz"); | ||||
|                 for (DynamicObject shjhCgz : shjh_cgzs) { | ||||
|                     DynamicObject fbasedataid = shjhCgz.getDynamicObject("fbasedataid"); | ||||
|                     if (fbasedataid != null && fbasedataid.getLong("id") == cgzid) { | ||||
|                         isbh = true; | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|                 if (!isbh && !shjh_cgzs.isEmpty()) { | ||||
|                     iterator.remove(); | ||||
|                     continue; | ||||
|                 } | ||||
| 
 | ||||
|                 // 检查不包含采购组 | ||||
|                 DynamicObjectCollection shjh_bbhcgzs = account.getDynamicObjectCollection("shjh_bbhcgz"); | ||||
|                 for (DynamicObject shjhBbhcgz : shjh_bbhcgzs) { | ||||
|                     DynamicObject fbasedataid = shjhBbhcgz.getDynamicObject("fbasedataid"); | ||||
|                     if (fbasedataid != null && fbasedataid.getLong("id") == cgzid) { | ||||
|                         iterator.remove(); | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (!configList.isEmpty()) { | ||||
|             // 处理找到符合条件的账户 | ||||
|             DynamicObject account = accounts[0]; | ||||
|             DynamicObject account = configList.get(0); | ||||
|             account = BusinessDataServiceHelper.loadSingle(account.getPkValue(), "shjh_pay_account"); | ||||
|             return account.getDynamicObject("shjh_membersubject"); | ||||
|         } else { | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ import kd.bos.orm.query.QCP; | |||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.OperationServiceHelper; | ||||
| import kd.bos.util.StringUtils; | ||||
| import shjh.jhzj7.fi.fi.utils.JhzjUtils; | ||||
| import shjh.jhzj7.fi.fi.webapi.model.ApiResultPayApplyExt; | ||||
| import shjh.jhzj7.fi.fi.webapi.model.ApplyBillModel; | ||||
|  | @ -433,6 +434,20 @@ public class ApplyBillControler { | |||
|         ap_payapply.set("shjh_sapuniquevalue",fkBillID + fkEntryID);//费控唯一值 :费控表头ID+费控分录ID | ||||
|         ap_payapply.set("shjh_transferremark", applybill.getTransferRemark());//转账附言 20250512 yxl | ||||
| 
 | ||||
|         //业务大类 | ||||
|         String bizbig = applybill.getBizbig(); | ||||
|         if (StringUtils.isNotEmpty(bizbig)) { | ||||
|             DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("shjh_bizbigtype", new QFilter[]{new QFilter("shjh_fknumber", QCP.equals, bizbig)}); | ||||
|             ap_payapply.set("shjh_bizbig", dynamicObject); | ||||
|         } | ||||
| 
 | ||||
|         //业务小类 | ||||
|         String bizsmall = applybill.getBizsmall(); | ||||
|         if (StringUtils.isNotEmpty(bizsmall)) { | ||||
|             DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("shjh_bizsmalltype", new QFilter[]{new QFilter("shjh_fknumber", QCP.equals, bizsmall)}); | ||||
|             ap_payapply.set("shjh_basedatafield", dynamicObject); | ||||
|         } | ||||
| 
 | ||||
|         OperateOption option= OperateOption.create(); | ||||
|         option.setVariableValue(OperateOptionConst.IGNOREWARN, String.valueOf(true)); // 不执行警告级别校验器 | ||||
|         // 新增数据 | ||||
|  |  | |||
|  | @ -59,6 +59,26 @@ public class ApplyBillModel implements Serializable { | |||
|     private String paymenttype; | ||||
|     @ApiParam(value="转账附言",required=false,position=26) | ||||
|     private String transferRemark; | ||||
|     @ApiParam(value="业务大类",required=false,position=27) | ||||
|     private String bizbig; | ||||
|     @ApiParam(value="业务小类",required=false,position=28) | ||||
|     private String bizsmall; | ||||
| 
 | ||||
|     public String getBizbig() { | ||||
|         return bizbig; | ||||
|     } | ||||
| 
 | ||||
|     public void setBizbig(String bizbig) { | ||||
|         this.bizbig = bizbig; | ||||
|     } | ||||
| 
 | ||||
|     public String getBizsmall() { | ||||
|         return bizsmall; | ||||
|     } | ||||
| 
 | ||||
|     public void setBizsmall(String bizsmall) { | ||||
|         this.bizsmall = bizsmall; | ||||
|     } | ||||
| 
 | ||||
|     public String getTransferRemark() { | ||||
|         return transferRemark; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue