|
@@ -2,18 +2,17 @@ package org.jeecg.modules.billetActual.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.billetActual.entity.*;
|
|
|
-import org.jeecg.modules.billetActual.mapper.BilletBasicInfoMapper;
|
|
|
-import org.jeecg.modules.billetActual.mapper.BilletHotsendChangeShiftMapper;
|
|
|
-import org.jeecg.modules.billetActual.mapper.BilletHotsendMapper;
|
|
|
-import org.jeecg.modules.billetActual.mapper.BilletRulerConfigMapper;
|
|
|
+import org.jeecg.modules.billetActual.mapper.*;
|
|
|
import org.jeecg.modules.billetActual.service.IBilletBasicInfoService;
|
|
|
import org.jeecg.modules.heatsActuals.entity.HeatsActuals;
|
|
|
import org.jeecg.modules.heatsActuals.mapper.HeatsActualsMapper;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -49,6 +48,9 @@ public class BilletBasicInfoServiceImpl extends ServiceImpl<BilletBasicInfoMappe
|
|
|
|
|
|
@Autowired
|
|
|
BilletHotsendChangeShiftMapper billetHotsendChangeShiftMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ BilletBasicInfoExceptionMapper billetBasicInfoExceptionMapper;
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void addC(BilletBasicInfo billetBasicInfo) {
|
|
@@ -77,7 +79,7 @@ public class BilletBasicInfoServiceImpl extends ServiceImpl<BilletBasicInfoMappe
|
|
|
Integer length = strandLengthMap.get(strandNo);
|
|
|
billetBasicInfo.setLength(length);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
log.info("{}{}", "start钢坯基础信息接收到mqtt消息,开始处理逻辑:", DateUtils.date2Str(new Date(), DateUtils.datetimeFormat.get()));
|
|
|
String classShiftGroup = String.format("class:shift:group:%s", billetBasicInfo.getCcmNo()); // 班组
|
|
|
String classShift = String.format("class:shift:%s", billetBasicInfo.getCcmNo()); // 班别
|
|
@@ -117,7 +119,26 @@ public class BilletBasicInfoServiceImpl extends ServiceImpl<BilletBasicInfoMappe
|
|
|
billetBasicInfo.setShift(classShiftStr);
|
|
|
billetBasicInfo.setBrandNum(brandNumStr);
|
|
|
billetBasicInfo.setShiftGroup(classShiftGroupStr);
|
|
|
-
|
|
|
+ // 判断组批号是否为空,不为空时,通过组批号查询钢坯实绩总数,超过4条,重置组批号并保存到钢坯异常表
|
|
|
+ if (oConvertUtils.isNotEmpty(billetBasicInfo.getAssemblyNumber())) {
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryAssemblyNumberWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryAssemblyNumberWrapper.eq(BilletBasicInfo::getCcmNo, billetBasicInfo.getCcmNo());
|
|
|
+ queryAssemblyNumberWrapper.eq(BilletBasicInfo::getAssemblyNumber, billetBasicInfo.getAssemblyNumber());
|
|
|
+ // 查询该组批号下的钢坯实绩总数
|
|
|
+ long count = baseMapper.selectCount(queryAssemblyNumberWrapper);
|
|
|
+ if (count > 4){
|
|
|
+ BilletBasicInfoException billetBasicInfoException = new BilletBasicInfoException();
|
|
|
+ BeanUtils.copyProperties(billetBasicInfo, billetBasicInfoException);
|
|
|
+ billetBasicInfoException.setId(String.valueOf(IdWorker.getId()));
|
|
|
+ String timeStamp = String.valueOf(System.currentTimeMillis());
|
|
|
+ String assemblyNumber = billetBasicInfo.getAssemblyNumber();
|
|
|
+ String timestampSuffix = timeStamp.substring(timeStamp.length() - 7);
|
|
|
+ String newAssemblyNumber = assemblyNumber.substring(0, 8) + timestampSuffix;
|
|
|
+ billetBasicInfoException.setAssemblyNumber(newAssemblyNumber);
|
|
|
+ billetBasicInfoExceptionMapper.insert(billetBasicInfoException);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
log.info("{}{}", "新增钢坯实绩时班组班别:", billetBasicInfo.getShiftGroup() + " " + billetBasicInfo.getShift());
|
|
|
baseMapper.insert(billetBasicInfo);
|
|
|
|