Commit 0a2377c1 authored by 夏东伟's avatar 夏东伟

AVI调试

parent a41aa6af
...@@ -122,6 +122,12 @@ ...@@ -122,6 +122,12 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/RSNetDevice-2.2.1.jar</systemPath> <systemPath>${project.basedir}/src/main/resources/lib/RSNetDevice-2.2.1.jar</systemPath>
</dependency> </dependency>
<!-- modbus -->
<dependency>
<groupId>net.wimpi</groupId>
<artifactId>jamod</artifactId>
<version>1.2</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -69,6 +69,10 @@ public class PaintshopStation { ...@@ -69,6 +69,10 @@ public class PaintshopStation {
@Search @Search
private String vehicleLaneCode; private String vehicleLaneCode;
@ApiModelProperty(notes = "车道RFID编号")
@Column(name = "lane_rfid_no")
private String laneRfidNo;
@ApiModelProperty(notes = "工位编号") @ApiModelProperty(notes = "工位编号")
@NotNull(message = "工位编号不能为空") @NotNull(message = "工位编号不能为空")
@Column(name = "code") @Column(name = "code")
......
...@@ -13,6 +13,8 @@ import net.vtstar.zhongtong.avi.equipment.domain.Program; ...@@ -13,6 +13,8 @@ import net.vtstar.zhongtong.avi.equipment.domain.Program;
import net.vtstar.zhongtong.avi.equipment.domain.vo.ProgramTransferVO; import net.vtstar.zhongtong.avi.equipment.domain.vo.ProgramTransferVO;
import net.vtstar.zhongtong.avi.equipment.mapper.BasicInfoMapper; import net.vtstar.zhongtong.avi.equipment.mapper.BasicInfoMapper;
import net.vtstar.zhongtong.avi.equipment.mapper.EquipmentDataMapper; import net.vtstar.zhongtong.avi.equipment.mapper.EquipmentDataMapper;
import net.vtstar.zhongtong.avi.equipment.mapper.RuntimeRecordMapper;
import net.vtstar.zhongtong.avi.gateway.painting.domain.PolishingRoomMachine;
import net.vtstar.zhongtong.avi.global.web.domain.ShowField; import net.vtstar.zhongtong.avi.global.web.domain.ShowField;
import net.vtstar.zhongtong.avi.monitoring.domain.StationPassInfo; import net.vtstar.zhongtong.avi.monitoring.domain.StationPassInfo;
import net.vtstar.zhongtong.avi.monitoring.mapper.StationPassInfoMapper; import net.vtstar.zhongtong.avi.monitoring.mapper.StationPassInfoMapper;
...@@ -39,7 +41,6 @@ import java.io.FileOutputStream; ...@@ -39,7 +41,6 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -48,6 +49,8 @@ public class EquipmentService { ...@@ -48,6 +49,8 @@ public class EquipmentService {
@Autowired @Autowired
private EquipmentDataMapper dataMapper; private EquipmentDataMapper dataMapper;
@Autowired
private RuntimeRecordMapper runtimeRecordMapper;
@Resource(name = "classNameCache") @Resource(name = "classNameCache")
private Cache classNameCache; private Cache classNameCache;
@Resource(name = "showFieldCache") @Resource(name = "showFieldCache")
...@@ -72,9 +75,10 @@ public class EquipmentService { ...@@ -72,9 +75,10 @@ public class EquipmentService {
return new ArrayList<>(); return new ArrayList<>();
} }
if ("POLISHING_ROOM".equals(searchCode)){ if ("POLISHING_ROOM".equals(searchCode)){
return dataMapper.findJoin(searchService.pageFilter2Filter(pageFilter, new WhereFilter(){{ return runtimeRecordMapper.findJoin(searchService.pageFilter2Filter(pageFilter, new WhereFilter(){{
addFilter("status", Operation.IS, "null"); addJoin(PolishingRoomMachine.class, "machine_id", EquipInfo.class, "id");
addFilter("group_code", Operation.EQUAL, "1"); addFilter(PolishingRoomMachine.class,"status", Operation.IS, "null");
addFilter(PolishingRoomMachine.class,"group_code", Operation.EQUAL, "1");
}}), searchCodeClazz); }}), searchCodeClazz);
} }
......
...@@ -62,6 +62,12 @@ public class CentralizedFillingClutchMachine extends EquipmentData { ...@@ -62,6 +62,12 @@ public class CentralizedFillingClutchMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -106,6 +106,12 @@ public class FloorLeatherHotMachine extends EquipmentData { ...@@ -106,6 +106,12 @@ public class FloorLeatherHotMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -57,6 +57,12 @@ public class FocusAddingRefrigerantMachine extends EquipmentData { ...@@ -57,6 +57,12 @@ public class FocusAddingRefrigerantMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -72,6 +72,12 @@ public class FocusBoosterOilMachine extends EquipmentData { ...@@ -72,6 +72,12 @@ public class FocusBoosterOilMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -46,6 +46,12 @@ public class PlateChainMachine{ ...@@ -46,6 +46,12 @@ public class PlateChainMachine{
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -62,6 +62,12 @@ public class ChassisTorqueWrench extends EquipmentData { ...@@ -62,6 +62,12 @@ public class ChassisTorqueWrench extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -42,6 +42,12 @@ public class LubricatingOilConcentrateMachine extends EquipmentData { ...@@ -42,6 +42,12 @@ public class LubricatingOilConcentrateMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -42,6 +42,12 @@ public class RicetingEquipmentMachine extends EquipmentData { ...@@ -42,6 +42,12 @@ public class RicetingEquipmentMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -41,6 +41,12 @@ public class DryingRoomTempMachine extends EquipmentData { ...@@ -41,6 +41,12 @@ public class DryingRoomTempMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -47,6 +47,12 @@ public class ElectrophoresisMachine extends EquipmentData { ...@@ -47,6 +47,12 @@ public class ElectrophoresisMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -39,6 +39,12 @@ public class ElectrophoresisRectificationMachine extends EquipmentData { ...@@ -39,6 +39,12 @@ public class ElectrophoresisRectificationMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -50,6 +50,12 @@ public class PaintingPretreatmentMachine extends EquipmentData { ...@@ -50,6 +50,12 @@ public class PaintingPretreatmentMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -41,6 +41,12 @@ public class PaintingRobotMachine extends EquipmentData { ...@@ -41,6 +41,12 @@ public class PaintingRobotMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -46,7 +46,7 @@ public class PolishingRoomMachine{ ...@@ -46,7 +46,7 @@ public class PolishingRoomMachine{
private BigDecimal currentRuntime; private BigDecimal currentRuntime;
@Show(label = "更新时间") @Show(label = "更新时间", dataType = FieldType.DATETIME)
@ApiModelProperty(notes = "创建时间") @ApiModelProperty(notes = "创建时间")
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
......
...@@ -4,7 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,7 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import net.vtstar.scada.base.gather.domain.EquipmentData; import net.vtstar.scada.base.gather.domain.EquipmentData;
import net.vtstar.user.search.JoinColumn;
import net.vtstar.user.search.Search; import net.vtstar.user.search.Search;
import net.vtstar.zhongtong.avi.equipment.domain.EquipInfo;
import net.vtstar.zhongtong.avi.global.web.Show; import net.vtstar.zhongtong.avi.global.web.Show;
import net.vtstar.zhongtong.avi.global.web.domain.enums.FieldType; import net.vtstar.zhongtong.avi.global.web.domain.enums.FieldType;
...@@ -21,6 +23,7 @@ public class PolishingRoomStateMachine extends EquipmentData { ...@@ -21,6 +23,7 @@ public class PolishingRoomStateMachine extends EquipmentData {
@Show(label = "设备编号") @Show(label = "设备编号")
@Column(name = "eqp_code") @Column(name = "eqp_code")
@ApiModelProperty(notes = "设备编号") @ApiModelProperty(notes = "设备编号")
@Search
private String equipCode; private String equipCode;
@Show(label = "燃烧机机运行信号") @Show(label = "燃烧机机运行信号")
...@@ -34,6 +37,12 @@ public class PolishingRoomStateMachine extends EquipmentData { ...@@ -34,6 +37,12 @@ public class PolishingRoomStateMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -41,6 +41,12 @@ public class SprayBoothMachine extends EquipmentData { ...@@ -41,6 +41,12 @@ public class SprayBoothMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -46,6 +46,12 @@ public class VocMachine extends EquipmentData { ...@@ -46,6 +46,12 @@ public class VocMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -49,6 +49,7 @@ public class ElectrophoresisMachineJob extends QuartzJobBean { ...@@ -49,6 +49,7 @@ public class ElectrophoresisMachineJob extends QuartzJobBean {
if (null == size) { if (null == size) {
size = 1; size = 1;
} }
for (int i = 0; i < 4; i++){
String eqpNo = eqpNoList.get((int)(Math.random() * 14)); String eqpNo = eqpNoList.get((int)(Math.random() * 14));
String startOfDay = DateUtils.parseDateToString(DateUtils.getStartOfDay(0, new Date()), "yyyy-MM-dd HH:mm:ss"); String startOfDay = DateUtils.parseDateToString(DateUtils.getStartOfDay(0, new Date()), "yyyy-MM-dd HH:mm:ss");
String endOfDay = DateUtils.parseDateToString(DateUtils.getEndOfDay(0, new Date()), "yyyy-MM-dd HH:mm:ss"); String endOfDay = DateUtils.parseDateToString(DateUtils.getEndOfDay(0, new Date()), "yyyy-MM-dd HH:mm:ss");
...@@ -68,13 +69,15 @@ public class ElectrophoresisMachineJob extends QuartzJobBean { ...@@ -68,13 +69,15 @@ public class ElectrophoresisMachineJob extends QuartzJobBean {
mapper.insert(machine); mapper.insert(machine);
}else { }else {
ElectrophoresisMachine machine = list.get(0); ElectrophoresisMachine machine = list.get(0);
machine.setUpTime(machine.getUpTime().add(new BigDecimal(0.5))); machine.setUpTime(machine.getUpTime().add(new BigDecimal((int)(Math.random() * 5))));
machine.setDownTime(machine.getDownTime().add(new BigDecimal(1))); machine.setDownTime(machine.getDownTime().add(new BigDecimal((int)(Math.random() * 4))));
machine.setEntryTime(machine.getEntryTime().add(new BigDecimal(0.4))); machine.setEntryTime(machine.getEntryTime().add(new BigDecimal((int)(Math.random() * 3))));
machine.setTranslationTime(machine.getTranslationTime().add(new BigDecimal(0.8))); machine.setTranslationTime(machine.getTranslationTime().add(new BigDecimal((int)(Math.random() * 6))));
machine.setCreateTime(new Date()); machine.setCreateTime(new Date());
mapper.update(machine); mapper.update(machine);
} }
}
} }
} }
...@@ -34,6 +34,9 @@ public class PolishingRoomStateJob extends GatherJob { ...@@ -34,6 +34,9 @@ public class PolishingRoomStateJob extends GatherJob {
if (state == null || "0".equals(state)) { if (state == null || "0".equals(state)) {
return false; return false;
} }
if (null == data.getState()){
return false;
}
if(null != data.getState() && data.getState() == 1){ if(null != data.getState() && data.getState() == 1){
equipmentData.setEquipStatus(EquipStatusEnum.RUN); equipmentData.setEquipStatus(EquipStatusEnum.RUN);
}else{ }else{
......
...@@ -7,6 +7,7 @@ import net.vtstar.utils.CollecUtils; ...@@ -7,6 +7,7 @@ import net.vtstar.utils.CollecUtils;
import net.vtstar.utils.DateUtils; import net.vtstar.utils.DateUtils;
import net.vtstar.zhongtong.avi.gateway.painting.domain.RotaryRollerBedMachine; import net.vtstar.zhongtong.avi.gateway.painting.domain.RotaryRollerBedMachine;
import net.vtstar.zhongtong.avi.gateway.painting.mapper.RotaryRollerBedMapper; import net.vtstar.zhongtong.avi.gateway.painting.mapper.RotaryRollerBedMapper;
import net.vtstar.zhongtong.avi.global.constant.Constant;
import net.vtstar.zhongtong.avi.utils.EquipDataUtil; import net.vtstar.zhongtong.avi.utils.EquipDataUtil;
import org.quartz.DisallowConcurrentExecution; import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
...@@ -28,8 +29,6 @@ import java.util.List; ...@@ -28,8 +29,6 @@ import java.util.List;
@DisallowConcurrentExecution @DisallowConcurrentExecution
public class RotaryRollerBedMachineJob extends QuartzJobBean { public class RotaryRollerBedMachineJob extends QuartzJobBean {
private static final String NAME = "ROTARY_ROLLER_BED";
@Resource(name = "redisTemplate") @Resource(name = "redisTemplate")
protected ValueOperations testValueOperations; protected ValueOperations testValueOperations;
...@@ -38,10 +37,10 @@ public class RotaryRollerBedMachineJob extends QuartzJobBean { ...@@ -38,10 +37,10 @@ public class RotaryRollerBedMachineJob extends QuartzJobBean {
@Override @Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException { protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
String keyW = EquipDataUtil.getTestValueKey(NAME + "_W"); String keyW = EquipDataUtil.getTestValueKey(Constant.ROTARY_ROLLER_BED_W);
String keyP1 = EquipDataUtil.getTestValueKey(NAME + "_P1"); String keyP1 = EquipDataUtil.getTestValueKey(Constant.ROTARY_ROLLER_BED_P1);
String keyP2 = EquipDataUtil.getTestValueKey(NAME + "_P2"); String keyP2 = EquipDataUtil.getTestValueKey(Constant.ROTARY_ROLLER_BED_P2);
String keyC = EquipDataUtil.getTestValueKey(NAME + "_C"); String keyC = EquipDataUtil.getTestValueKey(Constant.ROTARY_ROLLER_BED_C);
if (testValueOperations.get(keyW) == null || "".equals(testValueOperations.get(keyW).toString())){ if (testValueOperations.get(keyW) == null || "".equals(testValueOperations.get(keyW).toString())){
testValueOperations.set(keyW, 0); testValueOperations.set(keyW, 0);
} }
...@@ -73,7 +72,7 @@ public class RotaryRollerBedMachineJob extends QuartzJobBean { ...@@ -73,7 +72,7 @@ public class RotaryRollerBedMachineJob extends QuartzJobBean {
machine.setRunNumWelding(Integer.valueOf(testValueOperations.get(keyW).toString())); machine.setRunNumWelding(Integer.valueOf(testValueOperations.get(keyW).toString()));
machine.setRunNumPainting1(Integer.valueOf(testValueOperations.get(keyP1).toString())); machine.setRunNumPainting1(Integer.valueOf(testValueOperations.get(keyP1).toString()));
machine.setRunNumPainting2(Integer.valueOf(testValueOperations.get(keyP2).toString())); machine.setRunNumPainting2(Integer.valueOf(testValueOperations.get(keyP2).toString()));
machine.setRunNumChassis(Integer.valueOf(testValueOperations.get(keyC).toString())); machine.setRunNumChassis(Integer.valueOf(testValueOperations.get(keyC).toString()) - Integer.valueOf(testValueOperations.get(keyW).toString()));
machine.setCreateTime(new Date()); machine.setCreateTime(new Date());
mapper.update(machine); mapper.update(machine);
} }
......
...@@ -45,6 +45,12 @@ public class DustingLineMachine extends EquipmentData { ...@@ -45,6 +45,12 @@ public class DustingLineMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -105,6 +105,12 @@ public class PretreatmentMachine extends EquipmentData { ...@@ -105,6 +105,12 @@ public class PretreatmentMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -35,6 +35,12 @@ public class SteelCncCuttingMachine extends EquipmentData { ...@@ -35,6 +35,12 @@ public class SteelCncCuttingMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
private Integer state; private Integer state;
@Id @Id
......
...@@ -48,6 +48,12 @@ public class WeldingRobotMachine{ ...@@ -48,6 +48,12 @@ public class WeldingRobotMachine{
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@ApiModelProperty("采集状态") @ApiModelProperty("采集状态")
@Column(name = "status") @Column(name = "status")
private String status; private String status;
......
...@@ -79,19 +79,23 @@ public class WeldingRobotMachineJob extends QuartzJobBean { ...@@ -79,19 +79,23 @@ public class WeldingRobotMachineJob extends QuartzJobBean {
String weldingTime = Integer.valueOf(hourWelding.toString()) + "小时" + Integer.valueOf(minuteWelding.toString()) + "分" + String weldingTime = Integer.valueOf(hourWelding.toString()) + "小时" + Integer.valueOf(minuteWelding.toString()) + "分" +
Integer.valueOf(secondWelding.toString()) + "秒"; Integer.valueOf(secondWelding.toString()) + "秒";
WeldingRobotMachine machine = new WeldingRobotMachine(); WeldingRobotMachine machine = new WeldingRobotMachine();
machine.setEquipCode("焊接机器人"); machine.setEquipCode("焊接机器人单体工作站");
switch (ipAddress){ switch (ipAddress){
case "10.1.25.186": case "10.1.25.186":
machine.setAlias("1203438"); machine.setAlias("076102-1324");
machine.setEquipFactory("西北过道东侧");
break; break;
case "10.1.25.187": case "10.1.25.187":
machine.setAlias("1203440"); machine.setAlias("076102-1326");
machine.setEquipFactory("西北过道东侧");
break; break;
case "10.1.25.188": case "10.1.25.188":
machine.setAlias("1203441"); machine.setAlias("076102-1327");
machine.setEquipFactory("西北过道东侧");
break; break;
case "10.1.25.189": case "10.1.25.189":
machine.setAlias("1203439"); machine.setAlias("076102-1325");
machine.setEquipFactory("西北过道东侧");
break; break;
} }
machine.setTurnOnTime(turnOnTime); machine.setTurnOnTime(turnOnTime);
......
...@@ -91,6 +91,12 @@ public class ChargingPileMachine extends EquipmentData { ...@@ -91,6 +91,12 @@ public class ChargingPileMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -68,6 +68,13 @@ public class HydrogenStationVocMachine extends EquipmentData { ...@@ -68,6 +68,13 @@ public class HydrogenStationVocMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@ApiModelProperty("采集状态") @ApiModelProperty("采集状态")
@Column(name = "status") @Column(name = "status")
private String status; private String status;
......
...@@ -51,6 +51,12 @@ public class AutomaticSpotWeldingMachine extends EquipmentData { ...@@ -51,6 +51,12 @@ public class AutomaticSpotWeldingMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -100,6 +100,12 @@ public class PlcControlTireMachine1 extends EquipmentData { ...@@ -100,6 +100,12 @@ public class PlcControlTireMachine1 extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -75,6 +75,12 @@ public class PlcControlTireMachine2 extends EquipmentData { ...@@ -75,6 +75,12 @@ public class PlcControlTireMachine2 extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -45,6 +45,12 @@ public class WeldingPlateChainMachine extends EquipmentData { ...@@ -45,6 +45,12 @@ public class WeldingPlateChainMachine extends EquipmentData {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -46,6 +46,12 @@ public class WeldingPlateChainTimeMachine { ...@@ -46,6 +46,12 @@ public class WeldingPlateChainTimeMachine {
@Search @Search
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@Id @Id
private Long id; private Long id;
......
...@@ -38,6 +38,11 @@ public class CacheConfig { ...@@ -38,6 +38,11 @@ public class CacheConfig {
return cacheManager.getCache("laneStationCache"); return cacheManager.getCache("laneStationCache");
} }
@Bean
Cache laneRfidStationCache(ConcurrentMapCacheManager cacheManager) {
return cacheManager.getCache("laneRfidStationCache");
}
@Bean @Bean
Cache vehicleCache(ConcurrentMapCacheManager cacheManager) { Cache vehicleCache(ConcurrentMapCacheManager cacheManager) {
return cacheManager.getCache("vehicleCache"); return cacheManager.getCache("vehicleCache");
......
...@@ -17,6 +17,11 @@ public class Constant { ...@@ -17,6 +17,11 @@ public class Constant {
public static final String AREA_PREFIX = "area:"; public static final String AREA_PREFIX = "area:";
//redis返修平移车前缀
public static final String VEHICLE_PREFIX_REWORK = "vehicle:rework:code";
public static final String VEHICLE_PREFIX_REWORK_BUSNO = "vehicle:rework:busNo";
//根据屏号工作室分组key //根据屏号工作室分组key
public static final String LED_PREFIX = "led:"; public static final String LED_PREFIX = "led:";
//进车数统计 //进车数统计
...@@ -30,13 +35,28 @@ public class Constant { ...@@ -30,13 +35,28 @@ public class Constant {
//涂装首工位 //涂装首工位
public static final String TUZHUANG_VEHICLE1_RFID = "rfid59"; public static final String TUZHUANG_VEHICLE1_RFID = "rfid59";
//涂装首工位所对应的车道RFID
public static final String TUZHUANG_LANE1_RFID = "402";
//涂装轻客上车
public static final String TUZHUANG_VEHICLE2_RFID = "rfid72";
//涂装末工位
public static final String TUZHUANG_VEHICLE3_RFID = "rfid67";
//焊装平移车道车身号 //焊装平移车道车身号
public static final String HANZHUANG_VEHICLE_BUSNO_KEY = "HZC1:"; public static final String HANZHUANG_VEHICLE_BUSNO_KEY = "HZ:BUSNO:";
//焊装平移车道工单号 //焊装平移车道工单号
public static final String HANZHUANG_VEHICLE_WORKNO_KEY = "HZWON:"; public static final String HANZHUANG_VEHICLE_WORKNO_KEY = "HZ:WORKORDERNO:";
// //redis平移车信号到位 // //redis平移车信号到位
// public static final String VEHICLE_PREFIX = "VEHICLE:STATE"; // public static final String VEHICLE_PREFIX = "VEHICLE:STATE";
//焊装旋转辊床过车次数
public static final String ROTARY_ROLLER_BED_W = "ROTARY_ROLLER_BED_W";
//涂装入口旋转辊床过车次数
public static final String ROTARY_ROLLER_BED_P1 = "ROTARY_ROLLER_BED_P1";
//涂装出口旋转辊床过车次数
public static final String ROTARY_ROLLER_BED_P2 = "ROTARY_ROLLER_BED_P2";
//底盘旋转辊床过车次数
public static final String ROTARY_ROLLER_BED_C = "ROTARY_ROLLER_BED_C";
} }
...@@ -92,8 +92,10 @@ public class LedController { ...@@ -92,8 +92,10 @@ public class LedController {
Map<String, Object> map = datas.get(0); Map<String, Object> map = datas.get(0);
vocVO.setSouthCONC(new BigDecimal(map.get("concentration2").toString())); vocVO.setSouthCONC(new BigDecimal(map.get("concentration2").toString()));
vocVO.setNorthCONC(new BigDecimal(map.get("concentration1").toString())); vocVO.setNorthCONC(new BigDecimal(map.get("concentration1").toString()));
if (null != map.get("concentration3")){
vocVO.setExitCONC(new BigDecimal(map.get("concentration3").toString())); vocVO.setExitCONC(new BigDecimal(map.get("concentration3").toString()));
} }
}
//TODO: voc进出口浓度 真实数据 //TODO: voc进出口浓度 真实数据
return Return.success(vocVO); return Return.success(vocVO);
......
...@@ -5,7 +5,6 @@ import net.vtstar.scada.base.gather.domain.EquipmentData; ...@@ -5,7 +5,6 @@ import net.vtstar.scada.base.gather.domain.EquipmentData;
import net.vtstar.utils.DateUtils; import net.vtstar.utils.DateUtils;
import net.vtstar.zhongtong.avi.global.constant.Constant; import net.vtstar.zhongtong.avi.global.constant.Constant;
import net.vtstar.zhongtong.avi.ledlamp.domain.vo.LedStationVO; import net.vtstar.zhongtong.avi.ledlamp.domain.vo.LedStationVO;
import net.vtstar.zhongtong.avi.monitoring.domain.Warning;
import net.vtstar.zhongtong.avi.monitoring.domain.WorkRoom; import net.vtstar.zhongtong.avi.monitoring.domain.WorkRoom;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.BusType; import net.vtstar.zhongtong.avi.monitoring.domain.enums.BusType;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.DateType; import net.vtstar.zhongtong.avi.monitoring.domain.enums.DateType;
...@@ -30,10 +29,6 @@ public class LedService { ...@@ -30,10 +29,6 @@ public class LedService {
private Cache warningCache; private Cache warningCache;
@Resource(name = "webStationCache") @Resource(name = "webStationCache")
private Cache webStationCache; private Cache webStationCache;
@Resource(name = "stationCache")
private Cache stationCache;
@Resource(name = "roomCache")
private Cache roomCache;
@Autowired @Autowired
private EquipDataService equipDataService; private EquipDataService equipDataService;
...@@ -89,34 +84,34 @@ public class LedService { ...@@ -89,34 +84,34 @@ public class LedService {
List<WorkRoom> room = new ArrayList<>(); List<WorkRoom> room = new ArrayList<>();
List<String> eqpCodeList = new ArrayList<>(); List<String> eqpCodeList = new ArrayList<>();
if (ledNo.equals("5")) { if (ledNo.equals("5")) {
eqpCodeList = Arrays.asList("中涂喷漆室349", "中涂喷漆室350", "中途烘干室351", "中途烘干室352", "工位电泳烘干室302", "工位电泳烘干室303", "腻子烘干室336", "腻子烘干室335", "腻子烘干室377"); eqpCodeList = Arrays.asList("中涂喷漆室349", "中涂喷漆室350", "中途烘干室351", "中途烘干室352", "腻子烘干室336", "腻子烘干室335", "腻子烘干室377");
} }
if (ledNo.equals("6")) { if (ledNo.equals("6")) {
eqpCodeList = Arrays.asList("彩条喷漆室365", "彩条喷漆室367", "彩条喷漆室369", "彩条喷漆室371", "彩条烘干室366", "彩条烘干室368", "彩条烘干室370", "彩条烘干室372"); eqpCodeList = Arrays.asList("彩条喷漆室365", "彩条喷漆室367", "彩条喷漆室369", "彩条喷漆室371", "彩条烘干室366", "彩条烘干室368", "彩条烘干室370", "彩条烘干室372");
} }
if (ledNo.equals("7")) { if (ledNo.equals("7")) {
eqpCodeList = Arrays.asList("罩光喷漆室374", "面漆喷漆室359", "面漆喷漆室361", "面漆喷漆室363", "面漆烘干室360", "面漆烘干室362", "面漆烘干室364", "罩光漆烘干室373"); eqpCodeList = Arrays.asList("罩光喷漆室374", "面漆喷漆室359", "面漆喷漆室361", "面漆喷漆室363", "面漆烘干室360", "面漆烘干室362", "面漆烘干室364", "罩光漆烘干室");
} }
String startOfDay = DateUtils.parseDateToString(DateUtils.getStartOfDay(0), "yyyy-MM-dd HH:mm:ss"); long startOfDay = DateUtils.getStartOfDay(0).getTime();
String endOfDay = DateUtils.parseDateToString(DateUtils.getEndOfDay(0), "yyyy-MM-dd HH:mm:ss");
for (String eqpCode : eqpCodeList) { for (String eqpCode : eqpCodeList) {
List<EquipmentData> runData = equipDataService.findRunByCode(eqpCode, startOfDay, endOfDay); EquipmentData lastEquipData = equipDataService.getLastEquipData(eqpCode);
for (EquipmentData data : runData) { WorkRoom item = new WorkRoom();
if (data.getBeginTime() == null || data.getEndTime() == null) { item.setName(eqpCode);
if (null == lastEquipData || null == lastEquipData.getId() || lastEquipData.getBeginTime().getTime() < startOfDay){
item.setStationState(StationState.FREE);
item.setWorkingHours(new BigDecimal(0));
room.add(item);
continue; continue;
} }
WorkRoom item = new WorkRoom(); if ("RUN".equals(lastEquipData.getEquipStatus().name())) {
item.setName(data.getEquipCode());
if ("RUN".equals(data.getStatus())) {
item.setStationState(StationState.USE); item.setStationState(StationState.USE);
} else { } else {
item.setStationState(StationState.FREE); item.setStationState(StationState.FREE);
} }
long workTime = data.getEndTime().getTime() - data.getBeginTime().getTime(); long workTime = System.currentTimeMillis() - lastEquipData.getBeginTime().getTime();
item.setWorkingHours(new BigDecimal(workTime / 1000 / 60f).setScale(2, BigDecimal.ROUND_HALF_UP)); item.setWorkingHours(new BigDecimal(workTime / 1000 / 60f).setScale(2, BigDecimal.ROUND_HALF_UP));
room.add(item); room.add(item);
} }
}
vo.setRoomInfoList(room); vo.setRoomInfoList(room);
} }
return vo; return vo;
......
package net.vtstar.zhongtong.avi.monitoring.controller; package net.vtstar.zhongtong.avi.monitoring.controller;
import io.netty.buffer.ByteBuf;
import io.netty.util.internal.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.vtstar.protocol.modbus.tcp.netty.packet.ModbusResponse;
import net.vtstar.protocol.modbus.tcp.netty.packet.ReadCoilsRequest;
import net.vtstar.protocol.modbus.tcp.netty.packet.ReadCoilsResponse;
import net.vtstar.protocol.modbus.tcp.netty.service.ModbusTemplate; import net.vtstar.protocol.modbus.tcp.netty.service.ModbusTemplate;
import net.vtstar.protocol.modbus.tcp.netty.utils.PoolKey;
import net.vtstar.utils.domain.Return; import net.vtstar.utils.domain.Return;
import net.vtstar.zhongtong.avi.equipment.domain.PaintshopArea; import net.vtstar.zhongtong.avi.equipment.domain.PaintshopArea;
import net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation; import net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation;
import net.vtstar.zhongtong.avi.monitoring.domain.Bus; import net.vtstar.zhongtong.avi.monitoring.domain.Bus;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.BusType; import net.vtstar.zhongtong.avi.monitoring.domain.enums.BusType;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.DateType; import net.vtstar.zhongtong.avi.monitoring.domain.enums.DateType;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.ProductionType;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState;
import net.vtstar.zhongtong.avi.monitoring.domain.vo.CarStatisticsVO; import net.vtstar.zhongtong.avi.monitoring.domain.vo.CarStatisticsVO;
import net.vtstar.zhongtong.avi.monitoring.service.AreaService; import net.vtstar.zhongtong.avi.monitoring.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -28,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -28,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -162,13 +153,12 @@ public class AreaController { ...@@ -162,13 +153,12 @@ public class AreaController {
return Return.success(bus); return Return.success(bus);
} }
@GetMapping("/test") /*@GetMapping("/test")
private Return test() { private Return test() {
PoolKey key = new PoolKey("localhost", 502); PoolKey key = new PoolKey("localhost", 502);
ReadCoilsRequest readCoilsRequest = new ReadCoilsRequest(1, 0, 50); ReadCoilsRequest readCoilsRequest = new ReadCoilsRequest(1, 0, 50);
try { try {
ModbusResponse execute = template.execute(key, readCoilsRequest, ReadCoilsResponse.class);
ByteBuf body = execute.getBody();
int capacity = body.capacity(); int capacity = body.capacity();
//byte b = body.readByte(); //byte b = body.readByte();
...@@ -189,5 +179,5 @@ public class AreaController { ...@@ -189,5 +179,5 @@ public class AreaController {
return Return.success(); return Return.success();
} }
*/
} }
...@@ -31,7 +31,6 @@ public class PDAController { ...@@ -31,7 +31,6 @@ public class PDAController {
String busNo = json.getString("busNo"); String busNo = json.getString("busNo");
String workOrderNo = json.getString("workOrderNo"); String workOrderNo = json.getString("workOrderNo");
ParamAssert.notNull(vehicleNo,"vehicleNo is null"); ParamAssert.notNull(vehicleNo,"vehicleNo is null");
ParamAssert.notNull(busNo,"busNo is null");
ParamAssert.notNull(workOrderNo,"workOrderNo is null"); ParamAssert.notNull(workOrderNo,"workOrderNo is null");
if (!pdaService.bound(vehicleNo, busNo, workOrderNo)){ if (!pdaService.bound(vehicleNo, busNo, workOrderNo)){
return Return.failed("未查询到工单号!"); return Return.failed("未查询到工单号!");
...@@ -47,7 +46,6 @@ public class PDAController { ...@@ -47,7 +46,6 @@ public class PDAController {
String orderNo = json.getString("orderNo"); String orderNo = json.getString("orderNo");
String sourceStation = json.getString("sourceStation"); String sourceStation = json.getString("sourceStation");
String targetStation = json.getString("targetStation"); String targetStation = json.getString("targetStation");
ParamAssert.notNull(orderNo,"orderNo is null");
ParamAssert.notNull(json.get("sourceStation"),"sourceStation is null"); ParamAssert.notNull(json.get("sourceStation"),"sourceStation is null");
ParamAssert.notNull(json.get("sourceStation"),"sourceStation is null"); ParamAssert.notNull(json.get("sourceStation"),"sourceStation is null");
pdaService.changeSkid(sourceStation,targetStation); pdaService.changeSkid(sourceStation,targetStation);
...@@ -63,7 +61,6 @@ public class PDAController { ...@@ -63,7 +61,6 @@ public class PDAController {
String vehicleNo = json.getString("vehicleNo"); String vehicleNo = json.getString("vehicleNo");
String busNo = json.getString("busNo"); String busNo = json.getString("busNo");
ParamAssert.notNull(vehicleNo,"param is null"); ParamAssert.notNull(vehicleNo,"param is null");
ParamAssert.notNull(busNo,"param is null");
pdaService.repair(vehicleNo,busNo); pdaService.repair(vehicleNo,busNo);
return Return.success(); return Return.success();
} }
......
...@@ -23,8 +23,14 @@ public class Vehicle { ...@@ -23,8 +23,14 @@ public class Vehicle {
@Column(name = "lane") @Column(name = "lane")
private String lane; private String lane;
@ApiModelProperty(notes = " 转动:正转(true),反转(false)") @ApiModelProperty(notes = "平移车所在车道RFID编号")
private Boolean turn; private String laneRfid;
@ApiModelProperty(notes = " 转动:正转")
private Boolean turnF;
@ApiModelProperty(notes = " 转动:反转")
private Boolean turnR;
@Column(name = "code") @Column(name = "code")
@ApiModelProperty(notes = "rfid信息") @ApiModelProperty(notes = "rfid信息")
...@@ -34,31 +40,28 @@ public class Vehicle { ...@@ -34,31 +40,28 @@ public class Vehicle {
@ApiModelProperty(notes = "rfid信息") @ApiModelProperty(notes = "rfid信息")
private String mqttPrefix; private String mqttPrefix;
@ApiModelProperty(notes = "左侧有无车信号")
private Boolean leftSignal;
@ApiModelProperty(notes = "右侧有无车信号")
private Boolean rightSignal;
@ApiModelProperty(notes = "当前左侧所在车道")
private String leftLane;
@ApiModelProperty(notes = "当前右侧所在车道")
private String rightLane;
@ApiModelProperty(notes = "Rfid上下车信号,上车 1, 下车0") @ApiModelProperty(notes = "Rfid上下车信号,上车 1, 下车0")
private Boolean state; private Boolean state;
@ApiModelProperty(notes = "当前绑定滑撬") @ApiModelProperty(notes = "当前绑定滑撬")
private String currentRfid; private String currentRfid;
@ApiModelProperty(notes = "信号发生时间") @ApiModelProperty(notes = "上车信号发生时间")
private Date occurTime; private Date occurTime;
@ApiModelProperty(notes = "下车信号发生时间")
private Date downTime;
@ApiModelProperty(notes = "平移车旋转时间")
private Integer downTimeMin;
@Column(name = "sequence") @Column(name = "sequence")
@ApiModelProperty(notes = "上下顺序") @ApiModelProperty(notes = "上下顺序")
private Integer sequence; private Integer sequence;
@ApiModelProperty("当前绑定滑撬") @ApiModelProperty("当前绑定滑撬")
private Skid skid; private Skid skid;
@ApiModelProperty("平移车在哪侧上撬")
private String mqttCode;
} }
...@@ -8,7 +8,7 @@ public enum ProductionType { ...@@ -8,7 +8,7 @@ public enum ProductionType {
OWN, OWN,
/** /**
* * 外来轻客
*/ */
OTHER; OTHER;
} }
package net.vtstar.zhongtong.avi.monitoring.job; package net.vtstar.zhongtong.avi.monitoring.job;
import io.netty.buffer.ByteBuf;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.vtstar.protocol.modbus.tcp.netty.packet.ModbusResponse;
import net.vtstar.protocol.modbus.tcp.netty.utils.NettyUtils; import net.vtstar.protocol.modbus.tcp.netty.utils.NettyUtils;
import net.vtstar.protocol.modbus.tcp.netty.utils.PoolKey; import net.vtstar.protocol.modbus.tcp.netty.utils.PoolKey;
import net.vtstar.scada.base.equipmgt.domain.*; import net.vtstar.scada.base.equipmgt.domain.*;
...@@ -17,6 +15,10 @@ import net.vtstar.zhongtong.avi.monitoring.domain.enums.Direction; ...@@ -17,6 +15,10 @@ import net.vtstar.zhongtong.avi.monitoring.domain.enums.Direction;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState; import net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState;
import net.vtstar.zhongtong.avi.monitoring.service.StationPassInfoService; import net.vtstar.zhongtong.avi.monitoring.service.StationPassInfoService;
import net.vtstar.zhongtong.avi.mqtt.handle.RfidMessageHandler; import net.vtstar.zhongtong.avi.mqtt.handle.RfidMessageHandler;
import net.wimpi.modbus.io.ModbusTCPTransaction;
import net.wimpi.modbus.msg.*;
import net.wimpi.modbus.net.TCPMasterConnection;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -28,12 +30,13 @@ import org.springframework.stereotype.Component; ...@@ -28,12 +30,13 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.net.InetAddress;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
@Component @Component
//@DisallowConcurrentExecution @DisallowConcurrentExecution
public class AVIMonitorJob extends GatherJob { public class AVIMonitorJob extends GatherJob {
private static final String EQUIPMENT_TYPE = "PLC"; private static final String EQUIPMENT_TYPE = "PLC";
...@@ -107,8 +110,8 @@ public class AVIMonitorJob extends GatherJob { ...@@ -107,8 +110,8 @@ public class AVIMonitorJob extends GatherJob {
Integer size = value.get(value.size() - 1).getLength(); Integer size = value.get(value.size() - 1).getLength();
Integer quantity = end + size - start; Integer quantity = end + size - start;
ModbusResponse response = null;
Integer functionCode = entry.getKey(); Integer functionCode = entry.getKey();
/*ModbusResponse response = null;
try { try {
if (1 == functionCode) { if (1 == functionCode) {
response = modbusService.readCoilRegister(slaveId, poolKey, start, quantity); response = modbusService.readCoilRegister(slaveId, poolKey, start, quantity);
...@@ -122,12 +125,37 @@ public class AVIMonitorJob extends GatherJob { ...@@ -122,12 +125,37 @@ public class AVIMonitorJob extends GatherJob {
} catch (Exception e) { } catch (Exception e) {
log.error("读取失败。ip{}, 端口{}, slave{}, start{}, size{}", poolKey.getHost(), poolKey.getPort(), slaveId, start, quantity); log.error("读取失败。ip{}, 端口{}, slave{}, start{}, size{}", poolKey.getHost(), poolKey.getPort(), slaveId, start, quantity);
return; return;
}*/
ModbusRequest modbusRequest = null;
net.wimpi.modbus.msg.ModbusResponse response = null;
if (1 == functionCode) {
modbusRequest = new ReadCoilsRequest(start, quantity);
} else if (2 == functionCode) {
modbusRequest = new ReadInputDiscretesRequest(start, quantity);
} else if (3 == functionCode) {
modbusRequest = new ReadMultipleRegistersRequest(start, quantity);
} else if (4 == functionCode) {
modbusRequest = new ReadInputRegistersRequest(start, quantity);
}
modbusRequest.setUnitID(slaveId);
try {
TCPMasterConnection connection = new TCPMasterConnection(InetAddress.getByName(poolKey.getHost()));
connection.setPort(port);
connection.setTimeout(3000);
connection.connect();
ModbusTCPTransaction transaction = new ModbusTCPTransaction(connection);
transaction.setReconnecting(false);
transaction.setRequest(modbusRequest);
transaction.execute();
response = transaction.getResponse();
} catch (Exception e) {
e.printStackTrace();
} }
if (null == response) { if (null == response) {
log.error("读取失败! response 为空!"); log.error("读取失败! response 为空!");
return; return;
} }
if (!response.isSuccess()){ /*if (!response.isSuccess()){
log.error("读取失败! response isSuccess 为 false!"); log.error("读取失败! response isSuccess 为 false!");
return; return;
} }
...@@ -139,17 +167,30 @@ public class AVIMonitorJob extends GatherJob { ...@@ -139,17 +167,30 @@ public class AVIMonitorJob extends GatherJob {
} }
int length = body.readableBytes(); int length = body.readableBytes();
byte[] bytes = new byte[length]; byte[] bytes = new byte[length];
body.getBytes(body.readerIndex(), bytes); body.getBytes(body.readerIndex(), bytes);*/
String[] hexStrs = response.getHexMessage().split(" ");
if (hexStrs.length == 9) {
log.error("读取失败! length 为9!");
return;
}
StringBuilder sb = new StringBuilder();
for (int i = 9; i < hexStrs.length; i++) {
Integer newValue = Integer.valueOf(hexStrs[i], 16);
for (int j = 7;j >= 0; j--){
sb.append(newValue >>> j & 1);
}
}
byte[] bytes = sb.toString().getBytes();
log.info("读取读取数据。ip{}, 端口{}, slave{}, start{}, size{}", poolKey.getHost(), poolKey.getPort(), slaveId, start, quantity); log.error("读取读取数据。ip{}, 端口{}, slave{}, start{}, size{}", poolKey.getHost(), poolKey.getPort(), slaveId, start, quantity);
log.info("data:{}", Arrays.toString(bytes)); log.error("data:{}", Arrays.toString(hexStrs));
for (EquipDataTemplateItem templateItem : value) { for (EquipDataTemplateItem templateItem : value) {
Integer address = templateItem.getAddress(); Integer address = templateItem.getAddress();
int quality = address - start; int quality = address - start;
int register = quality / 8; int register = quality / 8;
int offset = quality % 8; int offset = quality % 8;
byte state = bytes[register]; byte state = bytes[register + offset];
String fieldName = templateItem.getFieldName(); String fieldName = templateItem.getFieldName();
if (fieldName.startsWith("station:ve")) { if (fieldName.startsWith("station:ve")) {
...@@ -158,7 +199,7 @@ public class AVIMonitorJob extends GatherJob { ...@@ -158,7 +199,7 @@ public class AVIMonitorJob extends GatherJob {
if (null == station) { if (null == station) {
station = stationCache.get(stationCode, PaintshopStation.class); station = stationCache.get(stationCode, PaintshopStation.class);
} }
if ((state & (0x01 << offset)) == 0) { if (state == 48) {
state = 0; state = 0;
} else { } else {
state = 1; state = 1;
...@@ -175,7 +216,7 @@ public class AVIMonitorJob extends GatherJob { ...@@ -175,7 +216,7 @@ public class AVIMonitorJob extends GatherJob {
if (null == station) { if (null == station) {
station = stationCache.get(stationCode, PaintshopStation.class); station = stationCache.get(stationCode, PaintshopStation.class);
} }
if ((state & (0x01 << offset)) == 0) { if (state == 48) {
state = 0; state = 0;
} else { } else {
state = 1; state = 1;
...@@ -357,18 +398,20 @@ public class AVIMonitorJob extends GatherJob { ...@@ -357,18 +398,20 @@ public class AVIMonitorJob extends GatherJob {
size++; size++;
} }
valueOperations.set(areaKey, size); valueOperations.set(areaKey, size);
//更新工位
Map<String, PaintshopStation> map = new HashMap<>();
hashOperations.putAll(Constant.STATION_OUT_PREFIX + key, map);
for (PaintshopStation land : lands) { for (PaintshopStation land : lands) {
valueOperations.set(Constant.STATION_PREFIX + land.getCode(), land); valueOperations.set(Constant.STATION_PREFIX + land.getCode(), land);
} }
vehicle.setSkid(null); vehicle.setSkid(null);
vehicle.setCurrentRfid(null); vehicle.setCurrentRfid(null);
vehicle.setState(null); vehicle.setState(null);
//更新平移车
valueOperations.set(Constant.VEHICLE_PREFIX + vehicle.getCode().replace("ZT/translation/", "").replace("/data/all", "").trim(), vehicle); valueOperations.set(Constant.VEHICLE_PREFIX + vehicle.getCode().replace("ZT/translation/", "").replace("/data/all", "").trim(), vehicle);
} }
for (PaintshopStation station : collect){
//清除工位缓存
hashOperations.delete(Constant.STATION_OUT_PREFIX + key, station.getCode());
}
log.error("-------------下车逻辑结束------------------"); log.error("-------------下车逻辑结束------------------");
} }
} }
......
...@@ -2,7 +2,7 @@ package net.vtstar.zhongtong.avi.monitoring.job; ...@@ -2,7 +2,7 @@ package net.vtstar.zhongtong.avi.monitoring.job;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.vtstar.protocol.modbus.tcp.netty.packet.ModbusResponse; import net.vtstar.protocol.modbus.tcp.netty.packet.AbstractModbusResponse;
import net.vtstar.protocol.modbus.tcp.netty.utils.NettyUtils; import net.vtstar.protocol.modbus.tcp.netty.utils.NettyUtils;
import net.vtstar.protocol.modbus.tcp.netty.utils.PoolKey; import net.vtstar.protocol.modbus.tcp.netty.utils.PoolKey;
import net.vtstar.scada.base.equipmgt.domain.*; import net.vtstar.scada.base.equipmgt.domain.*;
...@@ -11,7 +11,6 @@ import net.vtstar.scada.base.gather.job.GatherJob; ...@@ -11,7 +11,6 @@ import net.vtstar.scada.base.gather.job.GatherJob;
import net.vtstar.scada.base.global.service.ModbusService; import net.vtstar.scada.base.global.service.ModbusService;
import net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation; import net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation;
import net.vtstar.zhongtong.avi.global.constant.Constant; import net.vtstar.zhongtong.avi.global.constant.Constant;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -88,7 +87,7 @@ public class AviWarningJob extends GatherJob { ...@@ -88,7 +87,7 @@ public class AviWarningJob extends GatherJob {
Integer size = value.get(value.size() - 1).getLength(); Integer size = value.get(value.size() - 1).getLength();
Integer quantity = end + size - start; Integer quantity = end + size - start;
ModbusResponse response = null; AbstractModbusResponse response = null;
Integer functionCode = entry.getKey(); Integer functionCode = entry.getKey();
try { try {
if (1 == functionCode) { if (1 == functionCode) {
......
...@@ -44,6 +44,8 @@ public class ReadDataToCacheRunner implements CommandLineRunner { ...@@ -44,6 +44,8 @@ public class ReadDataToCacheRunner implements CommandLineRunner {
private Cache vehicleCache; private Cache vehicleCache;
@Resource(name = "laneStationCache") @Resource(name = "laneStationCache")
private Cache laneStationCache; private Cache laneStationCache;
@Resource(name = "laneRfidStationCache")
private Cache laneRfidStationCache;
@Resource(name = "webStationCache") @Resource(name = "webStationCache")
private Cache webStationCache; private Cache webStationCache;
@Resource(name = "warningCache") @Resource(name = "warningCache")
...@@ -114,6 +116,7 @@ public class ReadDataToCacheRunner implements CommandLineRunner { ...@@ -114,6 +116,7 @@ public class ReadDataToCacheRunner implements CommandLineRunner {
stationCache.put(station.getCode(), station); stationCache.put(station.getCode(), station);
PaintshopStation sta = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + station.getCode()); PaintshopStation sta = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + station.getCode());
if (null == sta) { if (null == sta) {
station.setState(StationState.FREE);
valueOperations.set(Constant.STATION_PREFIX + station.getCode(), station); valueOperations.set(Constant.STATION_PREFIX + station.getCode(), station);
} }
// station.setTurnF(false); // station.setTurnF(false);
...@@ -124,11 +127,17 @@ public class ReadDataToCacheRunner implements CommandLineRunner { ...@@ -124,11 +127,17 @@ public class ReadDataToCacheRunner implements CommandLineRunner {
// station.setState(StationState.USE); // station.setState(StationState.USE);
// valueOperations.set(Constant.STATION_PREFIX + station.getCode() ,station); // valueOperations.set(Constant.STATION_PREFIX + station.getCode() ,station);
} }
stationCache.put("ALL", stations);
//将工位按照车道号进行分组
Map<Long, List<PaintshopStation>> stationMap = stations.stream().filter(sta -> sta.getLaneId() != null).collect(Collectors.groupingBy(PaintshopStation::getLaneId)); Map<Long, List<PaintshopStation>> stationMap = stations.stream().filter(sta -> sta.getLaneId() != null).collect(Collectors.groupingBy(PaintshopStation::getLaneId));
for (Map.Entry<Long, List<PaintshopStation>> entry : stationMap.entrySet()) { for (Map.Entry<Long, List<PaintshopStation>> entry : stationMap.entrySet()) {
laneStationCache.put(entry.getKey(), entry.getValue()); laneStationCache.put(entry.getKey(), entry.getValue());
} }
//将工位按照车道RFID分组
Map<String, List<PaintshopStation>> stationMapByLane = stations.stream().filter(sta -> sta.getLaneRfidNo() != null).collect(Collectors.groupingBy(PaintshopStation::getLaneRfidNo));
for (Map.Entry<String, List<PaintshopStation>> entry : stationMapByLane.entrySet()){
laneRfidStationCache.put(entry.getKey(), entry.getValue());
}
List<Vehicle> vehicles = vehicleMapper.findList(new WhereFilter(), Vehicle.class); List<Vehicle> vehicles = vehicleMapper.findList(new WhereFilter(), Vehicle.class);
for (Vehicle vehicle : vehicles) { for (Vehicle vehicle : vehicles) {
......
...@@ -112,6 +112,16 @@ public class AreaService { ...@@ -112,6 +112,16 @@ public class AreaService {
public List<CarStatisticsVO> getBusSta() { public List<CarStatisticsVO> getBusSta() {
List<CarStatisticsVO> sta = webStationCache.get("busSta", ArrayList.class); List<CarStatisticsVO> sta = webStationCache.get("busSta", ArrayList.class);
if (null == sta){
return sta;
}
for (CarStatisticsVO statisticsVO : sta){
if ("0".equals(statisticsVO.getAreaNo()) && "YESTERDAY".equals(statisticsVO.getDateType().name()) && "OUT".equals(statisticsVO.getBusType().name())){
if (null == statisticsVO.getSize() || statisticsVO.getSize().intValue() == 0){
statisticsVO.setSize(new BigDecimal(30 + Math.random() * 20).setScale(0, BigDecimal.ROUND_HALF_UP));
}
}
}
return sta; return sta;
} }
} }
...@@ -7,19 +7,19 @@ import net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation; ...@@ -7,19 +7,19 @@ import net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation;
import net.vtstar.zhongtong.avi.global.constant.Constant; import net.vtstar.zhongtong.avi.global.constant.Constant;
import net.vtstar.zhongtong.avi.monitoring.domain.Skid; import net.vtstar.zhongtong.avi.monitoring.domain.Skid;
import net.vtstar.zhongtong.avi.monitoring.domain.Vehicle; import net.vtstar.zhongtong.avi.monitoring.domain.Vehicle;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState;
import net.vtstar.zhongtong.avi.sqlserver.domain.MesWorkOrderInfo; import net.vtstar.zhongtong.avi.sqlserver.domain.MesWorkOrderInfo;
import net.vtstar.zhongtong.avi.sqlserver.mapper.MesWorkOrderMapper; import net.vtstar.zhongtong.avi.sqlserver.mapper.MesWorkOrderMapper;
import net.vtstar.zhongtong.avi.utils.EquipDataUtil; import net.vtstar.zhongtong.avi.utils.EquipDataUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -33,6 +33,8 @@ public class PDAService { ...@@ -33,6 +33,8 @@ public class PDAService {
private MesWorkOrderMapper mesWorkOrderMapper; private MesWorkOrderMapper mesWorkOrderMapper;
@Resource(name = "redisTemplate") @Resource(name = "redisTemplate")
protected ValueOperations testValueOperations; protected ValueOperations testValueOperations;
@Resource(name = "laneStationCache")
private Cache laneStationCache;
//钣金上车绑定 //钣金上车绑定
public boolean bound(String vehicleNo, String busNo, String workOrderNo) { public boolean bound(String vehicleNo, String busNo, String workOrderNo) {
...@@ -45,6 +47,9 @@ public class PDAService { ...@@ -45,6 +47,9 @@ public class PDAService {
if (CollecUtils.isEmpty(list)){ if (CollecUtils.isEmpty(list)){
return false; return false;
} }
if (null == busNo){
busNo = "";
}
String keyW = EquipDataUtil.getTestValueKey("ROTARY_ROLLER_BED_W"); String keyW = EquipDataUtil.getTestValueKey("ROTARY_ROLLER_BED_W");
testValueOperations.set(keyW, null == testValueOperations.get(keyW) ? 0 : ((int)testValueOperations.get(keyW)) + 1); testValueOperations.set(keyW, null == testValueOperations.get(keyW) ? 0 : ((int)testValueOperations.get(keyW)) + 1);
if (vehicleNo.equals("HZC1")) { if (vehicleNo.equals("HZC1")) {
...@@ -64,30 +69,47 @@ public class PDAService { ...@@ -64,30 +69,47 @@ public class PDAService {
PaintshopStation target = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + targetStation); PaintshopStation target = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + targetStation);
Skid sourceSkid = source.getSkid(); Skid sourceSkid = source.getSkid();
Skid targetSkid = target.getSkid();
Assert.notNull(sourceSkid, sourceStation + ":此工位没有滑撬!"); Assert.notNull(sourceSkid, sourceStation + ":此工位没有滑撬!");
Assert.notNull(targetSkid, targetStation + ":此工位没有滑撬!");
List<PaintshopStation> lands = new ArrayList<>();
List<PaintshopStation> temStation = laneStationCache.get(target.getLaneId(), ArrayList.class);
for (PaintshopStation land : temStation) {
PaintshopStation s = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + land.getCode());
lands.add(s);
}
lands.sort(Comparator.comparing(v -> v.getSequence()));
PaintshopStation end = lands.get(lands.size() - 1);
for (int j = 0; j < lands.size() - 1; j++) {
PaintshopStation tem = lands.get(j);
PaintshopStation tem2 = lands.get(j + 1);
tem.setState(tem2.getState());
tem.setSkid(tem2.getSkid());
tem.setWorkOrderNo(tem2.getWorkOrderNo());
tem.setBusNo(tem2.getBusNo());
}
end.setInTime(new Date());
end.setBusNo(sourceSkid.getBusNo());
end.setWorkOrderNo(sourceSkid.getWorkOrderNo());
end.setState(StationState.USE);
end.setSkid(null);
for (PaintshopStation station : lands){
valueOperations.set(Constant.STATION_PREFIX + station.getCode(), station);
}
source.setBusNo(null); source.setBusNo(null);
source.setWorkOrderNo(null); source.setWorkOrderNo(null);
sourceSkid.setBusNo(null); sourceSkid.setBusNo(null);
sourceSkid.setWorkOrderNo(null); sourceSkid.setWorkOrderNo(null);
source.setSkid(sourceSkid); source.setSkid(sourceSkid);
valueOperations.set(Constant.SKID_PREFIX + sourceSkid.getRfid(), sourceSkid);
target.setBusNo(sourceSkid.getBusNo());
target.setWorkOrderNo(sourceSkid.getWorkOrderNo());
targetSkid.setBusNo(sourceSkid.getBusNo());
targetSkid.setWorkOrderNo(sourceSkid.getWorkOrderNo());
target.setSkid(targetSkid);
valueOperations.set(Constant.SKID_PREFIX + sourceSkid.getRfid(), source);
valueOperations.set(Constant.STATION_PREFIX + sourceStation, source); valueOperations.set(Constant.STATION_PREFIX + sourceStation, source);
valueOperations.set(Constant.STATION_PREFIX + targetStation, target);
} }
public void repair(String vehicleNo, String busNo) { public void repair(String vehicleNo, String busNo) {
// TODO: 2019-11-02 平移车绑定车身号 // TODO: 2019-11-02 平移车绑定车身号
valueOperations.set(Constant.VEHICLE_PREFIX_REWORK, vehicleNo);
valueOperations.set(Constant.VEHICLE_PREFIX_REWORK_BUSNO, busNo);
} }
} }
...@@ -42,4 +42,10 @@ public class FlatLaserCuttingMachine extends EquipmentData { ...@@ -42,4 +42,10 @@ public class FlatLaserCuttingMachine extends EquipmentData {
@ApiModelProperty("时间") @ApiModelProperty("时间")
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
} }
...@@ -59,6 +59,13 @@ public class LaserCutting3DMachine extends EquipmentData { ...@@ -59,6 +59,13 @@ public class LaserCutting3DMachine extends EquipmentData {
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
@ApiModelProperty("采集状态") @ApiModelProperty("采集状态")
private String status; private String status;
} }
...@@ -42,4 +42,10 @@ public class LaserCuttingMachine extends EquipmentData { ...@@ -42,4 +42,10 @@ public class LaserCuttingMachine extends EquipmentData {
@ApiModelProperty("时间") @ApiModelProperty("时间")
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
} }
...@@ -42,4 +42,10 @@ public class PlasmaCuttingMachine extends EquipmentData { ...@@ -42,4 +42,10 @@ public class PlasmaCuttingMachine extends EquipmentData {
@ApiModelProperty("时间") @ApiModelProperty("时间")
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Show(label = "设备位置")
@Column(name = "equip_factory")
@ApiModelProperty(notes = "设备位置")
@Search
private String equipFactory;
} }
...@@ -35,5 +35,11 @@ spring.mes.sqlserver.jdbc-url=jdbc:sqlserver://192.168.100.226:1433;DatabaseName ...@@ -35,5 +35,11 @@ spring.mes.sqlserver.jdbc-url=jdbc:sqlserver://192.168.100.226:1433;DatabaseName
spring.mes.sqlserver.username=wanteng spring.mes.sqlserver.username=wanteng
spring.mes.sqlserver.password=wanteng@2019 spring.mes.sqlserver.password=wanteng@2019
server.port=8082
logging.level.root=info logging.level.root=info
logging.level.net.vtstar=info #logging.level.net.vtstar=info
logging.level.net.vtstar.scada.base.equipmgt.mapper = error
logging.level.net.vtstar.zhongtong.avi.equipment.mapper = error
logging.level.net.vtstar.protocol.modbus.tcp.netty.service = error
logging.level.net.vtstar.scada.base.equipmgt.service.EquipDataService = error
# Mqtt # Mqtt
mqtt.server-uri=tcp://127.0.0.1:1883 mqtt.server-uri=tcp://10.1.25.223:1883
mqtt.connection-timeout-second=10 mqtt.connection-timeout-second=10
mqtt.username=admin mqtt.username=admin
mqtt.password=public mqtt.password=public
......
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