|
|
|
@ -183,6 +183,7 @@ public class ModbusCollectServiceImpl |
|
|
|
int port = folderLocation.getRegisterPort() != null ? folderLocation.getRegisterPort() : 502; |
|
|
|
int quantity = folderLocation.getRegisterNum() != null ? folderLocation.getRegisterNum() : 3; |
|
|
|
int offset = 0x00; |
|
|
|
Integer failureTime = folderLocation.getFailureTime() != null ? folderLocation.getFailureTime() : 5; |
|
|
|
String cuttingSymbol = folderLocation.getCuttingSymbol(); |
|
|
|
if (StringUtils.isNotBlank(cuttingSymbol)) { |
|
|
|
try { |
|
|
|
@ -234,7 +235,7 @@ public class ModbusCollectServiceImpl |
|
|
|
System.out.println("寄存器数据:"+ registerData); |
|
|
|
logger.info("寄存器数据: {}", registerData); |
|
|
|
//site+equipmentNo查询前5分钟,如果5条都是0,0,1,就往sfdc_time_hist插入数据,先要确认中间表有工单号 |
|
|
|
List<ThreeColorLamp> colorLampLisByTime = threeColorLampMapper.getThreeColorLampLisByTime(folderLocation.getSite(), folderLocation.getResourceId(), 5); |
|
|
|
List<ThreeColorLamp> colorLampLisByTime = threeColorLampMapper.getThreeColorLampLisByTime(folderLocation.getSite(), folderLocation.getResourceId(), failureTime); |
|
|
|
QueryWrapper<ResourceScheduled> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("site", folderLocation.getSite()); |
|
|
|
queryWrapper.eq("resource_id", folderLocation.getResourceId()); |
|
|
|
@ -280,7 +281,7 @@ public class ModbusCollectServiceImpl |
|
|
|
sfdcTimeHist.setSeqNo(soscheduled.getSeqno()); |
|
|
|
sfdcTimeHist.setHistSeqno(histSeqno+1); |
|
|
|
Date currentTime = new Date(); |
|
|
|
Date fiveMinutesAgo = new Date(currentTime.getTime() - 5 * 60 * 1000); |
|
|
|
Date fiveMinutesAgo = new Date(currentTime.getTime() - failureTime * 60 * 1000); |
|
|
|
sfdcTimeHist.setEventTime(fiveMinutesAgo); |
|
|
|
sfdcTimeHist.setEnteredBy(null); |
|
|
|
sfdcTimeHist.setEventDesc(null); |
|
|
|
@ -334,6 +335,9 @@ public class ModbusCollectServiceImpl |
|
|
|
if (resourceScheduleds != null && resourceScheduleds.size()>0){ |
|
|
|
for(ResourceScheduled resourceScheduled:resourceScheduleds){ |
|
|
|
ThreeColorLamp colorLamp = threeColorLampMapper.selectThreeColorLastByResourceId(folderLocation.getSite(),resourceScheduled.getResourceId()); |
|
|
|
if(colorLamp == null){ |
|
|
|
break; |
|
|
|
} |
|
|
|
ThreeColorLampDownlog downlogChangeLast = threeColorLampDownlogMapper.selectDownlogLast(folderLocation.getSite(),folderLocation.getResourceId()); |
|
|
|
if(!mapValueToString(registerData.get(0)).equals(colorLamp.getGreen()) || !mapValueToString(registerData.get(1)).equals(colorLamp.getOrange())|| !mapValueToString(registerData.get(2)).equals(colorLamp.getRed())){ |
|
|
|
if(downlogChangeLast != null){ |
|
|
|
@ -418,6 +422,7 @@ public class ModbusCollectServiceImpl |
|
|
|
|
|
|
|
}else{ |
|
|
|
ThreeColorLamp colorLamp = threeColorLampMapper.selectThreeColorLastByResourceId(folderLocation.getSite(),folderLocation.getResourceId()); |
|
|
|
if(colorLamp != null){ |
|
|
|
ThreeColorLampDownlog downlogChangeLast = threeColorLampDownlogMapper.selectDownlogLast(folderLocation.getSite(),folderLocation.getResourceId()); |
|
|
|
if(!mapValueToString(registerData.get(0)).equals(colorLamp.getGreen()) || !mapValueToString(registerData.get(1)).equals(colorLamp.getOrange())|| !mapValueToString(registerData.get(2)).equals(colorLamp.getRed())){ |
|
|
|
if(downlogChangeLast != null){ |
|
|
|
@ -451,6 +456,7 @@ public class ModbusCollectServiceImpl |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ThreeColorLamp lamp = new ThreeColorLamp(); |
|
|
|
lamp.setSite(folderLocation.getSite()); |
|
|
|
lamp.setEquipmentNo(folderLocation.getResourceId()); |
|
|
|
|