update:
foreach不能remove,使用迭代器
This commit is contained in:
parent
af9b7a83cb
commit
373b66aaa3
@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,7 +118,24 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe
|
|||||||
queryWrapper.eq(CurrTaskDet.IDEN_CARD_NUM, idCard)
|
queryWrapper.eq(CurrTaskDet.IDEN_CARD_NUM, idCard)
|
||||||
.eq(CurrTaskDet.VALID, 1);
|
.eq(CurrTaskDet.VALID, 1);
|
||||||
List<CurrTaskDet> list = currTaskDetServiceBiz.list(queryWrapper);
|
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());
|
CurrTaskVo byId = currTaskService.getCurrTask(IdParam.builder().id(e.getCurrTaskId()).build());
|
||||||
//如果加工类型是复加工,或者任务作废。移除对象
|
//如果加工类型是复加工,或者任务作废。移除对象
|
||||||
if (byId.getProcessType().equals(2) || byId.getValid() != 1)
|
if (byId.getProcessType().equals(2) || byId.getValid() != 1)
|
||||||
@ -131,7 +149,7 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe
|
|||||||
list.remove(e);
|
list.remove(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
//计算加工总数
|
//计算加工总数
|
||||||
double sumWeight = list.stream().mapToDouble(CurrTaskDet::getWeight).sum();
|
double sumWeight = list.stream().mapToDouble(CurrTaskDet::getWeight).sum();
|
||||||
double sumQuantity = list.stream().mapToDouble(CurrTaskDet::getQuantity).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 org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,7 +76,24 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ
|
|||||||
queryWrapper.eq(TaskDetHis.IDEN_CARD_NUM, idCard)
|
queryWrapper.eq(TaskDetHis.IDEN_CARD_NUM, idCard)
|
||||||
.eq(TaskDetHis.VALID, 1);
|
.eq(TaskDetHis.VALID, 1);
|
||||||
List<TaskDetHis> list = taskDetHisServiceBiz.list(queryWrapper);
|
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());
|
CurrTaskVo byId = taskhisService.getById(IdParam.builder().id(e.getCurrTaskId()).build());
|
||||||
//如果加工类型是复加工,或者任务作废。移除对象
|
//如果加工类型是复加工,或者任务作废。移除对象
|
||||||
if (byId.getProcessType().equals(2) || byId.getValid() != 1)
|
if (byId.getProcessType().equals(2) || byId.getValid() != 1)
|
||||||
@ -89,7 +107,7 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ
|
|||||||
list.remove(e);
|
list.remove(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
//计算加工总数
|
//计算加工总数
|
||||||
double sumWeight = list.stream().mapToDouble(TaskDetHis::getWeight).sum();
|
double sumWeight = list.stream().mapToDouble(TaskDetHis::getWeight).sum();
|
||||||
double sumQuantity = list.stream().mapToDouble(TaskDetHis::getQuantity).sum();
|
double sumQuantity = list.stream().mapToDouble(TaskDetHis::getQuantity).sum();
|
||||||
|
Loading…
Reference in New Issue
Block a user