parent
7e7361a44e
commit
97768ade11
@ -5,6 +5,11 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.ExtendedDataEntity;
|
||||
import kd.bos.entity.validate.AbstractValidator;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhouc
|
||||
* @date 2023/10/11 19:12
|
||||
@ -37,6 +42,32 @@ public class TracktaskconsoleSavevalidator extends AbstractValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
DynamicObjectCollection c = dataEntity.getDynamicObjectCollection("yem_es_materialinfo");
|
||||
Map<Long, Integer> cancelQty = new LinkedHashMap<>();
|
||||
for (DynamicObject d : c) {
|
||||
long id = d.getLong("id");
|
||||
BigDecimal cancel_num = d.getBigDecimal("yem_cancel_num");
|
||||
if (cancel_num.compareTo(BigDecimal.ZERO) > 0) {
|
||||
cancelQty.put(id, c.indexOf(d));
|
||||
}
|
||||
}
|
||||
|
||||
DynamicObjectCollection backC = dataEntity.getDynamicObjectCollection("yem_es_salesorder_r");
|
||||
for (DynamicObject d : backC) {
|
||||
long entrtyid = d.getLong("yem_entrtyid");
|
||||
if (cancelQty.containsKey(entrtyid)) {
|
||||
Integer idx = cancelQty.get(entrtyid);
|
||||
DynamicObjectCollection subC = d.getDynamicObjectCollection("yem_es_salesorder_z");
|
||||
if (!subC.isEmpty()) {
|
||||
sb.append(String.format("商品明细第 %s 行已维护取消数量,不允许维护整机生产信息!", idx + 1)).append("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
this.addErrorMessage(dataEntitie, sb.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user