feat():补充换道次逻辑以及轧辊上限逻辑

This commit is contained in:
Penknife
2025-01-14 14:27:07 +08:00
parent d7d27bd6ba
commit 54a94df908
2 changed files with 61 additions and 44 deletions

View File

@@ -29,7 +29,9 @@ public class RabbitQueueListener {
@Resource @Resource
ModSetupResultService modSetupResultService; ModSetupResultService modSetupResultService;
private Double LastRolledLength = 0d; private double LastRolledLength = 0d;
private int LastPassNo = -1;
// @RabbitListener(queues = CommonConstants.RabbitMQ.RECEIVE_MODEL) // @RabbitListener(queues = CommonConstants.RabbitMQ.RECEIVE_MODEL)
// @RabbitHandler // @RabbitHandler
// public void onHmiMessage(String message) { // public void onHmiMessage(String message) {
@@ -48,11 +50,15 @@ public class RabbitQueueListener {
if(Math.abs(LastRolledLength-rolledLength)<1){ if(Math.abs(LastRolledLength-rolledLength)<1){
return; return;
} }
if(LastRolledLength-rolledLength>300) { int passNo = Integer.parseInt(
JSONUtil.parse(message).getByPath("passNo").toString()
);
if(LastPassNo!=passNo) {
measureList = Lists.newArrayList(); measureList = Lists.newArrayList();
} }
measureList.add(message); measureList.add(message);
LastRolledLength=rolledLength; LastRolledLength=rolledLength;
LastPassNo = passNo;
//socket //socket
WebSocketUtil.sendMessage(WsTypeEnum.track_measure,message); WebSocketUtil.sendMessage(WsTypeEnum.track_measure,message);
} }

View File

