|
|
@@ -22,7 +22,7 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
|
|
|
DynamicObject bill = dataEntity.getDataEntity();
|
|
|
// 申请日期
|
|
|
Date bizDate = bill.getDate("bizdate");
|
|
|
- if(checkPeriod(bizDate)) {
|
|
|
+ if(checkPeriod(bizDate,bill)) {
|
|
|
String msg = "申请日期所在期间已关账,不允许" + this.getOperationName();
|
|
|
this.addErrorMessage(dataEntity, msg);
|
|
|
}
|
|
|
@@ -35,10 +35,19 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
|
|
|
* @param date
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean checkPeriod(Date date) {
|
|
|
+ public boolean checkPeriod(Date date, DynamicObject bill) {
|
|
|
QFilter filter = new QFilter("nckd_closestatus", QCP.equals, "B");
|
|
|
filter.and("nckd_period.begindate", QCP.less_equals, date);
|
|
|
filter.and("nckd_period.enddate", QCP.large_equals, date);
|
|
|
+ String entityKey = this.getEntityKey();
|
|
|
+
|
|
|
+ if("cas_paybill".equals(entityKey)) {
|
|
|
+ filter.and("org.id", QCP.equals, bill.getLong("applyorg.id"));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ filter.and("org.id", QCP.equals, bill.getLong("costcompany.id"));
|
|
|
+ }
|
|
|
+
|
|
|
return QueryServiceHelper.exists(PERIODCONTROL_ENTITY, new QFilter[]{filter});
|
|
|
}
|
|
|
}
|