|
@@ -64,6 +64,9 @@ public class ItemGroupServiceImpl implements ItemGroupService {
|
|
|
@Autowired
|
|
|
private ReportTableDao reportTableDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DictDao dictDao;
|
|
|
+
|
|
|
@Value("${opc_ua_server.address}")
|
|
|
private String opcUaUrl;
|
|
|
|
|
@@ -336,10 +339,16 @@ public class ItemGroupServiceImpl implements ItemGroupService {
|
|
|
throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组配置的数据源的ip地址,帐户,密码都不能为空");
|
|
|
}
|
|
|
synchronized (this) {
|
|
|
- Integer runNum = itemGroupDao.getRunItemGroupNum(dataSource.getIpAddress(), dataSource.getClsId(), ConstantStr.START_UP);
|
|
|
- if (runNum >= ConstantStr.DATA_SOURCE_GROUP_NUM) {
|
|
|
+ DictType dictType = dictDao.queryDictTypeByKeyType(ConstantStr.DATA_SOURCE_CON, null);
|
|
|
+ String dictKeyValue = dictType.getDictKeyValue();
|
|
|
+ if (Blank.isEmpty(dictType, dictKeyValue)) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "此驱动运行的数量超过5个,请先关闭一些不必要的数据组,再启动");
|
|
|
}
|
|
|
+ Integer num = Integer.valueOf(dictKeyValue);
|
|
|
+ Integer runNum = itemGroupDao.getRunItemGroupNum(dataSource.getIpAddress(), dataSource.getClsId(), ConstantStr.START_UP);
|
|
|
+ if (runNum >= num) {
|
|
|
+ return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "此驱动运行的数量超过" + num + "个,请先关闭一些不必要的数据组,再启动");
|
|
|
+ }
|
|
|
Server server = null;
|
|
|
try {
|
|
|
server = OpcDaUtil.createServer(dataSource);
|