Merge remote-tracking branch 'origin/master'

This commit is contained in:
sez 2025-11-24 16:31:33 +08:00
commit ebb8063c68
1 changed files with 47 additions and 22 deletions

View File

@ -7,6 +7,7 @@ import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.utils.StringUtils; import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.FormShowParameter; import kd.bos.form.FormShowParameter;
import kd.bos.form.events.AfterDoOperationEventArgs; import kd.bos.form.events.AfterDoOperationEventArgs;
@ -110,6 +111,9 @@ public class RebateRulesBillPlugin extends AbstractBillPlugIn implements BeforeF
String name = e.getProperty().getName(); String name = e.getProperty().getName();
DynamicObject dataEntity = this.getModel().getDataEntity(); DynamicObject dataEntity = this.getModel().getDataEntity();
String tqq9_rebatesub = dataEntity.getString("tqq9_rebatesub"); String tqq9_rebatesub = dataEntity.getString("tqq9_rebatesub");
ChangeData[] changeSet = e.getChangeSet();
Object newValueObj = changeSet[0].getNewValue();
Object oldValueObj = changeSet[0].getOldValue();
if (StringUtils.equals("0", tqq9_rebatesub)) { if (StringUtils.equals("0", tqq9_rebatesub)) {
if (StringUtils.equals("tqq9_shanghailici", name)) { if (StringUtils.equals("tqq9_shanghailici", name)) {
StringBuilder companyBulider = new StringBuilder(); StringBuilder companyBulider = new StringBuilder();
@ -331,31 +335,52 @@ public class RebateRulesBillPlugin extends AbstractBillPlugIn implements BeforeF
} }
getModel().setValue("name", newName.toString()); getModel().setValue("name", newName.toString());
} }
// 比较时间段 // 校验排除时间段的开始时间应大于返利时间范围的结束时间
if (StringUtils.equals("tqq9_date", name) || StringUtils.equals("tqq9_exclusiondate", name)) { if (StringUtils.equals("tqq9_startexcludate", name) ||
Date tqq9_startdate = (Date) dataEntity.get("tqq9_startdate"); // 返利开始时间 StringUtils.equals("tqq9_startdate", name)) {
Date tqq9_enddate = (Date) dataEntity.get("tqq9_enddate"); // 返利结束时间 Date tqq9_startdate = dataEntity.getDate("tqq9_startdate");
Date tqq9_startexcludate = (Date) dataEntity.get("tqq9_startexcludate"); // 排除开始时间 Date tqq9_startexcludate = dataEntity.getDate("tqq9_startexcludate");
Date tqq9_endexcludate = (Date) dataEntity.get("tqq9_endexcludate"); // 排除结束时间 // 修改返利开始时间的时候触发
// 首先判断返利时间范围是否填写 if (tqq9_startexcludate != null) {
if (tqq9_startdate == null || tqq9_enddate == null) { if (tqq9_startdate != null) {
this.getView().showErrorNotification("返利时间范围未填写"); if (tqq9_startdate.compareTo(tqq9_startexcludate) > 0) {
return; this.getView().showErrorNotification("排除时间段的开始时间应大于等于返利时间范围的结束时间!");
//清空排除时间
if ("tqq9_startdate".equals(name)) {
this.getModel().setValue("tqq9_startdate", oldValueObj);
} else {
this.getModel().setValue("tqq9_startexcludate", oldValueObj);
} }
// 判断排除时间范围是否填写
if (tqq9_startexcludate != null || tqq9_endexcludate != null) {
if (tqq9_startexcludate == null || tqq9_endexcludate == null) {
this.getView().showErrorNotification("排除时间范围需完整填写");
return;
} }
// 判断返利时间范围是否大于等于排除时间范围 } else {
if (tqq9_startdate.compareTo(tqq9_startexcludate) > 0 || tqq9_enddate.compareTo(tqq9_endexcludate) < 0) { this.getView().showErrorNotification("请先填写返利时间范围的开始时间!");
this.getView().showErrorNotification("返利时间范围应大于等于排除时间范围"); this.getModel().setValue("tqq9_startexcludate", null);
return; }
}
}
//校验排除时间段的结束时间应小于等于返利时间范围的结束时间
if (StringUtils.equals("tqq9_endexcludate", name) ||
StringUtils.equals("tqq9_enddate", name)) {
Date tqq9_enddate = dataEntity.getDate("tqq9_enddate");
Date tqq9_endexcludate = dataEntity.getDate("tqq9_endexcludate");
// 修改返利开始时间的时候触发
if (tqq9_endexcludate != null) {
if (tqq9_enddate != null) {
if (tqq9_endexcludate.compareTo(tqq9_enddate) > 0) {
this.getView().showErrorNotification("排除时间段的结束时间应小于等于返利时间范围的结束时间!");
//清空排除时间
if ("tqq9_enddate".equals(name)) {
this.getModel().setValue("tqq9_enddate", oldValueObj);
} else {
this.getModel().setValue("tqq9_endexcludate", oldValueObj);
}
}
} else {
this.getView().showErrorNotification("请先填写返利时间范围的结束时间!");
this.getModel().setValue("tqq9_endexcludate", null);
} }
} }
} }
} }