Commit fe0b27c7 authored by 夏东伟's avatar 夏东伟

网关采集

parent 092f73a3
......@@ -49,7 +49,7 @@ public class CentralizedFillingClutchMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
if ("fillingPressure".equals(fieldName)){
return Integer.valueOf(value.toString()) / 10;
}
......
......@@ -49,7 +49,7 @@ public class FloorLeatherHotMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
return value;
}
}
......@@ -48,7 +48,7 @@ public class FocusAddingRefrigerantMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
return value;
}
}
......@@ -48,7 +48,7 @@ public class FocusBoosterOilMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
return value;
}
}
......@@ -39,24 +39,24 @@ public class PlateChainStateMachineJob extends GatherJob {
return false;
}
String key = EquipDataUtil.getTestValueKey(equipmentData.getEquipCode());
switch (state) {
case 0:
equipmentData.setEquipStatus(EquipStatusEnum.SHUTDOWN);
break;
case 1:
equipmentData.setEquipStatus(EquipStatusEnum.RUN);
break;
case 2:
equipmentData.setEquipStatus(EquipStatusEnum.ALARM);
break;
default:
return false;
Object value = testValueOperations.get(key);
if (value == null){
equipmentData.setEquipStatus(EquipStatusEnum.RUN);
testValueOperations.set(key, state);
return true;
}
if (state.equals(value)){
equipmentData.setEquipStatus(EquipStatusEnum.ALARM);
testValueOperations.set(key, state);
return true;
}
equipmentData.setEquipStatus(EquipStatusEnum.RUN);
testValueOperations.set(key, state);
return true;
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
return value;
}
}
package net.vtstar.zhongtong.avi.gateway.assembly.job;
import lombok.extern.slf4j.Slf4j;
import net.vtstar.scada.base.equipmgt.domain.EquipInfo;
import net.vtstar.scada.base.equipmgt.mapper.EquipInfoMapper;
import net.vtstar.scada.base.equipmgt.service.EquipInfoService;
import net.vtstar.scada.base.gather.domain.EquipmentData;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.List;
/**
* 总装板链设备数据采集JOB
......@@ -15,12 +25,31 @@ import org.springframework.stereotype.Component;
@DisallowConcurrentExecution
public class PlateChainTimeMachineJob extends QuartzJobBean {
@Autowired
EquipInfoMapper equipInfoMapper;
@Resource(name = "jdbcTemplate")
private JdbcTemplate jdbcTemplate;
@Autowired
private EquipInfoService equipInfoService;
private static final String NAME = "ASSEMBLY_PLATE_CHAIN";
/**
* 定时读取板链测试量, 与Redis中保存的测试量比较, 若变量发生变化, 则状态为运行
*/
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
List<EquipInfo> equipInfoList = equipInfoService.getEquipInfoList(NAME);
if (CollectionUtils.isEmpty(equipInfoList)) {
return;
}
for (EquipInfo equipInfo : equipInfoList){
List<EquipmentData> data = jdbcTemplate.queryForList("select id,equip_type,equip_code,equip_status,begin_time,end_time " +
"from equip_status_record " +
"where equip_code = '" + equipInfo.getEquipCode() + "' and DATE(currentDate) = DATE(end_time) and equip_status = 'RUN'", EquipmentData.class);
}
}
}
......@@ -25,7 +25,8 @@ public class ChassisTorqueMachineJob extends GatherJob {
super.gatherByModbus(NAME, ChassisTorqueWrench.class);
}
public boolean handleObject(EquipmentData equipmentData) {
@Override
protected boolean handleObject(EquipmentData equipmentData) {
ChassisTorqueWrench data = (ChassisTorqueWrench) equipmentData;
Integer state = data.getState();
if (state == null) {
......@@ -48,7 +49,7 @@ public class ChassisTorqueMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
return value;
}
}
......@@ -49,7 +49,7 @@ public class PaintingRobotMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
return value;
}
}
......@@ -59,47 +59,47 @@ public class PretreatmentMachine extends EquipmentData {
@ApiModelProperty(notes = "预脱脂电动三通阀温度")
private String ytzTemperature;
@Show(label = "2#若酸洗槽时间")
@Show(label = "2#若酸洗槽时间(s)")
@Column(name = "rsc2_time")
@ApiModelProperty(notes = "2#若酸洗槽时间")
private Integer rsc2Time;
@Show(label = "3#中和槽时间")
@Show(label = "3#中和槽时间(s)")
@Column(name = "zhc3_time")
@ApiModelProperty(notes = "3#中和槽时间")
private Integer zhc3Time;
@Show(label = "4#水洗4槽时间")
@Show(label = "4#水洗4槽时间(s)")
@Column(name = "sx4_time")
@ApiModelProperty(notes = "4#水洗4槽时间")
private Integer sx4Time;
@Show(label = "5#表调时间")
@Show(label = "5#表调时间(s)")
@Column(name = "bt5_time")
@ApiModelProperty(notes = "5#表调时间")
private Integer bt5Time;
@Show(label = "6#磷化时间")
@Show(label = "6#磷化时间(s)")
@Column(name = "lh6_time")
@ApiModelProperty(notes = "6#磷化时间")
private Integer lh6Time;
@Show(label = "7#水洗5时间")
@Show(label = "7#水洗5时间(s)")
@Column(name = "sx7_time")
@ApiModelProperty(notes = "7#水洗5时间")
private Integer sx7Time;
@Show(label = "8#表调时间")
@Show(label = "8#表调时间(s)")
@Column(name = "bt8_time")
@ApiModelProperty(notes = "8#表调时间")
private Integer bt8Time;
@Show(label = "9#热纯水时间")
@Show(label = "9#热纯水时间(s)")
@Column(name = "rcs9_time")
@ApiModelProperty(notes = "9#热纯水时间")
private Integer rcs9Time;
@Show(label = "10#防锈液时间")
@Show(label = "10#防锈液时间(s)")
@Column(name = "fx10_time")
@ApiModelProperty(notes = "10#防锈液时间")
private Integer fx10Time;
......
......@@ -49,7 +49,7 @@ public class DustingLineMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
return value;
}
}
......@@ -50,10 +50,14 @@ public class PretreamentMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
if (fieldName.endsWith("Temperature")){
return String.valueOf(Long.valueOf(value.toString()) / 10f);
}
if (fieldName.endsWith("Time")){
return String.valueOf(Integer.valueOf(value.toString()) / 10);
}
return value;
}
}
......@@ -50,7 +50,7 @@ public class SteelCncCuttingMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
return value;
}
}
......@@ -48,7 +48,7 @@ public class ChargingPileMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
if ("outputVoltage".equals(fieldName) || "outputCurrent".equals(fieldName)){
return Integer.valueOf(value.toString()) / 10f;
}
......
......@@ -48,7 +48,7 @@ public class PlateChainMachineJob extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
return value;
}
}
......@@ -48,7 +48,7 @@ public class PlcControlTireMachine1Job extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
if (!"state".equals(fieldName)){
return Long.valueOf(value.toString()) / 100f;
}
......
......@@ -48,7 +48,7 @@ public class PlcControlTireMachine2Job extends GatherJob {
}
@Override
protected Object handleValue(String fieldName, Object value) {
public Object handleValue(String fieldName, Object value) {
if (!"state".equals(fieldName)){
return Long.valueOf(value.toString()) / 100f;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment