|
@@ -1178,30 +1178,30 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
inspection.setStartTime(new Date());
|
|
|
}
|
|
|
bizProcessInspecionService.save(inspection);
|
|
|
- //保存检查明细
|
|
|
- List<BizInspectionStandardsCheck> inspectionStandardsCheckList = bizInspectionStandardsCheckService.query()
|
|
|
- .eq("inspection_code", "instrumentRoomInspection")
|
|
|
- .eq("product_id", inspection.getProductId())
|
|
|
- .eq("process_id", processInspecion.getLot().getProcessId()).list();
|
|
|
- List<BizProcessInspectionDetail> detailList = new ArrayList<>();
|
|
|
- inspectionStandardsCheckList.forEach(inspectionStandardsCheck -> {
|
|
|
- BizProcessInspectionDetail detail = new BizProcessInspectionDetail();
|
|
|
- detail.setId(null);
|
|
|
- detail.setUserId(processInspecion.getLot().getUserId());
|
|
|
- detail.setProcessInspectionId(inspection.getId());
|
|
|
- detail.setDayworkId(0L);
|
|
|
- detail.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
- detail.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
- detail.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
- detail.setLotId(processInspecion.getLot().getId());
|
|
|
- detail.setDayworkItemId(dayworkItem.getId());
|
|
|
- detail.setCheckStandard(inspectionStandardsCheck.getStandard());
|
|
|
- detail.setInspectionStandardsId(inspectionStandardsCheck.getId());
|
|
|
- detailList.add(detail);
|
|
|
- });
|
|
|
- if(!detailList.isEmpty()) {
|
|
|
- processInspectionDetailService.saveBatch(detailList);
|
|
|
- }
|
|
|
+// //保存检查明细
|
|
|
+// List<BizInspectionStandardsCheck> inspectionStandardsCheckList = bizInspectionStandardsCheckService.query()
|
|
|
+// .eq("inspection_code", "instrumentRoomInspection")
|
|
|
+// .eq("product_id", inspection.getProductId())
|
|
|
+// .eq("process_id", processInspecion.getLot().getProcessId()).list();
|
|
|
+// List<BizProcessInspectionDetail> detailList = new ArrayList<>();
|
|
|
+// inspectionStandardsCheckList.forEach(inspectionStandardsCheck -> {
|
|
|
+// BizProcessInspectionDetail detail = new BizProcessInspectionDetail();
|
|
|
+// detail.setId(null);
|
|
|
+// detail.setUserId(processInspecion.getLot().getUserId());
|
|
|
+// detail.setProcessInspectionId(inspection.getId());
|
|
|
+// detail.setDayworkId(0L);
|
|
|
+// detail.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+// detail.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+// detail.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+// detail.setLotId(processInspecion.getLot().getId());
|
|
|
+// detail.setDayworkItemId(dayworkItem.getId());
|
|
|
+// detail.setCheckStandard(inspectionStandardsCheck.getStandard());
|
|
|
+// detail.setInspectionStandardsId(inspectionStandardsCheck.getId());
|
|
|
+// detailList.add(detail);
|
|
|
+// });
|
|
|
+// if(!detailList.isEmpty()) {
|
|
|
+// processInspectionDetailService.saveBatch(detailList);
|
|
|
+// }
|
|
|
//绑定检测载具
|
|
|
BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
|
|
|
newDayworkCarrier.setDayworkId(inspection.getDayworkId());
|
|
@@ -1475,30 +1475,30 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
inspection.setStartTime(new Date());
|
|
|
}
|
|
|
bizProcessInspecionService.save(inspection);
|
|
|
- //保存检查明细
|
|
|
- List<BizInspectionStandardsCheck> inspectionStandardsCheckList = bizInspectionStandardsCheckService.query()
|
|
|
- .eq("inspection_code", "instrumentRoomInspection")
|
|
|
- .eq("product_id", inspection.getProductId())
|
|
|
- .eq("process_id", processInspecion.getLot().getProcessId()).list();
|
|
|
- List<BizProcessInspectionDetail> detailList = new ArrayList<>();
|
|
|
- inspectionStandardsCheckList.forEach(inspectionStandardsCheck -> {
|
|
|
- BizProcessInspectionDetail detail = new BizProcessInspectionDetail();
|
|
|
- detail.setId(null);
|
|
|
- detail.setUserId(processInspecion.getLot().getUserId());
|
|
|
- detail.setProcessInspectionId(inspection.getId());
|
|
|
- detail.setDayworkId(0L);
|
|
|
- detail.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
- detail.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
- detail.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
- detail.setLotId(processInspecion.getLot().getId());
|
|
|
- detail.setDayworkItemId(dayworkItem.getId());
|
|
|
- detail.setCheckStandard(inspectionStandardsCheck.getStandard());
|
|
|
- detail.setInspectionStandardsId(inspectionStandardsCheck.getId());
|
|
|
- detailList.add(detail);
|
|
|
- });
|
|
|
- if(!detailList.isEmpty()) {
|
|
|
- processInspectionDetailService.saveBatch(detailList);
|
|
|
- }
|
|
|
+// //保存检查明细
|
|
|
+// List<BizInspectionStandardsCheck> inspectionStandardsCheckList = bizInspectionStandardsCheckService.query()
|
|
|
+// .eq("inspection_code", "instrumentRoomInspection")
|
|
|
+// .eq("product_id", inspection.getProductId())
|
|
|
+// .eq("process_id", processInspecion.getLot().getProcessId()).list();
|
|
|
+// List<BizProcessInspectionDetail> detailList = new ArrayList<>();
|
|
|
+// inspectionStandardsCheckList.forEach(inspectionStandardsCheck -> {
|
|
|
+// BizProcessInspectionDetail detail = new BizProcessInspectionDetail();
|
|
|
+// detail.setId(null);
|
|
|
+// detail.setUserId(processInspecion.getLot().getUserId());
|
|
|
+// detail.setProcessInspectionId(inspection.getId());
|
|
|
+// detail.setDayworkId(0L);
|
|
|
+// detail.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+// detail.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+// detail.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+// detail.setLotId(processInspecion.getLot().getId());
|
|
|
+// detail.setDayworkItemId(dayworkItem.getId());
|
|
|
+// detail.setCheckStandard(inspectionStandardsCheck.getStandard());
|
|
|
+// detail.setInspectionStandardsId(inspectionStandardsCheck.getId());
|
|
|
+// detailList.add(detail);
|
|
|
+// });
|
|
|
+// if(!detailList.isEmpty()) {
|
|
|
+// processInspectionDetailService.saveBatch(detailList);
|
|
|
+// }
|
|
|
//绑定检测载具
|
|
|
BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
|
|
|
newDayworkCarrier.setDayworkId(inspection.getDayworkId());
|
|
@@ -1985,20 +1985,49 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
@PostMapping("/unbindInspectionCarrier")
|
|
|
public AjaxResult unbindInspectionCarrier(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
List<BizDayworkCarrier> carrierList = bizDayworkCarrierService.query().eq("carrier_code", dayworkCarrier.getCarrierCode()).list();
|
|
|
- //判断领取的人是否是当前工序的操作者
|
|
|
- Long dayworkId = carrierList.get(0).getDayworkId();
|
|
|
- List<BizDayworkItem> dayworkItemList = bizDayworkItemService.query().eq("daywork_id", dayworkId).orderByDesc("create_time").list();
|
|
|
- String lastProcessStepNumber = dayworkItemList.get(0).getProcessStepNumber();
|
|
|
- List<BizDayworkItem> lastDayworkItemList = dayworkItemList.stream().filter(item -> item.getProcessStepNumber().equals(lastProcessStepNumber)).collect(Collectors.toList());
|
|
|
- List<Long> lastUserIds = lastDayworkItemList.stream().map(BizDayworkItem::getUserId).distinct().collect(Collectors.toList());
|
|
|
- Long loginUserId = SecurityUtils.getLoginUser().getUserId();
|
|
|
- if(!lastUserIds.contains(loginUserId)) {
|
|
|
- carrierList.forEach(item -> {
|
|
|
- item.setIsChanged(1);
|
|
|
- });
|
|
|
- return success(bizDayworkCarrierService.updateBatchById(carrierList));
|
|
|
+ //操作检查表
|
|
|
+ List<BizProcessInspecion> list = bizProcessInspecionService.query()
|
|
|
+ .eq("inspection_carrier_code", dayworkCarrier.getCarrierCode())
|
|
|
+ .eq("is_inspection_carrier_changed", 0)
|
|
|
+ .list();
|
|
|
+ //判断如果是出厂检查创建者和最新那道序所有报工人员能领取
|
|
|
+ if(list.stream().anyMatch(v->v.getType().equals("factoryInspection"))) {
|
|
|
+ Long dayworkId = carrierList.get(0).getDayworkId();
|
|
|
+ List<BizDayworkItem> dayworkItemList = bizDayworkItemService.query().eq("daywork_id", dayworkId).orderByDesc("create_time").list();
|
|
|
+ String lastProcessStepNumber = dayworkItemList.get(0).getProcessStepNumber();
|
|
|
+ List<BizDayworkItem> lastDayworkItemList = dayworkItemList.stream().filter(item -> item.getProcessStepNumber().equals(lastProcessStepNumber)).collect(Collectors.toList());
|
|
|
+ List<Long> lastUserIds = lastDayworkItemList.stream().map(BizDayworkItem::getUserId).distinct().collect(Collectors.toList());
|
|
|
+ lastUserIds.add(list.get(0).getCreatorId());
|
|
|
+ //当前登陆者
|
|
|
+ Long loginUserId = SecurityUtils.getLoginUser().getUserId();
|
|
|
+ if(lastUserIds.contains(loginUserId)) {
|
|
|
+ carrierList.forEach(item -> {
|
|
|
+ item.setIsChanged(1);
|
|
|
+ });
|
|
|
+ list.forEach(item ->{
|
|
|
+ item.setIsInspectionCarrierChanged(1);
|
|
|
+ bizProcessInspecionService.updateBatchById(list);
|
|
|
+ });
|
|
|
+ return success(bizDayworkCarrierService.updateBatchById(carrierList));
|
|
|
+ }
|
|
|
+ return error("您未参与当前批次的加工,无法领取");
|
|
|
+ }else {
|
|
|
+ //检查选择的操作者能领取
|
|
|
+ List<Long> lastUserIds = list.stream().map(BizProcessInspecion::getUserId).distinct().collect(Collectors.toList());
|
|
|
+ //当前登陆者
|
|
|
+ Long loginUserId = SecurityUtils.getLoginUser().getUserId();
|
|
|
+ if(lastUserIds.contains(loginUserId)) {
|
|
|
+ carrierList.forEach(item -> {
|
|
|
+ item.setIsChanged(1);
|
|
|
+ });
|
|
|
+ list.forEach(item ->{
|
|
|
+ item.setIsInspectionCarrierChanged(1);
|
|
|
+ bizProcessInspecionService.updateBatchById(list);
|
|
|
+ });
|
|
|
+ return success(bizDayworkCarrierService.updateBatchById(carrierList));
|
|
|
+ }
|
|
|
+ return error("您不是当前检查的操作者,无法领取");
|
|
|
}
|
|
|
- return error("您未参与当前批次的加工,无法领取");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2015,9 +2044,10 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
}
|
|
|
|
|
|
//获取报工信息
|
|
|
- List<BizDayworkItem> itemList = bizDayworkItemService.getByDayworkId(dayworkCarrier.getDayworkId()).stream().filter(item ->!item.getStatus().equals("0")).collect(Collectors.toList());
|
|
|
+ BizDayworkCarrier finalDayworkCarrier = dayworkCarrier;
|
|
|
+ List<BizDayworkItem> itemList = bizDayworkItemService.getByDayworkId(dayworkCarrier.getDayworkId()).stream().filter(item ->!item.getStatus().equals("0") && item.getDeptId().equals(finalDayworkCarrier.getDeptId())).collect(Collectors.toList());
|
|
|
if (itemList.size() == 0) {
|
|
|
- return error("该批次未开始加工");
|
|
|
+ return error("该批次当前工段没有报工");
|
|
|
}
|
|
|
BizDayworkItem item = itemList.get(0);
|
|
|
List<BizDayworkItem> latestList = itemList.stream().filter(v -> v.getProcessStepNumber().equals(item.getProcessStepNumber())).collect(Collectors.toList());
|