Browse Source

三色灯停机修改

master
shenzhouyu 4 weeks ago
parent
commit
d0220e873c
  1. 6
      threecolor-modbus-collector/src/main/java/com/xujie/modbus/entity/ResourceScheduled.java
  2. 21
      threecolor-modbus-collector/src/main/java/com/xujie/modbus/service/impl/ModbusCollectServiceImpl.java
  3. 4
      threecolor-modbus-collector/src/main/resources/dao/SfdcTimeHistMapper.xml

6
threecolor-modbus-collector/src/main/java/com/xujie/modbus/entity/ResourceScheduled.java

@ -1,8 +1,6 @@
package com.xujie.modbus.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
@Data
@ -19,7 +17,9 @@ public class ResourceScheduled {
private String status;
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String issend;
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Integer sfdcid;
}

21
threecolor-modbus-collector/src/main/java/com/xujie/modbus/service/impl/ModbusCollectServiceImpl.java

@ -265,7 +265,7 @@ public class ModbusCollectServiceImpl
("0".equals(lamp3.getOrange()))&&
("1".equals(lamp3.getRed()));
if (!red){
return;
break;
}
}
@ -279,14 +279,14 @@ public class ModbusCollectServiceImpl
sfdcTimeHist.setItemNo(Double.valueOf(soscheduled.getItemno()));
sfdcTimeHist.setSeqNo(soscheduled.getSeqno());
sfdcTimeHist.setHistSeqno(histSeqno+1);
sfdcTimeHist.setEventTime(new Date());
Date currentTime = new Date();
Date fiveMinutesAgo = new Date(currentTime.getTime() - 5 * 60 * 1000);
sfdcTimeHist.setEventTime(fiveMinutesAgo);
sfdcTimeHist.setEnteredBy(null);
sfdcTimeHist.setEventDesc(null);
sfdcTimeHist.setDowntimeCode(null);
sfdcTimeHist.setEventType("D");
sfdcTimeHist.setLinkhistSeqno(null);
sfdcTimeHist.setTillTime(new Date());
sfdcTimeHist.setTillenteredTime(new Date());
sfdcTimeHist.setTillenteredBy(null);
sfdcTimeHist.setCompletedFlag("N");
if("T".equals(resourceScheduled.getStatus())){
@ -317,7 +317,6 @@ public class ModbusCollectServiceImpl
}
}else{
//只在绿灯的时候改变状态
UpdateWrapper<ResourceScheduled> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("site", folderLocation.getSite());
updateWrapper.eq("resource_id", folderLocation.getResourceId());
@ -357,13 +356,16 @@ public class ModbusCollectServiceImpl
if(registerData.get(0) == 1){
downlog.setEventDesc("正常运作");
}
if(registerData.get(0) == 0 && registerData.get(1) == 0 && registerData.get(2) == 0){
downlog.setEventDesc("设备离线");
}
downlog.setStartDate(new Date());
downlog.setCreateDate(new Date());
String nowlamp = registerData.get(0)+"" + registerData.get(1) + ""+registerData.get(2);
downlog.setLamp(nowlamp);
threeColorLampDownlogMapper.insert(downlog);
if(1 == registerData.get(0) && 0 == registerData.get(1) && 0 == registerData.get(2)){
if(StringUtils.isNotBlank(resourceScheduled.getIssend()) && resourceScheduled.getSfdcid() == null){
if(StringUtils.isNotBlank(resourceScheduled.getIssend()) && resourceScheduled.getSfdcid() != null){
SfdcTimeHist sfdcTimeHist = new SfdcTimeHist();
sfdcTimeHist.setId(resourceScheduled.getSfdcid());
sfdcTimeHist.setSite(folderLocation.getSite());
@ -376,8 +378,8 @@ public class ModbusCollectServiceImpl
updateWrapper.eq("site", folderLocation.getSite());
updateWrapper.eq("resource_id", folderLocation.getResourceId());
updateWrapper.eq("seq_no", resourceScheduled.getSeqNo());
updateWrapper.set("issend", "");
updateWrapper.set("sfdcid","");
updateWrapper.set("issend", null);
updateWrapper.set("sfdcid",null);
resourceScheduledMapper.update(updateWrapper);
}
}
@ -397,6 +399,9 @@ public class ModbusCollectServiceImpl
if(registerData.get(0) == 1){
downlog.setEventDesc("正常运作");
}
if(registerData.get(0) == 0 && registerData.get(1) == 0 && registerData.get(2) == 0){
downlog.setEventDesc("设备离线");
}
downlog.setStartDate(new Date());
downlog.setCreateDate(new Date());
String nowlamp = registerData.get(0)+"" + registerData.get(1) + ""+registerData.get(2);

4
threecolor-modbus-collector/src/main/resources/dao/SfdcTimeHistMapper.xml

@ -3,7 +3,7 @@
<mapper namespace="com.xujie.modbus.mapper.SfdcTimeHistMapper">
<update id="updatesfdcTimeHistById">
UPDATE sfdc_time_hist SET till_time = #{sfdcTimeHist.totalTime}, tillentered_time = #{sfdcTimeHist.tillenteredTime},
completed_flag = #{sfdcTimeHist.completedFlag},total_time = DATEDIFF(MINUTE, event_time, #{sfdcTimeHist.totalTime}) WHERE id = #{sfdcTimeHist.id};
UPDATE sfdc_time_hist SET till_time = #{sfdcTimeHist.tillTime}, tillentered_time = #{sfdcTimeHist.tillenteredTime},
completed_flag = #{sfdcTimeHist.completedFlag},total_time = DATEDIFF(MINUTE, event_time, #{sfdcTimeHist.tillTime}) WHERE id = #{sfdcTimeHist.id};
</update>
</mapper>
Loading…
Cancel
Save