Commit 092f73a3 authored by 夏东伟's avatar 夏东伟

网关采集

parent 63789124
package net.vtstar.zhongtong.avi.gateway.assembly.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.vtstar.user.search.Search;
import net.vtstar.zhongtong.avi.global.web.Show;
import net.vtstar.zhongtong.avi.global.web.domain.enums.FieldType;
import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Date;
/**
* @Author: xiadongwei
* @Date: 2019/10/17 11:52
*/
@ApiModel("总装车间--板链记录")
@Data
@Search(code = "ASSEMBLY_PLATE_CHAIN")
@Table(name = "eqp_data_assembly_plate_chain")
public class PlateChainMachine{
@Show(label = "设备编号")
@Column(name = "eqp_code")
@ApiModelProperty(notes = "设备编号")
private String eqpCode;
@Show(label = "设备名称")
@Column(name = "eqp_name")
@ApiModelProperty(notes = "设备名称")
private String eqpName;
@Show(label = "当班平均运行间隔时间")
@ApiModelProperty(notes = "当班平均运行间隔时间")
@Column(name = "average_time")
private String averageTime;
@Show(label = "时间",dataType = FieldType.DATETIME)
@ApiModelProperty("时间")
@Column(name = "create_time")
private Date createTime;
}
package net.vtstar.zhongtong.avi.gateway.assembly.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.vtstar.scada.base.gather.domain.EquipmentData;
import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Date;
/**
* @Author: xiadongwei
* @Date: 2019/10/17 11:52
*/
@ApiModel("总装车间--板链")
@Data
@Table(name = "eqp_data_plate_chain_state")
public class PlateChainStateMachine extends EquipmentData {
@Column(name = "eqp_code")
@ApiModelProperty(notes = "设备编号")
private String eqpCode;
@Column(name = "eqp_name")
@ApiModelProperty(notes = "设备名称")
private String eqpName;
@Column(name = "state")
@ApiModelProperty(notes = "设备状态(0是关机,1是运行)")
private Integer state;
@ApiModelProperty("时间")
@Column(name = "create_time")
private Date createTime;
}
...@@ -26,7 +26,7 @@ public class CentralizedFillingClutchMachineJob extends GatherJob { ...@@ -26,7 +26,7 @@ public class CentralizedFillingClutchMachineJob extends GatherJob {
super.gatherByModbus(NAME, CentralizedFillingClutchMachine.class); super.gatherByModbus(NAME, CentralizedFillingClutchMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
CentralizedFillingClutchMachine data = (CentralizedFillingClutchMachine) equipmentData; CentralizedFillingClutchMachine data = (CentralizedFillingClutchMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
...@@ -26,7 +26,7 @@ public class FloorLeatherHotMachineJob extends GatherJob { ...@@ -26,7 +26,7 @@ public class FloorLeatherHotMachineJob extends GatherJob {
super.gatherByModbus(NAME, FloorLeatherHotMachine.class); super.gatherByModbus(NAME, FloorLeatherHotMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
FloorLeatherHotMachine data = (FloorLeatherHotMachine) equipmentData; FloorLeatherHotMachine data = (FloorLeatherHotMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
...@@ -25,7 +25,7 @@ public class FocusAddingRefrigerantMachineJob extends GatherJob { ...@@ -25,7 +25,7 @@ public class FocusAddingRefrigerantMachineJob extends GatherJob {
super.gatherByModbus(NAME, FocusAddingRefrigerantMachine.class); super.gatherByModbus(NAME, FocusAddingRefrigerantMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
FocusAddingRefrigerantMachine data = (FocusAddingRefrigerantMachine) equipmentData; FocusAddingRefrigerantMachine data = (FocusAddingRefrigerantMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
...@@ -25,7 +25,7 @@ public class FocusBoosterOilMachineJob extends GatherJob { ...@@ -25,7 +25,7 @@ public class FocusBoosterOilMachineJob extends GatherJob {
super.gatherByModbus(NAME, FocusBoosterOilMachine.class); super.gatherByModbus(NAME, FocusBoosterOilMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
FocusBoosterOilMachine data = (FocusBoosterOilMachine) equipmentData; FocusBoosterOilMachine data = (FocusBoosterOilMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
package net.vtstar.zhongtong.avi.gateway.assembly.job;
import lombok.extern.slf4j.Slf4j;
import net.vtstar.scada.base.equipmgt.domain.Enum.EquipStatusEnum;
import net.vtstar.scada.base.gather.domain.EquipmentData;
import net.vtstar.scada.base.gather.job.GatherJob;
import net.vtstar.zhongtong.avi.gateway.assembly.domain.PlateChainStateMachine;
import net.vtstar.zhongtong.avi.utils.EquipDataUtil;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 总装板链状态设备数据采集JOB
*/
@Slf4j
@Component
public class PlateChainStateMachineJob extends GatherJob {
private static final String NAME = "ASSEMBLY_PLATE_CHAIN";
@Resource(name = "redisTemplate")
protected ValueOperations testValueOperations;
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
log.info("JobName: {}", context.getJobDetail().getKey().getName());
super.gatherByModbus(NAME, PlateChainStateMachine.class);
}
public boolean handleObject(EquipmentData equipmentData) {
PlateChainStateMachine data = (PlateChainStateMachine) equipmentData;
Integer state = data.getState();
if (state == null) {
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;
}
return true;
}
@Override
protected Object handleValue(String fieldName, Object value) {
return value;
}
}
package net.vtstar.zhongtong.avi.gateway.assembly.job;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;
/**
* 总装板链设备数据采集JOB
*/
@Slf4j
@Component
@DisallowConcurrentExecution
public class PlateChainTimeMachineJob extends QuartzJobBean {
/**
* 定时读取板链测试量, 与Redis中保存的测试量比较, 若变量发生变化, 则状态为运行
*/
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
}
}
...@@ -25,7 +25,7 @@ public class ChassisTorqueMachineJob extends GatherJob { ...@@ -25,7 +25,7 @@ public class ChassisTorqueMachineJob extends GatherJob {
super.gatherByModbus(NAME, ChassisTorqueWrench.class); super.gatherByModbus(NAME, ChassisTorqueWrench.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
ChassisTorqueWrench data = (ChassisTorqueWrench) equipmentData; ChassisTorqueWrench data = (ChassisTorqueWrench) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
...@@ -26,7 +26,7 @@ public class PaintingRobotMachineJob extends GatherJob { ...@@ -26,7 +26,7 @@ public class PaintingRobotMachineJob extends GatherJob {
super.gatherByModbus(NAME, PaintingRobotMachine.class); super.gatherByModbus(NAME, PaintingRobotMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
PaintingRobotMachine data = (PaintingRobotMachine) equipmentData; PaintingRobotMachine data = (PaintingRobotMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
...@@ -25,7 +25,7 @@ public class DustingLineMachineJob extends GatherJob { ...@@ -25,7 +25,7 @@ public class DustingLineMachineJob extends GatherJob {
super.gatherByModbus(NAME, DustingLineMachine.class); super.gatherByModbus(NAME, DustingLineMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
//0待机,1是喷粉 //0待机,1是喷粉
DustingLineMachine data = (DustingLineMachine) equipmentData; DustingLineMachine data = (DustingLineMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
......
...@@ -26,7 +26,7 @@ public class PretreamentMachineJob extends GatherJob { ...@@ -26,7 +26,7 @@ public class PretreamentMachineJob extends GatherJob {
super.gatherByModbus(NAME, PretreatmentMachine.class); super.gatherByModbus(NAME, PretreatmentMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
PretreatmentMachine data = (PretreatmentMachine) equipmentData; PretreatmentMachine data = (PretreatmentMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
......
...@@ -26,7 +26,7 @@ public class SteelCncCuttingMachineJob extends GatherJob { ...@@ -26,7 +26,7 @@ public class SteelCncCuttingMachineJob extends GatherJob {
super.gatherByModbus(NAME, SteelCncCuttingMachine.class); super.gatherByModbus(NAME, SteelCncCuttingMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
SteelCncCuttingMachine data = (SteelCncCuttingMachine) equipmentData; SteelCncCuttingMachine data = (SteelCncCuttingMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
......
...@@ -25,7 +25,7 @@ public class ChargingPileMachineJob extends GatherJob { ...@@ -25,7 +25,7 @@ public class ChargingPileMachineJob extends GatherJob {
super.gatherByModbus(NAME, ChargingPileMachine.class); super.gatherByModbus(NAME, ChargingPileMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
ChargingPileMachine data = (ChargingPileMachine) equipmentData; ChargingPileMachine data = (ChargingPileMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
...@@ -25,7 +25,7 @@ public class PlateChainMachineJob extends GatherJob { ...@@ -25,7 +25,7 @@ public class PlateChainMachineJob extends GatherJob {
super.gatherByModbus(NAME, PlateChainMachine.class); super.gatherByModbus(NAME, PlateChainMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
PlateChainMachine data = (PlateChainMachine) equipmentData; PlateChainMachine data = (PlateChainMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
...@@ -25,7 +25,7 @@ public class PlcControlTireMachine1Job extends GatherJob { ...@@ -25,7 +25,7 @@ public class PlcControlTireMachine1Job extends GatherJob {
super.gatherByModbus(NAME, PlcControlTireMachine1.class); super.gatherByModbus(NAME, PlcControlTireMachine1.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
PlcControlTireMachine1 data = (PlcControlTireMachine1) equipmentData; PlcControlTireMachine1 data = (PlcControlTireMachine1) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
...@@ -25,7 +25,7 @@ public class PlcControlTireMachine2Job extends GatherJob { ...@@ -25,7 +25,7 @@ public class PlcControlTireMachine2Job extends GatherJob {
super.gatherByModbus(NAME, PlcControlTireMachine2.class); super.gatherByModbus(NAME, PlcControlTireMachine2.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
PlcControlTireMachine2 data = (PlcControlTireMachine2) equipmentData; PlcControlTireMachine2 data = (PlcControlTireMachine2) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
if (state == null) { if (state == null) {
......
...@@ -27,7 +27,7 @@ public class LaserCuttingMachineJob extends GatherJob { ...@@ -27,7 +27,7 @@ public class LaserCuttingMachineJob extends GatherJob {
super.gatherByModbus(NAME, LaserCuttingMachine.class); super.gatherByModbus(NAME, LaserCuttingMachine.class);
} }
protected boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
LaserCuttingMachine data = (LaserCuttingMachine) equipmentData; LaserCuttingMachine data = (LaserCuttingMachine) equipmentData;
Integer state = data.getState(); Integer state = data.getState();
......
package net.vtstar.zhongtong.avi.utils;
import lombok.experimental.UtilityClass;
@UtilityClass
public class EquipDataUtil {
/**
* 板链测试量数据, 若有变化则代表板链在运行
* @param equipCode
* @return
*/
public static String getTestValueKey(String equipCode) {
return new StringBuilder()
.append("equip:test:value:")
.append(equipCode)
.toString();
}
}
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