合同非定额计算逻辑插件1.2
This commit is contained in:
		
							parent
							
								
									8c70d425b2
								
							
						
					
					
						commit
						b554b09adb
					
				| 
						 | 
				
			
			@ -4,6 +4,8 @@ import kd.bos.dataentity.entity.DynamicObject;
 | 
			
		|||
import kd.bos.dataentity.entity.DynamicObjectCollection;
 | 
			
		||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
 | 
			
		||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
 | 
			
		||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
 | 
			
		||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.math.RoundingMode;
 | 
			
		||||
| 
						 | 
				
			
			@ -13,8 +15,25 @@ public class CalculationQuotaListOpPlugin extends AbstractOperationServicePlugIn
 | 
			
		|||
    @Override
 | 
			
		||||
    public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
 | 
			
		||||
        super.beforeExecuteOperationTransaction(e);
 | 
			
		||||
        DynamicObject[] dataEntities1 = e.getDataEntities();
 | 
			
		||||
        DynamicObject dynamicObject = dataEntities1[0];
 | 
			
		||||
        try {
 | 
			
		||||
            boolean util = util(e.getDataEntities()[0]);
 | 
			
		||||
            if(!util){
 | 
			
		||||
                e.setCancel(true);
 | 
			
		||||
                e.setCancelMessage("非定额清单的数量必填");
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }catch (Exception e1){
 | 
			
		||||
            DynamicObject dataEntity = e.getDataEntities()[0];
 | 
			
		||||
            dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(),"recon_contractbill");
 | 
			
		||||
            boolean util = util(dataEntity);
 | 
			
		||||
            if(!util){
 | 
			
		||||
                e.setCancel(true);
 | 
			
		||||
                e.setCancelMessage("非定额清单的数量必填");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private boolean util(DynamicObject dynamicObject){
 | 
			
		||||
        DynamicObjectCollection qeug_orderformentry = dynamicObject.getDynamicObjectCollection("qeug_orderformentry");
 | 
			
		||||
        for (int i = 0; qeug_orderformentry!=null&&i < qeug_orderformentry.size(); i++) {
 | 
			
		||||
            DynamicObject dynamicObject1 = qeug_orderformentry.get(i);
 | 
			
		||||
| 
						 | 
				
			
			@ -32,9 +51,7 @@ public class CalculationQuotaListOpPlugin extends AbstractOperationServicePlugIn
 | 
			
		|||
            }
 | 
			
		||||
            boolean qty1 = returnComperZero(qty);//数量
 | 
			
		||||
            if(!qty1){
 | 
			
		||||
                e.setCancel(true);
 | 
			
		||||
                e.setCancelMessage("非定额清单的数量必填");
 | 
			
		||||
                return;
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            boolean noTaxPrice = returnComperZero(qeug_exclusiveprice);//不含税
 | 
			
		||||
            boolean TaxPrice = returnComperZero(qeug_taxprice);//含税
 | 
			
		||||
| 
						 | 
				
			
			@ -131,7 +148,14 @@ public class CalculationQuotaListOpPlugin extends AbstractOperationServicePlugIn
 | 
			
		|||
                qeug_taxtotalprice = qty.multiply(qeug_taxprice);
 | 
			
		||||
                dynamicObject1.set("qeug_taxtotalprice", qeug_taxtotalprice);
 | 
			
		||||
            }
 | 
			
		||||
            qeug_orderformentry.set(i, dynamicObject1);
 | 
			
		||||
        }
 | 
			
		||||
//        dynamicObject.set("qeug_orderformentry",qeug_orderformentry);
 | 
			
		||||
//        if("submit".equals(e.getOperationKey())){
 | 
			
		||||
//            SaveServiceHelper.save(new DynamicObject[]{dynamicObject});
 | 
			
		||||
//
 | 
			
		||||
//        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private boolean returnComperZero(BigDecimal bigDecimal){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue