|
@@ -1220,8 +1220,6 @@ public class BizDayworkItemController extends BaseController {
|
|
|
List<BizDaywork> bizDayworks = bizDayworkService.query().in("id", allCarries.isEmpty() ? Collections.singletonList(0L) : allCarries.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).list();
|
|
|
//查询分选-包装的审核申请
|
|
|
List<BizDayworkItemExamine> dayworkExamineList = bizDayworkItemExamineService.query().in("daywork_id", allCarries.isEmpty() ? Collections.singletonList(0L) : allCarries.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).list();
|
|
|
- //需要删除的审核申请集合
|
|
|
- List<BizDayworkItemExamine> needRemoveList = new ArrayList<>();
|
|
|
//需要新增的审核申请集合
|
|
|
List<BizDayworkItemExamine> needAddList = new ArrayList<>();
|
|
|
// 遍历 daywork 数据集合
|
|
@@ -1244,15 +1242,11 @@ public class BizDayworkItemController extends BaseController {
|
|
|
bizItem.setStatus(bizDayworkItem.getStatus());
|
|
|
//添加分选-包装的审核申请
|
|
|
if(bizDayworkItem.getIsNextPacking()) {
|
|
|
- List<BizDayworkItemExamine> examineData = dayworkExamineList.stream().filter(item -> item.getDayworkId().equals(v.getId())).collect(Collectors.toList());
|
|
|
//如果有审核申请,则删除审核申请,重新新增
|
|
|
- if(examineData.size() > 0) {
|
|
|
- //如果已经审核了,则保留
|
|
|
- List<BizDayworkItemExamine> alreadyExamineList = examineData.stream().filter(item -> item.getStatus().equals(1) || item.getStatus().equals(2)).collect(Collectors.toList());
|
|
|
- if(alreadyExamineList.size() == 0) {
|
|
|
- needRemoveList.addAll(examineData);
|
|
|
- }
|
|
|
- }
|
|
|
+ if(dayworkExamineList.size() > 0) {
|
|
|
+ //删除多余的审核申请
|
|
|
+ bizDayworkItemExamineService.removeBatchByIds(dayworkExamineList);
|
|
|
+ }else {
|
|
|
//新增审核申请
|
|
|
BizDayworkItemExamine examine = new BizDayworkItemExamine();
|
|
|
examine.setDayworkId(v.getId());
|
|
@@ -1269,7 +1263,7 @@ public class BizDayworkItemController extends BaseController {
|
|
|
examine.setProcessAlias(bizDayworkItem.getProcess().getProcessAlias());
|
|
|
examine.setStatus(0);
|
|
|
needAddList.add(examine);
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
// 如果报工状态为:7(已送达)或者4(待周转),则需要设置对应的daywork的当前部门id,以及合格数
|
|
|
// 这里的状态值4/7,是由前端传递过来的。
|
|
@@ -1356,8 +1350,7 @@ public class BizDayworkItemController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //删除多余的审核申请
|
|
|
- bizDayworkItemExamineService.removeBatchByIds(needRemoveList);
|
|
|
+
|
|
|
bizDayworkItemExamineService.saveBatch(needAddList);
|
|
|
return toAjax(batch);
|
|
|
}
|