소스 검색

当班浇筑炉次查询添加上个班次的最新两炉炉次信息

qiangxuan 3 주 전
부모
커밋
b2f0e9ff92
1개의 변경된 파일27개의 추가작업 그리고 0개의 파일을 삭제
  1. 27 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/controller/StorageBillController.java

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

@@ -1846,7 +1846,10 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 																   @RequestParam(name="queryType", required = true) String queryType) {
 
 		List<HeatsActualsInfo> heatsActualsInfoList = new ArrayList<>();
+		// 当班
 		BilletHotsendChangeShift billetHotsendChangeShift;
+		// 上一个班次
+		BilletHotsendChangeShift lastBilletHotsendChangeShift = new BilletHotsendChangeShift();
 		if ("1".equals(queryType)){
 			String classShiftGroup = String.format("class:shift:group:%s", ccmNo); // 班组
 			String classShift = String.format("class:shift:%s",ccmNo); // 班别
@@ -1861,6 +1864,14 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 					.orderByDesc(BilletHotsendChangeShift::getCreateTime)
 					.last("limit 1");
 			billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+
+			// 根据ccmNo、billetHotsendChangeShift不为空的,创建时间倒序 取最新的一条交班记录为当班的上一个班次
+			LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapperLast = new LambdaQueryWrapper<>();
+			queryWrapperLast.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+					.isNotNull(BilletHotsendChangeShift::getChangeShiftTime)
+					.orderByDesc(BilletHotsendChangeShift::getCreateTime)
+					.last("limit 1");
+			lastBilletHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapperLast);
 		}else {
 			billetHotsendChangeShift = billetHotsendChangeShiftService.getById(changeShiftId);
 		}
@@ -1887,6 +1898,22 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 			log.info("{}{}", "查询浇筑信息失败,炉次传递单为空!", ccmNo + "失败时间:" + new Date());
 			return Result.OK(heatsActualsInfoList);
 		}
+		List<BilletHotsend> billetHotsendListLast = new ArrayList<>();
+		// 上一个班组的炉次传递单最新的2炉信息
+		if ("1".equals(queryType) && lastBilletHotsendChangeShift != null){
+			LambdaQueryWrapper<BilletHotsend> queryWrapperLast = new LambdaQueryWrapper<>();
+			queryWrapperLast.eq(BilletHotsend::getCcmNo, ccmNo)
+					.eq(BilletHotsend::getShift, lastBilletHotsendChangeShift.getShift())
+					.eq(BilletHotsend::getShiftGroup, lastBilletHotsendChangeShift.getShiftGroup())
+					.orderByDesc(BilletHotsend::getCreateTime)
+					.last("limit 2");
+			billetHotsendListLast = billetHotsendBaseService.list(queryWrapperLast);
+		}
+		if(oConvertUtils.listIsNotEmpty(billetHotsendListLast)){
+			billetHotsendList.addAll(billetHotsendListLast);
+			// 按创建时间倒序排序
+			billetHotsendList.sort(Comparator.comparing(BilletHotsend::getCreateTime).reversed());
+		}
 		billetHotsendList.forEach(x -> {
 			HeatsActualsInfo heatsActualsInfo = new HeatsActualsInfo();
 			heatsActualsInfo.setHeatNo(x.getHeatNo());