优化支出合同结算重复问题
This commit is contained in:
parent
a73729ebf3
commit
a8af3c532a
|
@ -20,6 +20,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import kd.bos.bill.OperationStatus;
|
||||
import kd.bos.dataentity.entity.DataEntityBase;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
|
@ -53,6 +54,7 @@ import kd.bos.form.field.events.BeforeF7SelectEvent;
|
|||
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
import kd.bos.list.ListShowParameter;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.ec.basedata.business.model.cont.ContractSettleTplConstant;
|
||||
|
@ -67,6 +69,7 @@ import kd.ec.contract.common.utils.ContractHelper;
|
|||
import kd.ec.contract.formplugin.AbstractContBillPlugin;
|
||||
import kd.ec.contract.utils.SettleUpdateAmtUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import zcgj.zcdev.zcdev.pr.plugin.utils.PluginUtils;
|
||||
|
||||
/**
|
||||
* 支出合同结算修改系统插件
|
||||
|
@ -1002,14 +1005,32 @@ public class ContractSettleCommonEditPluginExt extends AbstractContBillPlugin im
|
|||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
String name = e.getProperty().getName();
|
||||
ChangeData changeData = e.getChangeSet()[0];
|
||||
DynamicObject contract;
|
||||
if (StringUtils.equals(name, "contract")) {
|
||||
contract = (DynamicObject)changeData.getNewValue();
|
||||
/* contract = (DynamicObject) changeData.getNewValue();
|
||||
this.clearUnitproject();
|
||||
this.contractChanged(contract);
|
||||
this.contractChanged(contract);*///已被二开替代
|
||||
Object objcontract = this.getModel().getValue("contract");
|
||||
if (objcontract!=null){
|
||||
DynamicObject contract = (DynamicObject) objcontract;
|
||||
DynamicObject contractInfo = BusinessDataServiceHelper.loadSingle("ec_in_contract", "id,billno,billname,zcgj_renewal,zcgj_isrenewal,zcgj_enddate", new QFilter[]{new QFilter("id", QCP.equals, contract.getLong("id"))});
|
||||
Date zcgjEnddate = contractInfo.getDate("zcgj_enddate");
|
||||
if (zcgjEnddate!=null){
|
||||
Date nowdate = new Date();
|
||||
int timeDays = PluginUtils.getTimeDays(zcgjEnddate, nowdate);
|
||||
int endDays = Integer.parseInt(System.getProperty("contract.enddays"));
|
||||
// int endDays = 100;
|
||||
if (timeDays-endDays<=0){
|
||||
this.getView().showTipNotification("当前选择合同距离到期不足"+endDays+"天!");
|
||||
}
|
||||
}
|
||||
}
|
||||
DynamicObject contract = (DynamicObject)changeData.getNewValue();
|
||||
this.clearUnitproject();
|
||||
this.contractChanged(contract);//二开替代代码
|
||||
// this.clearOrNewProcessAlloc();//清除或者新增工序分摊分录
|
||||
} else if (StringUtils.equals(name, "period")) {
|
||||
this.periodChanged(changeData);
|
||||
} else if (!StringUtils.equals(name, "begindate") && !StringUtils.equals(name, "enddate")) {
|
||||
} else if (!StringUtils.equals(name, "begindate") && !StringUtils.equals(name, "enddate")) /*{
|
||||
if (StringUtils.equals(name, "issettlebymatin")) {
|
||||
this.isSettleByMaterialInChanged(changeData);
|
||||
} else if (StringUtils.equals(name, "issettlebyreconc")) {
|
||||
|
@ -1021,16 +1042,44 @@ public class ContractSettleCommonEditPluginExt extends AbstractContBillPlugin im
|
|||
} else if (StringUtils.equals(name, "rate")) {
|
||||
this.rateChanged(changeData);
|
||||
} else if (StringUtils.equals("unitproject", name)) {
|
||||
contract = (DynamicObject)this.getModel().getValue("contract");
|
||||
DynamicObject contract = (DynamicObject) this.getModel().getValue("contract");
|
||||
this.contractChanged(contract);
|
||||
}
|
||||
}*/
|
||||
{
|
||||
if (StringUtils.equals(name, "issettlebymatin")) {
|
||||
this.isSettleByMaterialInChanged(changeData);
|
||||
} else if (StringUtils.equals(name, "issettlebyreconc")) {
|
||||
this.isSettleByReconciliationChanged(changeData);
|
||||
} else if (StringUtils.equals(name, "oftaxamount")) {
|
||||
this.ofTaxAmountChanged(changeData);
|
||||
} else if (StringUtils.equals(name, "amount")) {
|
||||
boolean checkbox= this.getModel().getDataEntity().getBoolean("zcgj_adjustmounttax");//获取微调金额
|
||||
if(checkbox){//微调打开,调用子类值改变方法
|
||||
this.amountChanged(changeData);
|
||||
}else{//没打开,调用父类的
|
||||
this.amountChanged1(changeData);
|
||||
}
|
||||
} else if (StringUtils.equals(name, "taxamt")) {
|
||||
boolean checkbox= this.getModel().getDataEntity().getBoolean("zcgj_adjustmounttax");//获取微调金额
|
||||
if(checkbox){//微调打开,调用子类值改变方法
|
||||
this.taxamtChanged(changeData);
|
||||
}
|
||||
} else if (StringUtils.equals(name, "rate")) {
|
||||
this.rateChanged(changeData);
|
||||
} else if (StringUtils.equals("unitproject", name)) {
|
||||
DynamicObject contract = (DynamicObject)this.getModel().getValue("contract");
|
||||
this.contractChanged(contract);
|
||||
}else if (StringUtils.equals(name, "zcgj_adjustmounttax")) {
|
||||
//this.adjustAmountTax(changeData);
|
||||
}
|
||||
}/* else {
|
||||
this.setDateEditMinAndMaxDate();
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
protected void rateChanged(ChangeData changeData) {
|
||||
/* protected void rateChanged(ChangeData changeData) {
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
boolean isMultiRate = (Boolean)this.getModel().getValue("ismultirate");
|
||||
BigDecimal ofTaxAmount = (BigDecimal)this.getModel().getValue("oftaxamount", rowIndex);
|
||||
|
@ -1057,9 +1106,36 @@ public class ContractSettleCommonEditPluginExt extends AbstractContBillPlugin im
|
|||
}
|
||||
|
||||
}
|
||||
}*///已被二开替代
|
||||
protected void rateChanged(ChangeData changeData) {
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
boolean isMultiRate = (Boolean) this.getModel().getValue("ismultirate");
|
||||
BigDecimal ofTaxAmount = (BigDecimal) this.getModel().getValue("oftaxamount", rowIndex);
|
||||
BigDecimal amount = (BigDecimal) this.getModel().getValue("amount", rowIndex);
|
||||
BigDecimal taxRate = (BigDecimal) changeData.getNewValue();
|
||||
String ignoreRateChanged = this.getPageCache().get("ignoreRateChanged");
|
||||
if (ignoreRateChanged != null) {
|
||||
this.getPageCache().remove("ignoreRateChanged");
|
||||
} else {
|
||||
if (isMultiRate) {
|
||||
BigDecimal rate = BigDecimal.ONE.add(taxRate.divide(BigDecimal.valueOf(100L), 10, RoundingMode.HALF_UP));
|
||||
if (ofTaxAmount.compareTo(BigDecimal.ZERO) != 0) {
|
||||
amount = ofTaxAmount.divide(rate, 6, 4);
|
||||
BigDecimal taxAmount = ofTaxAmount.subtract(amount);
|
||||
this.getModel().setValue("taxamt", taxAmount, rowIndex);
|
||||
this.getModel().setValue("amount", amount, rowIndex);
|
||||
} else {
|
||||
ofTaxAmount = amount.multiply(rate);
|
||||
BigDecimal taxAmount = ofTaxAmount.subtract(amount);
|
||||
this.getModel().setValue("taxamt", taxAmount, rowIndex);
|
||||
this.getModel().setValue("oftaxamount", ofTaxAmount, rowIndex);
|
||||
}
|
||||
}
|
||||
|
||||
protected void amountChanged(ChangeData changeData) {
|
||||
}
|
||||
}//二开替代代码
|
||||
|
||||
/* protected void amountChanged(ChangeData changeData) {
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
if (this.isNotNonDirection(rowIndex)) {
|
||||
boolean isMultiRate = (Boolean) this.getModel().getValue("ismultirate");
|
||||
|
@ -1084,8 +1160,59 @@ public class ContractSettleCommonEditPluginExt extends AbstractContBillPlugin im
|
|||
SettleUpdateAmtUtils.calAllTypeAmount(this.getModel());
|
||||
}
|
||||
|
||||
//已被二开替代
|
||||
/* protected void ofTaxAmountChanged(ChangeData changeData) {
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
if (this.isNotNonDirection(rowIndex)) {
|
||||
BigDecimal ofTaxAmount = (BigDecimal) this.getModel().getValue("oftaxamount", rowIndex);
|
||||
BigDecimal rate = (BigDecimal) this.getModel().getValue("rate", rowIndex);
|
||||
BigDecimal amount = ofTaxAmount.divide(BigDecimal.ONE.add(rate.divide(BigDecimal.valueOf(100L), 10, RoundingMode.HALF_UP)), 10, 4);
|
||||
BigDecimal taxAmount = ofTaxAmount.subtract(amount);
|
||||
this.getModel().setValue("taxamt", taxAmount, rowIndex);
|
||||
this.getModel().setValue("amount", amount, rowIndex);
|
||||
this.checkNeedReComputeItem(rowIndex);
|
||||
SettleUpdateAmtUtils.setItemEntrySumAmt(this.getView());
|
||||
SettleUpdateAmtUtils.calAllTypeAmount(this.getModel());
|
||||
}
|
||||
|
||||
}*///已被二开替代
|
||||
protected void amountChanged(ChangeData changeData) {
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
BigDecimal amount = (BigDecimal) changeData.getNewValue();
|
||||
BigDecimal oftaxamount = (BigDecimal) this.getModel().getValue("oftaxamount", rowIndex);
|
||||
BigDecimal taxamt = oftaxamount.subtract(amount);
|
||||
this.getModel().setValue("taxamt", taxamt, rowIndex);
|
||||
SettleUpdateAmtUtils.setItemEntrySumAmt(this.getView());
|
||||
SettleUpdateAmtUtils.calAllTypeAmount(this.getModel());
|
||||
|
||||
}//二开替代代码
|
||||
protected void amountChanged1(ChangeData changeData) {
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
if (this.isNotNonDirection(rowIndex)) {
|
||||
boolean isMultiRate = (Boolean)this.getModel().getValue("ismultirate");
|
||||
BigDecimal ofTaxAmount = (BigDecimal)this.getModel().getValue("oftaxamount", rowIndex);
|
||||
BigDecimal amount = (BigDecimal)this.getModel().getValue("amount", rowIndex);
|
||||
if (isMultiRate && (BigDecimal.ZERO.compareTo(ofTaxAmount) == 0 || BigDecimal.ZERO.compareTo(amount) == 0)) {
|
||||
this.getModel().setValue("rate", 0, rowIndex);
|
||||
this.getModel().setValue("taxamt", BigDecimal.ZERO, rowIndex);
|
||||
this.getModel().setValue("oftaxamount", amount, rowIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
BigDecimal taxAmt = ofTaxAmount.subtract(amount);
|
||||
if (BigDecimal.ZERO.compareTo(amount) != 0 && isMultiRate) {
|
||||
BigDecimal taxRate = taxAmt.multiply(BigDecimal.valueOf(100L)).divide(amount, 4, 4);
|
||||
this.getModel().setValue("rate", taxRate, rowIndex);
|
||||
}
|
||||
|
||||
this.getModel().setValue("taxamt", taxAmt, rowIndex);
|
||||
this.checkNeedReComputeItem(rowIndex);
|
||||
SettleUpdateAmtUtils.setItemEntrySumAmt(this.getView());
|
||||
SettleUpdateAmtUtils.calAllTypeAmount(this.getModel());
|
||||
}
|
||||
|
||||
}//二开添加
|
||||
|
||||
protected void ofTaxAmountChanged(ChangeData changeData) {
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
if (this.isNotNonDirection(rowIndex)) {
|
||||
|
@ -1100,7 +1227,15 @@ public class ContractSettleCommonEditPluginExt extends AbstractContBillPlugin im
|
|||
SettleUpdateAmtUtils.calAllTypeAmount(this.getModel());
|
||||
}
|
||||
|
||||
}
|
||||
}//二开替代代码
|
||||
|
||||
private void taxamtChanged(ChangeData changeData) {
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
BigDecimal taxamt = (BigDecimal) changeData.getNewValue();
|
||||
BigDecimal oftaxamount = (BigDecimal) this.getModel().getValue("oftaxamount", rowIndex);
|
||||
BigDecimal amount = oftaxamount.subtract(taxamt);
|
||||
this.getModel().setValue("amount", amount, rowIndex);
|
||||
}//二开添加代码
|
||||
|
||||
public void checkNeedReComputeItem(int rowIndex) {
|
||||
Object changedPayItemPk = ((DynamicObject) this.getModel().getValue("payitem", rowIndex)).getPkValue();
|
||||
|
@ -1228,12 +1363,18 @@ public class ContractSettleCommonEditPluginExt extends AbstractContBillPlugin im
|
|||
this.initPayItemDetailEntry();
|
||||
}
|
||||
|
||||
/* private void clearUnitproject() {
|
||||
if (this.getPayDirection().equals(PayDirectionEnum.IN.getValue())) {
|
||||
this.getModel().setValue("unitproject", (Object) null);
|
||||
}
|
||||
|
||||
}*///已被二开替代
|
||||
private void clearUnitproject() {
|
||||
if (this.getPayDirection().equals(PayDirectionEnum.IN.getValue())) {
|
||||
this.getModel().setValue("unitproject", (Object) null);
|
||||
}
|
||||
|
||||
}
|
||||
}//二开替代代码
|
||||
|
||||
protected void initPayItemDetailEntry() {
|
||||
this.updateItemDetailEntry();
|
||||
|
|
Loading…
Reference in New Issue