借款单提交校验优化,备用金台账添加保存校验逻辑,设备维修确认单优化设备型号和设备名称字段取值逻辑
This commit is contained in:
parent
dd7cc6c22f
commit
c49cb583e9
|
|
@ -180,7 +180,7 @@ public class DailyLoanBillSubValidatorOp extends AbstractOperationServicePlugIn
|
|||
for (DynamicObject zcgj_dailyloanbilldata : zcgj_dailyloanbilldatas) {
|
||||
Object zcgj_dailyLoanBillDataId = zcgj_dailyloanbilldata.getDynamicObject("fbasedataid").getPkValue();//借款单id
|
||||
QFilter[] qFilters = new QFilter[]{new QFilter("id", QCP.equals, zcgj_dailyLoanBillDataId)};
|
||||
DynamicObject er_dailyloanbill = BusinessDataServiceHelper.loadSingle("er_dailyloanbill", "id,loanamount,returnedamount", qFilters);//借款单
|
||||
DynamicObject er_dailyloanbill = BusinessDataServiceHelper.loadSingle("er_dailyloanbill", "id,loanamount,returnedamount,usedamount", qFilters);//借款单
|
||||
if (er_dailyloanbill == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
package zcgj.zcdev.zcdev.fs.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 kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 定额备用金初始台账保存校验插件
|
||||
* 说明:校验分录人员是否存在于其他备用金初始台账中
|
||||
*/
|
||||
public class QuotaImprestLedgerSaveOp extends AbstractOperationServicePlugIn {
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
super.onPreparePropertys(e);
|
||||
e.getFieldKeys().add("zcgj_currentyear");//年度
|
||||
e.getFieldKeys().add("zcgj_person");//人员
|
||||
e.getFieldKeys().add("zcgj_entryentity");//分录
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
super.onAddValidators(e);
|
||||
e.getValidators().add(new ValidatorExt());
|
||||
}
|
||||
|
||||
class ValidatorExt extends AbstractValidator {
|
||||
@Override
|
||||
public void validate() {
|
||||
ExtendedDataEntity[] dataEntities = this.getDataEntities();
|
||||
for (ExtendedDataEntity dataEnt : dataEntities) {
|
||||
DynamicObject QuotaImprestLedger = dataEnt.getDataEntity();
|
||||
String zcgj_currentyear = QuotaImprestLedger.getString("zcgj_currentyear");//年度
|
||||
DynamicObjectCollection entryEntityCollection = QuotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录
|
||||
// 添加一个Set来记录已经处理过的人员
|
||||
Set<String> processedPersons = new HashSet<>();
|
||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||
DynamicObject zcgj_person = entryEntity.getDynamicObject("zcgj_person");//人员
|
||||
if (zcgj_person == null) {
|
||||
continue;
|
||||
}
|
||||
// 获取人员ID
|
||||
String personId = zcgj_person.getPkValue().toString();
|
||||
String personName = zcgj_person.getString("name");
|
||||
|
||||
// 检查当前人员是否在当前循环中已经出现过
|
||||
if (processedPersons.contains(personId)) {
|
||||
this.addFatalErrorMessage(dataEnt, "人员【" + personName + "】在当前台账中重复出现,请检查!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 将当前人员添加到已处理集合中
|
||||
processedPersons.add(personId);
|
||||
QFilter filter = new QFilter("zcgj_entryentity.zcgj_person", QCP.equals, zcgj_person.getPkValue());
|
||||
filter.and(new QFilter("zcgj_currentyear", QCP.equals, zcgj_currentyear));
|
||||
filter.and(new QFilter("id", QCP.not_in, QuotaImprestLedger.getPkValue()));
|
||||
DynamicObjectCollection zcgj_quotaimprestledgers = QueryServiceHelper.query("zcgj_quotaimprestledger", "id", new QFilter[]{filter});//定额备用金初始台账
|
||||
if (zcgj_quotaimprestledgers.size() > 0) {
|
||||
this.addFatalErrorMessage(dataEnt, "您现在保存的台账中人员【" + personName + "】已在其他台账中存在" + "!!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -416,6 +416,8 @@ public class MaintenanceAckBillPlugin extends AbstractBillPlugIn implements Plug
|
|||
for (int i = 0; i < maintenanceentry.size(); i++) {
|
||||
DynamicObject object = maintenanceentry.get(i);
|
||||
i = this.getModel().createNewEntryRow("entryentity");
|
||||
this.getModel().setValue("zcgj_leaseequiment", object.getString("zcgj_leaseequiment"), i);//租赁设备名称
|
||||
this.getModel().setValue("zcgj_leasemodel", object.getString("zcgj_leasemodel"), i);//设备型号
|
||||
this.getModel().setValue("zcgj_equipment", object.getDynamicObject("zcgj_equipment"), i);
|
||||
this.getModel().setValue("zcgj_fault", object.getString("zcgj_fault"), i);
|
||||
this.getModel().setValue("zcgj_faultreason", object.getString("zcgj_faultreason"), i);
|
||||
|
|
|
|||
Loading…
Reference in New Issue