|
@@ -54,7 +54,7 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
public static final String PENDING_PLAN_REVIEW = "待计划评审";
|
|
|
public static final String PREPARING_MATERIAL = "备料中";
|
|
|
public static final String TO_BE_PROCESSED = "待加工";
|
|
|
-
|
|
|
+ public static final String VERIFIED = "已检验";
|
|
|
|
|
|
/**
|
|
|
* 保存检验结果后更新相关信息
|
|
@@ -76,6 +76,10 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
log.error("无法根据ID:{}获取到报工记录", id);
|
|
|
return R.error();
|
|
|
}
|
|
|
+ if (VERIFIED.equals(reportRecordsDo.getCheckstatus())) {
|
|
|
+ log.error("当前报工记录已检验无法再次检验");
|
|
|
+ return R.error();
|
|
|
+ }
|
|
|
// 获取工序作业信息
|
|
|
ApsProcessOperationDo currentProcessOperationDo = apsProcessOperationService.getOne(new LambdaQueryWrapper<ApsProcessOperationDo>()
|
|
|
.eq(ApsProcessOperationDo::getId, reportRecordsDo.getProcessoperationid()).eq(BaseDo::getDeleted, NO_DELETED));
|
|
@@ -123,7 +127,10 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
List<ApsReportOutputDo> unqualificationOutPutList = reportOutputDos.stream().filter(info -> NO.equals(info.getQualified())).collect(Collectors.toList());
|
|
|
// 检验合格的数量信息
|
|
|
List<ApsReportOutputDo> qualifiedOutPutList = reportOutputDos.stream().filter(info -> YES.equals(info.getQualified())).collect(Collectors.toList());
|
|
|
-
|
|
|
+ if (unqualificationOutPutList.isEmpty() && qualifiedOutPutList.isEmpty()) {
|
|
|
+ log.debug("暂无检验的数据");
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
String nextProcessId = currentProcessOperationDo.getNextprocessid();
|
|
|
// 获取当前工序对应的后道工序信息
|
|
|
List<ApsProcessOperationDo> nextProcessOperationDos = new ArrayList<>();
|
|
@@ -139,9 +146,9 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
|
|
|
/******************************开始数据处理逻辑***************************************/
|
|
|
// 更新合格不合格数量
|
|
|
- int unqualifiedQuantity = qualifiedOutPutList.size();
|
|
|
+ int unqualifiedQuantity = unqualificationOutPutList.size();
|
|
|
// 更新合格数量
|
|
|
- int qualifiedQuantity = unqualificationOutPutList.size();
|
|
|
+ int qualifiedQuantity = qualifiedOutPutList.size();
|
|
|
// 更新已检验卷数
|
|
|
int inspectQuantity = reportOutputDos.size();
|
|
|
// 订单信息
|
|
@@ -164,7 +171,7 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
apsProcessOperationService.updateBachmaterialprocessByIds(nextProcessOperationDos.stream()
|
|
|
.map(ApsProcessOperationDo::getId).collect(Collectors.toList()), toBeProcessedBatchNum);
|
|
|
}
|
|
|
- //存在不合格批次信息时 更新更新报工记录对应订单的订单评审状态=待计划评审, 订单调整日期=今天
|
|
|
+ /***************************存在不合格批次信息时 更新更新报工记录对应订单的订单评审状态=待计划评审, 订单调整日期=今天*************************************/
|
|
|
if (unqualifiedQuantity > 0) {
|
|
|
apsProductionOrderService.update(new LambdaUpdateWrapper<ApsProductionOrderDo>()
|
|
|
.eq(ApsProductionOrderDo::getId, productionOrderDo.getId())
|
|
@@ -172,14 +179,24 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
.set(ApsProductionOrderDo::getAuditstatus, PENDING_PLAN_REVIEW)
|
|
|
);
|
|
|
}
|
|
|
- // 更新当前工序的输出已检验卷数,不合格卷数,合格卷数
|
|
|
+ /************************更新当前工序的输出已检验卷数,不合格卷数,合格卷数*******************************/
|
|
|
apsProcessOperationService.updateAboutCheckBatchNum(currentProcessOperationDo.getId(), inspectQuantity, qualifiedQuantity, unqualifiedQuantity);
|
|
|
- // 更新在制品信息
|
|
|
- apsWorkInProgressInventoryService.saveOrUpdateBatch(apsWorkInProgressInventoryDos);
|
|
|
- // 更新当前报工记录的待检验批次号
|
|
|
+ /***************更新在制品信息****************************/
|
|
|
+ // 需要刪除的ID
|
|
|
+ List<String> deletedIdList = apsWorkInProgressInventoryDos.stream()
|
|
|
+ .filter(info -> DELETED.equals(info.getDeleted())).map(ApsWorkInProgressInventoryDo::getId).collect(Collectors.toList());
|
|
|
+ List<ApsWorkInProgressInventoryDo> updateList = apsWorkInProgressInventoryDos.stream()
|
|
|
+ .filter(info -> NO_DELETED.equals(info.getDeleted())).collect(Collectors.toList());
|
|
|
+ if (!updateList.isEmpty()) {
|
|
|
+ apsWorkInProgressInventoryService.updateWorkinprocessstatus(apsWorkInProgressInventoryDos);
|
|
|
+ }
|
|
|
+ if (!deletedIdList.isEmpty()) {
|
|
|
+ apsWorkInProgressInventoryService.removeByIds(deletedIdList);
|
|
|
+ }
|
|
|
+ /********************************更新当前报工记录的待检验批次号*************************************/
|
|
|
apsReportRecordsService.update(new LambdaUpdateWrapper<ApsReportRecordsDo>().eq(ApsReportRecordsDo::getId, id)
|
|
|
+ .set(ApsReportRecordsDo::getCheckstatus, VERIFIED)
|
|
|
.set(ApsReportRecordsDo::getNeedcheckbatchnumber, ""));
|
|
|
-
|
|
|
return R.ok();
|
|
|
}
|
|
|
|