请款申请
This commit is contained in:
		
							parent
							
								
									336efdb5ec
								
							
						
					
					
						commit
						12f86885fc
					
				|  | @ -10,6 +10,7 @@ import kd.bos.entity.plugin.args.BeforeOperationArgs; | ||||||
| import kd.bos.entity.validate.AbstractValidator; | import kd.bos.entity.validate.AbstractValidator; | ||||||
| import kd.bos.logging.Log; | import kd.bos.logging.Log; | ||||||
| import kd.bos.logging.LogFactory; | import kd.bos.logging.LogFactory; | ||||||
|  | import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||||
| import kd.sdk.plugin.Plugin; | import kd.sdk.plugin.Plugin; | ||||||
| import kd.tmc.fbp.common.bean.BizBalanceModelBean; | import kd.tmc.fbp.common.bean.BizBalanceModelBean; | ||||||
| import kd.tmc.fbp.common.enums.TmcAppEnum; | import kd.tmc.fbp.common.enums.TmcAppEnum; | ||||||
|  | @ -37,30 +38,35 @@ public class ApplyTransBillSaveOperation extends AbstractOperationServicePlugIn | ||||||
|                     ExtendedDataEntity[] entities = this.getDataEntities(); |                     ExtendedDataEntity[] entities = this.getDataEntities(); | ||||||
|                     for (ExtendedDataEntity entity : entities) { |                     for (ExtendedDataEntity entity : entities) { | ||||||
|                         DynamicObject aDo = entity.getDataEntity(); |                         DynamicObject aDo = entity.getDataEntity(); | ||||||
|                         DynamicObject currency = aDo.getDynamicObject("currency"); |                         boolean revAmount = aDo.getBoolean("shjh_revamount");//是否已赋值 | ||||||
|                         Long currencyId = currency.getLong("id"); |                         if (!revAmount){ | ||||||
|                         DynamicObject org = aDo.getDynamicObject("company"); |                             DynamicObject currency = aDo.getDynamicObject("currency"); | ||||||
|                         Long orgId = org.getLong("id"); |                             Long currencyId = currency.getLong("id"); | ||||||
|                         String balanceType = TmcParameterHelper.getAppStringParameter(TmcAppEnum.FCS.getId(), orgId, "balancevalue"); |                             DynamicObject org = aDo.getDynamicObject("company"); | ||||||
|                         BalanceModelService balanceModelService = new BalanceModelService(); |                             Long orgId = org.getLong("id"); | ||||||
|  |                             String balanceType = TmcParameterHelper.getAppStringParameter(TmcAppEnum.FCS.getId(), orgId, "balancevalue"); | ||||||
|  |                             BalanceModelService balanceModelService = new BalanceModelService(); | ||||||
| 
 | 
 | ||||||
|                         DynamicObjectCollection entrys = aDo.getDynamicObjectCollection("entrys"); |                             DynamicObjectCollection entrys = aDo.getDynamicObjectCollection("entrys"); | ||||||
|                         for (DynamicObject entry : entrys) { |                             for (DynamicObject entry : entrys) { | ||||||
|  |                                 DynamicObject bankAcct = entry.getDynamicObject("subacct"); | ||||||
| 
 | 
 | ||||||
|                             DynamicObject bankAcct = entry.getDynamicObject("subacct"); |                                 DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(bankAcct.getLong("id"), "bd_accountbanks"); | ||||||
|                             BizBalanceModelBean bizBalanceModelBean = balanceModelService.getRunningBalance(balanceType, bankAcct.getLong("id"), currencyId); |                                 BizBalanceModelBean bizBalanceModelBean = balanceModelService.getRunningBalance(balanceType, bankAcct.getLong("id"), currencyId); | ||||||
|                             BigDecimal subcurbalance = bizBalanceModelBean.getAmount();//子账户即时余额 |                                 BigDecimal subcurbalance = bizBalanceModelBean.getAmount();//子账户即时余额 | ||||||
|                             BigDecimal applyamt = entry.getBigDecimal("applyamt");//申请下拨金额 |                                 //请款留底金额 | ||||||
|                             // 如果subcurbalance小于applyamt,则调整applyamt的值 |                                 BigDecimal decimal =dynamicObject.getBigDecimal("shjh_ldje"); | ||||||
|                             if (subcurbalance.compareTo(applyamt) >= 0) { |                                 BigDecimal applyamt = entry.getBigDecimal("applyamt");//申请下拨金额 | ||||||
|                                 this.addMessage(entity,"子账户即时余额 >= 申请下拨金额,不允许生成请款单!"); |                                 // 如果subcurbalance小于applyamt,则调整applyamt的值 | ||||||
|  |                                 if ((subcurbalance.subtract(decimal)).compareTo(applyamt) >= 0) { | ||||||
|  |                                     this.addMessage(entity,"子账户即时余额-请款留底金额 >= 申请下拨金额,不允许生成请款单!"); | ||||||
|  |                                 } | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  | @ -71,26 +77,33 @@ public class ApplyTransBillSaveOperation extends AbstractOperationServicePlugIn | ||||||
|         if("save".equals(eok)){ |         if("save".equals(eok)){ | ||||||
|             DynamicObject[] dos =  e.getDataEntities(); |             DynamicObject[] dos =  e.getDataEntities(); | ||||||
|             for (DynamicObject aDo : dos) { |             for (DynamicObject aDo : dos) { | ||||||
|                 DynamicObject currency = aDo.getDynamicObject("currency"); |                 boolean revAmount = aDo.getBoolean("shjh_revamount");//是否已赋值 | ||||||
|                 Long currencyId = currency.getLong("id"); |                 if (!revAmount) { | ||||||
|                 DynamicObject org = aDo.getDynamicObject("company"); |                     DynamicObject currency = aDo.getDynamicObject("currency"); | ||||||
|                 Long orgId = org.getLong("id"); |                     Long currencyId = currency.getLong("id"); | ||||||
|                 String balanceType = TmcParameterHelper.getAppStringParameter(TmcAppEnum.FCS.getId(), orgId, "balancevalue"); |                     DynamicObject org = aDo.getDynamicObject("company"); | ||||||
|                 BalanceModelService balanceModelService = new BalanceModelService(); |                     Long orgId = org.getLong("id"); | ||||||
|  |                     String balanceType = TmcParameterHelper.getAppStringParameter(TmcAppEnum.FCS.getId(), orgId, "balancevalue"); | ||||||
|  |                     BalanceModelService balanceModelService = new BalanceModelService(); | ||||||
| 
 | 
 | ||||||
|                 DynamicObjectCollection entrys = aDo.getDynamicObjectCollection("entrys"); |                     DynamicObjectCollection entrys = aDo.getDynamicObjectCollection("entrys"); | ||||||
|                 for (DynamicObject entry : entrys) { |                     for (DynamicObject entry : entrys) { | ||||||
| 
 | 
 | ||||||
|                     DynamicObject bankAcct = entry.getDynamicObject("subacct"); |                         DynamicObject bankAcct = entry.getDynamicObject("subacct"); | ||||||
|                     BizBalanceModelBean bizBalanceModelBean = balanceModelService.getRunningBalance(balanceType, bankAcct.getLong("id"), currencyId); |                         DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(bankAcct.getLong("id"), "bd_accountbanks"); | ||||||
|                     BigDecimal subcurbalance = bizBalanceModelBean.getAmount();//子账户即时余额 |  | ||||||
| 
 | 
 | ||||||
|  |                         BizBalanceModelBean bizBalanceModelBean = balanceModelService.getRunningBalance(balanceType, bankAcct.getLong("id"), currencyId); | ||||||
|  |                         BigDecimal subcurbalance = bizBalanceModelBean.getAmount();//子账户即时余额 | ||||||
|  |                         //请款留底金额 | ||||||
|  |                         BigDecimal decimal = dynamicObject.getBigDecimal("shjh_ldje"); | ||||||
| //                    BigDecimal subcurbalance = entry.getBigDecimal("subcurbalance");//子账户即时余额 | //                    BigDecimal subcurbalance = entry.getBigDecimal("subcurbalance");//子账户即时余额 | ||||||
|                     BigDecimal applyamt = entry.getBigDecimal("applyamt");//申请下拨金额 |                         BigDecimal applyamt = entry.getBigDecimal("applyamt");//申请下拨金额 | ||||||
|                     // 如果subcurbalance小于applyamt,则调整applyamt的值 |                         // 如果subcurbalance小于applyamt,则调整applyamt的值 | ||||||
|                     if (subcurbalance.compareTo(applyamt) < 0) { |                         if (subcurbalance.subtract(decimal).compareTo(applyamt) < 0) { | ||||||
|                         applyamt = applyamt.subtract(subcurbalance); |                             applyamt = applyamt.subtract(subcurbalance).add(decimal); | ||||||
|                         entry.set("applyamt", applyamt);//重新赋值--申请下拨金额 |                             entry.set("applyamt", applyamt);//重新赋值--申请下拨金额 | ||||||
|  |                             aDo.set("shjh_revamount",true); | ||||||
|  |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue