Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
		
						commit
						6d981ff250
					
				|  | @ -1,6 +1,7 @@ | |||
| package zcgj.zcdev.zcdev.pr.plugin.form; | ||||
| 
 | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.dataentity.resource.ResManager; | ||||
| import kd.bos.dataentity.utils.StringUtils; | ||||
| import kd.bos.entity.datamodel.events.ChangeData; | ||||
|  | @ -46,6 +47,25 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin | |||
| //        } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void doLockFieldWithPriceAdjustMode(PriceAdjustModeEnum mode) { | ||||
|         super.doLockFieldWithPriceAdjustMode(mode); | ||||
|         int entryRowCount = this.getModel().getEntryRowCount("listentry"); | ||||
|         Boolean adjustoftax = (Boolean)this.getModel().getValue("zcgj_hsjell"); | ||||
|         int i; | ||||
|         if (adjustoftax) { | ||||
|             for(i = 0; i < entryRowCount; ++i) { | ||||
|                 this.getView().setEnable(false, i, new String[]{"curtaxprice", "currentprice"}); | ||||
|                 this.getView().setEnable(true, i, new String[]{"thisoftaxmount","thisqty"}); | ||||
|             } | ||||
|         }else{ | ||||
|             for(i = 0; i < entryRowCount; ++i) { | ||||
|                 this.getView().setEnable(true, i, new String[]{"curtaxprice", "currentprice"}); | ||||
|                 this.getView().setEnable(false, i, new String[]{"thisoftaxmount"}); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void doNewListEntry() { | ||||
|         { | ||||
|  | @ -134,57 +154,29 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin | |||
|         } else { | ||||
|             this.onDateChanged(changeData, propName); | ||||
|         } | ||||
| //        String name = e.getProperty().getName(); | ||||
| //        ChangeData changeData = e.getChangeSet()[0]; | ||||
| //        int rowIndex = changeData.getRowIndex(); | ||||
| //        int parentRowIndex = changeData.getParentRowIndex(); | ||||
| //        BigDecimal curtaxprice = BigDecimal.ZERO;//当前含税单价 | ||||
| //        BigDecimal currentprice = BigDecimal.ZERO;//当前单价 | ||||
| //        BigDecimal qty = BigDecimal.ZERO;//数量 | ||||
| //        BigDecimal taxrate = BigDecimal.ZERO;//税率 | ||||
| ////        if(name.equals("curtaxprice")||name.equals("currentprice")) { | ||||
| ////            if (parentRowIndex>=0&&rowIndex>=0){ | ||||
| ////                Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); | ||||
| ////                if (curtaxpriceobj != null) { | ||||
| ////                    curtaxprice = (BigDecimal) curtaxpriceobj; | ||||
| ////                } | ||||
| ////                Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex); | ||||
| ////                if (currentpriceobj != null) { | ||||
| ////                    currentprice = (BigDecimal) currentpriceobj; | ||||
| ////                    ; | ||||
| ////                } | ||||
| ////                Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex); | ||||
| ////                if (totalqtyibj != null) { | ||||
| ////                    qty = (BigDecimal) totalqtyibj; | ||||
| ////                } | ||||
| ////                Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); | ||||
| ////                if (entrytaxrateobj != null) { | ||||
| ////                    BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj; | ||||
| ////                    taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); | ||||
| ////                } | ||||
| ////                if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) { | ||||
| ////                    BigDecimal divide = curtaxprice.divide(taxrate,6, RoundingMode.HALF_UP);//当前单价 | ||||
| ////                    BigDecimal multiply = divide.multiply(qty);//当前金额 | ||||
| ////                    BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计 | ||||
| ////                    BigDecimal subtract = multiply1.subtract(multiply);//当前税额 | ||||
| //////                    this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex); | ||||
| ////                    this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价 | ||||
| ////                    this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 | ||||
| ////                    this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额 | ||||
| ////                    this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计 | ||||
| ////                } else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) { | ||||
| ////                    BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价 | ||||
| ////                    BigDecimal multiply = currentprice.multiply(qty);//当前金额 | ||||
| ////                    BigDecimal multiply1 = divide.multiply(qty);//当前价税合计 | ||||
| ////                    BigDecimal subtract = multiply1.subtract(multiply);//当前税额 | ||||
| ////                    this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价 | ||||
| ////                    this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 | ||||
| ////                    this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额 | ||||
| ////                    this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计 | ||||
| ////                } | ||||
| ////                this.getView().updateView(); | ||||
| ////            } | ||||
| //// | ||||
| //        } | ||||
|         int rowIndex = changeData.getRowIndex(); | ||||
|         int parentRowIndex = changeData.getParentRowIndex(); | ||||
|         if (StringUtils.equals(propName, "zcgj_hsjell")) { | ||||
|             doLockFieldWithPriceAdjustMode((PriceAdjustModeEnum)null); | ||||
|         } else if (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount")) { | ||||
|             BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex); | ||||
|             BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex); | ||||
|             BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex); | ||||
|             BigDecimal entrytaxrate =(BigDecimal) this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); | ||||
|             BigDecimal tax = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); | ||||
|             BigDecimal zero = new BigDecimal(0); | ||||
|             if (thisqty.compareTo(zero)>0 && thisoftaxmount.compareTo(zero)>0) { | ||||
|                 BigDecimal curtaxprice = thisoftaxmount.divide(thisqty,6,BigDecimal.ROUND_HALF_UP); | ||||
|                 BigDecimal currentprice = curtaxprice.divide(tax, 6, BigDecimal.ROUND_HALF_UP); | ||||
|                 DynamicObjectCollection listmodelentry = this.getModel().getDataEntity().getDynamicObjectCollection("listmodelentry"); | ||||
|                 DynamicObject listentry = listmodelentry.get(parentRowIndex).getDynamicObjectCollection("listentry").get(rowIndex); | ||||
|                 listentry.set("curtaxprice",curtaxprice); | ||||
|                 listentry.set("currentprice",currentprice); | ||||
|                 listentry.set("currentamt",currentprice.multiply(totalqty)); | ||||
|                 listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty))); | ||||
|                 listentry.set("currentoftax",curtaxprice.multiply(totalqty)); | ||||
|                 this.getView().updateView(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| package zcgj.zcdev.zcdev.pr.plugin.form; | ||||
| 
 | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.dataentity.resource.ResManager; | ||||
| import kd.bos.dataentity.utils.StringUtils; | ||||
| import kd.bos.entity.datamodel.events.ChangeData; | ||||
|  | @ -10,6 +11,7 @@ import kd.bos.form.ShowFormHelper; | |||
| import kd.bos.list.ListShowParameter; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.ec.contract.common.enums.PriceAdjustModeEnum; | ||||
| import kd.ec.contract.formplugin.InContractMeasureBillEditPlugin; | ||||
| import java.math.BigDecimal; | ||||
| import java.math.RoundingMode; | ||||
|  | @ -42,6 +44,27 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd | |||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void doLockFieldWithPriceAdjustMode(PriceAdjustModeEnum mode) { | ||||
|         super.doLockFieldWithPriceAdjustMode(mode); | ||||
|         int entryRowCount = this.getModel().getEntryRowCount("listentry"); | ||||
|         Boolean adjustoftax = (Boolean)this.getModel().getValue("zcgj_hsjell"); | ||||
|         int i; | ||||
|         if (adjustoftax) { | ||||
|             for(i = 0; i < entryRowCount; ++i) { | ||||
|                 this.getView().setEnable(false, i, new String[]{"curtaxprice", "currentprice"}); | ||||
|                 this.getView().setEnable(true, i, new String[]{"thisoftaxmount","thisqty"}); | ||||
|             } | ||||
|         }else{ | ||||
|             for(i = 0; i < entryRowCount; ++i) { | ||||
|                 this.getView().setEnable(true, i, new String[]{"curtaxprice", "currentprice"}); | ||||
|                 this.getView().setEnable(false, i, new String[]{"thisoftaxmount"}); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void doNewListEntry() { | ||||
|         { | ||||
|  | @ -149,58 +172,32 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd | |||
|     @Override | ||||
|     public void propertyChanged(PropertyChangedArgs e) { | ||||
|         super.propertyChanged(e); | ||||
| //        String name = e.getProperty().getName(); | ||||
| //        ChangeData changeData = e.getChangeSet()[0]; | ||||
| //        int rowIndex = changeData.getRowIndex(); | ||||
| //        int parentRowIndex = changeData.getParentRowIndex(); | ||||
| //        BigDecimal curtaxprice = BigDecimal.ZERO;//当前含税单价 | ||||
| //        BigDecimal currentprice = BigDecimal.ZERO;//当前单价 | ||||
| //        BigDecimal qty = BigDecimal.ZERO;//数量 | ||||
| //        BigDecimal taxrate = BigDecimal.ZERO;//税率 | ||||
| //        if(name.equals("curtaxprice")||name.equals("currentprice")) { | ||||
| //            if (parentRowIndex>=0&&rowIndex>=0){ | ||||
| //                Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); | ||||
| //                if (curtaxpriceobj != null) { | ||||
| //                    curtaxprice = (BigDecimal) curtaxpriceobj; | ||||
| //                } | ||||
| //                Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex); | ||||
| //                if (currentpriceobj != null) { | ||||
| //                    currentprice = (BigDecimal) currentpriceobj; | ||||
| //                    ; | ||||
| //                } | ||||
| //                Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex); | ||||
| //                if (totalqtyibj != null) { | ||||
| //                    qty = (BigDecimal) totalqtyibj; | ||||
| //                } | ||||
| //                Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); | ||||
| //                if (entrytaxrateobj != null) { | ||||
| //                    BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj; | ||||
| //                    taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); | ||||
| //                } | ||||
| //                if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) { | ||||
| //                    BigDecimal divide = curtaxprice.divide(taxrate,6,RoundingMode.HALF_UP);//当前单价 | ||||
| //                    BigDecimal multiply = divide.multiply(qty);//当前金额 | ||||
| //                    BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计 | ||||
| //                    BigDecimal subtract = multiply1.subtract(multiply);//当前税额 | ||||
| ////                    this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex); | ||||
| //                    this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价 | ||||
| //                    this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 | ||||
| //                    this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额 | ||||
| //                    this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计 | ||||
| //                } else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) { | ||||
| //                    BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价 | ||||
| //                    BigDecimal multiply = currentprice.multiply(qty);//当前金额 | ||||
| //                    BigDecimal multiply1 = divide.multiply(qty);//当前价税合计 | ||||
| //                    BigDecimal subtract = multiply1.subtract(multiply);//当前税额 | ||||
| //                    this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价 | ||||
| //                    this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 | ||||
| //                    this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额 | ||||
| //                    this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计 | ||||
| //                } | ||||
| //                this.getView().updateView(); | ||||
| //        } | ||||
| // | ||||
| //        } | ||||
|         String propName = e.getProperty().getName(); | ||||
|         ChangeData changeData = e.getChangeSet()[0]; | ||||
|         int rowIndex = changeData.getRowIndex(); | ||||
|         int parentRowIndex = changeData.getParentRowIndex(); | ||||
|         if (StringUtils.equals(propName, "zcgj_hsjell")) { | ||||
|             doLockFieldWithPriceAdjustMode((PriceAdjustModeEnum)null); | ||||
|         } else if (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount")) { | ||||
|             BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex); | ||||
|             BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex); | ||||
|             BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex); | ||||
|             BigDecimal entrytaxrate =(BigDecimal) this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); | ||||
|             BigDecimal tax = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); | ||||
|             BigDecimal zero = new BigDecimal(0); | ||||
|             if (thisqty.compareTo(zero)>0 && thisoftaxmount.compareTo(zero)>0) { | ||||
|                 BigDecimal curtaxprice = thisoftaxmount.divide(thisqty,6,BigDecimal.ROUND_HALF_UP); | ||||
|                 BigDecimal currentprice = curtaxprice.divide(tax, 6, BigDecimal.ROUND_HALF_UP); | ||||
|                 DynamicObjectCollection listmodelentry = this.getModel().getDataEntity().getDynamicObjectCollection("listmodelentry"); | ||||
|                 DynamicObject listentry = listmodelentry.get(parentRowIndex).getDynamicObjectCollection("listentry").get(rowIndex); | ||||
|                 listentry.set("curtaxprice",curtaxprice); | ||||
|                 listentry.set("currentprice",currentprice); | ||||
|                 listentry.set("currentamt",currentprice.multiply(totalqty)); | ||||
|                 listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty))); | ||||
|                 listentry.set("currentoftax",curtaxprice.multiply(totalqty)); | ||||
|                 this.getView().updateView(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     protected void updateAmount(ChangeData changeData) { | ||||
|  |  | |||
|  | @ -0,0 +1,27 @@ | |||
| package zcgj.zcdev.zcdev.pr.plugin.operate; | ||||
| 
 | ||||
| import kd.bos.entity.plugin.AddValidatorsEventArgs; | ||||
| import kd.bos.entity.validate.AbstractValidator; | ||||
| import kd.ec.contract.opplugin.fund.PaymentApplyFundOp; | ||||
| import kd.ec.contract.opplugin.fund.validator.PaymentMaxAmountValidator; | ||||
| import kd.ec.contract.opplugin.fund.validator.PaymentTypeValidator; | ||||
| import kd.ec.contract.opplugin.validator.ContractMeasureValidator; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| public class PaymentApplyFundExtOp extends PaymentApplyFundOp { | ||||
| 
 | ||||
|     @Override | ||||
|     public void onAddValidators(AddValidatorsEventArgs e) { | ||||
|         super.onAddValidators(e); | ||||
|         List<AbstractValidator> validators = e.getValidators(); | ||||
|         // 删除标品校验器 | ||||
|         validators.removeIf(validator -> validator instanceof PaymentMaxAmountValidator); | ||||
|         validators.removeIf(validator -> validator instanceof PaymentTypeValidator); | ||||
| 
 | ||||
| 
 | ||||
|         // 添加定制二开的校验器(位置放第一位,优先执行) | ||||
| //        validators.add(0, new ContractMeasurementValidator()); | ||||
| 
 | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue