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

fix: avi修改

parent 321d6c73
...@@ -8,6 +8,7 @@ import net.vtstar.user.search.Search; ...@@ -8,6 +8,7 @@ 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.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 org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.persistence.Column; import javax.persistence.Column;
...@@ -52,12 +53,17 @@ public class PaintshopStation implements Serializable { ...@@ -52,12 +53,17 @@ public class PaintshopStation implements Serializable {
private Long laneId; private Long laneId;
@ApiModelProperty(notes = "车道编号") @ApiModelProperty(notes = "车道编号")
//@JoinColumn(tableName = PaintshopLane.class, name = "lane_code") @Column(name = "vehicle_lane_code")
@Search @Search
private String laneCode; private String laneCode;
@ApiModelProperty(notes = "从上至下车道号")
@Column(name = "lane_no")
@Search
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;
...@@ -107,4 +113,10 @@ public class PaintshopStation implements Serializable { ...@@ -107,4 +113,10 @@ public class PaintshopStation implements Serializable {
@ApiModelProperty(notes = "工位正转", hidden = true) @ApiModelProperty(notes = "工位正转", hidden = true)
private Boolean turnF; private Boolean turnF;
@ApiModelProperty(notes = "工艺流向", hidden = true)
private Boolean flow;
@ApiModelProperty(notes = "工位平移车位置", hidden = true)
private StationPos pos;
} }
...@@ -30,7 +30,8 @@ public class PretreamentMachineJob extends GatherJob { ...@@ -30,7 +30,8 @@ public class PretreamentMachineJob extends GatherJob {
@Override @Override
public boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
PretreatmentMachine data = (PretreatmentMachine) equipmentData; PretreatmentMachine data = (PretreatmentMachine) equipmentData;
Integer state = data.getStatus(); // Integer state = data.getStatus();
Integer state = 1;
if (state != null && state ==1) { if (state != null && state ==1) {
return false; return false;
} }
......
...@@ -30,7 +30,8 @@ public class AutomaticSpotWeldingMachineJob extends GatherJob { ...@@ -30,7 +30,8 @@ public class AutomaticSpotWeldingMachineJob extends GatherJob {
@Override @Override
public boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
AutomaticSpotWeldingMachine data = (AutomaticSpotWeldingMachine) equipmentData; AutomaticSpotWeldingMachine data = (AutomaticSpotWeldingMachine) equipmentData;
Integer state = data.getStatus(); // Integer state = data.getStatus();
Integer state = 1;
if (state != null && state == 0) { if (state != null && state == 0) {
return false; return false;
} }
......
...@@ -30,7 +30,8 @@ public class PlcControlTireMachine2Job extends GatherJob { ...@@ -30,7 +30,8 @@ public class PlcControlTireMachine2Job extends GatherJob {
@Override @Override
public boolean handleObject(EquipmentData equipmentData) { public boolean handleObject(EquipmentData equipmentData) {
PlcControlTireMachine2 data = (PlcControlTireMachine2) equipmentData; PlcControlTireMachine2 data = (PlcControlTireMachine2) equipmentData;
Integer state = data.getStatus(); // Integer state = data.getStatus();
Integer state = 1;
if (state != null && state == 0) { if (state != null && state == 0) {
return false; return false;
} }
......
...@@ -10,9 +10,11 @@ public class Constant { ...@@ -10,9 +10,11 @@ public class Constant {
public static final String HANZHUANG_VEHICLE2_RFID = "rfid69"; public static final String HANZHUANG_VEHICLE2_RFID = "rfid69";
public static final String HANZHUANG_VEHICLE1_BUSNO_KEY = "HZC1"; //焊装平移车道1车身号
public static final String HANZHUANG_VEHICLE1_BUSNO_KEY = "HZC1:";
public static final String HANZHUANG_VEHICLE2_BUSNO_KEY = "HZC2"; //焊装平移车道2车身号
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";
......
...@@ -12,6 +12,8 @@ import net.vtstar.zhongtong.avi.monitoring.domain.enums.DateType; ...@@ -12,6 +12,8 @@ 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.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.CarStatisticsVO; import net.vtstar.zhongtong.avi.monitoring.domain.vo.CarStatisticsVO;
import net.vtstar.zhongtong.avi.monitoring.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -29,10 +31,15 @@ import java.util.Map; ...@@ -29,10 +31,15 @@ import java.util.Map;
@RequestMapping("/area") @RequestMapping("/area")
public class AreaController { public class AreaController {
@Autowired
private AreaService areaService;
@ApiOperation(value = "根据区域编号查询区域实时信息", response = PaintshopArea.class, responseContainer = "List",notes = "区域编号:\r\n" + @ApiOperation(value = "根据区域编号查询区域实时信息", response = PaintshopArea.class, responseContainer = "List",notes = "区域编号:\r\n" +
"整体区域:0\r\n钣金:1\r\n电泳:2\r\n密封防腐:3\r\n腻子:4\r\n中涂:5\r\n面/色漆:6\r\n成品:7") "整体区域:0\r\n钣金:1\r\n电泳:2\r\n密封防腐:3\r\n腻子:4\r\n中涂:5\r\n面/色漆:6\r\n成品:7")
@GetMapping("/areaInfo/realTime") @GetMapping("/areaInfo/realTime")
private Return getAreaInfo(@RequestParam(value = "areaNo",required = false) String areaNo) { private Return getAreaInfo(@RequestParam(value = "areaNo",required = false) String areaNo) {
List<PaintshopArea> areas2 = areaService.getInfoByAreaNo(areaNo);
List<PaintshopArea> areas = new ArrayList<>(); List<PaintshopArea> areas = new ArrayList<>();
PaintshopArea area = new PaintshopArea(); PaintshopArea area = new PaintshopArea();
area.setCode("2"); area.setCode("2");
......
...@@ -2,8 +2,6 @@ package net.vtstar.zhongtong.avi.monitoring.domain.bo; ...@@ -2,8 +2,6 @@ package net.vtstar.zhongtong.avi.monitoring.domain.bo;
import lombok.Data; import lombok.Data;
import java.util.Date;
@Data @Data
public class MQTTMessageBO { public class MQTTMessageBO {
......
package net.vtstar.zhongtong.avi.monitoring.domain.vo;
/**
*工位位于平移车位置
*/
public enum StationPos {
LEFT,
RIGHT;
}
...@@ -56,7 +56,14 @@ public class AVIMonitorJob extends GatherJob { ...@@ -56,7 +56,14 @@ public class AVIMonitorJob extends GatherJob {
// Map<String, PaintshopStation> stationMap = hashOperations.entries("station"); // Map<String, PaintshopStation> stationMap = hashOperations.entries("station");
// Map<String, Vehicle> vehicleMap = hashOperations.entries("vehicle_signal"); // Map<String, Vehicle> vehicleMap = hashOperations.entries("vehicle_signal");
equipInfoList.forEach(equipInfo -> { long l = System.currentTimeMillis();
int total = 0;
int error = 0;
int timeout = 0;
int errorTotal = 0;
for (EquipInfo equipInfo : equipInfoList) {
List<EquipCommunication> commList = equipInfoService.getCommunicationList(equipInfo.getEquipCode(), 1); List<EquipCommunication> commList = equipInfoService.getCommunicationList(equipInfo.getEquipCode(), 1);
if (CollectionUtils.isEmpty(commList)) { if (CollectionUtils.isEmpty(commList)) {
return; return;
...@@ -80,12 +87,17 @@ public class AVIMonitorJob extends GatherJob { ...@@ -80,12 +87,17 @@ public class AVIMonitorJob extends GatherJob {
List<List<EquipDataTemplateItem>> lists = modbusService.groupByAddress(templateItemList); List<List<EquipDataTemplateItem>> lists = modbusService.groupByAddress(templateItemList);
for (List<EquipDataTemplateItem> itemList : lists) { for (List<EquipDataTemplateItem> itemList : lists) {
total = total + 1;
EquipDataTemplateItem startTemplate = itemList.get(0); EquipDataTemplateItem startTemplate = itemList.get(0);
Integer startAddress = startTemplate.getAddress(); Integer startAddress = startTemplate.getAddress();
Integer endAddress = itemList.get(itemList.size() - 1).getAddress(); Integer endAddress = itemList.get(itemList.size() - 1).getAddress();
Integer quantity = itemList.get(itemList.size() - 1).getLength(); Integer quantity = itemList.get(itemList.size() - 1).getLength();
Integer count = endAddress + quantity - startAddress; Integer count = endAddress + quantity - startAddress;
AbstractModbusResponse response = null; AbstractModbusResponse response = null;
long start = System.currentTimeMillis();
try { try {
if (1 == startTemplate.getFunctionCode()) { if (1 == startTemplate.getFunctionCode()) {
response = modbusService.readCoilRegister(slaveId, poolKey, startAddress, count); response = modbusService.readCoilRegister(slaveId, poolKey, startAddress, count);
...@@ -100,14 +112,26 @@ public class AVIMonitorJob extends GatherJob { ...@@ -100,14 +112,26 @@ public class AVIMonitorJob extends GatherJob {
log.info("读取失败。ip{},端口{},slave{},start{}", poolKey.getHost(), poolKey.getPort(), slaveId, startAddress); log.info("读取失败。ip{},端口{},slave{},start{}", poolKey.getHost(), poolKey.getPort(), slaveId, startAddress);
continue; continue;
} }
long end = System.currentTimeMillis();
log.debug("readTime:" + (end - start));
log.debug("___"); log.debug("___");
log.debug("slaveID:" + slaveId + " start:" + startAddress + " count:" + count + " functionCode:" + startTemplate.getFunctionCode()); log.debug("slaveID:" + slaveId + " start:" + startAddress + " count:" + count + " functionCode:" + startTemplate.getFunctionCode());
if (null == response) { if (null == response) {
log.error("读取异常!"); log.error("读取异常!");
error++;
log.error("异常次数!:" + error);
continue; continue;
} }
if (!response.isSuccess()) { if (!response.isSuccess()) {
log.error(response.getError()); errorTotal++;
String error1 = response.getError();
if (error1.contains("秒内与对端连接")) {
timeout++;
log.error("超时次数!:" + timeout);
}
log.error(error1);
continue; continue;
} }
...@@ -160,7 +184,17 @@ public class AVIMonitorJob extends GatherJob { ...@@ -160,7 +184,17 @@ public class AVIMonitorJob extends GatherJob {
} }
} }
} }
}); }
;
log.debug("_________________________________________________");
log.debug("_________________________________________________");
log.debug("total" + total);
log.debug("error" + error);
log.debug("timeout" + timeout);
long l1 = System.currentTimeMillis();
log.debug("time:" + (l1 - l) / 1000);
// stationCache.put("station", stationMap); // stationCache.put("station", stationMap);
// hashOperations.putAll("station", stationMap); // hashOperations.putAll("station", stationMap);
} }
......
...@@ -8,6 +8,7 @@ import net.vtstar.zhongtong.avi.equipment.domain.PaintshopArea; ...@@ -8,6 +8,7 @@ import net.vtstar.zhongtong.avi.equipment.domain.PaintshopArea;
import net.vtstar.zhongtong.avi.equipment.domain.PaintshopLane; import net.vtstar.zhongtong.avi.equipment.domain.PaintshopLane;
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.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.mapper.SkidMapper; import net.vtstar.zhongtong.avi.monitoring.mapper.SkidMapper;
...@@ -17,6 +18,7 @@ import org.springframework.boot.CommandLineRunner; ...@@ -17,6 +18,7 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.cache.Cache; import org.springframework.cache.Cache;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -37,7 +39,8 @@ public class ReadStationToCacheRunner implements CommandLineRunner { ...@@ -37,7 +39,8 @@ public class ReadStationToCacheRunner implements CommandLineRunner {
private Cache laneStationCache; private Cache laneStationCache;
@Resource(name = "redisTemplate") @Resource(name = "redisTemplate")
protected HashOperations hashOperations; protected HashOperations hashOperations;
@Resource(name = "redisTemplate")
protected ValueOperations valueOperations;
@Autowired @Autowired
private SearchService searchService; private SearchService searchService;
@Autowired @Autowired
...@@ -54,14 +57,16 @@ public class ReadStationToCacheRunner implements CommandLineRunner { ...@@ -54,14 +57,16 @@ public class ReadStationToCacheRunner implements CommandLineRunner {
List<PaintshopStation> stations = stationMapper.findList(new WhereFilter() {{ List<PaintshopStation> stations = stationMapper.findList(new WhereFilter() {{
addJoin(PaintshopStation.class, "area_id", PaintshopArea.class, "id"); addJoin(PaintshopStation.class, "area_id", PaintshopArea.class, "id");
addJoin(PaintshopStation.class, "lane_id", PaintshopLane.class, "id"); addJoin(PaintshopStation.class, "lane_id", PaintshopLane.class, "id");
addOrderBy(PaintshopStation.class, "sequence", OrderBy.ASC); addOrderBy(PaintshopStation.class, "id", OrderBy.ASC);
}}, PaintshopStation.class); }}, PaintshopStation.class);
for (PaintshopStation station : stations) { for (PaintshopStation station : stations) {
stationCache.put(station.getCode(),station); stationCache.put(station.getCode(),station);
// station.setTurnF(false);
// station.setTurnR(false);
// 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<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()) { for (Map.Entry<String, List<PaintshopStation>> entry : stationMap.entrySet()) {
laneStationCache.put(entry.getKey(),entry.getValue()); laneStationCache.put(entry.getKey(),entry.getValue());
} }
......
package net.vtstar.zhongtong.avi.monitoring.service;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@Service
public class AreaService {
@Resource(name = "redisTemplate")
protected ValueOperations valueOperations;
@Resource(name = "redisTemplate")
private RedisTemplate redisTemplate;
public List<PaintshopArea> getInfoByAreaNo(String areaNo) {
List<PaintshopArea> areas = new ArrayList<>();
Set keys = redisTemplate.keys(Constant.STATION_PREFIX + "*");
for (Object key : keys) {
PaintshopStation station = (PaintshopStation) valueOperations.get(key);
}
return null;
}
}
package net.vtstar.zhongtong.avi.monitoring.service; package net.vtstar.zhongtong.avi.monitoring.service;
import net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation;
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 org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.HashOperations;
...@@ -7,7 +9,10 @@ import org.springframework.data.redis.core.ValueOperations; ...@@ -7,7 +9,10 @@ import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class PDAService { public class PDAService {
...@@ -17,12 +22,28 @@ public class PDAService { ...@@ -17,12 +22,28 @@ public class PDAService {
@Resource(name = "redisTemplate") @Resource(name = "redisTemplate")
protected ValueOperations valueOperations; protected ValueOperations valueOperations;
public static void main(String[] args) {
boolean a =true;
boolean b =false;
boolean c =false;
boolean d =true;
System.out.println(a & b);
System.out.println(a & d);
System.out.println(b&&c);
}
//钣金上车绑定 //钣金上车绑定
public void bound(String vehicleNo, String busNo) { public void bound(String vehicleNo, String busNo) {
// TODO: 2019-11-02 判断车身工单号是否在计划中 // TODO: 2019-11-02 判断车身工单号是否在计划中
valueOperations.set(vehicleNo, busNo);
if (vehicleNo.equals("HZC1")){
valueOperations.set(Constant.HANZHUANG_VEHICLE1_BUSNO_KEY + "rfid68", busNo);
}
if (vehicleNo.equals("HZC2")){
valueOperations.set(Constant.HANZHUANG_VEHICLE1_BUSNO_KEY + "rfid69", busNo);
}
} }
} }
...@@ -203,8 +203,8 @@ quartz.job.taskInfos[20].start=false ...@@ -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].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 0/3 * * * ?
quartz.job.taskInfos[24].start=false quartz.job.taskInfos[24].start=true
#mes 工单同步 #mes 工单同步
quartz.job.taskInfos[26].jobName=net.vtstar.zhongtong.avi.sqlserver.job.MesWorkOrderJob quartz.job.taskInfos[26].jobName=net.vtstar.zhongtong.avi.sqlserver.job.MesWorkOrderJob
......
...@@ -14,7 +14,9 @@ import org.springframework.test.context.ActiveProfiles; ...@@ -14,7 +14,9 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
...@@ -77,4 +79,21 @@ public class StationTest { ...@@ -77,4 +79,21 @@ public class StationTest {
stationMapper.insert(station); stationMapper.insert(station);
} }
} }
@Test
public void tt(){
ArrayList<PaintshopStation> stations = new ArrayList<>();
PaintshopStation station = new PaintshopStation();
station.setTurnR(true);
station.setTurnF(false);
PaintshopStation station2 = new PaintshopStation();
station2.setTurnR(true);
station2.setTurnF(false);
stations.add(station);
stations.add(station2);
List<PaintshopStation> collect = stations.stream().filter(sta -> sta.getTurnF() != null).collect(Collectors.toList());
int a =1;
}
} }
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