diff --git a/business/src/main/java/com/fizz/business/mq/RabbitMQ/RabbitQueueListener.java b/business/src/main/java/com/fizz/business/mq/RabbitMQ/RabbitQueueListener.java index c9266c8..9312207 100644 --- a/business/src/main/java/com/fizz/business/mq/RabbitMQ/RabbitQueueListener.java +++ b/business/src/main/java/com/fizz/business/mq/RabbitMQ/RabbitQueueListener.java @@ -29,7 +29,9 @@ public class RabbitQueueListener { @Resource ModSetupResultService modSetupResultService; - private Double LastRolledLength = 0d; + private double LastRolledLength = 0d; + private int LastPassNo = -1; + // @RabbitListener(queues = CommonConstants.RabbitMQ.RECEIVE_MODEL) // @RabbitHandler // public void onHmiMessage(String message) { @@ -48,11 +50,15 @@ public class RabbitQueueListener { if(Math.abs(LastRolledLength-rolledLength)<1){ return; } - if(LastRolledLength-rolledLength>300) { + int passNo = Integer.parseInt( + JSONUtil.parse(message).getByPath("passNo").toString() + ); + if(LastPassNo!=passNo) { measureList = Lists.newArrayList(); } measureList.add(message); LastRolledLength=rolledLength; + LastPassNo = passNo; //socket WebSocketUtil.sendMessage(WsTypeEnum.track_measure,message); } diff --git a/business/src/main/java/com/fizz/business/service/impl/RollDataServiceImpl.java b/business/src/main/java/com/fizz/business/service/impl/RollDataServiceImpl.java index 5887b64..44d1425 100644 --- a/business/src/main/java/com/fizz/business/service/impl/RollDataServiceImpl.java +++ b/business/src/main/java/com/fizz/business/service/impl/RollDataServiceImpl.java @@ -7,15 +7,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fizz.business.constants.CommonConstants; import com.fizz.business.constants.enums.RollerPositionEnum; import com.fizz.business.constants.enums.RollerTypeEnum; -import com.fizz.business.domain.PlantConfig; -import com.fizz.business.domain.RollData; -import com.fizz.business.domain.RollHistory; -import com.fizz.business.domain.ShiftHistory; +import com.fizz.business.domain.*; import com.fizz.business.mapper.RollDataMapper; -import com.fizz.business.service.PlantConfigService; -import com.fizz.business.service.RollDataService; -import com.fizz.business.service.RollHistoryService; -import com.fizz.business.service.ShiftHistoryService; +import com.fizz.business.service.*; import com.fizz.business.vo.OnlineRollDataVO; import com.fizz.business.vo.ReadyRollDataVO; @@ -51,6 +45,9 @@ public class RollDataServiceImpl extends ServiceImpl i @Resource RabbitTemplate rabbitTemplate; + @Resource + RollChangeCycleService rollChangeCycleService; + @Override public List getList(String position,String type,String status) { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -109,6 +106,7 @@ public class RollDataServiceImpl extends ServiceImpl i List readyRollDataVOList = new ArrayList<>(); List rollDataList = getList(null, null,"ONLINE"); + List changeList = rollChangeCycleService.list(); for (RollData rollData : rollDataList) { OnlineRollDataVO onlineRollDataVO = new OnlineRollDataVO(); // 使用 BeanUtils 复制属性 @@ -116,35 +114,48 @@ public class RollDataServiceImpl extends ServiceImpl i onlineRollDataVO.setPosition(RollerPositionEnum.valueOf(rollData.getPosition())); onlineRollDataVO.setType(RollerTypeEnum.valueOf(rollData.getType())); - String lengthKey=""; - String weightKey=""; - switch(rollData.getType()){ - case "BACKUP": - lengthKey = "MAX_BUR_ROLLER_LENGTH"; - weightKey = "MAX_BUR_ROLLER_WEIGHT"; - break; - case "INTERMEDIATE": - lengthKey = "MAX_INTERMEDIATE_ROLLER_LENGTH"; - weightKey = "MAX_INTERMEDIATE_ROLLER_WEIGHT"; - break; - case "WORK": - lengthKey = "MAX_WORK_ROLLER_LENGTH"; - weightKey = "MAX_WORK_ROLLER_WEIGHT"; - break; - } - //轧制长度,轧制重量 - if(plantConfigMap.containsKey(lengthKey)){ - PlantConfig plantConfig = plantConfigMap.get(lengthKey); - double value = Double.parseDouble(plantConfig.getValue()); - onlineRollDataVO.setUsableLength(value); - onlineRollDataVO.setLeftLength(value-onlineRollDataVO.getRolledWeight()); - } - if(plantConfigMap.containsKey(weightKey)){ - PlantConfig plantConfig = plantConfigMap.get(weightKey); - double value = Double.parseDouble(plantConfig.getValue()); - onlineRollDataVO.setRolledWeight(value); - onlineRollDataVO.setLeftLength(value-onlineRollDataVO.getRolledWeight()); + RollChangeCycle rollChangeCycle = changeList.stream().filter(item->item.getType().equals(rollData.getType()) + &&item.getPosition().equals(rollData.getPosition())) + .findFirst() + .orElse(null); + if(rollChangeCycle!=null) + { + onlineRollDataVO.setUsableLength(rollChangeCycle.getRolledLength()); + onlineRollDataVO.setLeftLength(rollChangeCycle.getRolledLength()-onlineRollDataVO.getRolledLength()); + + onlineRollDataVO.setUsableWeight(rollChangeCycle.getRolledWeight()); + onlineRollDataVO.setLeftWeight(rollChangeCycle.getRolledWeight()-onlineRollDataVO.getRolledWeight()); } + +// String lengthKey=""; +// String weightKey=""; +// switch(rollData.getType()){ +// case "BACKUP": +// lengthKey = "MAX_BUR_ROLLER_LENGTH"; +// weightKey = "MAX_BUR_ROLLER_WEIGHT"; +// break; +// case "INTERMEDIATE": +// lengthKey = "MAX_INTERMEDIATE_ROLLER_LENGTH"; +// weightKey = "MAX_INTERMEDIATE_ROLLER_WEIGHT"; +// break; +// case "WORK": +// lengthKey = "MAX_WORK_ROLLER_LENGTH"; +// weightKey = "MAX_WORK_ROLLER_WEIGHT"; +// break; +// } +// //轧制长度,轧制重量 +// if(plantConfigMap.containsKey(lengthKey)){ +// PlantConfig plantConfig = plantConfigMap.get(lengthKey); +// double value = Double.parseDouble(plantConfig.getValue()); +// onlineRollDataVO.setUsableLength(value); +// onlineRollDataVO.setLeftLength(value-onlineRollDataVO.getRolledWeight()); +// } +// if(plantConfigMap.containsKey(weightKey)){ +// PlantConfig plantConfig = plantConfigMap.get(weightKey); +// double value = Double.parseDouble(plantConfig.getValue()); +// onlineRollDataVO.setRolledWeight(value); +// onlineRollDataVO.setLeftLength(value-onlineRollDataVO.getRolledWeight()); +// } readyRollDataVOList.add(onlineRollDataVO); } return readyRollDataVOList; @@ -194,9 +205,9 @@ public class RollDataServiceImpl extends ServiceImpl i .grindCount(0) .build()); //更新辊径、凸度和粗糙度 - temp.setDiameter(temp.getDiameter()); - temp.setCrown(temp.getCrown()); - temp.setRough(temp.getRough()); + temp.setDiameter(item.getDiameter()); + temp.setCrown(item.getCrown()); + temp.setRough(item.getRough()); temp.setStatus("STANDBY"); newDataList.add(temp); }); @@ -349,21 +360,21 @@ public class RollDataServiceImpl extends ServiceImpl i if(plantConfigMap.containsKey(maxValueKey)){ double value = Double.parseDouble(plantConfigMap.get(maxValueKey).getValue()); if(rollDia1>value||rollDia2>value){ - result.add(String.format("%s辊径超限[max:{1}]",name,value)); + result.add(String.format("%s辊径超限[max:%.2f]",name,value)); } } //最小值 if(plantConfigMap.containsKey(minValueKey)){ double value = Double.parseDouble(plantConfigMap.get(minValueKey).getValue()); if(rollDia1value){ - result.add(String.format("{%s辊径超限[diff:{1}]",name,value)); + result.add(String.format("{%s辊径超限[diff:%.2f]",name,value)); } } }