|
|
|
@ -42,23 +42,23 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<MesEquipmentLog> getEquipmentLogList(String organizeCode, Integer equipId, Integer needNewValue, List<Long> clientHandleList) {
|
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(equipId) || CollectionUtils.isEmpty(clientHandleList)) return null;
|
|
|
|
|
public List<MesEquipmentLog> getEquipmentLogList(String organizeCode, Integer equipId, Integer needNewValue, List<Long> equipVariableIdList) {
|
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(equipId) || CollectionUtils.isEmpty(equipVariableIdList)) return null;
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(equipId, MesPcnExtConstWords.EQUIP_ID, packBean);
|
|
|
|
|
if (!CollectionUtils.isEmpty(clientHandleList) && clientHandleList.size() == 1) DdlPreparedPack.getNumEqualPack(clientHandleList.get(0), MesPcnExtConstWords.ID, packBean);
|
|
|
|
|
else DdlPreparedPack.getInPackList(clientHandleList, MesPcnExtConstWords.ID, packBean);
|
|
|
|
|
if (!CollectionUtils.isEmpty(equipVariableIdList) && equipVariableIdList.size() == 1) DdlPreparedPack.getNumEqualPack(equipVariableIdList.get(0), MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean);
|
|
|
|
|
else DdlPreparedPack.getInPackList(equipVariableIdList, MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean);
|
|
|
|
|
if (!StringUtils.isEmpty(needNewValue) && MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue() == needNewValue) DdlPreparedPack.getNegativeNumEqualPack(MesPcnExtConstWords.ZERO, MesPcnExtConstWords.EQUIP_VARIABLE_STATUS, packBean);
|
|
|
|
|
return equipmentLogRepository.findByHqlWhere(packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateEquipmentLogList(String organizeCode, Integer equipId, List<Long> clientHandleList) {
|
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(equipId) || CollectionUtils.isEmpty(clientHandleList)) return;
|
|
|
|
|
public void updateEquipmentLogList(String organizeCode, Integer equipId, List<Long> equipVariableIdList) {
|
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(equipId) || CollectionUtils.isEmpty(equipVariableIdList)) return;
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(equipId, MesPcnExtConstWords.EQUIP_ID, packBean);
|
|
|
|
|
if (!CollectionUtils.isEmpty(clientHandleList) && clientHandleList.size() == 1) DdlPreparedPack.getNumEqualPack(clientHandleList.get(0), MesPcnExtConstWords.ID, packBean);
|
|
|
|
|
else DdlPreparedPack.getInPackList(clientHandleList, MesPcnExtConstWords.ID, packBean);
|
|
|
|
|
if (!CollectionUtils.isEmpty(equipVariableIdList) && equipVariableIdList.size() == 1) DdlPreparedPack.getNumEqualPack(equipVariableIdList.get(0), MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean);
|
|
|
|
|
else DdlPreparedPack.getInPackList(equipVariableIdList, MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean);
|
|
|
|
|
equipmentLogRepository.updateByProperties(new String[]{MesPcnExtConstWords.EQUIP_VARIABLE_STATUS}, new Object[]{MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue()}, packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -135,7 +135,7 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
|
|
|
|
|
private Map<Long, 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());
|
|
|
|
|
if (CollectionUtils.isEmpty(filterList)) return null;
|
|
|
|
|
List<MesEquipmentLog> equipmentLogList = getEquipmentLogList(cellEquipContext.getOrganizeCode(), cellEquipContext.getEquipId(), needNewValue, collectClientHandleList(filterList));
|
|
|
|
|
List<MesEquipmentLog> equipmentLogList = getEquipmentLogList(cellEquipContext.getOrganizeCode(), cellEquipContext.getEquipId(), needNewValue, collectEquipVariableIdList(filterList));
|
|
|
|
|
Optional<MesEquipmentLog> optional = CollectionUtils.isEmpty(equipmentLogList) ? null : equipmentLogList.stream().filter(o -> (null != o && !checkEquipQuality(o.getQuality()))).findFirst();
|
|
|
|
|
if (null != optional && optional.isPresent()) cellEquipContext.setQuality(optional.get().getQuality());
|
|
|
|
|
|
|
|
|
@ -150,14 +150,14 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
|
|
|
|
|
return null != optional && optional.isPresent() ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<Long> collectClientHandleList(List<MesEquipVariableCfgCollectContext> equipVariableCollectContextList) {
|
|
|
|
|
List<Long> clientHandleList = null;
|
|
|
|
|
private List<Long> collectEquipVariableIdList(List<MesEquipVariableCfgCollectContext> equipVariableCollectContextList) {
|
|
|
|
|
List<Long> equipVariableIdList = null;
|
|
|
|
|
for (MesEquipVariableCfgCollectContext equipVariableCfgCollectContext : equipVariableCollectContextList) {
|
|
|
|
|
if (null == equipVariableCfgCollectContext || CollectionUtils.isEmpty(equipVariableCfgCollectContext.getClientHandleList())) continue;
|
|
|
|
|
if (CollectionUtils.isEmpty(clientHandleList)) clientHandleList = new ArrayList<>();
|
|
|
|
|
clientHandleList.addAll(equipVariableCfgCollectContext.getClientHandleList());
|
|
|
|
|
if (null == equipVariableCfgCollectContext || CollectionUtils.isEmpty(equipVariableCfgCollectContext.getEquipVariableIdList())) continue;
|
|
|
|
|
if (CollectionUtils.isEmpty(equipVariableIdList)) equipVariableIdList = new ArrayList<>();
|
|
|
|
|
equipVariableIdList.addAll(equipVariableCfgCollectContext.getEquipVariableIdList());
|
|
|
|
|
}
|
|
|
|
|
return CollectionUtils.isEmpty(clientHandleList) ? null : clientHandleList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList());
|
|
|
|
|
return CollectionUtils.isEmpty(equipVariableIdList) ? null : equipVariableIdList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|