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

fix: avi修改

parent f61c5598
......@@ -6,6 +6,7 @@ import lombok.Data;
import net.vtstar.user.search.JoinColumn;
import net.vtstar.user.search.Search;
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.StationState;
import net.vtstar.zhongtong.avi.monitoring.domain.vo.StationPos;
......@@ -63,7 +64,7 @@ public class PaintshopStation implements Serializable {
private String landNo;
@ApiModelProperty(notes = "平移车道编号")
//@Column(name = "vehicle_lane_code")
@Column(name = "vehicle_lane_code")
@Search
private String vehicleLaneCode;
......@@ -117,6 +118,10 @@ public class PaintshopStation implements Serializable {
@ApiModelProperty(notes = "工艺流向", hidden = true)
private Boolean flow;
@Column(name = "ve_direction")
@ApiModelProperty(notes = "相对平移车位置", hidden = true)
private Direction direction;
@ApiModelProperty(notes = "工位平移车位置", hidden = true)
private StationPos pos;
}
......@@ -2,10 +2,6 @@ package net.vtstar.zhongtong.avi.global.constant;
public class Constant {
public static long totalSize = 0;
public static long totalTimeOut = 0;
//redis滑撬前缀
public static final String SKID_PREFIX = "skid:";
//redis工位前缀
......@@ -14,6 +10,10 @@ public class Constant {
public static final String ROOM_PREFIX = "room:";
//redis报警前缀
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:";
......@@ -22,7 +22,7 @@ public class Constant {
//进车数统计
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";
......@@ -34,6 +34,6 @@ public class Constant {
//焊装平移车道2车身号
public static final String HANZHUANG_VEHICLE2_BUSNO_KEY = "HZC2:";
//redis平移车信号到位
public static final String VEHICLE_PREFIX = "VEHICLE:STATE";
// //redis平移车信号到位
// public static final String VEHICLE_PREFIX = "VEHICLE:STATE";
}
......@@ -72,10 +72,9 @@ public class LedService {
}*/
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<>());
warningCache.get(ledNo);
List warningList = warningCache.get(Constant.LED_PREFIX + ledNo, ArrayList.class);
vo.setWarningList(warningList);
} else {
List<WorkRoom> room = new ArrayList<>();
List<String> eqpCodeList = new ArrayList<>();
......
......@@ -173,7 +173,7 @@ public class AreaController {
@GetMapping("/test")
private Return test() {
PoolKey key = new PoolKey("localhost", 502);
ReadCoilsRequest readCoilsRequest = new ReadCoilsRequest(1,0,50);
ReadCoilsRequest readCoilsRequest = new ReadCoilsRequest(1, 0, 50);
try {
ModbusResponse execute = template.execute(key, readCoilsRequest, ReadCoilsResponse.class);
ByteBuf body = execute.getBody();
......@@ -186,10 +186,10 @@ public class AreaController {
byte aByte1 = body.getByte(1);
byte aByte = body.getByte(2);
int length = body.readableBytes();
// byte[] bytes = new byte[lenght];
// ByteBuf bytes1 = body.getBytes(body.readerIndex(), bytes);
// byte[] bytes = new byte[lenght];
// ByteBuf bytes1 = body.getBytes(body.readerIndex(), bytes);
int a =1;
int a = 1;
} catch (Exception e) {
......
......@@ -6,6 +6,7 @@ import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Date;
@ApiModel("平移车")
@Data
......@@ -20,7 +21,7 @@ public class Vehicle {
@ApiModelProperty(notes = "所属平移车道(从东向西(1,2,3,4))")
@Column(name = "lane")
private Integer lane;
private String lane;
@ApiModelProperty(notes = " 转动:正转(true),反转(false)")
private Boolean turn;
......@@ -50,4 +51,14 @@ public class Vehicle {
@ApiModelProperty(notes = "当前绑定滑撬")
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
}
......@@ -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.PaintshopStation;
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.DateType;
import net.vtstar.zhongtong.avi.monitoring.domain.vo.CarStatisticsVO;
......@@ -33,6 +34,8 @@ public class RedisToCacheJob extends GatherJob {
private RedisTemplate redisTemplate;
@Resource(name = "webStationCache")
private Cache webStationCache;
@Resource(name = "warningCache")
private Cache warningCache;
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
......@@ -40,6 +43,28 @@ public class RedisToCacheJob extends GatherJob {
log.info("______________");
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 + "*");
List<PaintshopStation> stations = new ArrayList<>();
......@@ -71,12 +96,21 @@ public class RedisToCacheJob extends GatherJob {
}
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();
vo.setAreaNo(code);
Integer todaySize = (Integer) valueOperations.get(Constant.BUS_SIZE_IN + code + ":" + today);
vo.setDateType(dateType);
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 {
vo.setSize(BigDecimal.valueOf(todaySize));
}
......@@ -87,7 +121,12 @@ public class RedisToCacheJob extends GatherJob {
Integer todayOut = (Integer) valueOperations.get(Constant.BUS_SIZE_OUT + code + ":" + today);
out.setDateType(dateType);
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 {
out.setSize(BigDecimal.valueOf(todayOut));
}
......@@ -97,5 +136,10 @@ public class RedisToCacheJob extends GatherJob {
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 {
addOrderBy(PaintshopStation.class, "id", OrderBy.ASC);
}}, 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);
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.setTurnR(false);
// station.setArrive(false);
......@@ -110,11 +127,8 @@ public class ReadDataToCacheRunner implements CommandLineRunner {
// 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));
for (
Map.Entry<String, List<PaintshopStation>> entry : stationMap.entrySet())
{
Map<Long, List<PaintshopStation>> stationMap = stations.stream().filter(sta -> sta.getLaneCode() != null).collect(Collectors.groupingBy(PaintshopStation::getLaneId));
for (Map.Entry<Long, List<PaintshopStation>> entry : stationMap.entrySet()) {
laneStationCache.put(entry.getKey(), entry.getValue());
}
......
......@@ -14,6 +14,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
......@@ -51,15 +52,20 @@ public class AreaService {
}
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<String> nos = new ArrayList<>();
if (null != orderNo){
if (!StringUtils.isEmpty(orderNo)) {
List<MesWorkOrderInfo> info = workOrderMapper.findList(new WhereFilter() {{
addFilter("sales_order_no", Operation.EQUAL, orderNo);
addFilter("status", Operation.EQUAL, "4");
}}, MesWorkOrderInfo.class);
nos = info.stream().map(MesWorkOrderInfo::getWorkOrderNo).distinct().collect(Collectors.toList());
}
else {
} else {
nos.add(workOrderNo);
}
List<PaintshopArea> areas = webStationCache.get("stationList", ArrayList.class);
......@@ -71,8 +77,11 @@ public class AreaService {
PaintshopStation value = entry.getValue();
String key = entry.getKey();
for (String no : nos) {
if (value.getBusNo().equals(no)){
newMap.put(key,value);
if (null == value.getBusNo()) {
continue;
}
if (value.getBusNo().equals(no)) {
newMap.put(key, value);
}
}
}
......@@ -85,11 +94,11 @@ public class AreaService {
public Bus getByBusNo(String busNo) {
List<MesWorkOrderInfo> info = workOrderMapper.findList(new WhereFilter() {{
addFilter("work_order_no", Operation.EQUAL, busNo);
addFilter("status", Operation.EQUAL, "4");
}}, MesWorkOrderInfo.class);
if (CollectionUtils.isEmpty(info)){
if (CollectionUtils.isEmpty(info)) {
return null;
}
else {
} else {
MesWorkOrderInfo orderInfo = info.get(0);
Bus bus = new Bus();
bus.setBusType(orderInfo.getVehicleModel());
......
......@@ -38,6 +38,7 @@ spring.mes.sqlserver.password=123456
spring.resources.static-locations=classpath:/META-INF/resources/,file:///D:/productWeb/zhongtong/static
# 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.password=
\ No newline at end of file
......@@ -3,10 +3,11 @@ spring.quartz.job-store-type=jdbc
spring.quartz.jdbc.initialize-schema=always
spring.quartz.jdbc.comment-prefix=#
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.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.class=org.quartz.impl.jdbcjobstore.JobStoreTX
spring.quartz.properties.org.quartz.jobStore.tablePrefix=QRTZ_
......@@ -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.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.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].jobGroup=LaserCuttingMachineJob
......@@ -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].jobGroup=AVIMonitorJob
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
#mes 工单同步
......@@ -260,4 +261,4 @@ quartz.job.taskInfos[29].start=true
##quartz.job.taskInfos[8].jobGroup=CleanEquipStatusJob
##quartz.job.taskInfos[8].jobDescription=\u6E05\u6D17\u8BBE\u5907\u72B6\u6001Job
##quartz.job.taskInfos[8].cronExpression=0/10 * * * * ?
##quartz.job.taskInfos[8].start=true
\ No newline at end of file
##quartz.job.taskInfos[8].start=false
\ No newline at end of file
......@@ -9,7 +9,7 @@ spring.aop.auto=true
spring.main.allow-bean-definition-overriding=true
# server
server.port=8085
server.port=8082
spring.servlet.multipart.max-file-size=1000MB
spring.servlet.multipart.max-request-size=2000MB
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