@@ -7,15 +7,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fizz.business.constants.CommonConstants; import com.fizz.business.constants.CommonConstants;
import com.fizz.business.constants.enums.RollerPositionEnum; import com.fizz.business.constants.enums.RollerPositionEnum;
import com.fizz.business.constants.enums.RollerTypeEnum; import com.fizz.business.constants.enums.RollerTypeEnum;
import com.fizz.business.domain.PlantConfig; import com.fizz.business.domain.*;
import com.fizz.business.domain.RollData;
import com.fizz.business.domain.RollHistory;
import com.fizz.business.domain.ShiftHistory;
import com.fizz.business.mapper.RollDataMapper; import com.fizz.business.mapper.RollDataMapper;
import com.fizz.business.service.PlantConfigService; import com.fizz.business.service.*;
import com.fizz.business.service.RollDataService;
import com.fizz.business.service.RollHistoryService;
import com.fizz.business.service.ShiftHistoryService;
import com.fizz.business.vo.OnlineRollDataVO; import com.fizz.business.vo.OnlineRollDataVO;
import com.fizz.business.vo.ReadyRollDataVO; import com.fizz.business.vo.ReadyRollDataVO;
@@ -51,6 +45,9 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
@Resource @Resource
RabbitTemplate rabbitTemplate; RabbitTemplate rabbitTemplate;
@Resource
RollChangeCycleService rollChangeCycleService;
@Override @Override
public List<RollData> getList(String position,String type,String status) { public List<RollData> getList(String position,String type,String status) {
QueryWrapper<RollData> queryWrapper = new QueryWrapper<>(); QueryWrapper<RollData> queryWrapper = new QueryWrapper<>();
@@ -109,6 +106,7 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
List<OnlineRollDataVO> readyRollDataVOList = new ArrayList<>(); List<OnlineRollDataVO> readyRollDataVOList = new ArrayList<>();
List<RollData> rollDataList = getList(null, null,"ONLINE"); List<RollData> rollDataList = getList(null, null,"ONLINE");
List<RollChangeCycle> changeList = rollChangeCycleService.list();
for (RollData rollData : rollDataList) { for (RollData rollData : rollDataList) {
OnlineRollDataVO onlineRollDataVO = new OnlineRollDataVO(); OnlineRollDataVO onlineRollDataVO = new OnlineRollDataVO();
// 使用 BeanUtils 复制属性 // 使用 BeanUtils 复制属性
@@ -116,35 +114,48 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
onlineRollDataVO.setPosition(RollerPositionEnum.valueOf(rollData.getPosition())); onlineRollDataVO.setPosition(RollerPositionEnum.valueOf(rollData.getPosition()));
onlineRollDataVO.setType(RollerTypeEnum.valueOf(rollData.getType())); onlineRollDataVO.setType(RollerTypeEnum.valueOf(rollData.getType()));
String lengthKey=""; RollChangeCycle rollChangeCycle = changeList.stream().filter(item->item.getType().equals(rollData.getType())
String weightKey=""; &&item.getPosition().equals(rollData.getPosition()))
switch(rollData.getType()){ .findFirst()
case "BACKUP": .orElse(null);
lengthKey = "MAX_BUR_ROLLER_LENGTH"; if(rollChangeCycle!=null)
weightKey = "MAX_BUR_ROLLER_WEIGHT"; {
break; onlineRollDataVO.setUsableLength(rollChangeCycle.getRolledLength());
case "INTERMEDIATE": onlineRollDataVO.setLeftLength(rollChangeCycle.getRolledLength()-onlineRollDataVO.getRolledLength());
lengthKey = "MAX_INTERMEDIATE_ROLLER_LENGTH";
weightKey = "MAX_INTERMEDIATE_ROLLER_WEIGHT"; onlineRollDataVO.setUsableWeight(rollChangeCycle.getRolledWeight());
break; onlineRollDataVO.setLeftWeight(rollChangeCycle.getRolledWeight()-onlineRollDataVO.getRolledWeight());
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());
} }
// 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); readyRollDataVOList.add(onlineRollDataVO);
} }
return readyRollDataVOList; return readyRollDataVOList;
@@ -194,9 +205,9 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
.grindCount(0) .grindCount(0)
.build()); .build());
//更新辊径、凸度和粗糙度 //更新辊径、凸度和粗糙度
temp.setDiameter(temp.getDiameter()); temp.setDiameter(item.getDiameter());
temp.setCrown(temp.getCrown()); temp.setCrown(item.getCrown());
temp.setRough(temp.getRough()); temp.setRough(item.getRough());
temp.setStatus("STANDBY"); temp.setStatus("STANDBY");
newDataList.add(temp); newDataList.add(temp);
}); });
@@ -349,21 +360,21 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
if(plantConfigMap.containsKey(maxValueKey)){ if(plantConfigMap.containsKey(maxValueKey)){
double value = Double.parseDouble(plantConfigMap.get(maxValueKey).getValue()); double value = Double.parseDouble(plantConfigMap.get(maxValueKey).getValue());
if(rollDia1>value||rollDia2>value){ 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)){ if(plantConfigMap.containsKey(minValueKey)){
double value = Double.parseDouble(plantConfigMap.get(minValueKey).getValue()); double value = Double.parseDouble(plantConfigMap.get(minValueKey).getValue());
if(rollDia1<value||rollDia2<value){ if(rollDia1<value||rollDia2<value){
result.add(String.format("%s辊径超限[min{1}]",name,value)); result.add(String.format("%s辊径超限[min%.2f]",name,value));
} }
} }
//差值 //差值
if(plantConfigMap.containsKey(diffValueKey)){ if(plantConfigMap.containsKey(diffValueKey)){
double value = Double.parseDouble(plantConfigMap.get(diffValueKey).getValue()); double value = Double.parseDouble(plantConfigMap.get(diffValueKey).getValue());
if(Math.abs(rollDia1-rollDia2)>value){ if(Math.abs(rollDia1-rollDia2)>value){
result.add(String.format("{%s辊径超限[diff{1}]",name,value)); result.add(String.format("{%s辊径超限[diff%.2f]",name,value));
} }
} }
} }