update:
foreach不能remove,使用迭代器
Bu işleme şunda yer alıyor:
ebeveyn
af9b7a83cb
işleme
373b66aaa3
@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -117,7 +118,24 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe
|
||||
queryWrapper.eq(CurrTaskDet.IDEN_CARD_NUM, idCard)
|
||||
.eq(CurrTaskDet.VALID, 1);
|
||||
List<CurrTaskDet> list = currTaskDetServiceBiz.list(queryWrapper);
|
||||
list.forEach(e -> {
|
||||
Iterator<CurrTaskDet> iterator=list.iterator();
|
||||
while (iterator.hasNext()){
|
||||
CurrTaskDet currTaskDet = iterator.next();
|
||||
CurrTaskVo byId = currTaskService.getCurrTask(IdParam.builder().id(currTaskDet.getCurrTaskId()).build());
|
||||
//如果加工类型是复加工,或者任务作废。移除对象
|
||||
if (byId.getProcessType().equals(2) || byId.getValid() != 1)
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
//如果是多步骤任务且不是第一步,移除对象
|
||||
if (byId.getIsAuto()==1){
|
||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(byId.getAutoExeTaskId());
|
||||
if (!byId.getId().equals(autoExeTask.getFTaskId())){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
/* list.forEach(e -> {
|
||||
CurrTaskVo byId = currTaskService.getCurrTask(IdParam.builder().id(e.getCurrTaskId()).build());
|
||||
//如果加工类型是复加工,或者任务作废。移除对象
|
||||
if (byId.getProcessType().equals(2) || byId.getValid() != 1)
|
||||
@ -131,7 +149,7 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe
|
||||
list.remove(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
});*/
|
||||
//计算加工总数
|
||||
double sumWeight = list.stream().mapToDouble(CurrTaskDet::getWeight).sum();
|
||||
double sumQuantity = list.stream().mapToDouble(CurrTaskDet::getQuantity).sum();
|
||||
|
@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -75,7 +76,24 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ
|
||||
queryWrapper.eq(TaskDetHis.IDEN_CARD_NUM, idCard)
|
||||
.eq(TaskDetHis.VALID, 1);
|
||||
List<TaskDetHis> list = taskDetHisServiceBiz.list(queryWrapper);
|
||||
list.forEach(e -> {
|
||||
Iterator<TaskDetHis> iterator=list.iterator();
|
||||
while (iterator.hasNext()){
|
||||
TaskDetHis taskDetHis = iterator.next();
|
||||
CurrTaskVo byId = taskhisService.getById(IdParam.builder().id(taskDetHis.getCurrTaskId()).build());
|
||||
//如果加工类型是复加工,或者任务作废。移除对象
|
||||
if (byId.getProcessType().equals(2) || byId.getValid() != 1)
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
//如果是多步骤任务且不是第一步,移除对象
|
||||
if (byId.getIsAuto()==1){
|
||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(byId.getAutoExeTaskId());
|
||||
if (!byId.getId().equals(autoExeTask.getFTaskId())){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
/* list.forEach(e -> {
|
||||
CurrTaskVo byId = taskhisService.getById(IdParam.builder().id(e.getCurrTaskId()).build());
|
||||
//如果加工类型是复加工,或者任务作废。移除对象
|
||||
if (byId.getProcessType().equals(2) || byId.getValid() != 1)
|
||||
@ -89,7 +107,7 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ
|
||||
list.remove(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
});*/
|
||||
//计算加工总数
|
||||
double sumWeight = list.stream().mapToDouble(TaskDetHis::getWeight).sum();
|
||||
double sumQuantity = list.stream().mapToDouble(TaskDetHis::getQuantity).sum();
|
||||
|
Yükleniyor…
Yeni konuda referans
Bir kullanıcı engelle