|
@@ -39,6 +39,7 @@ import org.jeecg.modules.billet.billetOriginalProductRecord.vo.LengthCountVO;
|
|
|
import org.jeecg.modules.billet.storageBill.entity.HeatsActualsInfo;
|
|
|
import org.jeecg.modules.billet.storageBill.entity.StorageBillPrint;
|
|
|
import org.jeecg.modules.billet.storageBill.service.IStorageBillPrintService;
|
|
|
+import org.jeecg.modules.carUnit.service.ISysDictService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -81,6 +82,10 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
|
|
|
@Autowired
|
|
|
private IStorageBillPrintService storageBillPrintService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysDictService sysDictService;
|
|
|
+
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -336,20 +341,43 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
@ApiOperation("送样卡获取定尺支数明细表")
|
|
|
@GetMapping("/lengthDetailsTable")
|
|
|
public Result<List<LengthCountVO>> getLengthDetailsTable(LengthCountQueryDTO queryDTO) {
|
|
|
- if (queryDTO == null || StringUtils.isBlank(queryDTO.getCcmNo()) || StringUtils.isBlank(queryDTO.getChangeShiftId())) {
|
|
|
+ if (queryDTO == null || StringUtils.isBlank(queryDTO.getCcmNo())) {
|
|
|
return Result.error("参数不能为空");
|
|
|
}
|
|
|
|
|
|
- LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(BilletHotsendChangeShift::getId, queryDTO.getChangeShiftId())
|
|
|
- .eq(BilletHotsendChangeShift::getCcmNo, queryDTO.getCcmNo());
|
|
|
+ String shiftGroup = "";
|
|
|
+ String shift = "";
|
|
|
+ BilletHotsendChangeShift billetHotsendChangeShift;
|
|
|
|
|
|
- BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
- if (billetHotsendChangeShift == null) {
|
|
|
- log.info("查询班次信息失败,交班记录为空!失败时间:{}", new Date());
|
|
|
- return Result.OK(Collections.emptyList());
|
|
|
- }
|
|
|
+ if(oConvertUtils.isEmpty(queryDTO.getChangeShiftId())){
|
|
|
+ // 从 Redis 获取班次信息
|
|
|
+ String classShiftGroup = String.format("class:shift:group:%s", queryDTO.getCcmNo()); // 班组
|
|
|
+ String classShift = String.format("class:shift:%s",queryDTO.getCcmNo()); // 班别
|
|
|
+ shift = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)) : "";
|
|
|
+ shiftGroup = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)) : "";
|
|
|
+ // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
|
|
|
+ LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, queryDTO.getCcmNo())
|
|
|
+ .eq(BilletHotsendChangeShift::getShift, shift)
|
|
|
+ .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
|
|
|
+ .orderByDesc(BilletHotsendChangeShift::getCreateTime)
|
|
|
+ .last("limit 1");
|
|
|
+ billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
+ if (billetHotsendChangeShift == null){
|
|
|
+ log.info("查询班次信息失败,交班记录为空!失败时间:{}", new Date());
|
|
|
+ return Result.OK(Collections.emptyList());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(BilletHotsendChangeShift::getId, queryDTO.getChangeShiftId())
|
|
|
+ .eq(BilletHotsendChangeShift::getCcmNo, queryDTO.getCcmNo());
|
|
|
|
|
|
+ billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
+ if (billetHotsendChangeShift == null) {
|
|
|
+ log.info("查询班次信息失败,交班记录为空!失败时间:{}", new Date());
|
|
|
+ return Result.OK(Collections.emptyList());
|
|
|
+ }
|
|
|
+ }
|
|
|
QueryWrapper<BilletOriginalProductRecord> queryWrapperB = new QueryWrapper<>();
|
|
|
queryWrapperB.eq("ccm_no", queryDTO.getCcmNo())
|
|
|
.eq("shift", billetHotsendChangeShift.getShift())
|
|
@@ -369,6 +397,10 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
JsonNode root = objectMapper.readTree(json);
|
|
|
LengthCountVO vo = new LengthCountVO();
|
|
|
vo.setHeatNo(record.getHeatNo());
|
|
|
+ String brandNum = Optional.ofNullable(record.getGrade())
|
|
|
+ .map(bn -> sysDictService.queryDictTextByKey("billet_spec", bn))
|
|
|
+ .orElseGet(() -> sysDictService.queryDictTextByKey("billet_spec", "5"));
|
|
|
+ vo.setBrandNum(brandNum);
|
|
|
|
|
|
for (Iterator<Map.Entry<String, JsonNode>> it = root.fields(); it.hasNext(); ) {
|
|
|
Map.Entry<String, JsonNode> entry = it.next();
|
|
@@ -866,4 +898,5 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
record.setRemark(record.getRemark());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|