二开系统插件标记
This commit is contained in:
parent
4acfc8616c
commit
1d42049cf1
|
@ -0,0 +1,99 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
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.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 kd.bos.entity.validate.ErrorLevel;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.ec.basedata.common.enums.ContractStatusEnum;
|
||||
|
||||
public class PaymentContSubmitOpExt extends AbstractOperationServicePlugIn {
|
||||
public PaymentContSubmitOpExt() {
|
||||
}
|
||||
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
super.onPreparePropertys(e);
|
||||
}
|
||||
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
super.onAddValidators(e);
|
||||
e.addValidator(new AbstractValidator() {
|
||||
public void validate() {
|
||||
String operateKey = this.getOperateKey();
|
||||
if (StringUtils.equals(operateKey, "submit")) {
|
||||
ExtendedDataEntity[] dataEntities = this.getDataEntities();
|
||||
ExtendedDataEntity[] var3 = dataEntities;
|
||||
int var4 = dataEntities.length;
|
||||
|
||||
for(int var5 = 0; var5 < var4; ++var5) {
|
||||
ExtendedDataEntity dataEntity = var3[var5];
|
||||
long newFormId = (Long)dataEntity.getDataEntity().getPkValue();
|
||||
DynamicObjectCollection entryEntity = dataEntity.getDataEntity().getDynamicObjectCollection("entryentity");
|
||||
|
||||
for(int i = 0; i < entryEntity.size(); ++i) {
|
||||
DynamicObject row = (DynamicObject)entryEntity.get(i);
|
||||
DynamicObject contract = row.getDynamicObject("contract");
|
||||
if (contract != null) {
|
||||
String contStatus = contract.getString("contstatus");
|
||||
String contName = contract.getString("name");
|
||||
if (StringUtils.equals(contStatus, ContractStatusEnum.CLOSED.getValue())) {
|
||||
this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%1s】的状态为%2s状态,不能进行业务操作", "PaymentContSubmitOp_5", "ec-ecpf-opplugin", new Object[0]), contName, ContractStatusEnum.getEnumByValue(contStatus).getName()));
|
||||
} else {
|
||||
QFilter filters = new QFilter("contract", "=", contract.getPkValue());
|
||||
filters.and(new QFilter("billstatus", "=", "B"));
|
||||
QFilter pauseFilter = new QFilter("afterstatus", "=", ContractStatusEnum.PAUSE.getValue());
|
||||
QFilter relieveFilter = new QFilter("afterstatus", "=", ContractStatusEnum.RELIEVE.getValue());
|
||||
QFilter closedFilter = new QFilter("afterstatus", "=", ContractStatusEnum.CLOSED.getValue());
|
||||
QFilter runningFilter = new QFilter("afterstatus", "=", ContractStatusEnum.RUNNING.getValue());
|
||||
boolean pauseExist = QueryServiceHelper.exists("ec_statusmanage", new QFilter[]{filters, pauseFilter});
|
||||
boolean relieveExist = QueryServiceHelper.exists("ec_statusmanage", new QFilter[]{filters, relieveFilter});
|
||||
boolean closedExist = QueryServiceHelper.exists("ec_statusmanage", new QFilter[]{filters, closedFilter});
|
||||
boolean runningExist = QueryServiceHelper.exists("ec_statusmanage", new QFilter[]{filters, runningFilter});
|
||||
if (pauseExist) {
|
||||
this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%1s】的状态正在变更为%2s状态,不能进行业务操作", "PaymentContSubmitOp_3", "ec-ecpf-opplugin", new Object[0]), contName, ContractStatusEnum.PAUSE.getName()));
|
||||
}
|
||||
|
||||
if (relieveExist) {
|
||||
this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%1s】的状态正在变更为%2s状态,不能进行业务操作", "PaymentContSubmitOp_3", "ec-ecpf-opplugin", new Object[0]), contName, ContractStatusEnum.RELIEVE.getName()));
|
||||
}
|
||||
|
||||
if (closedExist) {
|
||||
this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%1s】的状态正在变更为%2s状态,不能进行业务操作", "PaymentContSubmitOp_3", "ec-ecpf-opplugin", new Object[0]), contName, ContractStatusEnum.CLOSED.getName()));
|
||||
}
|
||||
|
||||
if (runningExist) {
|
||||
this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%1s】的状态正在变更为%2s状态,不能进行业务操作", "PaymentContSubmitOp_3", "ec-ecpf-opplugin", new Object[0]), contName, ContractStatusEnum.RUNNING.getName()));
|
||||
}
|
||||
|
||||
Set<String> contStatusSet = new HashSet(4);
|
||||
contStatusSet.add(ContractStatusEnum.PAUSE.getValue());
|
||||
contStatusSet.add(ContractStatusEnum.RELIEVE.getValue());
|
||||
contStatusSet.add(ContractStatusEnum.OVERSETTLE.getValue());
|
||||
if (contStatusSet.contains(contStatus)) {
|
||||
this.addMessage(dataEntity, String.format(ResManager.loadKDString("合同【%1s】的合同状态为%2s状态,是否继续,请确认?", "PaymentContSubmitOp_4", "ec-ecpf-opplugin", new Object[0]), contName, ContractStatusEnum.getEnumByValue(contStatus).getName()), ErrorLevel.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue