|
@@ -106,38 +106,62 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
|
|
|
if (redisService.hasKey(id) && !redisService.getRedisCatchObj(id).equals(currentUser.getId())) {
|
|
|
log.error("该作业已被其他人:{}检验", locks.get(id));
|
|
|
- return R.error("该作业已被其他人检验");
|
|
|
+ throw new CustomException("该作业已被其他人检验");
|
|
|
}
|
|
|
try {
|
|
|
if (StringUtil.isBlank(id)) {
|
|
|
log.debug("参数为空");
|
|
|
- return R.error("报工检验参数异常");
|
|
|
+ throw new CustomException("报工检验参数异常");
|
|
|
}
|
|
|
// 获取报工记录
|
|
|
ApsReportRecordsDo reportRecordsDo = apsReportRecordsService.getById(id);
|
|
|
if (reportRecordsDo == null) {
|
|
|
log.error("无法根据ID:{}获取到报工记录", id);
|
|
|
- return R.error("无法获取到报工记录");
|
|
|
+ throw new CustomException("无法获取到报工记录");
|
|
|
}
|
|
|
if (VERIFIED.equals(reportRecordsDo.getCheckstatus())) {
|
|
|
log.error("当前报工记录已检验无法再次检验");
|
|
|
- return R.error("该作业已被其他人检验");
|
|
|
+ throw new CustomException("该作业已被其他人检验");
|
|
|
}
|
|
|
- apsReportRecordsService.update(new LambdaUpdateWrapper<ApsReportRecordsDo>().eq(ApsReportRecordsDo::getId, id)
|
|
|
- .set(ApsReportRecordsDo::getCheckstatus, VERIFIED));
|
|
|
// 获取该工序生成的物料输出信息
|
|
|
List<ApsReportOutputDo> reportOutputDos = apsReportOutputService.list(new LambdaQueryWrapper<ApsReportOutputDo>()
|
|
|
.eq(ApsReportOutputDo::getMainid, id)
|
|
|
.eq(BaseDo::getDeleted, NO_DELETED));
|
|
|
if (reportOutputDos.isEmpty()) {
|
|
|
log.error("无法根据ID:{}获取到输出物料信息", id);
|
|
|
- return R.error("无法获取到输出物料信息");
|
|
|
+ throw new CustomException("无法获取到输出物料信息");
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<ApsReportRecordsDo> reportUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ //根据输出物料信息,赋值更新报工记录的合格信息
|
|
|
+ //查询不合格的输出
|
|
|
+ List<ApsReportOutputDo> unQualifiedList = reportOutputDos.stream().filter(item -> item.getQualified().equals("否")).collect(Collectors.toList());
|
|
|
+ if (unQualifiedList.isEmpty()) {
|
|
|
+ reportUpdateWrapper.set(ApsReportRecordsDo::getQualified, "是");
|
|
|
+ } else {
|
|
|
+ reportUpdateWrapper.set(ApsReportRecordsDo::getQualified, "否");
|
|
|
+ String defectdesc = "";
|
|
|
+ for (ApsReportOutputDo apsReportOutputDo : unQualifiedList) {
|
|
|
+ String mainError = "";
|
|
|
+ String secondError = "";
|
|
|
+ if (StringUtils.isNotBlank(apsReportOutputDo.getMajordesc())) {
|
|
|
+ mainError = apsReportOutputDo.getMajordesc();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(apsReportOutputDo.getMinordesc())) {
|
|
|
+ secondError = apsReportOutputDo.getMinordesc();
|
|
|
+ }
|
|
|
+ defectdesc += apsReportOutputDo.getOutputnumber() + "-主要缺陷:" + mainError + ";次要缺陷:" + secondError + "。";
|
|
|
+ }
|
|
|
+ reportUpdateWrapper.set(ApsReportRecordsDo::getDefectdesc, defectdesc);
|
|
|
}
|
|
|
+
|
|
|
+ apsReportRecordsService.update(reportUpdateWrapper.eq(ApsReportRecordsDo::getId, id)
|
|
|
+ .set(ApsReportRecordsDo::getCheckstatus, VERIFIED));
|
|
|
+
|
|
|
// 获取工序作业信息
|
|
|
String currentProcessOperationId = reportRecordsDo.getProcessoperationid();
|
|
|
if (StringUtils.isBlank(currentProcessOperationId)) {
|
|
|
log.error("当前报工记录:{}无法获取到对应的工序作业信息!", id);
|
|
|
- return R.error("无法获取到工序作业信息,请联系系统管理员!");
|
|
|
+ throw new CustomException("无法获取到工序作业信息,请联系系统管理员!");
|
|
|
}
|
|
|
// 获取工序作业主表信息
|
|
|
ApsProcessOperationDo currentProcessOperationMainDo = apsProcessOperationService.getOne(new LambdaQueryWrapper<ApsProcessOperationDo>()
|
|
@@ -145,13 +169,13 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
.eq(BaseDo::getDeleted, NO_DELETED));
|
|
|
if (currentProcessOperationMainDo == null) {
|
|
|
log.error("无法根据ID:{}获取到工序作业信息", id);
|
|
|
- return R.error("无法获取到工序作业信息,请联系系统管理员!");
|
|
|
+ throw new CustomException("无法获取到工序作业信息,请联系系统管理员!");
|
|
|
}
|
|
|
// 获取工序作业明细信息
|
|
|
ApsProcessOperationProcessEquDo currentProcessOperationEqu = apsProcessOperationProcessEquService.getById(reportRecordsDo.getProcessequid());
|
|
|
if (currentProcessOperationEqu == null) {
|
|
|
log.error("无法找到当前报工记录对应的工序作业信息");
|
|
|
- return R.error("无法找到当前报工记录对应的工序作业信息");
|
|
|
+ throw new CustomException("无法找到当前报工记录对应的工序作业信息");
|
|
|
}
|
|
|
// 获取工序作业对应的输出物料信息
|
|
|
List<ApsProcessOperationOutMaterDo> operationOutMaterDoList = apsProcessOperationOutMaterService.list(new LambdaQueryWrapper<ApsProcessOperationOutMaterDo>()
|
|
@@ -159,7 +183,7 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
.eq(BaseDo::getDeleted, NO_DELETED));
|
|
|
if (operationOutMaterDoList.isEmpty()) {
|
|
|
log.error("无法根据工序作业ID:{}获取对应的输出物料信息", currentProcessOperationId);
|
|
|
- return R.error("无法获取到对应的输出物料信息");
|
|
|
+ throw new CustomException("无法获取到对应的输出物料信息");
|
|
|
}
|
|
|
// 工序作业明细ID
|
|
|
String processOperationEquId = currentProcessOperationEqu.getId();
|
|
@@ -169,32 +193,32 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
String blankId = currentProcessOperationMainDo.getBlankid();
|
|
|
if (StringUtils.isBlank(blankId)) {
|
|
|
log.error("无法根据工序获取到生产订单信息");
|
|
|
- return R.error("无法获取到生产订单信息");
|
|
|
+ throw new CustomException("无法获取到生产订单信息");
|
|
|
}
|
|
|
// 获取坯料计划
|
|
|
ApsBlankOrderDo blankOrderDo = apsBlankOrderService.getBaseMapper().selectById(blankId);
|
|
|
if (blankOrderDo == null) {
|
|
|
log.error("无法根据ID:{}找到对应的坯料计划信息", blankId);
|
|
|
- return R.error("无法获取到坯料计划信息");
|
|
|
+ throw new CustomException("无法获取到坯料计划信息");
|
|
|
}
|
|
|
// 获取订单记录
|
|
|
String productionOrderId = blankOrderDo.getProductionorderid();
|
|
|
if (StringUtils.isBlank(productionOrderId)) {
|
|
|
log.error("坯料计划对应的订单ID为空");
|
|
|
- return R.error("无法通过坯料计划找到订单信息");
|
|
|
+ throw new CustomException("无法通过坯料计划找到订单信息");
|
|
|
}
|
|
|
// 获取订单信息
|
|
|
ApsProductionOrderDo productionOrderDo = apsProductionOrderService.getById(productionOrderId);
|
|
|
if (productionOrderDo == null) {
|
|
|
log.error("无法根据ID:{},获取到订单信息", productionOrderId);
|
|
|
- return R.error("无法找到订单信息");
|
|
|
+ throw new CustomException("无法找到订单信息");
|
|
|
}
|
|
|
// 获取当前报工作业对应的在制品信息
|
|
|
List<ApsWorkInProgressInventoryDo> apsWorkInProgressInventoryDos = apsWorkInProgressInventoryService.list(new LambdaQueryWrapper<ApsWorkInProgressInventoryDo>()
|
|
|
.eq(ApsWorkInProgressInventoryDo::getWorkreportrecordid, id).eq(BaseDo::getDeleted, NO_DELETED));
|
|
|
if (apsWorkInProgressInventoryDos.isEmpty()) {
|
|
|
log.error("无法获取到当前工序对应的在制品信息");
|
|
|
- return R.error("无法获取在制品信息");
|
|
|
+ throw new CustomException("无法获取在制品信息");
|
|
|
}
|
|
|
// 更新当前工序作业和作业明细的已检验卷数
|
|
|
|
|
@@ -203,7 +227,7 @@ public class ReportCheckServiceImpl implements ReportCheckService {
|
|
|
String batchnumber = reportRecordsDo.getBatchnumber();
|
|
|
if (StringUtils.isBlank(batchnumber)) {
|
|
|
log.error("报工记录的批次号为空");
|
|
|
- throw new RuntimeException("报工记录的批次号为空");
|
|
|
+ throw new CustomException("报工记录的批次号为空");
|
|
|
}
|
|
|
// inputBatchNum
|
|
|
int count = (int) Arrays.stream(batchnumber.split(",")).distinct().filter(StringUtils::isNotBlank).count();
|