|
@@ -40,6 +40,50 @@ public class RemoteOpcServiceImpl extends BaseServiceImpl<RemoteOpcMapper, Remot
|
|
|
|
|
|
private final SysDictMapper sysDictMapper;
|
|
|
|
|
|
+ /**
|
|
|
+ * 检查av状态和点位后缀是否一致
|
|
|
+ * 1: avFalg=1,则点位后缀必须是_AV
|
|
|
+ * 2: avFalg=0,则点位后缀必须是_DV
|
|
|
+ * *
|
|
|
+ * @param model
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public RemoteOpc saveModelByDTO(RemoteOpcDTO model) {
|
|
|
+ if(model.getAvFlag()==1){
|
|
|
+ if(model.getPositionNum().lastIndexOf("_AV")<0){
|
|
|
+ throw new BusinessException("模拟量的点位后缀必须是_AV,请检查");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(model.getPositionNum().lastIndexOf("_DV")<0){
|
|
|
+ throw new BusinessException("数字量的点位后缀必须是_DV,请检查");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return super.saveModelByDTO(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查av状态和点位后缀是否一致
|
|
|
+ * 1: avFalg=1,则点位后缀必须是_AV
|
|
|
+ * 2: avFalg=0,则点位后缀必须是_DV
|
|
|
+ * *
|
|
|
+ * @param model
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void modModelByDTO(RemoteOpcDTO model) {
|
|
|
+ if(model.getAvFlag()==1){
|
|
|
+ if(model.getPositionNum().lastIndexOf("_AV")<0){
|
|
|
+ throw new BusinessException("模拟量的点位后缀必须是_AV,请检查");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(model.getPositionNum().lastIndexOf("_DV")<0){
|
|
|
+ throw new BusinessException("数字量的点位后缀必须是_DV,请检查");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ super.modModelByDTO(model);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public int batchDelete(List<String> ids) {
|
|
|
Weekend<RemoteOpc> weekend = new Weekend<>(RemoteOpc.class);
|
|
@@ -91,6 +135,7 @@ public class RemoteOpcServiceImpl extends BaseServiceImpl<RemoteOpcMapper, Remot
|
|
|
remoteOpc.setType(1);
|
|
|
remoteOpc.setLine(line);
|
|
|
remoteOpc.setAvFlag(YesNoEnum.YES.getValue());
|
|
|
+ remoteOpc.setPositionNum(remoteOpc.getDescription() + "_AV");// 初始化都是AV,也可以导入的时候配置好
|
|
|
remoteOpc.setCreatedFlag(YesNoEnum.NO.getValue());
|
|
|
remoteOpc.setPositionFlag(YesNoEnum.NO.getValue());
|
|
|
/* boolean find = false;
|