这里先做了一个小的构思,
@Transient
public Integer getRejBatch() {
Set<String> set = new HashSet<String>();
for(NormalSample sample : normalSamples){
String aa = sample.getJudgement()+sample.getBatchNO();
set.add(aa);//如果 判断+卡板号 aa的数目=卡板数,表示全部通过,否者多几个就是几个不合格。
}
//FixedME cset中有几个Re就是几
int a = getBatchNum().intValue();
return set.size()> a ? (set.size() - getBatchNum()): 0;
}
但是有个bug,就是,就一个卡板,就一箱,或者卡板每箱都是NG,这就不能判定了,
修改:
@Transient
public Integer getRejBatch() {
Set<String> set = new HashSet<String>();
for(NormalSample sample : normalSamples){
String aa = (sample.getJudgement()+sample.getBatchNO());
set.add(aa);//
}
//FixedME change to set中有几个Re就是几
int a=0;
String s1 ="Re";
for(String str:set){
if (str.contains(s1)){
a++;
}
}
return a;
}
直接从set集合中找包含“Re”的字符串的个数,,呵呵,这个解决后够自己乐好几天了--