This commit is contained in:
parent
78e865e2aa
commit
ca2827f957
|
@ -0,0 +1,64 @@
|
||||||
|
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 kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单提交操作校验插件
|
||||||
|
* 说明:
|
||||||
|
*/
|
||||||
|
public class MaterialInBillOrgSubmitValidatorOp extends AbstractOperationServicePlugIn {
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("fiaccountOrg");
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 ecma_MaterialInBill = extendedDataEntity.getDataEntity();
|
||||||
|
DynamicObject fiaccountOrg = ecma_MaterialInBill.getDynamicObject("fiaccountOrg");//财务记账组织
|
||||||
|
if (fiaccountOrg == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QFilter f1 = new QFilter("number", QCP.equals, "ecma_materialinbill");
|
||||||
|
QFilter f2 = new QFilter("zcgj_org.fbasedataid", QCP.in, fiaccountOrg.getPkValue());
|
||||||
|
DynamicObject zcgj_authorizedcompany = BusinessDataServiceHelper.loadSingle("zcgj_authorizedcompany",
|
||||||
|
new QFilter[]{f1.and(f2)});//入库单公司过滤
|
||||||
|
if (zcgj_authorizedcompany != null) {
|
||||||
|
DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
||||||
|
for (int i = 0; i < entryEntityCollection.size(); i++) {
|
||||||
|
DynamicObject entryEntity = entryEntityCollection.get(i);
|
||||||
|
DynamicObject material = entryEntity.getDynamicObject("material");//资源编码
|
||||||
|
if (material != null) {
|
||||||
|
DynamicObject resource = material.getDynamicObject("resource");//资源编码-清单分类
|
||||||
|
if (resource != null) {
|
||||||
|
String number = resource.getString("number");//清单分类-编码
|
||||||
|
if (number.contains("ZCKS03") || number.contains("ZCKS05")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ecma_MaterialInBill.getString("zcgj_attachmentcountfield");//附件数
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue