Преглед изворни кода

历史班次炉次浇筑信息

qiangxuan пре 3 недеља
родитељ
комит
f12f7da7ec

+ 34 - 21
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/controller/StorageBillController.java

@@ -1835,39 +1835,52 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 		return Result.OK(result);
 	}
 
-	@ApiOperation(value="当班炉次浇筑信息查询", notes="当班炉次浇筑信息查询")
+	@ApiOperation(value="炉次浇筑信息查询", notes="炉次浇筑信息查询")
 	@GetMapping(value = "/queryHeatsActualsByCcmNo")
-	public Result<List<HeatsActualsInfo>> queryHeatsActualsByCcmNo(@RequestParam(name="ccmNo", required = true) String ccmNo) {
+	public Result<List<HeatsActualsInfo>> queryHeatsActualsByCcmNo(@RequestParam(name="ccmNo", required = false) String ccmNo,
+																   @RequestParam(name="changeShiftId", required = false) String changeShiftId,
+																   @RequestParam(name="queryType", required = true) String queryType) {
 
 		List<HeatsActualsInfo> heatsActualsInfoList = new ArrayList<>();
+		BilletHotsendChangeShift billetHotsendChangeShift;
+		if ("1".equals(queryType)){
+			String classShiftGroup = String.format("class:shift:group:%s", ccmNo); // 班组
+			String classShift = String.format("class:shift:%s",ccmNo); // 班别
+			String shift = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)) : "";
+			String shiftGroup = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)) : "";
+			// 根据ccmNo、shift、shiftGroup查询最新的交班记录
+			LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+			queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+					.eq(BilletHotsendChangeShift::getShift, shift)
+					.eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+					.isNull(BilletHotsendChangeShift::getChangeShiftTime)
+					.orderByDesc(BilletHotsendChangeShift::getCreateTime)
+					.last("limit 1");
+			billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+		}else {
+			billetHotsendChangeShift = billetHotsendChangeShiftService.getById(changeShiftId);
+		}
 
-		String classShiftGroup = String.format("class:shift:group:%s", ccmNo); // 班组
-		String classShift = String.format("class:shift:%s",ccmNo); // 班别
-		String shift = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)) : "";
-		String shiftGroup = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)) : "";
-		// 根据ccmNo、shift、shiftGroup查询最新的交班记录
-		LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-		queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-				.eq(BilletHotsendChangeShift::getShift, shift)
-				.eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-				.isNull(BilletHotsendChangeShift::getChangeShiftTime)
-				.orderByDesc(BilletHotsendChangeShift::getCreateTime)
-				.last("limit 1");
-		BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
 		if (billetHotsendChangeShift ==	null){
-			log.info("{}{}", "查询当班浇筑信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+			log.info("{}{}", "查询浇筑信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
 			return Result.OK(heatsActualsInfoList);
 		}
+		String shift = billetHotsendChangeShift.getShift();
+		String shiftGroup = billetHotsendChangeShift.getShiftGroup();
 		//根据ccmNo、shift、shiftGroup、大于billetHotsendChangeShift的创建时间 查询所有炉次传递单BilletHotsend
 		LambdaQueryWrapper<BilletHotsend> queryWrapper1 = new LambdaQueryWrapper<>();
 		queryWrapper1.eq(BilletHotsend::getCcmNo, ccmNo)
 				.eq(BilletHotsend::getShift, shift)
-				.eq(BilletHotsend::getShiftGroup, shiftGroup)
-				.between(BilletHotsend::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date())
-				.orderByDesc(BilletHotsend::getCreateTime);
+				.eq(BilletHotsend::getShiftGroup, shiftGroup);
+		if ("1".equals(queryType)){
+			queryWrapper1.between(BilletHotsend::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+		}else {
+			queryWrapper1.between(BilletHotsend::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
+		}
+		queryWrapper1.orderByDesc(BilletHotsend::getCreateTime);
 		List<BilletHotsend> billetHotsendList = billetHotsendBaseService.list(queryWrapper1);
 		if (oConvertUtils.listIsEmpty(billetHotsendList)){
-			log.info("{}{}", "查询当班浇筑信息失败,炉次传递单为空!", ccmNo + "失败时间:" + new Date());
+			log.info("{}{}", "查询浇筑信息失败,炉次传递单为空!", ccmNo + "失败时间:" + new Date());
 			return Result.OK(heatsActualsInfoList);
 		}
 		billetHotsendList.forEach(x -> {
@@ -1882,7 +1895,7 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 					.eq(BilletBasicInfo::getShiftGroup, x.getShiftGroup());
 			List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper2);
 			if (oConvertUtils.listIsEmpty(billetBasicInfoList)){
-				log.info("{}{}", "查询当班浇筑信息失败,钢坯实绩信息为空!", x.getCcmNo() + "失败时间:" + new Date());
+				log.info("{}{}", "查询浇筑信息失败,钢坯实绩信息为空!", x.getCcmNo() + "失败时间:" + new Date());
 				return;
 			}
 			// 统计各流号的数量