|
|
@ -16,8 +16,6 @@ import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentLog;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentLogDetail;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentLogDetail;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentRecord;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentRecord;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentLogDetailRepository;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentLogRepository;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentRecordRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentRecordRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentVariableRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentVariableRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
@ -36,9 +34,9 @@ import org.springframework.util.StringUtils;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.persistence.EntityManager;
|
|
|
|
import javax.persistence.EntityManager;
|
|
|
|
import javax.persistence.Query;
|
|
|
|
import javax.persistence.Query;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Optional;
|
|
|
|
import java.util.StringJoiner;
|
|
|
|
import java.util.StringJoiner;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@ -52,17 +50,17 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
|
|
|
|
private MesEquipmentVariableRepository equipmentVariableRepository;
|
|
|
|
private MesEquipmentVariableRepository equipmentVariableRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesEquipmentLogExtService mesEquipmentLogExtService;
|
|
|
|
private MesEquipmentLogExtService equipmentLogExtService;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesEquipmentExtService mesEquipmentExtService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesEquipmentLogDetailRepository mesEquipmentLogDetailRepository;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesEquipmentLogRepository mesEquipmentLogRepository;
|
|
|
|
private MesEquipmentExtService equipmentExtService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesEquipmentRecordRepository mesEquipmentRecordRepository;
|
|
|
|
private MesEquipmentRecordRepository mesEquipmentRecordRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private SnowflakeIdMaker snowflakeIdMaker;
|
|
|
|
private SnowflakeIdMaker snowflakeIdMaker;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource(name = "redisMesPcn")
|
|
|
|
@Resource(name = "redisMesPcn")
|
|
|
|
private ImppRedis redisMesPcn;
|
|
|
|
private ImppRedis redisMesPcn;
|
|
|
|
|
|
|
|
|
|
|
@ -75,7 +73,7 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void saveEquipmentLogToRedis(ActorMessage actorMessage) {
|
|
|
|
public void saveEquipmentLogToRedis(ActorMessage actorMessage) {
|
|
|
|
// 获取设备变量属性
|
|
|
|
// 获取设备变量属性
|
|
|
|
List<MesEquipmentVariable> equipmentVariableList = mesEquipmentExtService.getEquipmentVariableList(actorMessage.getOrganizeCode(), actorMessage.getEquipmentCode(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue());
|
|
|
|
List<MesEquipmentVariable> equipmentVariableList = equipmentExtService.getEquipmentVariableList(actorMessage.getOrganizeCode(), actorMessage.getEquipmentCode(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue());
|
|
|
|
// 获取变量ID集合
|
|
|
|
// 获取变量ID集合
|
|
|
|
Map<Long, MesEquipmentVariable> equipVariableMap = CollectionUtils.isEmpty(equipmentVariableList) ? null : equipmentVariableList.stream().filter(o -> null != o).collect(Collectors.toMap(MesEquipmentVariable::getId, o -> o));
|
|
|
|
Map<Long, MesEquipmentVariable> equipVariableMap = CollectionUtils.isEmpty(equipmentVariableList) ? null : equipmentVariableList.stream().filter(o -> null != o).collect(Collectors.toMap(MesEquipmentVariable::getId, o -> o));
|
|
|
|
if (CollectionUtils.isEmpty(equipVariableMap)) {
|
|
|
|
if (CollectionUtils.isEmpty(equipVariableMap)) {
|
|
|
@ -84,7 +82,7 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取设备数据采集信息
|
|
|
|
// 获取设备数据采集信息
|
|
|
|
List<MesEquipVariableCollectContext> equipmentLogList = mesEquipmentLogExtService.getEquipmentLogCollectList(actorMessage.getOrganizeCode(), actorMessage.getEquipId(), MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.FALSE.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue());
|
|
|
|
List<MesEquipVariableCollectContext> equipmentLogList = equipmentLogExtService.getEquipmentLogCollectList(actorMessage.getOrganizeCode(), actorMessage.getEquipId(), MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.FALSE.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue());
|
|
|
|
// 筛选出该设备中设备变量属性对应的数据采集信息
|
|
|
|
// 筛选出该设备中设备变量属性对应的数据采集信息
|
|
|
|
equipmentLogList = CollectionUtils.isEmpty(equipmentLogList) ? null : equipmentLogList.stream().filter(o -> equipVariableMap.containsKey(o.getEquipVariableId())).collect(Collectors.toList());
|
|
|
|
equipmentLogList = CollectionUtils.isEmpty(equipmentLogList) ? null : equipmentLogList.stream().filter(o -> equipVariableMap.containsKey(o.getEquipVariableId())).collect(Collectors.toList());
|
|
|
|
if (CollectionUtils.isEmpty(equipmentLogList)) {
|
|
|
|
if (CollectionUtils.isEmpty(equipmentLogList)) {
|
|
|
@ -97,12 +95,13 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
|
|
|
|
MesEquipmentRecord mesEquipmentRecord =new MesEquipmentRecord();
|
|
|
|
MesEquipmentRecord mesEquipmentRecord =new MesEquipmentRecord();
|
|
|
|
BeanUtils.copyProperties(actorMessage, mesEquipmentRecord);
|
|
|
|
BeanUtils.copyProperties(actorMessage, mesEquipmentRecord);
|
|
|
|
mesEquipmentRecord.setRecordStatus(MesExtEnumUtil.RECORD_STATUS.RECORD_STATUS_10.getValue());
|
|
|
|
mesEquipmentRecord.setRecordStatus(MesExtEnumUtil.RECORD_STATUS.RECORD_STATUS_10.getValue());
|
|
|
|
mesEquipmentRecord.setId(snowflakeIdMaker.nextId());
|
|
|
|
mesEquipmentRecord.setId(!StringUtils.isEmpty(actorMessage.getMouldRecordId()) ? actorMessage.getMouldRecordId() : snowflakeIdMaker.nextId());
|
|
|
|
ConvertBean.serviceModelInitialize(mesEquipmentRecord, actorMessage.getUserName());
|
|
|
|
ConvertBean.serviceModelInitialize(mesEquipmentRecord, actorMessage.getUserName());
|
|
|
|
|
|
|
|
|
|
|
|
String key = getKey(mesEquipmentRecord);
|
|
|
|
String key = getKey(mesEquipmentRecord);
|
|
|
|
equipmentLogList.forEach(equipLog -> redisMesPcn.putList(key, equipLog));
|
|
|
|
equipmentLogList.forEach(equipLog -> redisMesPcn.putList(key, equipLog));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//不能使用insert, 防止id偶发重复问题
|
|
|
|
mesEquipmentRecordRepository.save(mesEquipmentRecord);
|
|
|
|
mesEquipmentRecordRepository.save(mesEquipmentRecord);
|
|
|
|
|
|
|
|
|
|
|
|
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- KEY:{} --- 工艺参数:{}",
|
|
|
|
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- KEY:{} --- 工艺参数:{}",
|
|
|
@ -119,64 +118,58 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void saveEquipmentLogDetails(String organizeCode) {
|
|
|
|
public void saveEquipmentLogDetails(String organizeCode, String userInfo, Integer qty) {
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.RECORD_STATUS.RECORD_STATUS_10.getValue(), "recordStatus", ddlPackBean);
|
|
|
|
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.RECORD_STATUS.RECORD_STATUS_10.getValue(), MesPcnExtConstWords.RECORD_STATUS, ddlPackBean);
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"createDatetime"}, ddlPackBean);
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{MesPcnExtConstWords.CREATE_DATE_TIME}, ddlPackBean);
|
|
|
|
List<MesEquipmentRecord> mesEquipmentRecords = mesEquipmentRecordRepository.findByHqlTopWhere(ddlPackBean, 10);
|
|
|
|
List<MesEquipmentRecord> mesEquipmentRecords = mesEquipmentRecordRepository.findByHqlTopWhere(ddlPackBean, 10);
|
|
|
|
|
|
|
|
|
|
|
|
LOGGER.info("保存工艺参数job --- 读取到设备记录信息[{}]条 ---", CollectionUtils.isEmpty(mesEquipmentRecords) ? MesPcnExtConstWords.ZERO : mesEquipmentRecords.size());
|
|
|
|
LOGGER.info("保存工艺参数JOB --- 读取到设备记录信息[{}]条 ---", CollectionUtils.isEmpty(mesEquipmentRecords) ? MesPcnExtConstWords.ZERO : mesEquipmentRecords.size());
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(mesEquipmentRecords)) return;
|
|
|
|
if (CollectionUtils.isEmpty(mesEquipmentRecords)) return;
|
|
|
|
|
|
|
|
|
|
|
|
for (MesEquipmentRecord mesEquipmentRecord : mesEquipmentRecords) {
|
|
|
|
for (MesEquipmentRecord mesEquipmentRecord : mesEquipmentRecords) {
|
|
|
|
if (null == mesEquipmentRecord) continue;
|
|
|
|
if (null == mesEquipmentRecord) continue;
|
|
|
|
saveEquipmentLogDetail(mesEquipmentRecord);
|
|
|
|
saveEquipmentLogDetail(organizeCode, userInfo, qty, mesEquipmentRecord);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void saveEquipmentLogDetail(MesEquipmentRecord mesEquipmentRecord) {
|
|
|
|
private void saveEquipmentLogDetail(String organizeCode, String userInfo, Integer qty, MesEquipmentRecord mesEquipmentRecord) {
|
|
|
|
|
|
|
|
|
|
|
|
String key = getKey(mesEquipmentRecord);
|
|
|
|
String key = getKey(mesEquipmentRecord);
|
|
|
|
List<MesEquipmentLog> equipmentLogList = (List<MesEquipmentLog>)redisMesPcn.getList(key, 0, -1);
|
|
|
|
List<MesEquipmentLog> equipmentLogList = (List<MesEquipmentLog>)redisMesPcn.getList(key, 0, -1);
|
|
|
|
if (CollectionUtils.isEmpty(equipmentLogList)) {
|
|
|
|
|
|
|
|
// 修改状态
|
|
|
|
|
|
|
|
mesEquipmentRecord.setRecordStatus(MesExtEnumUtil.RECORD_STATUS.RECORD_STATUS_20.getValue());
|
|
|
|
|
|
|
|
mesEquipmentRecordRepository.save(mesEquipmentRecord);
|
|
|
|
|
|
|
|
// 删除key
|
|
|
|
|
|
|
|
redisMesPcn.deleteKey(key);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<MesEquipmentLogDetail> mesEquipmentLogDetails = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (MesEquipmentLog mesEquipmentLog : equipmentLogList) {
|
|
|
|
|
|
|
|
MesEquipmentLogDetail mesEquipmentLogDetail = new MesEquipmentLogDetail();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(mesEquipmentLog, mesEquipmentLogDetail);
|
|
|
|
|
|
|
|
mesEquipmentLogDetail.setAreaCode(mesEquipmentRecord.getAreaCode());
|
|
|
|
|
|
|
|
mesEquipmentLogDetail.setCraftCode(mesEquipmentRecord.getCraftCode());
|
|
|
|
|
|
|
|
mesEquipmentLogDetail.setProcessCode(mesEquipmentRecord.getProcessCode());
|
|
|
|
|
|
|
|
mesEquipmentLogDetail.setWorkCenterCode(mesEquipmentRecord.getWorkCenterCode());
|
|
|
|
|
|
|
|
mesEquipmentLogDetail.setId(null);
|
|
|
|
|
|
|
|
mesEquipmentLogDetail.setCreateDatetime(null);
|
|
|
|
|
|
|
|
mesEquipmentLogDetail.setCreateUser(null);
|
|
|
|
|
|
|
|
mesEquipmentLogDetail.setOrgEquipId(mesEquipmentLogDetail.getOrganizeCode()+"_"+mesEquipmentLogDetail.getEquipId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String jsonStr = mesEquipmentRecord.getProduceSnJson();
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(jsonStr)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mesEquipmentLogDetail.setExtend(mesEquipmentRecord.getProduceSnJson());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ConvertBean.serviceModelInitialize(mesEquipmentLogDetail, "job");
|
|
|
|
|
|
|
|
mesEquipmentLogDetails.add(mesEquipmentLogDetail);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mesEquipmentLogDetailRepository.saveAll(mesEquipmentLogDetails);
|
|
|
|
|
|
|
|
// 修改状态
|
|
|
|
// 修改状态
|
|
|
|
mesEquipmentRecord.setRecordStatus(MesExtEnumUtil.RECORD_STATUS.RECORD_STATUS_20.getValue());
|
|
|
|
mesEquipmentRecord.setRecordStatus(CollectionUtils.isEmpty(equipmentLogList) ? MesExtEnumUtil.RECORD_STATUS.RECORD_STATUS_20.getValue() : MesExtEnumUtil.RECORD_STATUS.RECORD_STATUS_30.getValue());
|
|
|
|
|
|
|
|
ConvertBean.serviceModelUpdate(mesEquipmentRecord, userInfo);
|
|
|
|
mesEquipmentRecordRepository.save(mesEquipmentRecord);
|
|
|
|
mesEquipmentRecordRepository.save(mesEquipmentRecord);
|
|
|
|
// 删除key
|
|
|
|
// 删除key
|
|
|
|
redisMesPcn.deleteKey(key);
|
|
|
|
redisMesPcn.deleteKey(key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(equipmentLogList)) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Optional<MesEquipmentLog> optional = equipmentLogList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getEquipId()))).findFirst();
|
|
|
|
|
|
|
|
if (null == optional || !optional.isPresent()) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insertBatchEquipmentLogDetail(organizeCode, optional.get().getEquipId(), userInfo, qty, mesEquipmentRecord, equipmentLogList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void insertBatchEquipmentLogDetail(String organizeCode, Integer equipId, String userInfo, Integer qty, MesEquipmentRecord mesEquipmentRecord, List<MesEquipmentLog> equipmentLogList) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(equipmentLogList)) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (qty.compareTo(equipmentLogList.size()) >= 0) {
|
|
|
|
|
|
|
|
equipmentLogExtService.insertBatchEquipmentLogDetail(organizeCode, equipId, userInfo, mesEquipmentRecord, equipmentLogList);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
List<MesEquipmentLog> handleList = equipmentLogList.subList(0, qty);
|
|
|
|
|
|
|
|
equipmentLogExtService.insertBatchEquipmentLogDetail(organizeCode, equipId, userInfo, mesEquipmentRecord, handleList);
|
|
|
|
|
|
|
|
insertBatchEquipmentLogDetail(organizeCode, equipId, userInfo, qty, mesEquipmentRecord, equipmentLogList.subList(qty, equipmentLogList.size()));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -191,12 +184,12 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
|
|
|
|
if (mesEquipmentVariable == null) {
|
|
|
|
if (mesEquipmentVariable == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 获取设备点位数据
|
|
|
|
// 获取设备点位数据 //TODO 暂不使用此代码块 使用需要调整代码 此表已不支持shardingsphere配置
|
|
|
|
MesEquipmentLog equipmentLog = getMesEquipmentLog(equipLogMqttMsg, mesEquipmentVariable);
|
|
|
|
MesEquipmentLog equipmentLog = getMesEquipmentLog(equipLogMqttMsg, mesEquipmentVariable);
|
|
|
|
if (equipmentLog == null) {
|
|
|
|
if (equipmentLog == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 更新设备点位数据
|
|
|
|
// 更新设备点位数据 //TODO 暂不使用此代码块 使用需要调整代码 此表已不支持shardingsphere配置
|
|
|
|
updateEquipmentLog(equipLogMqttMsg, mesEquipmentVariable, equipmentLog);
|
|
|
|
updateEquipmentLog(equipLogMqttMsg, mesEquipmentVariable, equipmentLog);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -213,12 +206,12 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void updateEquipmentLog(EquipLogMqttMsg equipLogMqttMsg, MesEquipmentVariable mesEquipmentVariable, MesEquipmentLog equipmentLog) {
|
|
|
|
private void updateEquipmentLog(EquipLogMqttMsg equipLogMqttMsg, MesEquipmentVariable mesEquipmentVariable, MesEquipmentLog equipmentLog) {
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesEquipmentVariable.getOrganizeCode());
|
|
|
|
// DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesEquipmentVariable.getOrganizeCode());
|
|
|
|
DdlPreparedPack.getNumEqualPack(equipmentLog.getEquipId(), MesPcnExtConstWords.EQUIP_ID, packBean);
|
|
|
|
// DdlPreparedPack.getNumEqualPack(equipmentLog.getEquipId(), MesPcnExtConstWords.EQUIP_ID, packBean);
|
|
|
|
DdlPreparedPack.getNumEqualPack(equipmentLog.getEquipVariableId(), MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean);
|
|
|
|
// DdlPreparedPack.getNumEqualPack(equipmentLog.getEquipVariableId(), MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean);
|
|
|
|
log.info("== MesEquipmentLog修改开始");
|
|
|
|
// log.info("== MesEquipmentLog修改开始");
|
|
|
|
mesEquipmentLogRepository.updateByProperties(new String[]{MesPcnExtConstWords.EQUIP_VARIABLE_STATUS,"equipVariableValue"}, new Object[]{MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(), equipLogMqttMsg.getValue() }, packBean);
|
|
|
|
// mesEquipmentLogRepository.updateByProperties(new String[]{MesPcnExtConstWords.EQUIP_VARIABLE_STATUS,"equipVariableValue"}, new Object[]{MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(), equipLogMqttMsg.getValue() }, packBean);
|
|
|
|
log.info("== MesEquipmentLog修改结束");
|
|
|
|
// log.info("== MesEquipmentLog修改结束");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MesEquipmentVariable getMesEquipmentVariable(EquipLogMqttMsg equipLogMqttMsg) {
|
|
|
|
private MesEquipmentVariable getMesEquipmentVariable(EquipLogMqttMsg equipLogMqttMsg) {
|
|
|
@ -245,22 +238,23 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MesEquipmentLog getMesEquipmentLog(EquipLogMqttMsg equipLogMqttMsg, MesEquipmentVariable mesEquipmentVariable) {
|
|
|
|
private MesEquipmentLog getMesEquipmentLog(EquipLogMqttMsg equipLogMqttMsg, MesEquipmentVariable mesEquipmentVariable) {
|
|
|
|
String variableKey = getVariableKey(equipLogMqttMsg.getPTCode(), "MES_EQUIPMENT_LOG");
|
|
|
|
// String variableKey = getVariableKey(equipLogMqttMsg.getPTCode(), "MES_EQUIPMENT_LOG");
|
|
|
|
Object obj = redisMesPcn.getHash(variableKey, equipLogMqttMsg.getKey());
|
|
|
|
// Object obj = redisMesPcn.getHash(variableKey, equipLogMqttMsg.getKey());
|
|
|
|
MesEquipmentLog equipmentLog = new MesEquipmentLog();
|
|
|
|
// MesEquipmentLog equipmentLog = new MesEquipmentLog();
|
|
|
|
if (obj == null) {
|
|
|
|
// if (obj == null) {
|
|
|
|
log.info("== MesEquipmentLog查询开始");
|
|
|
|
// log.info("== MesEquipmentLog查询开始");
|
|
|
|
equipmentLog = mesEquipmentLogExtService.queryMesEquipmentLog(mesEquipmentVariable.getOrganizeCode(), Integer.valueOf(equipLogMqttMsg.getPTCode()), mesEquipmentVariable.getId());
|
|
|
|
// equipmentLog = mesEquipmentLogExtService.queryMesEquipmentLog(mesEquipmentVariable.getOrganizeCode(), Integer.valueOf(equipLogMqttMsg.getPTCode()), mesEquipmentVariable.getId());
|
|
|
|
log.info("== MesEquipmentLog查询结束");
|
|
|
|
// log.info("== MesEquipmentLog查询结束");
|
|
|
|
if (equipmentLog == null) {
|
|
|
|
// if (equipmentLog == null) {
|
|
|
|
LOGGER.info("log信息不存在 不存在【{}】", equipLogMqttMsg.getTagAddress());
|
|
|
|
// LOGGER.info("log信息不存在 不存在【{}】", equipLogMqttMsg.getTagAddress());
|
|
|
|
return null;
|
|
|
|
// return null;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
redisMesPcn.putHash(variableKey, equipLogMqttMsg.getKey(), equipmentLog);
|
|
|
|
// redisMesPcn.putHash(variableKey, equipLogMqttMsg.getKey(), equipmentLog);
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
equipmentLog = (MesEquipmentLog) obj;
|
|
|
|
// equipmentLog = (MesEquipmentLog) obj;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
return equipmentLog;
|
|
|
|
// return equipmentLog;
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void saveLogDetail(MesEquipmentLogDetail mesEquipmentLogDetail) {
|
|
|
|
public void saveLogDetail(MesEquipmentLogDetail mesEquipmentLogDetail) {
|
|
|
|