pdi部件绑定修改
This commit is contained in:
parent
cd7149b5b7
commit
f0d5c619d5
|
|
@ -50,6 +50,7 @@ public class QmsPdiComponentBindingControllerService {
|
||||||
|
|
||||||
List<QmsPdiComponentBinding> bindings = new ArrayList<>();
|
List<QmsPdiComponentBinding> bindings = new ArrayList<>();
|
||||||
for (QmsPdiComponentBindingSaveQO.ImageBindingQO image : request.getItems()) {
|
for (QmsPdiComponentBindingSaveQO.ImageBindingQO image : request.getItems()) {
|
||||||
|
boolean hasComponentBinding = false;
|
||||||
if (CollectionUtil.isEmpty(image.getComponents())) {
|
if (CollectionUtil.isEmpty(image.getComponents())) {
|
||||||
bindings.add(new QmsPdiComponentBinding()
|
bindings.add(new QmsPdiComponentBinding()
|
||||||
.setPdiDetectionRulesId(request.getPdiDetectionRulesId())
|
.setPdiDetectionRulesId(request.getPdiDetectionRulesId())
|
||||||
|
|
@ -58,6 +59,10 @@ public class QmsPdiComponentBindingControllerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QmsPdiComponentBindingSaveQO.ComponentBindingQO component : image.getComponents()) {
|
for (QmsPdiComponentBindingSaveQO.ComponentBindingQO component : image.getComponents()) {
|
||||||
|
if (component.getPdiComponentId() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
hasComponentBinding = true;
|
||||||
bindings.add(new QmsPdiComponentBinding()
|
bindings.add(new QmsPdiComponentBinding()
|
||||||
.setPdiDetectionRulesId(request.getPdiDetectionRulesId())
|
.setPdiDetectionRulesId(request.getPdiDetectionRulesId())
|
||||||
.setUploadImageId(image.getUploadImageId())
|
.setUploadImageId(image.getUploadImageId())
|
||||||
|
|
@ -66,6 +71,11 @@ public class QmsPdiComponentBindingControllerService {
|
||||||
.setYCoordinatePoint(component.getYCoordinatePoint())
|
.setYCoordinatePoint(component.getYCoordinatePoint())
|
||||||
.setStatus(component.getStatus()));
|
.setStatus(component.getStatus()));
|
||||||
}
|
}
|
||||||
|
if (!hasComponentBinding) {
|
||||||
|
bindings.add(new QmsPdiComponentBinding()
|
||||||
|
.setPdiDetectionRulesId(request.getPdiDetectionRulesId())
|
||||||
|
.setUploadImageId(image.getUploadImageId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(bindings)) {
|
if (CollectionUtil.isNotEmpty(bindings)) {
|
||||||
|
|
@ -164,7 +174,10 @@ public class QmsPdiComponentBindingControllerService {
|
||||||
throw new NflgException(STATE.BusinessError, "部件绑定对象不能为空");
|
throw new NflgException(STATE.BusinessError, "部件绑定对象不能为空");
|
||||||
}
|
}
|
||||||
if (component.getPdiComponentId() == null) {
|
if (component.getPdiComponentId() == null) {
|
||||||
throw new NflgException(STATE.BusinessError, "部件ID不能为空");
|
if (hasBindingValue(component)) {
|
||||||
|
throw new NflgException(STATE.BusinessError, "部件ID为空时不能传入坐标或状态");
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (StrUtil.isBlank(component.getXCoordinatePoint()) || StrUtil.isBlank(component.getYCoordinatePoint())) {
|
if (StrUtil.isBlank(component.getXCoordinatePoint()) || StrUtil.isBlank(component.getYCoordinatePoint())) {
|
||||||
throw new NflgException(STATE.BusinessError, "绑定部件时x轴坐标和y轴坐标不能为空");
|
throw new NflgException(STATE.BusinessError, "绑定部件时x轴坐标和y轴坐标不能为空");
|
||||||
|
|
@ -280,6 +293,12 @@ public class QmsPdiComponentBindingControllerService {
|
||||||
return status != null && (status == STATIC_STATUS || status == DYNAMIC_STATUS);
|
return status != null && (status == STATIC_STATUS || status == DYNAMIC_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasBindingValue(QmsPdiComponentBindingSaveQO.ComponentBindingQO component) {
|
||||||
|
return StrUtil.isNotBlank(component.getXCoordinatePoint())
|
||||||
|
|| StrUtil.isNotBlank(component.getYCoordinatePoint())
|
||||||
|
|| component.getStatus() != null;
|
||||||
|
}
|
||||||
|
|
||||||
private String coordinateKey(Long uploadImageId, String xCoordinatePoint, String yCoordinatePoint) {
|
private String coordinateKey(Long uploadImageId, String xCoordinatePoint, String yCoordinatePoint) {
|
||||||
return uploadImageId + "|" + xCoordinatePoint + "|" + yCoordinatePoint;
|
return uploadImageId + "|" + xCoordinatePoint + "|" + yCoordinatePoint;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue