作者 钟来

plc004支持定时功能

... ... @@ -144,6 +144,15 @@ public class DeviceController {
Map<String,Object> map = new HashMap<>();
map.put(skey,Integer.parseInt(data.get("shi")+""+data.get("feng")));
map.put(ekey,Integer.parseInt(data.get("shi1")+""+data.get("feng1")));
if("PW1".equals(pw))
{
if((int)map.get("PW1_TS1")==1 && (int)map.get("PW1_TE1")==2)
{
map.put("PW_AUTO",0);
}else{
map.put("PW_AUTO",1);
}
}
OrderDtu orderDtu = deviceService.getOrderDtu(deviceControlMessage.getDeviceId());
Topic topic = new Topic("2",orderDtu.getDeviceType(),deviceControlMessage.getDeviceId(),"PUT",null);
mqttMessage.setPayload(JSON.toJSONString(map).trim().getBytes());
... ...
... ... @@ -33,6 +33,7 @@ public class PLCDataPersistenceService {
for (DeviceInfo deviceInfo:list)
{
baseDao.update(deviceInfo);
log.info("{}设备数据更新{}",topic.getClientid(),list);
}
}
}
... ...
... ... @@ -80,7 +80,7 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> {
log.info("点位对应的设备id{}",deviceInfoId);
if(deviceInfoId.equals(topic.getClientid()))
{
if(null != list )
if(null != list && "SYS_AUTO".equals(key))
{
for (DeviceInfo deviceInfo:list)
{
... ... @@ -134,6 +134,7 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> {
deviceInfo.setDataUpdateTime(DateUtils.getNowTimeMilly());
deviceInfo.setDeviceServiceIp(SysParameter.service_ip);
deviceInfo.setOnline("01");
log.info("设备信息{}",deviceInfo);
}
}
private void analysisTime( JSONObject jsonObject,Map<String, DeviceDataConfig> deviceDataConfigMap,Topic topic,List<DeviceInfo> deviceInfoList)
... ...