Commit 105810b7 authored by 喻训浩's avatar 喻训浩

fix: avi修改

parent 5a5c3c1b
......@@ -57,7 +57,7 @@ public class PaintshopStation implements Serializable {
private String laneCode;
@ApiModelProperty(notes = "平移车道编号")
//@JoinColumn(tableName = PaintshopLane.class, name = "vehicle_lane_code")
@Column(name = "vehicle_lane_code")
@Search
private String vehicleLaneCode;
......@@ -89,6 +89,10 @@ public class PaintshopStation implements Serializable {
@ApiModelProperty(value = "车体类型")
private ProductionType busType;
@ApiModelProperty(notes = "状态", hidden = true)
@Column(name = "status")
private String status;
@ApiModelProperty(notes = "旧状态", hidden = true)
private StationState oldState;
......@@ -98,6 +102,9 @@ public class PaintshopStation implements Serializable {
@ApiModelProperty(notes = "当前绑定滑撬", hidden = true)
private Skid skid;
@ApiModelProperty(notes = "工位正反转,正转true,翻转false", hidden = true)
private Boolean turn;
@ApiModelProperty(notes = "工位反转", hidden = true)
private Boolean turnR;
@ApiModelProperty(notes = "工位正转", hidden = true)
private Boolean turnF;
}
......@@ -32,4 +32,14 @@ public class CacheConfig {
Cache laneStationCache(ConcurrentMapCacheManager cacheManager) {
return cacheManager.getCache("laneStationCache");
}
@Bean
Cache vehicleCache(ConcurrentMapCacheManager cacheManager) {
return cacheManager.getCache("vehicleCache");
}
@Bean
Cache skidCache(ConcurrentMapCacheManager cacheManager) {
return cacheManager.getCache("skidCache");
}
}
......@@ -6,9 +6,9 @@ public class Constant {
public static final String STATION_PREFIX = "station:";
public static final String HANZHUANG_VEHICLE1_RFID = "11111";
public static final String HANZHUANG_VEHICLE1_RFID = "rfid68";
public static final String HANZHUANG_VEHICLE2_RFID = "22222";
public static final String HANZHUANG_VEHICLE2_RFID = "rfid69";
public static final String HANZHUANG_VEHICLE1_BUSNO_KEY = "HZC1";
......
......@@ -4,24 +4,35 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Table;
@ApiModel("平移车")
@Data
@Table(name = "vehicle")
public class Vehicle {
@Column(name = "id")
private Long id;
@ApiModelProperty(notes = "别名(平移车号)")
private String alias;
@ApiModelProperty(notes = "所属平移车道(从东向西(1,2,3,4))")
@Column(name = "lane")
private Integer lane;
@ApiModelProperty(notes = " 转动:正转(true),反转(false)")
private Boolean turn;
@Column(name = "code")
@ApiModelProperty(notes = "rfid信息")
private String code;
@Column(name = "mqtt_prefix")
@ApiModelProperty(notes = "rfid信息")
private String mqttPrefix;
@ApiModelProperty(notes = "左侧有无车信号")
private Boolean leftSignal;
......
package net.vtstar.zhongtong.avi.monitoring.domain.bo;
import lombok.Data;
import java.util.Date;
@Data
public class MQTTMessageBO {
private Integer State;
private String ID;
private String createDate;
}
......@@ -100,12 +100,24 @@ public class AVIMonitorJob extends GatherJob {
log.info("读取失败。ip{},端口{},slave{},start{}", poolKey.getHost(), poolKey.getPort(), slaveId, startAddress);
continue;
}
log.debug("___");
log.debug("slaveID:" + slaveId + " start:" + startAddress + " count:" + count + " functionCode:" + startTemplate.getFunctionCode());
if (null == response) {
log.error("读取异常!");
continue;
}
if (!response.isSuccess()) {
log.error(response.getError());
continue;
}
for (EquipDataTemplateItem item : itemList) {
String fieldName = item.getFieldName();
if (fieldName.startsWith("station:ve")) {
String stationCode = fieldName.split(":")[2];
PaintshopStation station = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + stationCode);
log.debug("__________________");
log.debug("stationCode " + stationCode);
if (null == station) {
station = stationCache.get(stationCode, PaintshopStation.class);
}
......@@ -116,12 +128,15 @@ public class AVIMonitorJob extends GatherJob {
} else {
state = 1;
}
log.debug(station.toString());
station.setOldState(station.getState());
station.setState(state == 0 ? StationState.FREE : StationState.USE);
station.setArrive(state == 1 ? true : false);
valueOperations.set(Constant.STATION_PREFIX + stationCode, station);
}
if (fieldName.startsWith("station:turn")) {
String stationCode = fieldName.split(":")[3];
String[] split = fieldName.split(":");
String stationCode = fieldName.split(":")[2];
PaintshopStation station = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + stationCode);
if (null == station) {
station = stationCache.get(stationCode, PaintshopStation.class);
......@@ -133,7 +148,13 @@ public class AVIMonitorJob extends GatherJob {
state = 1;
}
station.setOldState(station.getState());
station.setTurn(state == 0 ? true : false);
String turn = split[1];
if (turn.endsWith("F")) {
station.setTurnF(state == 1 ? true : false);
}
if (turn.endsWith("R")) {
station.setTurnR(state == 1 ? true : false);
}
valueOperations.set(Constant.STATION_PREFIX + stationCode, station);
}
}
......
package net.vtstar.zhongtong.avi.monitoring.mapper;
import net.vtstar.user.mybatis.BaseMapper;
import net.vtstar.zhongtong.avi.monitoring.domain.Skid;
import net.vtstar.zhongtong.avi.monitoring.domain.Vehicle;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface VehicleMapper extends BaseMapper<Vehicle> {
}
......@@ -9,7 +9,9 @@ import net.vtstar.zhongtong.avi.equipment.domain.PaintshopLane;
import net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation;
import net.vtstar.zhongtong.avi.equipment.mapper.PaintshopStationMapper;
import net.vtstar.zhongtong.avi.monitoring.domain.Skid;
import net.vtstar.zhongtong.avi.monitoring.domain.Vehicle;
import net.vtstar.zhongtong.avi.monitoring.mapper.SkidMapper;
import net.vtstar.zhongtong.avi.monitoring.mapper.VehicleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.cache.Cache;
......@@ -29,16 +31,22 @@ public class ReadStationToCacheRunner implements CommandLineRunner {
@Resource(name = "stationCache")
private Cache stationCache;
@Resource(name = "vehicleCache")
private Cache vehicleCache;
@Resource(name = "laneStationCache")
private Cache laneStationCache;
@Resource(name = "redisTemplate")
protected HashOperations hashOperations;
@Autowired
private SearchService searchService;
@Autowired
private PaintshopStationMapper stationMapper;
@Autowired
private VehicleMapper vehicleMapper;
@Autowired
private SkidMapper skidMapper;
@Resource(name = "redisTemplate")
protected HashOperations hashOperations;
@Override
public void run(String... args) throws Exception {
......@@ -53,6 +61,16 @@ public class ReadStationToCacheRunner implements CommandLineRunner {
stationCache.put(station.getCode(),station);
}
Map<String, List<PaintshopStation>> stationMap = stations.stream().filter(sta -> sta.getVehicleLaneCode() != null).collect(Collectors.groupingBy(PaintshopStation::getVehicleLaneCode));
for (Map.Entry<String, List<PaintshopStation>> entry : stationMap.entrySet()) {
laneStationCache.put(entry.getKey(),entry.getValue());
}
List<Vehicle> vehicles = vehicleMapper.findList(new WhereFilter(), Vehicle.class);
for (Vehicle vehicle : vehicles) {
vehicleCache.put(vehicle.getMqttPrefix(),vehicle);
}
//
// Map<String, Skid> skidMap = hashOperations.entries("skid");
// if (null == skidMap) {
......
spring.profiles.include=mybatis,quartz,swagger,security,mqtt,ztip
spring.profiles.include=mybatis,quartz,swagger,security,mqtt,ztip,modbus
# Mysql
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
......
modbus.tcp.netty.thread-num=200
modbus.tcp.netty.pool.max-connections=10
modbus.tcp.netty.option.so-keep-alive=true
modbus.tcp.netty.max-frame-length=260
modbus.tcp.netty.idle-state.reader-time-millis=3000
modbus.tcp.netty.event-executor-group.thread-num=64
......@@ -16,27 +16,27 @@ mqtt.subscribe.data-system-topic-suffix=system
mqtt.subscribe.data-alarm-topic-suffix=alarm
mqtt.subscribe.data-all-topic-suffix=all
mqtt.subscribe.topics=\
ZT/translation/rfid01/data/all,\
ZT/translation/rfid02/data/all,\
ZT/translation/rfid03/data/all,\
ZT/translation/rfid04/data/all,\
ZT/translation/rfid05/data/all,\
ZT/translation/rfid06/data/all,\
ZT/translation/rfid07/data/all,\
ZT/translation/rfid08/data/all,\
ZT/translation/rfid09/data/all,\
ZT/translation/rfid10/data/all,\
ZT/translation/rfid11/data/all,\
ZT/translation/rfid12/data/all,\
ZT/translation/rfid13/data/all,\
ZT/skid/rfid01/data/all,\
ZT/skid/rfid02/data/all,\
ZT/skid/rfid03/data/all,\
ZT/skid/rfid04/data/all,\
ZT/skid/rfid05/data/all,\
ZT/skid/rfid06/data/all,\
ZT/skid/rfid07/data/all,\
ZT/skid/rfid08/data/all,\
ZT/skid/rfid09/data/all,\
ZT/skid/rfid10/data/all,\
ZT/skid/rfid11/data/all
ZT/translation/rfid51/data/all,\
ZT/translation/rfid52/data/all,\
ZT/translation/rfid53/data/all,\
ZT/translation/rfid54/data/all,\
ZT/translation/rfid55/data/all,\
ZT/translation/rfid56/data/all,\
ZT/translation/rfid57/data/all,\
ZT/translation/rfid58/data/all,\
ZT/translation/rfid59/data/all,\
ZT/translation/rfid60/data/all,\
ZT/translation/rfid61/data/all,\
ZT/translation/rfid62/data/all,\
ZT/translation/rfid63/data/all,\
ZT/translation/rfid64/data/all,\
ZT/translation/rfid65/data/all,\
ZT/translation/rfid66/data/all,\
ZT/translation/rfid67/data/all,\
ZT/translation/rfid68/data/all,\
ZT/translation/rfid69/data/all,\
ZT/translation/rfid70/data/all,\
ZT/translation/rfid71/data/all,\
ZT/translation/rfid72/data/all,\
ZT/translation/rfid73/data/all,\
ZT/translation/rfid74/data/all
......@@ -203,8 +203,8 @@ quartz.job.taskInfos[20].start=false
quartz.job.taskInfos[24].jobName=net.vtstar.zhongtong.avi.monitoring.job.AVIMonitorJob
quartz.job.taskInfos[24].jobGroup=AVIMonitorJob
quartz.job.taskInfos[24].jobDescription=\u76d1\u63a7\u0041\u0056\u0049Job
quartz.job.taskInfos[24].cronExpression=0/10 * * * * ?
quartz.job.taskInfos[24].start=true
quartz.job.taskInfos[24].cronExpression=0/20 * * * * ?
quartz.job.taskInfos[24].start=false
#mes 工单同步
quartz.job.taskInfos[26].jobName=net.vtstar.zhongtong.avi.sqlserver.job.MesWorkOrderJob
......
......@@ -2,7 +2,7 @@
spring.output.ansi.enabled=always
spring.main.banner-mode=off
logging.level.root=info
logging.level.net.vtstar=trace
logging.level.net.vtstar=debug
#logging.file=D://zhongtong/logs/zhongtong-service.log
spring.aop.auto=true
......
......@@ -13,6 +13,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.validation.constraints.NotNull;
import java.util.List;
@Slf4j
......@@ -27,14 +28,53 @@ public class StationTest {
private EquipDataTemplateItemMapper itemMapper;
@Test
public void test(){
List<EquipDataTemplateItem> tem = itemMapper.findByTemplateId(1);
EquipDataTemplateItem item = tem.get(0);
for (int i = 0; i < 130; i++) {
item.setAddress(0);
public void test() {
List<EquipDataTemplateItem> tem = itemMapper.findByTemplateId(2);
for (EquipDataTemplateItem item : tem) {
item.setTemplateId(1);
item.setFieldDesc("正转信号");
item.setFunctionCode(1);
item.setAddress(null);
item.setId(null);
itemMapper.insert(item);
item.setFieldDesc("反转信号");
itemMapper.insert(item);
}
}
@Test
public void stationTest() {
List<EquipDataTemplateItem> list = itemMapper.findByTemplateId(2);
for (EquipDataTemplateItem station : list) {
String newCdoe;
if (station.getId() <= 145) {
continue;
}
String code = station.getFieldName();
String[] split = code.split(":");
String stationCode = split[2];
String s = split[1];
if (s.endsWith("F")){
newCdoe = "station:turnF:" + stationCode;
}else {
newCdoe = "station:turnR:" + stationCode;
}
station.setFieldName(newCdoe);
itemMapper.update(station);
}
}
@Test
public void createStation() {
PaintshopStation station = new PaintshopStation();
station.setWorkshopCode("1");
station.setKeyStation(true);
station.setStatus("1");
for (int i = 1; i < 34; i++) {
station.setCode("HDG5-" + i);
stationMapper.insert(station);
}
}
}
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