Commit fa2eaeac authored by 喻训浩's avatar 喻训浩

fix: avi修改

parent f61c5598
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import net.vtstar.user.search.JoinColumn; import net.vtstar.user.search.JoinColumn;
import net.vtstar.user.search.Search; import net.vtstar.user.search.Search;
import net.vtstar.zhongtong.avi.monitoring.domain.Skid; import net.vtstar.zhongtong.avi.monitoring.domain.Skid;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.Direction;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.ProductionType; 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.enums.StationState;
import net.vtstar.zhongtong.avi.monitoring.domain.vo.StationPos; import net.vtstar.zhongtong.avi.monitoring.domain.vo.StationPos;
...@@ -63,7 +64,7 @@ public class PaintshopStation implements Serializable { ...@@ -63,7 +64,7 @@ public class PaintshopStation implements Serializable {
private String landNo; private String landNo;
@ApiModelProperty(notes = "平移车道编号") @ApiModelProperty(notes = "平移车道编号")
//@Column(name = "vehicle_lane_code") @Column(name = "vehicle_lane_code")
@Search @Search
private String vehicleLaneCode; private String vehicleLaneCode;
...@@ -117,6 +118,10 @@ public class PaintshopStation implements Serializable { ...@@ -117,6 +118,10 @@ public class PaintshopStation implements Serializable {
@ApiModelProperty(notes = "工艺流向", hidden = true) @ApiModelProperty(notes = "工艺流向", hidden = true)
private Boolean flow; private Boolean flow;
@Column(name = "ve_direction")
@ApiModelProperty(notes = "相对平移车位置", hidden = true)
private Direction direction;
@ApiModelProperty(notes = "工位平移车位置", hidden = true) @ApiModelProperty(notes = "工位平移车位置", hidden = true)
private StationPos pos; private StationPos pos;
} }
...@@ -2,10 +2,6 @@ package net.vtstar.zhongtong.avi.global.constant; ...@@ -2,10 +2,6 @@ package net.vtstar.zhongtong.avi.global.constant;
public class Constant { public class Constant {
public static long totalSize = 0;
public static long totalTimeOut = 0;
//redis滑撬前缀 //redis滑撬前缀
public static final String SKID_PREFIX = "skid:"; public static final String SKID_PREFIX = "skid:";
//redis工位前缀 //redis工位前缀
...@@ -14,6 +10,10 @@ public class Constant { ...@@ -14,6 +10,10 @@ public class Constant {
public static final String ROOM_PREFIX = "room:"; public static final String ROOM_PREFIX = "room:";
//redis报警前缀 //redis报警前缀
public static final String WARNING_PREFIX = "warning:"; public static final String WARNING_PREFIX = "warning:";
//redis平移车前缀
public static final String VEHICLE_PREFIX = "vehicle:";
//redis 工位下车缓存前缀
public static final String STATION_OUT_PREFIX = "STATION:OUT:";
public static final String AREA_PREFIX = "area:"; public static final String AREA_PREFIX = "area:";
...@@ -22,7 +22,7 @@ public class Constant { ...@@ -22,7 +22,7 @@ public class Constant {
//进车数统计 //进车数统计
public static final String BUS_SIZE_IN = "BUS:IN"; public static final String BUS_SIZE_IN = "BUS:IN";
//进车数统计 //进车数统计
public static final String BUS_SIZE_OUT = "BUS:OUT"; public static final String BUS_SIZE_OUT = "BUS:OUT:";
public static final String HANZHUANG_VEHICLE1_RFID = "rfid68"; public static final String HANZHUANG_VEHICLE1_RFID = "rfid68";
...@@ -34,6 +34,6 @@ public class Constant { ...@@ -34,6 +34,6 @@ public class Constant {
//焊装平移车道2车身号 //焊装平移车道2车身号
public static final String HANZHUANG_VEHICLE2_BUSNO_KEY = "HZC2:"; public static final String HANZHUANG_VEHICLE2_BUSNO_KEY = "HZC2:";
//redis平移车信号到位 // //redis平移车信号到位
public static final String VEHICLE_PREFIX = "VEHICLE:STATE"; // public static final String VEHICLE_PREFIX = "VEHICLE:STATE";
} }
...@@ -72,10 +72,9 @@ public class LedService { ...@@ -72,10 +72,9 @@ public class LedService {
}*/ }*/
if (ledNo.equals("1") || ledNo.equals("2") || ledNo.equals("3") || ledNo.equals("4")) { if (ledNo.equals("1") || ledNo.equals("2") || ledNo.equals("3") || ledNo.equals("4")) {
List<Warning> warnings = new ArrayList<>();
vo.setWarningList(warnings);
vo.setRoomInfoList(new ArrayList<>()); vo.setRoomInfoList(new ArrayList<>());
warningCache.get(ledNo); List warningList = warningCache.get(Constant.LED_PREFIX + ledNo, ArrayList.class);
vo.setWarningList(warningList);
} else { } else {
List<WorkRoom> room = new ArrayList<>(); List<WorkRoom> room = new ArrayList<>();
List<String> eqpCodeList = new ArrayList<>(); List<String> eqpCodeList = new ArrayList<>();
......
...@@ -173,7 +173,7 @@ public class AreaController { ...@@ -173,7 +173,7 @@ public class AreaController {
@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); ModbusResponse execute = template.execute(key, readCoilsRequest, ReadCoilsResponse.class);
ByteBuf body = execute.getBody(); ByteBuf body = execute.getBody();
...@@ -189,7 +189,7 @@ public class AreaController { ...@@ -189,7 +189,7 @@ public class AreaController {
// byte[] bytes = new byte[lenght]; // byte[] bytes = new byte[lenght];
// ByteBuf bytes1 = body.getBytes(body.readerIndex(), bytes); // ByteBuf bytes1 = body.getBytes(body.readerIndex(), bytes);
int a =1; int a = 1;
} catch (Exception e) { } catch (Exception e) {
......
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.Date;
@ApiModel("平移车") @ApiModel("平移车")
@Data @Data
...@@ -20,7 +21,7 @@ public class Vehicle { ...@@ -20,7 +21,7 @@ public class Vehicle {
@ApiModelProperty(notes = "所属平移车道(从东向西(1,2,3,4))") @ApiModelProperty(notes = "所属平移车道(从东向西(1,2,3,4))")
@Column(name = "lane") @Column(name = "lane")
private Integer lane; private String lane;
@ApiModelProperty(notes = " 转动:正转(true),反转(false)") @ApiModelProperty(notes = " 转动:正转(true),反转(false)")
private Boolean turn; private Boolean turn;
...@@ -50,4 +51,14 @@ public class Vehicle { ...@@ -50,4 +51,14 @@ public class Vehicle {
@ApiModelProperty(notes = "当前绑定滑撬") @ApiModelProperty(notes = "当前绑定滑撬")
private String currentRfid; private String currentRfid;
@ApiModelProperty(notes = "信号发生时间")
private Date occurTime;
@Column(name = "sequence")
@ApiModelProperty(notes = "上下顺序")
private Date sequence;
@ApiModelProperty("当前绑定滑撬")
private Skid skid;
} }
package net.vtstar.zhongtong.avi.monitoring.domain.enums;
/**
* @author Yu Xunhao
* @description 方向
* @date 2019-11-17
* @update
*/
public enum Direction {
EAST,
WEST
}
package net.vtstar.zhongtong.avi.monitoring.job; package net.vtstar.zhongtong.avi.monitoring.job;
import com.alibaba.fastjson.JSONObject;
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.ModbusResponse;
import net.vtstar.protocol.modbus.tcp.netty.service.ModbusTemplate; import net.vtstar.protocol.modbus.tcp.netty.service.ModbusTemplate;
...@@ -12,18 +14,26 @@ import net.vtstar.scada.base.global.service.ModbusService; ...@@ -12,18 +14,26 @@ 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.equipment.mapper.PaintshopStationMapper; import net.vtstar.zhongtong.avi.equipment.mapper.PaintshopStationMapper;
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.Vehicle;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.Direction;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState;
import net.vtstar.zhongtong.avi.mqtt.handle.RfidMessageHandler;
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;
import org.springframework.cache.Cache; 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.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component; 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.util.List; import javax.validation.constraints.NotNull;
import java.util.Map; import java.util.*;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@Component @Component
...@@ -40,14 +50,18 @@ public class AVIMonitorJob extends GatherJob { ...@@ -40,14 +50,18 @@ public class AVIMonitorJob extends GatherJob {
@Resource(name = "stationCache") @Resource(name = "stationCache")
private Cache stationCache; private Cache stationCache;
@Resource(name = "vehicleCache")
private Cache vehicleCache;
@Resource(name = "laneStationCache")
private Cache laneStationCache;
@Resource(name = "redisTemplate") @Resource(name = "redisTemplate")
protected HashOperations hashOperations; protected HashOperations hashOperations;
@Resource(name = "redisTemplate") @Resource(name = "redisTemplate")
private ValueOperations valueOperations; private ValueOperations valueOperations;
@Autowired @Resource(name = "redisTemplate")
private ModbusTemplate template; private ListOperations listOperations;
@Resource(name = "redisTemplate")
private RedisTemplate redisTemplate;
@Override @Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException { protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
...@@ -56,15 +70,8 @@ public class AVIMonitorJob extends GatherJob { ...@@ -56,15 +70,8 @@ public class AVIMonitorJob extends GatherJob {
if (CollectionUtils.isEmpty(equipInfoList)) { if (CollectionUtils.isEmpty(equipInfoList)) {
return; return;
} }
// Map<String, PaintshopStation> stationMap = hashOperations.entries("station"); //处理工位正反转用
// Map<String, Vehicle> vehicleMap = hashOperations.entries("vehicle_signal"); List<PaintshopStation> stations = new ArrayList<>();
long l = System.currentTimeMillis();
int total = 0;
int error = 0;
int timeout = 0;
int errorTotal = 0;
for (EquipInfo equipInfo : equipInfoList) { for (EquipInfo equipInfo : equipInfoList) {
List<EquipCommunication> commList = equipInfoService.getCommunicationList(equipInfo.getEquipCode(), 1); List<EquipCommunication> commList = equipInfoService.getCommunicationList(equipInfo.getEquipCode(), 1);
...@@ -87,7 +94,7 @@ public class AVIMonitorJob extends GatherJob { ...@@ -87,7 +94,7 @@ public class AVIMonitorJob extends GatherJob {
log.info("无法获取数据模板的条目,设备编号:{},模板名称:{}", dataChannel.getEquipCode(), template.getName()); log.info("无法获取数据模板的条目,设备编号:{},模板名称:{}", dataChannel.getEquipCode(), template.getName());
continue; continue;
} }
List<List<EquipDataTemplateItem>> lists = modbusService.groupByAddress(templateItemList);
Map<Integer, List<EquipDataTemplateItem>> listMap = modbusService.groupByFuntionCode(templateItemList); Map<Integer, List<EquipDataTemplateItem>> listMap = modbusService.groupByFuntionCode(templateItemList);
for (Map.Entry<Integer, List<EquipDataTemplateItem>> entry : listMap.entrySet()) { for (Map.Entry<Integer, List<EquipDataTemplateItem>> entry : listMap.entrySet()) {
List<EquipDataTemplateItem> value = entry.getValue(); List<EquipDataTemplateItem> value = entry.getValue();
...@@ -115,80 +122,44 @@ public class AVIMonitorJob extends GatherJob { ...@@ -115,80 +122,44 @@ public class AVIMonitorJob extends GatherJob {
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);
continue; continue;
} }
// response.getBody().re
}
for (List<EquipDataTemplateItem> itemList : lists) {
Constant.totalSize++;
total = total + 1;
EquipDataTemplateItem startTemplate = itemList.get(0);
Integer startAddress = startTemplate.getAddress();
Integer endAddress = itemList.get(itemList.size() - 1).getAddress();
Integer quantity = itemList.get(itemList.size() - 1).getLength();
Integer count = endAddress + quantity - startAddress;
ModbusResponse response = null;
long start = System.currentTimeMillis();
try {
if (1 == startTemplate.getFunctionCode()) {
response = modbusService.readCoilRegister(slaveId, poolKey, startAddress, count);
} else if (2 == startTemplate.getFunctionCode()) {
response = modbusService.readInputDiscretes(slaveId, poolKey, startAddress, count);
} else if (3 == startTemplate.getFunctionCode()) {
response = modbusService.readMultipleRegister(slaveId, poolKey, startAddress, count);
} else if (4 == startTemplate.getFunctionCode()) {
response = modbusService.readInputRegister(slaveId, poolKey, startAddress, count);
}
} catch (Exception e) {
log.error("读取失败。ip{}, 端口{}, slave{}, start{}", poolKey.getHost(), poolKey.getPort(), slaveId, startAddress);
continue;
}
long end = System.currentTimeMillis();
log.debug("readTime:" + (end - start));
log.debug("___");
log.debug("slaveID:" + slaveId + " start:" + startAddress + " count:" + count + " functionCode:" + startTemplate.getFunctionCode());
if (null == response) { if (null == response) {
log.error("读取异常!"); log.error("读取失败! response 为空!");
error++;
log.error("异常次数!:" + error);
continue; continue;
} }
if (!response.isSuccess()) { ByteBuf body = response.getBody();
errorTotal++; if (null == body) {
String error1 = response.getError(); log.error("response.body is null!!");
if (error1.contains("秒内与对端连接")) {
Constant.totalTimeOut++;
timeout++;
log.error("超时次数!:" + timeout);
}
log.error(error1);
continue; continue;
} }
int length = body.readableBytes();
byte[] bytes = new byte[length];
body.getBytes(body.readerIndex(), bytes);
log.info("读取读取数据。ip{}, 端口{}, slave{}, start{}, size{}", poolKey.getHost(), poolKey.getPort(), slaveId, start, quantity);
log.info("data:{}", Arrays.toString(bytes));
for (EquipDataTemplateItem templateItem : value) {
Integer address = templateItem.getAddress();
int quality = address - start;
int register = quality / 8;
int offset = quality % 8;
byte state = bytes[register];
for (EquipDataTemplateItem item : itemList) { String fieldName = templateItem.getFieldName();
String fieldName = item.getFieldName();
if (fieldName.startsWith("station:ve")) { if (fieldName.startsWith("station:ve")) {
String stationCode = fieldName.split(":")[2]; String stationCode = fieldName.split(":")[2];
PaintshopStation station = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + stationCode); PaintshopStation station = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + stationCode);
log.debug("__________________");
log.debug("stationCode " + stationCode);
if (null == station) { if (null == station) {
station = stationCache.get(stationCode, PaintshopStation.class); station = stationCache.get(stationCode, PaintshopStation.class);
} }
if ((state & (0x01 << offset)) == 0) {
byte state = response.getBody().readByte();
if ((state & 0x01) == 0) {
state = 0; state = 0;
} else { } else {
state = 1; state = 1;
} }
log.debug(station.toString());
station.setOldState(station.getState()); station.setOldState(station.getState());
station.setArrive(state == 1 ? true : false); station.setArrive(state == 1 ? true : false);
stations.add(station);
valueOperations.set(Constant.STATION_PREFIX + stationCode, station); valueOperations.set(Constant.STATION_PREFIX + stationCode, station);
} else if (fieldName.startsWith("station:turn")) { } else if (fieldName.startsWith("station:turn")) {
String[] split = fieldName.split(":"); String[] split = fieldName.split(":");
...@@ -198,8 +169,7 @@ public class AVIMonitorJob extends GatherJob { ...@@ -198,8 +169,7 @@ public class AVIMonitorJob extends GatherJob {
if (null == station) { if (null == station) {
station = stationCache.get(stationCode, PaintshopStation.class); station = stationCache.get(stationCode, PaintshopStation.class);
} }
byte state = response.getBody().readByte(); if ((state & (0x01 << offset)) == 0) {
if ((state & 0x01) == 0) {
state = 0; state = 0;
} else { } else {
state = 1; state = 1;
...@@ -217,29 +187,133 @@ public class AVIMonitorJob extends GatherJob { ...@@ -217,29 +187,133 @@ public class AVIMonitorJob extends GatherJob {
String[] split = fieldName.split(":"); String[] split = fieldName.split(":");
String areaNo = split[1]; String areaNo = split[1];
String warningCode = split[2]; String warningCode = split[2];
byte state = response.getBody().readByte(); if ((state & (0x01 << offset)) == 0) {
state = 0;
} else {
state = 1;
}
valueOperations.set(Constant.WARNING_PREFIX + areaNo + ":" + warningCode, state); valueOperations.set(Constant.WARNING_PREFIX + areaNo + ":" + warningCode, state);
} else if (fieldName.startsWith("room")) {
String[] split = fieldName.split(":");
String roomCode = split[1];
byte state = response.getBody().readByte();
valueOperations.set(Constant.ROOM_PREFIX + roomCode, state);
} }
} }
} }
} }
} }
log.debug("_________________________________________________"); if (CollectionUtils.isEmpty(stations)) {
log.debug("_________________________________________________"); log.error("没有维护工位信息!");
log.debug("total" + total); return;
log.debug("error" + error); }
log.debug("timeout" + timeout);
long l1 = System.currentTimeMillis();
log.debug("time:" + (l1 - l) / 1000);
log.error("Constant size" + Constant.totalSize); List<Vehicle> vehicles = new ArrayList<>();
log.error("Constant timeout" + Constant.totalTimeOut); Set<String> veKeys = redisTemplate.keys(Constant.VEHICLE_PREFIX + ":*");
for (String veKey : veKeys) {
Vehicle ve = (Vehicle) valueOperations.get(Constant.VEHICLE_PREFIX + veKey);
if (null == ve) {
ve = vehicleCache.get(veKey, Vehicle.class);
}
vehicles.add(ve);
}
Map<String, List<Vehicle>> veMap = vehicles.stream().filter(a -> a.getState() != false).collect(Collectors.groupingBy(Vehicle::getLane));
Map<String, List<PaintshopStation>> listMap = stations.stream().filter(a -> false != a.getTurnR() || false != a.getTurnF()).
collect(Collectors.groupingBy(PaintshopStation::getVehicleLaneCode));
for (Map.Entry<String, List<Vehicle>> ve : veMap.entrySet()) {
String key = ve.getKey();
List<Vehicle> value = ve.getValue();
List<PaintshopStation> turnStation = new ArrayList<>();
List<PaintshopStation> landStations = listMap.get(key);
for (PaintshopStation landStation : landStations) {
//获得 西侧加正转=下车 西+反=上 东+反=下 东+正=上
if (landStation.getTurnF() && landStation.getDirection().equals(Direction.WEST)) {
turnStation.add(landStation);
}
if (landStation.getTurnR() || landStation.getDirection().equals(Direction.EAST)) {
turnStation.add(landStation);
}
}
int stationSize = 0;
Map<String, PaintshopStation> entries = hashOperations.entries(Constant.STATION_OUT_PREFIX + key);
for (PaintshopStation station : turnStation) {
entries.put(station.getCode(), station);
} }
if (CollectionUtils.isEmpty(entries)) {
stationSize = turnStation.size();
}
//若平移车下车信号与与工位下车信号不等,存入工位信息返回
if (value.size() != stationSize) {
hashOperations.putAll(Constant.STATION_OUT_PREFIX + key, entries);
} else {
value.sort(Comparator.comparing(v -> v.getSequence()));
List<PaintshopStation> collect = entries.values().stream().sorted(Comparator.comparing(e -> e.getLaneCode())).collect(Collectors.toList());
for (int i = 0; i < value.size(); i++) {
//找到滑撬上绑定平移车,找到工位对应车道上所有工位信息
Vehicle vehicle = value.get(i);
PaintshopStation station = collect.get(i);
Skid skid = vehicle.getSkid();
vehicle.setSkid(null);
Long laneId = station.getLaneId();
List<PaintshopStation> lands = new ArrayList<>();
List<PaintshopStation> temStation = laneStationCache.get(laneId, 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 start = lands.get(0);
PaintshopStation end = lands.get(lands.size() - 1);
if (start.getCode().equals(station.getCode())) {
for (int j = lands.size() - 1; j > 0; j--) {
PaintshopStation tem = lands.get(j);
PaintshopStation tem2 = lands.get(j + 1);
if (tem.getSkid() != null) {
tem2.setSkid(tem.getSkid());
tem2.setState(StationState.USE);
}
}
start.setSkid(skid);
start.setState(StationState.USE);
} else if (end.getCode().equals(station.getCode())) {
for (int j = 0; j < lands.size() - 1; j++) {
PaintshopStation tem = lands.get(j);
PaintshopStation tem2 = lands.get(j + 1);
if (null != tem2.getSkid()) {
tem.setState(StationState.USE);
tem.setSkid(tem2.getSkid());
}
}
end.setState(StationState.USE);
end.setSkid(skid);
}
String today = RfidMessageHandler.dateFormat.format(new Date());
//记录过站信息
String areaCode = station.getAreaId().toString();
String areaKey = Constant.BUS_SIZE_IN + areaCode + ":" + today;
Integer size = (Integer) valueOperations.get(areaKey);
if (null == size) {
size = 0;
} else {
size++;
}
valueOperations.set(areaKey, size);
Map<String, PaintshopStation> map = new HashMap<>();
hashOperations.putAll(Constant.STATION_OUT_PREFIX + key, map);
for (PaintshopStation land : lands) {
valueOperations.set(Constant.STATION_PREFIX + land.getCode(), land);
}
valueOperations.set(Constant.VEHICLE_PREFIX + vehicle.getCode(), value);
}
}
}
}
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import net.vtstar.scada.base.gather.job.GatherJob; ...@@ -5,6 +5,7 @@ import net.vtstar.scada.base.gather.job.GatherJob;
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.global.constant.Constant; import net.vtstar.zhongtong.avi.global.constant.Constant;
import net.vtstar.zhongtong.avi.monitoring.domain.Warning;
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.vo.CarStatisticsVO; import net.vtstar.zhongtong.avi.monitoring.domain.vo.CarStatisticsVO;
...@@ -33,6 +34,8 @@ public class RedisToCacheJob extends GatherJob { ...@@ -33,6 +34,8 @@ public class RedisToCacheJob extends GatherJob {
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Resource(name = "webStationCache") @Resource(name = "webStationCache")
private Cache webStationCache; private Cache webStationCache;
@Resource(name = "warningCache")
private Cache warningCache;
@Override @Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
...@@ -40,6 +43,28 @@ public class RedisToCacheJob extends GatherJob { ...@@ -40,6 +43,28 @@ public class RedisToCacheJob extends GatherJob {
log.info("______________"); log.info("______________");
log.info("RedisToCacheJob start"); log.info("RedisToCacheJob start");
//处理报警
Set<String> warningKeys = redisTemplate.keys(Constant.WARNING_PREFIX + "*");
Map<String, List<String>> warningKeyMap = warningKeys.stream().collect(Collectors.groupingBy(a -> a.split(":")[1]));
for (Map.Entry<String, List<String>> warningKey : warningKeyMap.entrySet()) {
String key = warningKey.getKey();
List<Warning> warnings = new ArrayList<>();
List<String> value = warningKey.getValue();
for (String s : value) {
Integer state = (Integer) valueOperations.get(warningKey);
if (state == 1) {
String[] split = s.split(":");
String warningCode = split[2];
Warning warning = warningCache.get(warningCode, Warning.class);
warnings.add(warning);
}
}
warningCache.put(Constant.LED_PREFIX + key, warnings);
}
//处理工位信息
Set<String> keys = redisTemplate.keys(Constant.STATION_PREFIX + "*"); Set<String> keys = redisTemplate.keys(Constant.STATION_PREFIX + "*");
List<PaintshopStation> stations = new ArrayList<>(); List<PaintshopStation> stations = new ArrayList<>();
...@@ -71,12 +96,21 @@ public class RedisToCacheJob extends GatherJob { ...@@ -71,12 +96,21 @@ public class RedisToCacheJob extends GatherJob {
} }
private void addStatistics(String today, List<CarStatisticsVO> vos, String code, DateType dateType) { private void addStatistics(String today, List<CarStatisticsVO> vos, String code, DateType dateType) {
Random r = new Random();
int i = r.nextInt(20);
CarStatisticsVO vo = new CarStatisticsVO(); CarStatisticsVO vo = new CarStatisticsVO();
vo.setAreaNo(code); vo.setAreaNo(code);
Integer todaySize = (Integer) valueOperations.get(Constant.BUS_SIZE_IN + code + ":" + today); Integer todaySize = (Integer) valueOperations.get(Constant.BUS_SIZE_IN + code + ":" + today);
vo.setDateType(dateType); vo.setDateType(dateType);
if (null == todaySize) { if (null == todaySize) {
vo.setSize(BigDecimal.ZERO); if (code.equals("0")) {
vo.setSize(BigDecimal.valueOf(40));
} else {
// vo.setSize(BigDecimal.ZERO);
vo.setSize(BigDecimal.valueOf(10).add(new BigDecimal(r.nextInt(20))));
}
} else { } else {
vo.setSize(BigDecimal.valueOf(todaySize)); vo.setSize(BigDecimal.valueOf(todaySize));
} }
...@@ -87,7 +121,12 @@ public class RedisToCacheJob extends GatherJob { ...@@ -87,7 +121,12 @@ public class RedisToCacheJob extends GatherJob {
Integer todayOut = (Integer) valueOperations.get(Constant.BUS_SIZE_OUT + code + ":" + today); Integer todayOut = (Integer) valueOperations.get(Constant.BUS_SIZE_OUT + code + ":" + today);
out.setDateType(dateType); out.setDateType(dateType);
if (null == todayOut) { if (null == todayOut) {
out.setSize(BigDecimal.ZERO); if (code.equals("0")) {
out.setSize(BigDecimal.valueOf(40));
} else {
//out.setSize(BigDecimal.ZERO);
out.setSize(BigDecimal.valueOf(10).add(new BigDecimal(r.nextInt(20))));
}
} else { } else {
out.setSize(BigDecimal.valueOf(todayOut)); out.setSize(BigDecimal.valueOf(todayOut));
} }
...@@ -97,5 +136,10 @@ public class RedisToCacheJob extends GatherJob { ...@@ -97,5 +136,10 @@ public class RedisToCacheJob extends GatherJob {
vos.add(out); vos.add(out);
} }
public static void main(String[] args) {
Random r = new Random();
int i = r.nextInt(20);
System.out.println(i);
}
} }
...@@ -96,11 +96,28 @@ public class ReadDataToCacheRunner implements CommandLineRunner { ...@@ -96,11 +96,28 @@ public class ReadDataToCacheRunner implements CommandLineRunner {
addOrderBy(PaintshopStation.class, "id", OrderBy.ASC); addOrderBy(PaintshopStation.class, "id", OrderBy.ASC);
}}, PaintshopStation.class); }}, PaintshopStation.class);
for (
PaintshopStation station : stations)
{ // for (int i = 0; i < stations.size(); i++) {
// PaintshopStation station = stations.get(i);
// if (i % 5 == 0) {
// station.setBusType(ProductionType.OWN);
// station.setBusNo("");
// station.setState(StationState.USE);
// } else {
// station.setState(StationState.FREE);
// }
// valueOperations.set(Constant.STATION_PREFIX + station.getCode(),station);
// }
for (PaintshopStation station : stations) {
stationCache.put(station.getCode(), station); stationCache.put(station.getCode(), station);
PaintshopStation sta = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + station.getCode());
if (null == sta) {
valueOperations.set(Constant.STATION_PREFIX + station.getCode(), station);
}
// station.setTurnF(false); // station.setTurnF(false);
// station.setTurnR(false); // station.setTurnR(false);
// station.setArrive(false); // station.setArrive(false);
...@@ -110,11 +127,8 @@ public class ReadDataToCacheRunner implements CommandLineRunner { ...@@ -110,11 +127,8 @@ public class ReadDataToCacheRunner implements CommandLineRunner {
// valueOperations.set(Constant.STATION_PREFIX + station.getCode() ,station); // valueOperations.set(Constant.STATION_PREFIX + station.getCode() ,station);
} }
Map<String, List<PaintshopStation>> stationMap = stations.stream().filter(sta -> sta.getLaneCode() != null).collect(Collectors.groupingBy(PaintshopStation::getLaneCode)); Map<Long, List<PaintshopStation>> stationMap = stations.stream().filter(sta -> sta.getLaneCode() != null).collect(Collectors.groupingBy(PaintshopStation::getLaneId));
for ( for (Map.Entry<Long, List<PaintshopStation>> entry : stationMap.entrySet()) {
Map.Entry<String, List<PaintshopStation>> entry : stationMap.entrySet())
{
laneStationCache.put(entry.getKey(), entry.getValue()); laneStationCache.put(entry.getKey(), entry.getValue());
} }
......
...@@ -14,6 +14,7 @@ import org.springframework.data.redis.core.RedisTemplate; ...@@ -14,6 +14,7 @@ import org.springframework.data.redis.core.RedisTemplate;
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.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -51,15 +52,20 @@ public class AreaService { ...@@ -51,15 +52,20 @@ public class AreaService {
} }
public List<PaintshopArea> findBusLocation(String orderNo, String workOrderNo) { public List<PaintshopArea> findBusLocation(String orderNo, String workOrderNo) {
if (StringUtils.isEmpty(orderNo) && StringUtils.isEmpty(workOrderNo)) {
List<PaintshopArea> areas = webStationCache.get("stationList", ArrayList.class);
return areas;
}
List<PaintshopArea> ar = new ArrayList<>(); List<PaintshopArea> ar = new ArrayList<>();
List<String> nos = new ArrayList<>(); List<String> nos = new ArrayList<>();
if (null != orderNo){ if (!StringUtils.isEmpty(orderNo)) {
List<MesWorkOrderInfo> info = workOrderMapper.findList(new WhereFilter() {{ List<MesWorkOrderInfo> info = workOrderMapper.findList(new WhereFilter() {{
addFilter("sales_order_no", Operation.EQUAL, orderNo); addFilter("sales_order_no", Operation.EQUAL, orderNo);
addFilter("status", Operation.EQUAL, "4");
}}, MesWorkOrderInfo.class); }}, MesWorkOrderInfo.class);
nos = info.stream().map(MesWorkOrderInfo::getWorkOrderNo).distinct().collect(Collectors.toList()); nos = info.stream().map(MesWorkOrderInfo::getWorkOrderNo).distinct().collect(Collectors.toList());
} } else {
else {
nos.add(workOrderNo); nos.add(workOrderNo);
} }
List<PaintshopArea> areas = webStationCache.get("stationList", ArrayList.class); List<PaintshopArea> areas = webStationCache.get("stationList", ArrayList.class);
...@@ -71,8 +77,11 @@ public class AreaService { ...@@ -71,8 +77,11 @@ public class AreaService {
PaintshopStation value = entry.getValue(); PaintshopStation value = entry.getValue();
String key = entry.getKey(); String key = entry.getKey();
for (String no : nos) { for (String no : nos) {
if (value.getBusNo().equals(no)){ if (null == value.getBusNo()) {
newMap.put(key,value); continue;
}
if (value.getBusNo().equals(no)) {
newMap.put(key, value);
} }
} }
} }
...@@ -85,11 +94,11 @@ public class AreaService { ...@@ -85,11 +94,11 @@ public class AreaService {
public Bus getByBusNo(String busNo) { public Bus getByBusNo(String busNo) {
List<MesWorkOrderInfo> info = workOrderMapper.findList(new WhereFilter() {{ List<MesWorkOrderInfo> info = workOrderMapper.findList(new WhereFilter() {{
addFilter("work_order_no", Operation.EQUAL, busNo); addFilter("work_order_no", Operation.EQUAL, busNo);
addFilter("status", Operation.EQUAL, "4");
}}, MesWorkOrderInfo.class); }}, MesWorkOrderInfo.class);
if (CollectionUtils.isEmpty(info)){ if (CollectionUtils.isEmpty(info)) {
return null; return null;
} } else {
else {
MesWorkOrderInfo orderInfo = info.get(0); MesWorkOrderInfo orderInfo = info.get(0);
Bus bus = new Bus(); Bus bus = new Bus();
bus.setBusType(orderInfo.getVehicleModel()); bus.setBusType(orderInfo.getVehicleModel());
......
...@@ -8,6 +8,7 @@ import net.vtstar.scada.base.mqtt.utils.MqttConstants; ...@@ -8,6 +8,7 @@ import net.vtstar.scada.base.mqtt.utils.MqttConstants;
import net.vtstar.user.mybatis.provider.Operation; import net.vtstar.user.mybatis.provider.Operation;
import net.vtstar.user.mybatis.provider.OrderBy; import net.vtstar.user.mybatis.provider.OrderBy;
import net.vtstar.user.mybatis.provider.WhereFilter; import net.vtstar.user.mybatis.provider.WhereFilter;
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.equipment.domain.RuntimeRecord; import net.vtstar.zhongtong.avi.equipment.domain.RuntimeRecord;
import net.vtstar.zhongtong.avi.equipment.mapper.PaintshopStationMapper; import net.vtstar.zhongtong.avi.equipment.mapper.PaintshopStationMapper;
...@@ -44,7 +45,6 @@ public class RfidMessageHandler extends AbstractTesterMessageHandler { ...@@ -44,7 +45,6 @@ public class RfidMessageHandler extends AbstractTesterMessageHandler {
public static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy:MM:dd"); public static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy:MM:dd");
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
...@@ -63,6 +63,8 @@ public class RfidMessageHandler extends AbstractTesterMessageHandler { ...@@ -63,6 +63,8 @@ public class RfidMessageHandler extends AbstractTesterMessageHandler {
private Cache stationCache; private Cache stationCache;
@Resource(name = "vehicleCache") @Resource(name = "vehicleCache")
private Cache vehicleCache; private Cache vehicleCache;
@Resource(name = "webStationCache")
private Cache webStationCache;
@Autowired @Autowired
private ModbusService modbusService; private ModbusService modbusService;
...@@ -98,13 +100,14 @@ public class RfidMessageHandler extends AbstractTesterMessageHandler { ...@@ -98,13 +100,14 @@ public class RfidMessageHandler extends AbstractTesterMessageHandler {
log.info(vehicleCode + "______" + json.toJSONString() + " code:" + vehicleCode); log.info(vehicleCode + "______" + json.toJSONString() + " code:" + vehicleCode);
listOperations.rightPush("rfid:log:" + vehicleCode, messageBO); listOperations.rightPush("rfid:log:" + vehicleCode, messageBO);
Map<String, Vehicle> vehicleMap = hashOperations.entries("vehicle");
if (id.equals("A61A0000000000000000000000000")) { if (id.startsWith("A61A")) {
log.error("读写头错误!"); log.error("过滤掉乱发信息!:{},平移车:{}", id, vehicleCode);
return; return;
} }
Skid skid = (Skid) valueOperations.get(Constant.SKID_PREFIX + id); Skid skid = (Skid) valueOperations.get(Constant.SKID_PREFIX + id);
//若是焊装车间进车,绑定滑撬与车身关系
if (state == 1 && (vehicleCode.equals(Constant.HANZHUANG_VEHICLE1_RFID) || vehicleCode.equals(Constant.HANZHUANG_VEHICLE1_RFID))) { if (state == 1 && (vehicleCode.equals(Constant.HANZHUANG_VEHICLE1_RFID) || vehicleCode.equals(Constant.HANZHUANG_VEHICLE1_RFID))) {
String busNo = (String) valueOperations.get(Constant.HANZHUANG_VEHICLE1_BUSNO_KEY + vehicleCode); String busNo = (String) valueOperations.get(Constant.HANZHUANG_VEHICLE1_BUSNO_KEY + vehicleCode);
if (null == busNo) { if (null == busNo) {
...@@ -131,119 +134,207 @@ public class RfidMessageHandler extends AbstractTesterMessageHandler { ...@@ -131,119 +134,207 @@ public class RfidMessageHandler extends AbstractTesterMessageHandler {
log.error("无滑撬信息! :" + vehicleCode); log.error("无滑撬信息! :" + vehicleCode);
return; return;
} }
Vehicle vehicle = vehicleMap.get(vehicleCode);
Vehicle vehicle = (Vehicle) valueOperations.get(Constant.VEHICLE_PREFIX + vehicleCode);
if (null == vehicle) { if (null == vehicle) {
vehicle = vehicleCache.get(vehicleCode, Vehicle.class); vehicle = vehicleCache.get(vehicleCode, Vehicle.class);
} }
// TODO: 2019-11-02 获得正反转信息,以及相邻的工位
Integer land = vehicle.getLane(); String rfid = vehicle.getCurrentRfid();
//Set<String> keys = redisTemplate.keys(Constant.STATION_PREFIX + land + ":*"); if (null != rfid && id.equals(rfid)) {
if (state == 1) {
List<PaintshopStation> arriveList = new ArrayList<>(); Date occurTime = vehicle.getOccurTime();
long l = occurTime.getTime() - date.getTime() / 1000;
List<PaintshopStation> stationList = laneStationCache.get(land.toString(), ArrayList.class); if (l < 60) {
for (PaintshopStation station : stationList) { log.error("{} 平移车发生重发现象 ,滑撬id {}", vehicleCode, id);
String code = station.getCode(); return;
PaintshopStation sta = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + code);
if (null == sta) {
sta = stationCache.get(code, PaintshopStation.class);
}
if (null == sta.getArrive()) {
continue;
}
if (sta.getArrive()) {
arriveList.add(sta);
} }
} }
if (CollectionUtils.isEmpty(arriveList)) {
log.error("找不到对平移车到位信号! 平移车 id:{},滑撬 {}", vehicle.getCode(), id);
return;
} }
List<PaintshopStation> collect = arriveList.stream().filter(sta -> (sta.getTurnF() != null && sta.getTurnR() != null)).collect(Collectors.toList()); vehicle.setState(0 == state ? false : true);
Map<String, List<PaintshopStation>> listMap = collect.stream().collect(Collectors.groupingBy(PaintshopStation::getLandNo)); vehicle.setOccurTime(date);
vehicle.setCurrentRfid(id);
vehicle.setSkid(skid);
valueOperations.set(Constant.VEHICLE_PREFIX + vehicleCode, vehicle);
PaintshopStation sourceStation = new PaintshopStation(); if (state == 0){
if (CollectionUtils.isEmpty(listMap)) {
return; return;
} }
if (listMap.size() > 1) { List<PaintshopArea> areas = webStationCache.get("stationList", ArrayList.class);
Set<String> veKeys = redisTemplate.keys(Constant.VEHICLE_PREFIX); for (PaintshopArea area : areas) {
if (CollectionUtils.isEmpty(veKeys) || veKeys.size() != listMap.size()) { Map<String, PaintshopStation> stationMap = area.getStationMap();
log.error("平移车读写信号数量:{} 与 到位信号数量不一致!{}", veKeys.size(), listMap.size()); for (Map.Entry<String, PaintshopStation> entry : stationMap.entrySet()) {
return; PaintshopStation value = entry.getValue();
if (value.getState().equals(StationState.FREE)) {
continue;
} }
for (String veKey : veKeys) { if (value.getSkid().getRfid().equals(id)) {
Vehicle v = (Vehicle) valueOperations.get(veKey); List<PaintshopStation> lands = new ArrayList<>();
List<PaintshopStation> temStation = laneStationCache.get(value.getLaneId(), ArrayList.class);
for (PaintshopStation land : temStation) {
PaintshopStation s = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + land.getCode());
lands.add(s);
} }
} else {
List<PaintshopStation> stations = listMap.get(0); lands.sort(Comparator.comparing(v -> v.getSequence()));
if (stations.size() == 1) {
sourceStation = stations.get(0); PaintshopStation start = lands.get(0);
} else { PaintshopStation end = lands.get(lands.size() - 1);
PaintshopStation sta = stations.get(0); if (start.getCode().equals(value.getCode())) {
// if (state == 1 && (sta.getTurnR() && )){
vehicle.setSkid(start.getSkid());
for (int j = 1; j < lands.size() - 2; j++) {
PaintshopStation tem = lands.get(j);
PaintshopStation tem2 = lands.get(j - 1);
if (tem.getSkid() != null) {
tem2.setSkid(tem.getSkid());
tem2.setState(StationState.USE);
} }
} }
Long laneId = sourceStation.getLaneId(); } else if (end.getCode().equals(value.getCode())) {
vehicle.setSkid(end.getSkid());
vehicle.setCurrentRfid(id); for (int j = lands.size() - 2; j > 0; j--) {
StationState oldState = null; PaintshopStation tem = lands.get(j);
String oldSkidId = null; PaintshopStation tem2 = lands.get(j + 1);
if (state == 1) { if (tem.getSkid() != null){
//获得正反转信息,得到平移车相邻工位信息 tem2.setState(StationState.USE);
List<PaintshopStation> stations; tem2.setSkid(tem.getSkid());
stations = stationMapper.findList(new WhereFilter() {{ }
addFilter(PaintshopStation.class, "lane_id", Operation.EQUAL, laneId);
addOrderBy(RuntimeRecord.class, "sequence", OrderBy.DESC);
}}, PaintshopStation.class);
for (PaintshopStation station : stations) {
station.setOldState(oldState);
station.setSkidID(oldSkidId);
oldState = station.getState();
oldSkidId = station.getSkidID();
station.setState(StationState.USE);
station.setSkidID(id);
} }
String currentRfid = vehicle.getCurrentRfid();
vehicle.setCurrentRfid(null);
//记录过站数及信息
savePassInfo(today, currentDate, skid, sourceStation);
} else if (state == 0) {
List<PaintshopStation> stations = new ArrayList<>();
for (PaintshopStation station : stations) {
station.setOldState(oldState);
station.setSkidID(oldSkidId);
oldState = station.getState();
oldSkidId = station.getSkidID();
station.setState(StationState.FREE);
station.setSkidID(id);
} }
PaintshopStation station = new PaintshopStation();
station.setState(StationState.FREE);
station.setSkidID(null);
//记录过站数及信息
String areaCode = sourceStation.getAreaId().toString(); //记录过站信息
String key = Constant.BUS_SIZE_IN + areaCode + ":" + today; String areaCode = value.getAreaId().toString();
Integer size = (Integer) valueOperations.get(key); String areaKey = Constant.BUS_SIZE_IN + areaCode + ":" + today;
Integer size = (Integer) valueOperations.get(areaKey);
if (null == size) { if (null == size) {
size = 0; size = 0;
} else { } else {
size++; size++;
} }
valueOperations.set(key, size); valueOperations.set(areaKey, size);
List<StationPassInfo> list = passInfoMapper.findList(new WhereFilter() {{
addFilter("area_no", Operation.EQUAL, areaCode);
addFilter("out_time", Operation.IS, "null");
}}, StationPassInfo.class);
if (CollectionUtils.isEmpty(list)){
for (PaintshopStation land : lands) {
valueOperations.set(Constant.STATION_PREFIX + land.getCode(), land);
} }
valueOperations.set(Constant.VEHICLE_PREFIX + vehicle.getCode(), value);
} }
}
}
// // TODO: 2019-11-02 获得正反转信息,以及相邻的工位
// Integer land = vehicle.getLane();
// //Set<String> keys = redisTemplate.keys(Constant.STATION_PREFIX + land + ":*");
//
// List<PaintshopStation> arriveList = new ArrayList<>();
//
// List<PaintshopStation> stationList = laneStationCache.get(land.toString(), ArrayList.class);
// for (PaintshopStation station : stationList) {
// String code = station.getCode();
// PaintshopStation sta = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + code);
// if (null == sta) {
// sta = stationCache.get(code, PaintshopStation.class);
// }
// if (null == sta.getArrive()) {
// continue;
// }
// if (sta.getArrive()) {
// arriveList.add(sta);
// }
// }
// if (CollectionUtils.isEmpty(arriveList)) {
// log.error("找不到对平移车到位信号! 平移车 id:{},滑撬 {}", vehicle.getCode(), id);
// return;
// }
//
// List<PaintshopStation> collect = arriveList.stream().filter(sta -> (sta.getTurnF() != null && sta.getTurnR() != null)).collect(Collectors.toList());
// Map<String, List<PaintshopStation>> listMap = collect.stream().collect(Collectors.groupingBy(PaintshopStation::getLandNo));
//
// PaintshopStation sourceStation = new PaintshopStation();
// if (CollectionUtils.isEmpty(listMap)) {
// return;
// }
// if (listMap.size() > 1) {
// Set<String> veKeys = redisTemplate.keys(Constant.VEHICLE_PREFIX);
// if (CollectionUtils.isEmpty(veKeys) || veKeys.size() != listMap.size()) {
// log.error("平移车读写信号数量:{} 与 到位信号数量不一致!{}", veKeys.size(), listMap.size());
// return;
// }
// for (String veKey : veKeys) {
// Vehicle v = (Vehicle) valueOperations.get(veKey);
// }
// } else {
// List<PaintshopStation> stations = listMap.get(0);
// if (stations.size() == 1) {
// sourceStation = stations.get(0);
// } else {
// PaintshopStation sta = stations.get(0);
// // if (state == 1 && (sta.getTurnR() && )){
// }
// }
// Long laneId = sourceStation.getLaneId();
//
// vehicle.setCurrentRfid(id);
// StationState oldState = null;
// String oldSkidId = null;
// if (state == 1) {
// //获得正反转信息,得到平移车相邻工位信息
// List<PaintshopStation> stations;
// stations = stationMapper.findList(new WhereFilter() {{
// addFilter(PaintshopStation.class, "lane_id", Operation.EQUAL, laneId);
// addOrderBy(RuntimeRecord.class, "sequence", OrderBy.DESC);
// }}, PaintshopStation.class);
//
// for (PaintshopStation station : stations) {
// station.setOldState(oldState);
// station.setSkidID(oldSkidId);
// oldState = station.getState();
// oldSkidId = station.getSkidID();
// station.setState(StationState.USE);
// station.setSkidID(id);
// }
// String currentRfid = vehicle.getCurrentRfid();
// vehicle.setCurrentRfid(null);
//
// //记录过站数及信息
// savePassInfo(today, currentDate, skid, sourceStation);
// } else if (state == 0) {
// List<PaintshopStation> stations = new ArrayList<>();
// for (PaintshopStation station : stations) {
// station.setOldState(oldState);
// station.setSkidID(oldSkidId);
// oldState = station.getState();
// oldSkidId = station.getSkidID();
// station.setState(StationState.FREE);
// station.setSkidID(id);
// }
// PaintshopStation station = new PaintshopStation();
// station.setState(StationState.FREE);
// station.setSkidID(null);
//
// //记录过站数及信息
// String areaCode = sourceStation.getAreaId().toString();
// String key = Constant.BUS_SIZE_IN + areaCode + ":" + today;
// Integer size = (Integer) valueOperations.get(key);
// if (null == size) {
// size = 0;
// } else {
// size++;
// }
// valueOperations.set(key, size);
//
// List<StationPassInfo> list = passInfoMapper.findList(new WhereFilter() {{
// addFilter("area_no", Operation.EQUAL, areaCode);
// addFilter("out_time", Operation.IS, "null");
// }}, StationPassInfo.class);
// if (CollectionUtils.isEmpty(list)) {
//
// }
// }
} }
......
...@@ -38,6 +38,7 @@ spring.mes.sqlserver.password=123456 ...@@ -38,6 +38,7 @@ spring.mes.sqlserver.password=123456
spring.resources.static-locations=classpath:/META-INF/resources/,file:///D:/productWeb/zhongtong/static spring.resources.static-locations=classpath:/META-INF/resources/,file:///D:/productWeb/zhongtong/static
# redis # redis
spring.redis.host=10.1.25.249 #spring.redis.host=10.1.25.249
spring.redis.host=10.1.25.224
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password= spring.redis.password=
\ No newline at end of file
...@@ -3,10 +3,11 @@ spring.quartz.job-store-type=jdbc ...@@ -3,10 +3,11 @@ spring.quartz.job-store-type=jdbc
spring.quartz.jdbc.initialize-schema=always spring.quartz.jdbc.initialize-schema=always
spring.quartz.jdbc.comment-prefix=# spring.quartz.jdbc.comment-prefix=#
spring.quartz.startupDelay=2s spring.quartz.startupDelay=2s
#spring.quartz.auto-startup=true #spring.quartz.auto-startup=false
spring.quartz.properties.org.quartz.jobStore.misfireThreshold=400000
spring.quartz.properties.org.quartz.scheduler.instanceName=myScheduler-scada spring.quartz.properties.org.quartz.scheduler.instanceName=myScheduler-scada
spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO
spring.quartz.properties.org.quartz.jobStore.isClustered=true spring.quartz.properties.org.quartz.jobStore.isClustered=false
spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval=10000 spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval=10000
spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
spring.quartz.properties.org.quartz.jobStore.tablePrefix=QRTZ_ spring.quartz.properties.org.quartz.jobStore.tablePrefix=QRTZ_
...@@ -14,11 +15,11 @@ spring.quartz.properties.org.quartz.jobStore.useProperties=false ...@@ -14,11 +15,11 @@ spring.quartz.properties.org.quartz.jobStore.useProperties=false
spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
spring.quartz.properties.org.quartz.threadPool.threadCount=25 spring.quartz.properties.org.quartz.threadPool.threadCount=40
spring.quartz.properties.org.quartz.threadPool.threadPriority=5 spring.quartz.properties.org.quartz.threadPool.threadPriority=5
spring.quartz.properties.org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true spring.quartz.properties.org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=false
quartz.job.allow-start=false quartz.job.allow-start=true
quartz.job.taskInfos[0].jobName=net.vtstar.zhongtong.avi.stamping.job.LaserCuttingMachineJob quartz.job.taskInfos[0].jobName=net.vtstar.zhongtong.avi.stamping.job.LaserCuttingMachineJob
quartz.job.taskInfos[0].jobGroup=LaserCuttingMachineJob quartz.job.taskInfos[0].jobGroup=LaserCuttingMachineJob
...@@ -238,7 +239,7 @@ quartz.job.taskInfos[20].start=false ...@@ -238,7 +239,7 @@ quartz.job.taskInfos[20].start=false
quartz.job.taskInfos[24].jobName=net.vtstar.zhongtong.avi.monitoring.job.AVIMonitorJob quartz.job.taskInfos[24].jobName=net.vtstar.zhongtong.avi.monitoring.job.AVIMonitorJob
quartz.job.taskInfos[24].jobGroup=AVIMonitorJob quartz.job.taskInfos[24].jobGroup=AVIMonitorJob
quartz.job.taskInfos[24].jobDescription=\u76d1\u63a7\u0041\u0056\u0049Job quartz.job.taskInfos[24].jobDescription=\u76d1\u63a7\u0041\u0056\u0049Job
quartz.job.taskInfos[24].cronExpression=0/20 * * * * ? quartz.job.taskInfos[24].cronExpression=0/10 * * * * ?
quartz.job.taskInfos[24].start=false quartz.job.taskInfos[24].start=false
#mes 工单同步 #mes 工单同步
...@@ -260,4 +261,4 @@ quartz.job.taskInfos[29].start=true ...@@ -260,4 +261,4 @@ quartz.job.taskInfos[29].start=true
##quartz.job.taskInfos[8].jobGroup=CleanEquipStatusJob ##quartz.job.taskInfos[8].jobGroup=CleanEquipStatusJob
##quartz.job.taskInfos[8].jobDescription=\u6E05\u6D17\u8BBE\u5907\u72B6\u6001Job ##quartz.job.taskInfos[8].jobDescription=\u6E05\u6D17\u8BBE\u5907\u72B6\u6001Job
##quartz.job.taskInfos[8].cronExpression=0/10 * * * * ? ##quartz.job.taskInfos[8].cronExpression=0/10 * * * * ?
##quartz.job.taskInfos[8].start=true ##quartz.job.taskInfos[8].start=false
\ No newline at end of file \ No newline at end of file
...@@ -9,7 +9,7 @@ spring.aop.auto=true ...@@ -9,7 +9,7 @@ spring.aop.auto=true
spring.main.allow-bean-definition-overriding=true spring.main.allow-bean-definition-overriding=true
# server # server
server.port=8085 server.port=8082
spring.servlet.multipart.max-file-size=1000MB spring.servlet.multipart.max-file-size=1000MB
spring.servlet.multipart.max-request-size=2000MB spring.servlet.multipart.max-request-size=2000MB
spring.servlet.multipart.enabled=true spring.servlet.multipart.enabled=true
......
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