|
|
@ -87,8 +87,8 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
|
|
|
|
//标记当前设备通信默认正常
|
|
|
|
//标记当前设备通信默认正常
|
|
|
|
cellEquipContext.setQuality(MesExtEnumUtil.EQUIP_LOG_QUALITY.defaultQuality());
|
|
|
|
cellEquipContext.setQuality(MesExtEnumUtil.EQUIP_LOG_QUALITY.defaultQuality());
|
|
|
|
//根据常变值分别获取设备ID分表的采集数据
|
|
|
|
//根据常变值分别获取设备ID分表的采集数据
|
|
|
|
Map<Long, MesEquipmentLog> needNewValue2Collect = getEquipmentLog(equipLogDispatchContext, cellEquipContext, collectContextList, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue());
|
|
|
|
Map<Long, List<MesEquipmentLog>> needNewValue2Collect = getEquipmentLog(equipLogDispatchContext, cellEquipContext, collectContextList, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue());
|
|
|
|
Map<Long, MesEquipmentLog> unNeedNewValue2Collect = getEquipmentLog(equipLogDispatchContext, cellEquipContext, collectContextList, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.FALSE.getValue());
|
|
|
|
Map<Long, List<MesEquipmentLog>> unNeedNewValue2Collect = getEquipmentLog(equipLogDispatchContext, cellEquipContext, collectContextList, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.FALSE.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
//根据设备ID,设备数据变量ID集合 修改设备ID分表采集数据的状态 【修改常变值配置对应的设备ID分表的采集数据的状态为1】 【isResetEquipVariable = false 标记需要修改的设备数据变量ID, 后续匹配成功后再调用updateEquipmentLogList进行修改】
|
|
|
|
//根据设备ID,设备数据变量ID集合 修改设备ID分表采集数据的状态 【修改常变值配置对应的设备ID分表的采集数据的状态为1】 【isResetEquipVariable = false 标记需要修改的设备数据变量ID, 后续匹配成功后再调用updateEquipmentLogList进行修改】
|
|
|
|
if (!CollectionUtils.isEmpty(needNewValue2Collect) && checkEquipQuality(cellEquipContext.getQuality())) {
|
|
|
|
if (!CollectionUtils.isEmpty(needNewValue2Collect) && checkEquipQuality(cellEquipContext.getQuality())) {
|
|
|
@ -133,16 +133,16 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MesEquipmentLog filterEquipmentLog(Map<Long, MesEquipmentLog> needNewValue2Collect, Map<Long, MesEquipmentLog> unNeedNewValue2Collect, Long equipVariableId, Integer needNewValue) {
|
|
|
|
private MesEquipmentLog filterEquipmentLog(Map<Long, List<MesEquipmentLog>> needNewValue2Collect, Map<Long, List<MesEquipmentLog>> unNeedNewValue2Collect, Long equipVariableId, Integer needNewValue) {
|
|
|
|
if (!StringUtils.isEmpty(needNewValue) && MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue() == needNewValue) return filterEquipmentLog(needNewValue2Collect, equipVariableId);
|
|
|
|
if (!StringUtils.isEmpty(needNewValue) && MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue() == needNewValue) return filterEquipmentLog(needNewValue2Collect, equipVariableId);
|
|
|
|
else return filterEquipmentLog(unNeedNewValue2Collect, equipVariableId);
|
|
|
|
else return filterEquipmentLog(unNeedNewValue2Collect, equipVariableId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MesEquipmentLog filterEquipmentLog(Map<Long, MesEquipmentLog> collectMap, Long equipVariableId) {
|
|
|
|
private MesEquipmentLog filterEquipmentLog(Map<Long, List<MesEquipmentLog>> collectMap, Long equipVariableId) {
|
|
|
|
return !CollectionUtils.isEmpty(collectMap) ? collectMap.get(equipVariableId) : null;
|
|
|
|
return (!CollectionUtils.isEmpty(collectMap) && collectMap.containsKey(equipVariableId)) ? collectMap.get(equipVariableId).get(0) : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<Long, MesEquipmentLog> getEquipmentLog(MesEquipLogDispatchContext equipLogDispatchContext, MesCellEquipContext cellEquipContext, List<MesEquipVariableCfgCollectContext> equipVariableCollectContextList, Integer needNewValue) {
|
|
|
|
private Map<Long, List<MesEquipmentLog>> getEquipmentLog(MesEquipLogDispatchContext equipLogDispatchContext, MesCellEquipContext cellEquipContext, List<MesEquipVariableCfgCollectContext> equipVariableCollectContextList, Integer needNewValue) {
|
|
|
|
List<MesEquipVariableCfgCollectContext> filterList = equipVariableCollectContextList.stream().filter(o -> (null != o && o.getNeedNewValue().compareTo(needNewValue) == 0)).collect(Collectors.toList());
|
|
|
|
List<MesEquipVariableCfgCollectContext> filterList = equipVariableCollectContextList.stream().filter(o -> (null != o && o.getNeedNewValue().compareTo(needNewValue) == 0)).collect(Collectors.toList());
|
|
|
|
if (CollectionUtils.isEmpty(filterList)) return null;
|
|
|
|
if (CollectionUtils.isEmpty(filterList)) return null;
|
|
|
|
List<MesEquipmentLog> equipmentLogList = getEquipmentLogList(cellEquipContext.getOrganizeCode(), cellEquipContext.getEquipId(), needNewValue, collectEquipVariableIdList(filterList));
|
|
|
|
List<MesEquipmentLog> equipmentLogList = getEquipmentLogList(cellEquipContext.getOrganizeCode(), cellEquipContext.getEquipId(), needNewValue, collectEquipVariableIdList(filterList));
|
|
|
@ -152,7 +152,7 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
|
|
|
|
//【已经采集到任何数据 或者 (equipmentLogList有数据且是长变值方式获取的 或者 不是常变值方式获取的但必须有value) 】 情况下isCollectValue标记为true
|
|
|
|
//【已经采集到任何数据 或者 (equipmentLogList有数据且是长变值方式获取的 或者 不是常变值方式获取的但必须有value) 】 情况下isCollectValue标记为true
|
|
|
|
if (equipLogDispatchContext.getIsCollectValue() || (!CollectionUtils.isEmpty(equipmentLogList) && (needNewValue == MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue() || checkEquipmentLogHasValue(equipmentLogList)))) equipLogDispatchContext.isCollectValue();
|
|
|
|
if (equipLogDispatchContext.getIsCollectValue() || (!CollectionUtils.isEmpty(equipmentLogList) && (needNewValue == MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue() || checkEquipmentLogHasValue(equipmentLogList)))) equipLogDispatchContext.isCollectValue();
|
|
|
|
|
|
|
|
|
|
|
|
return CollectionUtils.isEmpty(equipmentLogList) ? null : equipmentLogList.stream().filter(o -> null != o).collect(Collectors.toMap(MesEquipmentLog::getEquipVariableId, o -> o));
|
|
|
|
return CollectionUtils.isEmpty(equipmentLogList) ? null : equipmentLogList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesEquipmentLog::getEquipVariableId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Boolean checkEquipmentLogHasValue(List<MesEquipmentLog> equipmentLogList) {
|
|
|
|
private Boolean checkEquipmentLogHasValue(List<MesEquipmentLog> equipmentLogList) {
|
|
|
|