1.支出合同增加工序分摊开发

2.合同付款申请单付款金额关联发票后未锁定问题开发
3.合同付款申请单实际付款金额重复计算问题开发
This commit is contained in:
zhangzhiguo 2025-04-03 18:54:11 +08:00
parent 0c7ef831e5
commit bf874af17b
5 changed files with 174 additions and 1 deletions

View File

@ -53,5 +53,4 @@ public class ContractProcessRevisionFilterPlugin extends AbstractBillPlugIn impl
}
}
// }
}

View File

@ -0,0 +1,45 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.sdk.plugin.Plugin;
import java.util.EventObject;
public class OutContractSettleProcessFilterPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
BasedataEdit contractprocess = this.getControl("zcgj_pa_process");
if(contractprocess != null) {
contractprocess.addBeforeF7SelectListener(this);
}
}
@Override
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
String name1 = beforeF7SelectEvent.getProperty().getName();
if(name1.equals("zcgj_pa_process")) {
String name = this.getModel().getDataEntity().getDataEntityType().getName();
Object projectObj = this.getModel().getValue("project");
if(projectObj instanceof DynamicObject) {
DynamicObject project = (DynamicObject) projectObj;
QFilter qFilter = new QFilter("project.id", QCP.equals, project.getLong("id"));
QFilter treeFilter = new QFilter("number", QCP.equals, project.getString("number"));
ListShowParameter showParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
showParameter.getListFilterParameter().getQFilters().add(qFilter);
showParameter.getTreeFilterParameter().getQFilters().add(treeFilter);
}
}
}
}

View File

@ -0,0 +1,65 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.LoadDataEventArgs;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.ec.contract.formplugin.PaymentApplyEditUI;
import java.math.BigDecimal;
import java.util.EventObject;
import java.util.HashSet;
import java.util.Set;
public class PaymentApplyEditUIExtPlugin extends PaymentApplyEditUI {
@Override
protected void thisApplyOfTaxChanged(ChangeData changeData) {
this.sumApplyOfTax();
//this.setRealPayAmt();
if (this.getPageCache().get("thisApplyAmountCache") != null) {
this.getPageCache().remove("thisApplyAmountCache");
} else {
int rowIndex = changeData.getRowIndex();
if (!this.hasInvoice(rowIndex)) {
this.setShouldPayOfTax(rowIndex);
BigDecimal applyOfTaxAmount = (BigDecimal)changeData.getNewValue();
BigDecimal taxRate = (BigDecimal)this.getModel().getValue("conttaxrate", rowIndex);
BigDecimal applyAmount = applyOfTaxAmount.divide(BigDecimal.ONE.add(taxRate.divide(BigDecimal.valueOf(100L), 4)), 10, 5);
this.getPageCache().put("thisApplyOfTaxCache", "1");
this.getModel().setValue("thisapplyamount", applyAmount, rowIndex);
}
}
}
private void setRealPayAmt() {
DynamicObjectCollection dynamicObjectCollection = this.getModel().getDataEntity().getDynamicObjectCollection("entryentity");
BigDecimal totalAmount = BigDecimal.ZERO;
Set<String> contractNo = new HashSet<>();
for (DynamicObject dynamicObject : dynamicObjectCollection) {
DynamicObject contract = dynamicObject.getDynamicObject("contract");
if(contract != null) {
String billno = contract.getString("id");
if(!contractNo.contains(billno)) {
totalAmount = dynamicObject.getBigDecimal("thisrealpayamt");
contractNo.add(billno);
}
}
}
this.getModel().setValue("realpayamt", totalAmount);
//Object id = this.getModel().getValue("id");
//DynamicObject paymentapply = BusinessDataServiceHelper.loadSingle(id, "ec_paymentapply", "realpayamt");
//paymentapply.set("realpayamt", 99999);
//SaveServiceHelper.update(new DynamicObject[]{paymentapply});
this.getView().updateView("realpayamt");
}
@Override
public void afterLoadData(EventObject e) {
this.setRealPayAmt();
super.afterLoadData(e);
}
}

View File

@ -41,6 +41,15 @@ public class PaymentapplyCopyPlugin extends AbstractBillPlugIn implements Plugi
this.getModel().setValue("totalshouldpay", this.getSum("entryentity", "applyoftaxamount"));
this.getView().updateView(ENTITY_KEY);
this.getView().updateView("totalshouldpay");
//判断是否有发票有发票则锁定本次申请金额
for (int i = 0; i < entity.size(); i++) {
DynamicObject dynamicObject = entity.get(i);
DynamicObjectCollection dynamicObjectCollection = dynamicObject.getDynamicObjectCollection("subentryentity");
if(dynamicObjectCollection == null || dynamicObjectCollection.isEmpty()){
this.getView().setEnable(false,i,"thisapplyoftax");
}
}
}
}

View File

@ -0,0 +1,55 @@
package zcgj.zcdev.zcdev.pr.plugin.operate;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.ExtendedDataEntity;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.validate.AbstractValidator;
import java.math.BigDecimal;
/**
* 工序分摊金额校验
*/
public class OutContractSettleProcessCheckOp extends AbstractOperationServicePlugIn {
@Override
public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e);
e.getFieldKeys().add("itementry");
e.getFieldKeys().add("zcgj_processallocatentity");
}
@Override
public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e);
//当前所在的组织是属于矿山下的
e.getValidators().add(new ValidatorExt());
}
class ValidatorExt extends AbstractValidator {
@Override
public void validate() {
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
DynamicObjectCollection itementryCollection = dataEntity.getDynamicObjectCollection("itementry");
int i=1;
for (DynamicObject itementry : itementryCollection) {
BigDecimal oftaxamount = itementry.getBigDecimal("oftaxamount");
DynamicObjectCollection processallocatentityCollection = itementry.getDynamicObjectCollection("zcgj_processallocatentity");
BigDecimal totalPaAmount = BigDecimal.ZERO;
for (DynamicObject dynamicObject : processallocatentityCollection) {
totalPaAmount = totalPaAmount.add(dynamicObject.getBigDecimal("zcgj_pa_amount"));
}
if(totalPaAmount.compareTo(oftaxamount)!=0){
this.addFatalErrorMessage(extendedDataEntity, "合同支付项第"+i+"条,价税合计金额与工序分摊金额不一致,请重新核对并调整分摊金额,以确保两者相等。");
}
i++;
}
}
}
}
}