|
@@ -1,11 +1,13 @@
|
|
|
package nckd.xtpoc.fi.app.plugin.validate;
|
|
package nckd.xtpoc.fi.app.plugin.validate;
|
|
|
|
|
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
import kd.bos.entity.ExtendedDataEntity;
|
|
import kd.bos.entity.ExtendedDataEntity;
|
|
|
import kd.bos.entity.validate.AbstractValidator;
|
|
import kd.bos.entity.validate.AbstractValidator;
|
|
|
import kd.bos.orm.query.QCP;
|
|
import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
|
|
@@ -26,6 +28,10 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
|
|
|
String msg = "申请日期所在期间已关账,不允许" + this.getOperationName();
|
|
String msg = "申请日期所在期间已关账,不允许" + this.getOperationName();
|
|
|
this.addErrorMessage(dataEntity, msg);
|
|
this.addErrorMessage(dataEntity, msg);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!checkSupplier(bill)) {
|
|
|
|
|
+ String msg = "费用明细的供应商和车牌号与关联申请单不一致,不允许" + this.getOperationName();
|
|
|
|
|
+ this.addErrorMessage(dataEntity, msg);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -41,4 +47,42 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
|
|
|
filter.and("nckd_period.enddate", QCP.large_equals, date);
|
|
filter.and("nckd_period.enddate", QCP.large_equals, date);
|
|
|
return QueryServiceHelper.exists(PERIODCONTROL_ENTITY, new QFilter[]{filter});
|
|
return QueryServiceHelper.exists(PERIODCONTROL_ENTITY, new QFilter[]{filter});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 校验供应商和车牌号
|
|
|
|
|
+ * @param bill
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public boolean checkSupplier(DynamicObject bill) {
|
|
|
|
|
+ // 费用明细
|
|
|
|
|
+ DynamicObjectCollection expenseentryentity = bill.getDynamicObjectCollection("expenseentryentity");
|
|
|
|
|
+ // 关联申请
|
|
|
|
|
+ DynamicObjectCollection writeoffapply = bill.getDynamicObjectCollection("writeoffapply");
|
|
|
|
|
+
|
|
|
|
|
+ for (DynamicObject dynamicObject : expenseentryentity) {
|
|
|
|
|
+ DynamicObject expenseitem = dynamicObject.getDynamicObject("expenseitem");
|
|
|
|
|
+ if (expenseitem != null && "FY00202".equals(expenseitem.getString("number"))) {
|
|
|
|
|
+ if (ObjectUtils.isEmpty(writeoffapply)) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ for (DynamicObject apply : writeoffapply) {
|
|
|
|
|
+ // 供应商
|
|
|
|
|
+ DynamicObject nckdApplysupplier = apply.getDynamicObject("nckd_applysupplier");
|
|
|
|
|
+ DynamicObject nckdSupplier = dynamicObject.getDynamicObject("nckd_supplier");
|
|
|
|
|
+ // 车牌号
|
|
|
|
|
+ String applyPlateNo = apply.getString("nckd_plateno");
|
|
|
|
|
+ String plateNo = dynamicObject.getString("nckd_textfield");
|
|
|
|
|
+ if (nckdApplysupplier != null && nckdSupplier != null
|
|
|
|
|
+ && applyPlateNo != null && plateNo != null) {
|
|
|
|
|
+ if (nckdApplysupplier.getLong("id") == nckdSupplier.getLong("id") && applyPlateNo.equals(plateNo)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|