添加入库单提交操作校验插件:分录中资源编码不是火工材料和燃料类的分录行,且单价大于两千的分录行,则需要上传比价附件
This commit is contained in:
parent
ca2827f957
commit
ea17708cde
|
@ -11,14 +11,20 @@ import kd.bos.orm.query.QCP;
|
|||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 入库单提交操作校验插件
|
||||
* 说明:
|
||||
* 说明:分录中资源编码不是火工材料和燃料类的分录行,且单价大于两千的分录行,则需要上传比价附件
|
||||
*/
|
||||
public class MaterialInBillOrgSubmitValidatorOp extends AbstractOperationServicePlugIn {
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
super.onPreparePropertys(e);
|
||||
e.getFieldKeys().add("fiaccountOrg");
|
||||
e.getFieldKeys().add("entryentity");
|
||||
e.getFieldKeys().add("material");
|
||||
e.getFieldKeys().add("price");
|
||||
e.getFieldKeys().add("zcgj_attachmentcount");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,7 +39,7 @@ public class MaterialInBillOrgSubmitValidatorOp extends AbstractOperationService
|
|||
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
DynamicObject ecma_MaterialInBill = extendedDataEntity.getDataEntity();
|
||||
DynamicObject fiaccountOrg = ecma_MaterialInBill.getDynamicObject("fiaccountOrg");//财务记账组织
|
||||
DynamicObject fiaccountOrg = ecma_MaterialInBill.getDynamicObject("fiaccountorg");//财务记账组织
|
||||
if (fiaccountOrg == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -43,20 +49,24 @@ public class MaterialInBillOrgSubmitValidatorOp extends AbstractOperationService
|
|||
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);
|
||||
boolean isPrice = false;
|
||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||
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;
|
||||
BigDecimal price = entryEntity.getBigDecimal("price");//入库单价
|
||||
if (price.compareTo(new BigDecimal("2000")) > 0 && !number.contains("ZCKS03") && !number.contains("ZCKS05")) {
|
||||
isPrice = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ecma_MaterialInBill.getString("zcgj_attachmentcountfield");//附件数
|
||||
int zcgj_attachmentcount = ecma_MaterialInBill.getInt("zcgj_attachmentcount"); //比价附件数
|
||||
if (zcgj_attachmentcount == 0 && isPrice) {
|
||||
this.addFatalErrorMessage(extendedDataEntity, "入库单价大于2000,需要上传比价附件!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue