|
@@ -3,15 +3,24 @@ package org.jeecg.modules.actualControl.heatsActuals.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
|
|
|
+import org.jeecg.modules.actualControl.billetActual.billetActual.mapper.BilletBasicInfoMapper;
|
|
|
+import org.jeecg.modules.actualControl.heatsActuals.dto.BilletQueryDTO;
|
|
|
import org.jeecg.modules.actualControl.heatsActuals.entity.BilletSendRecord;
|
|
|
import org.jeecg.modules.actualControl.heatsActuals.entity.HeatsActuals;
|
|
|
import org.jeecg.modules.actualControl.heatsActuals.mapper.BilletSendRecordMapper;
|
|
|
import org.jeecg.modules.actualControl.heatsActuals.mapper.HeatsActualsMapper;
|
|
|
import org.jeecg.modules.actualControl.heatsActuals.service.IBilletSendRecordService;
|
|
|
+import org.jeecg.modules.actualControl.heatsActuals.vo.BilletQueryVO;
|
|
|
+import org.jeecg.modules.carUnit.service.ISysDictService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
* @Description: 钢坯接收记录
|
|
@@ -30,6 +39,12 @@ public class BilletSendRecordServiceImpl extends ServiceImpl<BilletSendRecordMap
|
|
|
@Autowired
|
|
|
private BilletSendProcessor billetSendProcessor;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private BilletBasicInfoMapper billetBasicInfoMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysDictService sysDictService;
|
|
|
+
|
|
|
@Override
|
|
|
public void sendHeatsActuals() {
|
|
|
//查询出所有未完成推送的数据
|
|
@@ -45,4 +60,51 @@ public class BilletSendRecordServiceImpl extends ServiceImpl<BilletSendRecordMap
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public BilletQueryVO getBilletQueryVO(BilletQueryDTO queryDTO) {
|
|
|
+ // 参数校验
|
|
|
+ if (oConvertUtils.isEmpty(queryDTO.getHeatNo()) && oConvertUtils.isEmpty(queryDTO.getStrandNo())) {
|
|
|
+ throw new IllegalArgumentException("参数异常:炉号和流号不能同时为空!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 默认表名处理
|
|
|
+ String belongTable = StringUtils.hasText(queryDTO.getBelongTable())
|
|
|
+ ? queryDTO.getBelongTable()
|
|
|
+ : "roll_club_one";
|
|
|
+
|
|
|
+ // 构建查询条件
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(BilletBasicInfo::getHeatNo, queryDTO.getHeatNo())
|
|
|
+ .eq(BilletBasicInfo::getStrandNo, queryDTO.getStrandNo())
|
|
|
+ .eq(BilletBasicInfo::getBelongTable, belongTable)
|
|
|
+ .orderByDesc(BilletBasicInfo::getCreateTime)
|
|
|
+ .last("LIMIT 1");
|
|
|
+
|
|
|
+ // 执行查询
|
|
|
+ BilletBasicInfo billetBasicInfo = billetBasicInfoMapper.selectOne(queryWrapper);
|
|
|
+
|
|
|
+ if (billetBasicInfo == null) {
|
|
|
+ throw new IllegalStateException("未查询到对应钢坯信息,请确认炉号、流号是否正确!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 钢种牌号处理
|
|
|
+ String brandNum = Optional.ofNullable(billetBasicInfo.getBrandNum())
|
|
|
+ .map(bn -> sysDictService.queryDictTextByKey("billet_spec", bn))
|
|
|
+ .orElseGet(() -> sysDictService.queryDictTextByKey("billet_spec", "5"));
|
|
|
+
|
|
|
+ // 构建返回对象
|
|
|
+ BilletQueryVO billetQueryVO = new BilletQueryVO();
|
|
|
+ billetQueryVO.setBilletNo(billetBasicInfo.getBilletNo());
|
|
|
+ billetQueryVO.setSteelGrade(brandNum);
|
|
|
+ billetQueryVO.setLength(billetBasicInfo.getLength());
|
|
|
+
|
|
|
+ // 重量转 BigDecimal,考虑 null 情况
|
|
|
+ Double billetWeight = billetBasicInfo.getBilletWeight();
|
|
|
+ BigDecimal weight = billetWeight != null ? BigDecimal.valueOf(billetWeight) : BigDecimal.ZERO;
|
|
|
+ billetQueryVO.setPerWeight(weight);
|
|
|
+
|
|
|
+ return billetQueryVO;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|