Merge branch 'feature/NoScanning' into qms/develop
This commit is contained in:
commit
7065419b52
|
|
@ -819,7 +819,6 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
|
||||||
.one();
|
.one();
|
||||||
|
|
||||||
Long targetRuleId;
|
Long targetRuleId;
|
||||||
boolean isNewRule = false;
|
|
||||||
|
|
||||||
if (Objects.isNull(highestRule)) {
|
if (Objects.isNull(highestRule)) {
|
||||||
// 该机型无规则,新建
|
// 该机型无规则,新建
|
||||||
|
|
@ -834,14 +833,12 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
|
||||||
newRule.setCreateTime(now);
|
newRule.setCreateTime(now);
|
||||||
ruleService.save(newRule);
|
ruleService.save(newRule);
|
||||||
targetRuleId = newRule.getId();
|
targetRuleId = newRule.getId();
|
||||||
isNewRule = true;
|
|
||||||
} else if (highestRule.getAuditStatus() != null && highestRule.getAuditStatus() == 1) {
|
} else if (highestRule.getAuditStatus() != null && highestRule.getAuditStatus() == 1) {
|
||||||
// 最高版本已审核,fork新版本
|
// 最高版本已审核,fork新版本
|
||||||
if (checkDraftExists(modelNo, null)) {
|
if (checkDraftExists(modelNo, null)) {
|
||||||
throw new NflgException(STATE.BusinessError, "机型" + modelNo + "已存在未审核的版本,请先完成审核后再导入");
|
throw new NflgException(STATE.BusinessError, "机型" + modelNo + "已存在未审核的版本,请先完成审核后再导入");
|
||||||
}
|
}
|
||||||
targetRuleId = forkNewVersion(highestRule);
|
targetRuleId = forkNewVersion(highestRule);
|
||||||
isNewRule = true;
|
|
||||||
} else {
|
} else {
|
||||||
// 最高版本未审核,直接在其上修改
|
// 最高版本未审核,直接在其上修改
|
||||||
targetRuleId = highestRule.getId();
|
targetRuleId = highestRule.getId();
|
||||||
|
|
@ -875,11 +872,10 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
|
||||||
appendImportPointsAndItems(targetRuleId, pointGroups, stepDicItems, operator, operatorId, now);
|
appendImportPointsAndItems(targetRuleId, pointGroups, stepDicItems, operator, operatorId, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNewRule) {
|
removeRedundantPlaceholderPoints(targetRuleId);
|
||||||
ensurePlaceholderPointsForMissingSteps(targetRuleId, stepDicItems, operator, operatorId, now);
|
ensurePlaceholderPointsForMissingSteps(targetRuleId, stepDicItems, operator, operatorId, now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存导入的检查点和检查项(覆盖模式)
|
* 保存导入的检查点和检查项(覆盖模式)
|
||||||
|
|
@ -1235,6 +1231,56 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
|
||||||
return maxVersion + 1;
|
return maxVersion + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeRedundantPlaceholderPoints(Long ruleId) {
|
||||||
|
List<QmsPqcInspectionPoint> points = pointService.lambdaQuery()
|
||||||
|
.eq(QmsPqcInspectionPoint::getPqcRuleId, ruleId)
|
||||||
|
.list();
|
||||||
|
if (CollectionUtil.isEmpty(points)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Long> realStepIds = points.stream()
|
||||||
|
.filter(point -> point.getStepDicItemId() != null)
|
||||||
|
.filter(point -> StrUtil.isNotBlank(point.getInspectionPointCode())
|
||||||
|
|| StrUtil.isNotBlank(point.getInspectionPointName()))
|
||||||
|
.map(QmsPqcInspectionPoint::getStepDicItemId)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isEmpty(realStepIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Long> placeholderPointIds = points.stream()
|
||||||
|
.filter(point -> point.getStepDicItemId() != null)
|
||||||
|
.filter(point -> realStepIds.contains(point.getStepDicItemId()))
|
||||||
|
.filter(point -> StrUtil.isBlank(point.getInspectionPointCode()))
|
||||||
|
.filter(point -> StrUtil.isBlank(point.getInspectionPointName()))
|
||||||
|
.map(QmsPqcInspectionPoint::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isEmpty(placeholderPointIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Long> pointIdsWithItems = itemsService.lambdaQuery()
|
||||||
|
.in(QmsPqcInspectionPointItems::getInspectionCodeId, placeholderPointIds)
|
||||||
|
.list()
|
||||||
|
.stream()
|
||||||
|
.map(QmsPqcInspectionPointItems::getInspectionCodeId)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
placeholderPointIds = placeholderPointIds.stream()
|
||||||
|
.filter(pointId -> !pointIdsWithItems.contains(pointId))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isEmpty(placeholderPointIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
itemsService.lambdaUpdate()
|
||||||
|
.in(QmsPqcInspectionPointItems::getInspectionCodeId, placeholderPointIds)
|
||||||
|
.remove();
|
||||||
|
pointService.removeByIds(placeholderPointIds);
|
||||||
|
}
|
||||||
|
|
||||||
private void ensurePlaceholderPointsForMissingSteps(Long ruleId,
|
private void ensurePlaceholderPointsForMissingSteps(Long ruleId,
|
||||||
List<DictionaryItem> stepDicItems,
|
List<DictionaryItem> stepDicItems,
|
||||||
String operator,
|
String operator,
|
||||||
|
|
|
||||||
|
|
@ -124,10 +124,10 @@ public class InProduceOrderController extends BaseController {
|
||||||
@Transactional
|
@Transactional
|
||||||
@PostMapping("save")
|
@PostMapping("save")
|
||||||
public ApiResult<Long> save(@Valid @RequestBody InProduceOrderGenerateMaterialsQO request) {
|
public ApiResult<Long> save(@Valid @RequestBody InProduceOrderGenerateMaterialsQO request) {
|
||||||
if (request.isNeedInspection()) {
|
// if (request.isNeedInspection()) {
|
||||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getModelNo()) || StrUtil.isBlank(request.getWorkbenchNo()))
|
// VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getModelNo()) || StrUtil.isBlank(request.getWorkbenchNo()))
|
||||||
.throwMessage("机型编号和机台编号不能为空");
|
// .throwMessage("机型编号和机台编号不能为空");
|
||||||
}
|
// }
|
||||||
WmsInProduceOrder order = new WmsInProduceOrder()
|
WmsInProduceOrder order = new WmsInProduceOrder()
|
||||||
.setId(IdUtil.getSnowflakeNextId())
|
.setId(IdUtil.getSnowflakeNextId())
|
||||||
.setDataType(request.getDataType())
|
.setDataType(request.getDataType())
|
||||||
|
|
@ -154,8 +154,8 @@ public class InProduceOrderController extends BaseController {
|
||||||
.setBatchNo(date + index)
|
.setBatchNo(date + index)
|
||||||
.setSernr(request.getSernr())
|
.setSernr(request.getSernr())
|
||||||
.setWorkbenchNo(request.getWorkbenchNo())
|
.setWorkbenchNo(request.getWorkbenchNo())
|
||||||
.setModelNo(request.getModelNo())
|
.setModelNo(request.getModelNo());
|
||||||
.setInspectionStatus(request.isNeedInspection() ? 0 : null);
|
// .setInspectionStatus(request.isNeedInspection() ? 0 : null);
|
||||||
produceOrderItemService.save(parent);
|
produceOrderItemService.save(parent);
|
||||||
if (request.getList()) {
|
if (request.getList()) {
|
||||||
List<WmsBom> children = bomService.getChildren(request.getMatnr());
|
List<WmsBom> children = bomService.getChildren(request.getMatnr());
|
||||||
|
|
@ -213,9 +213,9 @@ public class InProduceOrderController extends BaseController {
|
||||||
.setCreateTime(LocalDateTime.now())
|
.setCreateTime(LocalDateTime.now())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (request.isNeedInspection()) {
|
// if (request.isNeedInspection()) {
|
||||||
qmsService.pushPdiInspection(order.getOrderNo(), parent);
|
// qmsService.pushPdiInspection(order.getOrderNo(), parent);
|
||||||
}
|
// }
|
||||||
return ApiResult.success(order.getId());
|
return ApiResult.success(order.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue