Browse Source

历史当班明细记录查询

qiangxuan 3 months ago
parent
commit
ed7e7276ed
19 changed files with 614 additions and 293 deletions
  1. 27 24
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/service/impl/BilletHotsendChangeShiftServiceImpl.java
  2. 3 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/controller/RollClubOneController.java
  3. 1 1
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/service/IRollClubOneService.java
  4. 49 22
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/service/impl/RollClubOneServiceImpl.java
  5. 3 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/controller/RollClubThreeController.java
  6. 1 1
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/service/IRollClubThreeService.java
  7. 50 22
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/service/impl/RollClubThreeServiceImpl.java
  8. 3 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/controller/RollClubTwoController.java
  9. 1 1
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/service/IRollClubTwoService.java
  10. 51 22
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/service/impl/RollClubTwoServiceImpl.java
  11. 3 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/controller/RollHeightController.java
  12. 1 1
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/service/IRollHeightService.java
  13. 53 24
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/service/impl/RollHeightServiceImpl.java
  14. 3 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/controller/RollOutShippController.java
  15. 1 1
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/service/IRollOutShippService.java
  16. 50 22
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/service/impl/RollOutShippServiceImpl.java
  17. 15 10
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/controller/StorageBillController.java
  18. 5 7
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/IStorageBillService.java
  19. 294 125
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/impl/StorageBillServiceImpl.java

+ 27 - 24
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/service/impl/BilletHotsendChangeShiftServiceImpl.java

@@ -48,31 +48,34 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
         redisTemplate.opsForValue().set(keyShiftGroup, billetHotsendChangeShiftVo.getShiftGroup());
         redisTemplate.opsForValue().set(keyShift, billetHotsendChangeShiftVo.getShift());
         // 获取当前班组班别
-        List<BilletHotsendChangeShift> billetHotsendChangeShiftList = baseMapper.selectList(new LambdaQueryWrapper<BilletHotsendChangeShift>()
+        BilletHotsendChangeShift billetHotsendChangeShift = baseMapper.selectOne(new LambdaQueryWrapper<BilletHotsendChangeShift>()
                 .eq(BilletHotsendChangeShift::getCcmNo, billetHotsendChangeShiftVo.getCcmNo())
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime));
-        if (oConvertUtils.listIsNotEmpty(billetHotsendChangeShiftList)){
-            BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftList.stream().findFirst().orElse(null);
-            // 获取当前最新炉号
-            BilletBasicInfo billetBasicInfo = billetBasicInfoService.list(new LambdaQueryWrapper<BilletBasicInfo>().orderByDesc(BilletBasicInfo::getCreateTime)).stream().findFirst().orElse(null);
-            if (oConvertUtils.isNotEmpty(billetBasicInfo)){
-                // 根据当前炉号、铸机号、班组、班别查询总生产的钢坯数
-                LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<BilletBasicInfo>()
-                        .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsendChangeShiftVo.getCcmNo()))
-                        .eq(BilletBasicInfo::getHeatNo, billetBasicInfo.getHeatNo())
-                        .eq(BilletBasicInfo::getShift, billetHotsendChangeShift.getShift())
-                        .eq(BilletBasicInfo::getShiftGroup, billetHotsendChangeShift.getShiftGroup())
-                        .orderByDesc(BilletBasicInfo::getCreateTime);
-                List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper);
-                if (oConvertUtils.listIsNotEmpty(billetBasicInfoList)){
-                    List<BilletBasicInfo> updateBilletBasicInfo = extractRemainderData(billetBasicInfoList);
-                    updateBilletBasicInfo.forEach(x ->{
-                        x.setShift(billetHotsendChangeShiftVo.getShift());
-                        x.setShiftGroup(billetHotsendChangeShiftVo.getShiftGroup());
-                        x.setUpdateTime(new Date());
-                    });
-                    billetBasicInfoService.saveOrUpdateBatch(updateBilletBasicInfo);
-                }
+                .orderByDesc(BilletHotsendChangeShift::getCreateTime).last("limit 1"));
+        if (oConvertUtils.isEmpty(billetHotsendChangeShift)){
+            result.put("fail", "当班查询为空,交班操作失败!");
+        }
+        // 更新当前班次的更新时间,相当于上一个班交班的结束时间
+        billetHotsendChangeShift.setUpdateTime(new Date());
+        baseMapper.updateById(billetHotsendChangeShift);
+        // 获取当前最新炉号
+        BilletBasicInfo billetBasicInfo = billetBasicInfoService.list(new LambdaQueryWrapper<BilletBasicInfo>().orderByDesc(BilletBasicInfo::getCreateTime)).stream().findFirst().orElse(null);
+        if (oConvertUtils.isNotEmpty(billetBasicInfo)){
+            // 根据当前炉号、铸机号、班组、班别查询总生产的钢坯数
+            LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<BilletBasicInfo>()
+                    .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsendChangeShiftVo.getCcmNo()))
+                    .eq(BilletBasicInfo::getHeatNo, billetBasicInfo.getHeatNo())
+                    .eq(BilletBasicInfo::getShift, billetHotsendChangeShift.getShift())
+                    .eq(BilletBasicInfo::getShiftGroup, billetHotsendChangeShift.getShiftGroup())
+                    .orderByDesc(BilletBasicInfo::getCreateTime);
+            List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper);
+            if (oConvertUtils.listIsNotEmpty(billetBasicInfoList)){
+                List<BilletBasicInfo> updateBilletBasicInfo = extractRemainderData(billetBasicInfoList);
+                updateBilletBasicInfo.forEach(x ->{
+                    x.setShift(billetHotsendChangeShiftVo.getShift());
+                    x.setShiftGroup(billetHotsendChangeShiftVo.getShiftGroup());
+                    x.setUpdateTime(new Date());
+                });
+                billetBasicInfoService.saveOrUpdateBatch(updateBilletBasicInfo);
             }
         }
 

+ 3 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/controller/RollClubOneController.java

@@ -167,8 +167,9 @@ public class RollClubOneController {
 
 	 @ApiOperation(value="当班轧钢棒一-通过铸机号班组班别查询", notes="轧钢棒一-通过铸机号班组班别查询")
 	 @GetMapping(value = "/queryOnDutyRollClubOneByCcmNo")
-	 public Result<DestinationStatistics> queryOnDutyByCcmNo(@RequestParam(name="ccmNo") String ccmNo) {
-		 DestinationStatistics destinationStatistics = rollClubOneService.queryOnDutyByCcmNo(ccmNo);
+	 public Result<DestinationStatistics> queryOnDutyByCcmNo(@RequestParam(name="ccmNo") String ccmNo,
+															 @RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		 DestinationStatistics destinationStatistics = rollClubOneService.queryOnDutyByCcmNo(ccmNo, changeShiftId);
 		 if(destinationStatistics == null) {
 			 return Result.ok("未找到当班对应数据");
 		 }

+ 1 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/service/IRollClubOneService.java

@@ -14,5 +14,5 @@ public interface IRollClubOneService extends IService<RollClubOne> {
 
     DestinationStatistics queryByCcmNoHandle(String ccmNo);
 
-    DestinationStatistics queryOnDutyByCcmNo(String ccmNo);
+    DestinationStatistics queryOnDutyByCcmNo(String ccmNo, String changeShiftId);
 }

+ 49 - 22
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/service/impl/RollClubOneServiceImpl.java

@@ -103,32 +103,52 @@ public class RollClubOneServiceImpl extends ServiceImpl<RollClubOneMapper, RollC
     }
 
     @Override
-    public DestinationStatistics queryOnDutyByCcmNo(String ccmNo) {
+    public DestinationStatistics queryOnDutyByCcmNo(String ccmNo, String changeShiftId) {
         DestinationStatistics destinationStatistics = new DestinationStatistics();
 
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        if (oConvertUtils.isEmpty(shiftGroup) || oConvertUtils.isEmpty(shift)){
-            return destinationStatistics;
-        }
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper2 = new LambdaQueryWrapper<>();
-        queryWrapper2.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper2);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班轧钢棒一信息失败,交班记录为空!", ccmNo + "失败时间:"+ new Date());
-            return destinationStatistics;
+        String shiftGroup = "";
+        String shift = "";
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班轧钢棒一信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
+                return destinationStatistics;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询历史当班轧钢棒一信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
+                return destinationStatistics;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
         LambdaQueryWrapper<RollClubOne> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(RollClubOne::getCcmNo, ccmNo)
                     .eq(RollClubOne::getShift, shift)
-                    .eq(RollClubOne::getShiftGroup, shiftGroup)
-                    .between(RollClubOne::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                    .eq(RollClubOne::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper.between(RollClubOne::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper.between(RollClubOne::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubOne> rollClubOneList = baseMapper.selectList(queryWrapper);
         if (oConvertUtils.listIsEmpty(rollClubOneList)){
             log.info("{}{}", "查询当班轧钢棒一信息失败,棒一信息为空!", ccmNo);
@@ -146,8 +166,15 @@ public class RollClubOneServiceImpl extends ServiceImpl<RollClubOneMapper, RollC
         LambdaQueryWrapper<RollClubOneDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
         queryWrapperDetails.eq(RollClubOneDetails::getCcmNo, ccmNo)
                             .eq(RollClubOneDetails::getShift, shift)
-                            .eq(RollClubOneDetails::getShiftGroup, shiftGroup)
-                            .between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());;
+                            .eq(RollClubOneDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapperDetails.between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapperDetails.between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubOneDetails> rollClubOneDetailsList = rollClubOneDetailsService.list(queryWrapperDetails);
         if (oConvertUtils.listIsEmpty(rollClubOneDetailsList)){
             log.info("{}{}", "查询当班轧钢棒一信息失败,棒一明细信息为空!", ccmNo);

+ 3 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/controller/RollClubThreeController.java

@@ -179,8 +179,9 @@ public class RollClubThreeController {
 
 	@ApiOperation(value="当班轧钢棒三-通过铸机号班组班别查询", notes="当班轧钢棒三-通过铸机号班组班别查询")
 	@GetMapping(value = "/queryOnDutyRollClubThreeByCcmNo")
-	public Result<DestinationStatistics> queryOnDutyByCcmNo(@RequestParam(name="ccmNo") String ccmNo) {
-		DestinationStatistics destinationStatistics = rollClubThreeService.queryOnDutyByCcmNoHandle(ccmNo);
+	public Result<DestinationStatistics> queryOnDutyByCcmNo(@RequestParam(name="ccmNo") String ccmNo,
+															@RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		DestinationStatistics destinationStatistics = rollClubThreeService.queryOnDutyByCcmNoHandle(ccmNo, changeShiftId);
 		if(destinationStatistics == null) {
 			return Result.ok("未找到当班对应数据");
 		}

+ 1 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/service/IRollClubThreeService.java

@@ -14,5 +14,5 @@ public interface IRollClubThreeService extends IService<RollClubThree> {
 
     DestinationStatistics queryByCcmNoHandle(String ccmNo);
 
-    DestinationStatistics queryOnDutyByCcmNoHandle(String ccmNo);
+    DestinationStatistics queryOnDutyByCcmNoHandle(String ccmNo, String changeShiftId);
 }

+ 50 - 22
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/service/impl/RollClubThreeServiceImpl.java

@@ -119,33 +119,54 @@ public class RollClubThreeServiceImpl extends ServiceImpl<RollClubThreeMapper, R
     }
 
     @Override
-    public DestinationStatistics queryOnDutyByCcmNoHandle(String ccmNo) {
+    public DestinationStatistics queryOnDutyByCcmNoHandle(String ccmNo, String changeShiftId) {
 
         DestinationStatistics destinationStatistics = new DestinationStatistics();
 
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        if (oConvertUtils.isEmpty(shiftGroup) || oConvertUtils.isEmpty(shift)){
-            return destinationStatistics;
-        }
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper2 = new LambdaQueryWrapper<>();
-        queryWrapper2.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper2);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班棒三信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
-            return destinationStatistics;
+        String shiftGroup = "";
+        String shift = "";
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班轧钢棒三信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
+                return destinationStatistics;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询历史当班轧钢棒三信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
+                return destinationStatistics;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
+
         LambdaQueryWrapper<RollClubThree> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(RollClubThree::getCcmNo, ccmNo)
                 .eq(RollClubThree::getShift, shift)
-                .eq(RollClubThree::getShiftGroup, shiftGroup)
-                .between(RollClubThree::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollClubThree::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper.between(RollClubThree::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper.between(RollClubThree::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubThree> rollClubThreeList = baseMapper.selectList(queryWrapper);
         if (oConvertUtils.listIsEmpty(rollClubThreeList)){
             return destinationStatistics;
@@ -160,8 +181,15 @@ public class RollClubThreeServiceImpl extends ServiceImpl<RollClubThreeMapper, R
         LambdaQueryWrapper<RollClubThreeDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
         queryWrapperDetails.eq(RollClubThreeDetails::getCcmNo, ccmNo)
                             .eq(RollClubThreeDetails::getShift, shift)
-                            .eq(RollClubThreeDetails::getShiftGroup, shiftGroup)
-                            .between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                            .eq(RollClubThreeDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapperDetails.between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapperDetails.between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapperDetails);
         if (oConvertUtils.listIsEmpty(rollClubThreeDetailsList)){
             return destinationStatistics;

+ 3 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/controller/RollClubTwoController.java

@@ -174,8 +174,9 @@ public class RollClubTwoController {
 
 	@ApiOperation(value="当班轧钢棒二-通过铸机号班组班别查询", notes="当班轧钢棒二-通过铸机号班组班别查询")
 	@GetMapping(value = "/queryOnDutyRollClubTwoByCcmNo")
-	public Result<DestinationStatistics> queryOnDutyByCcmNo(@RequestParam(name="ccmNo") String ccmNo) {
-		DestinationStatistics destinationStatistics = rollClubTwoService.queryOnDutyByCcmNo(ccmNo);
+	public Result<DestinationStatistics> queryOnDutyByCcmNo(@RequestParam(name="ccmNo") String ccmNo,
+															@RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		DestinationStatistics destinationStatistics = rollClubTwoService.queryOnDutyByCcmNo(ccmNo, changeShiftId);
 		if(destinationStatistics == null) {
 			return Result.ok("未找到当班对应数据");
 		}

+ 1 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/service/IRollClubTwoService.java

@@ -14,5 +14,5 @@ public interface IRollClubTwoService extends IService<RollClubTwo> {
 
     DestinationStatistics queryByCcmNoHandle(String ccmNo);
 
-    DestinationStatistics queryOnDutyByCcmNo(String ccmNo);
+    DestinationStatistics queryOnDutyByCcmNo(String ccmNo, String changeShiftId);
 }

+ 51 - 22
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/service/impl/RollClubTwoServiceImpl.java

@@ -116,32 +116,54 @@ public class RollClubTwoServiceImpl extends ServiceImpl<RollClubTwoMapper, RollC
     }
 
     @Override
-    public DestinationStatistics queryOnDutyByCcmNo(String ccmNo) {
+    public DestinationStatistics queryOnDutyByCcmNo(String ccmNo, String changeShiftId) {
         DestinationStatistics destinationStatistics = new DestinationStatistics();
 
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        if (oConvertUtils.isEmpty(shiftGroup) || oConvertUtils.isEmpty(shift)){
-            return destinationStatistics;
-        }
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper2 = new LambdaQueryWrapper<>();
-        queryWrapper2.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper2);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班轧钢棒二信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
-            return destinationStatistics;
+        String shiftGroup = "";
+        String shift = "";
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班轧钢棒二信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
+                return destinationStatistics;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询历史当班轧钢棒二信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
+                return destinationStatistics;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
+
         LambdaQueryWrapper<RollClubTwo> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(RollClubTwo::getCcmNo, ccmNo)
                 .eq(RollClubTwo::getShift, shift)
-                .eq(RollClubTwo::getShiftGroup, shiftGroup)
-                .between(RollClubTwo::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollClubTwo::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper.between(RollClubTwo::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper.between(RollClubTwo::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
+
         List<RollClubTwo> rollClubTwoList = baseMapper.selectList(queryWrapper);
         if (oConvertUtils.listIsEmpty(rollClubTwoList)){
             return destinationStatistics;
@@ -156,8 +178,15 @@ public class RollClubTwoServiceImpl extends ServiceImpl<RollClubTwoMapper, RollC
         LambdaQueryWrapper<RollClubTwoDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
         queryWrapperDetails.eq(RollClubTwoDetails::getCcmNo, ccmNo)
                             .eq(RollClubTwoDetails::getShift, shift)
-                            .eq(RollClubTwoDetails::getShiftGroup, shiftGroup)
-                            .between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                            .eq(RollClubTwoDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapperDetails.between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapperDetails.between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapperDetails);
         if (oConvertUtils.listIsEmpty(rollClubTwoDetailsList)){
             return destinationStatistics;

+ 3 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/controller/RollHeightController.java

@@ -146,8 +146,9 @@ public class RollHeightController {
 
 	 @ApiOperation(value="当班高线统计-通过铸机号班组班别查询", notes="当班高线统计-通过铸机号班组班别查询")
 	 @GetMapping(value = "/queryOnDutyRollHeightByCcmNo")
-	 public Result<DestinationStatistics> queryOnDutyRollHeightByCcmNo(@RequestParam(name="ccmNo") String ccmNo) {
-		 DestinationStatistics destinationStatistics = rollHeightService.queryOnDutyRollHeightByCcmNo(ccmNo);
+	 public Result<DestinationStatistics> queryOnDutyRollHeightByCcmNo(@RequestParam(name="ccmNo") String ccmNo,
+																	   @RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		 DestinationStatistics destinationStatistics = rollHeightService.queryOnDutyRollHeightByCcmNo(ccmNo, changeShiftId);
 		 if(destinationStatistics == null) {
 			 return Result.ok("未找到当班对应数据");
 		 }

+ 1 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/service/IRollHeightService.java

@@ -14,5 +14,5 @@ public interface IRollHeightService extends IService<RollHeight> {
 
     DestinationStatistics queryByCcmNoHandle(String ccmNo);
 
-    DestinationStatistics queryOnDutyRollHeightByCcmNo(String ccmNo);
+    DestinationStatistics queryOnDutyRollHeightByCcmNo(String ccmNo, String changeShiftId);
 }

+ 53 - 24
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/service/impl/RollHeightServiceImpl.java

@@ -19,7 +19,10 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -104,34 +107,53 @@ public class RollHeightServiceImpl extends ServiceImpl<RollHeightMapper, RollHei
     }
 
     @Override
-    public DestinationStatistics queryOnDutyRollHeightByCcmNo(String ccmNo) {
+    public DestinationStatistics queryOnDutyRollHeightByCcmNo(String ccmNo, String changeShiftId) {
         DestinationStatistics destinationStatistics = new DestinationStatistics();
 
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        if (oConvertUtils.isEmpty(shiftGroup) || oConvertUtils.isEmpty(shift)){
-            return destinationStatistics;
-        }
-
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper2 = new LambdaQueryWrapper<>();
-        queryWrapper2.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper2);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班轧钢高线信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
-            return destinationStatistics;
+        String shiftGroup = "";
+        String shift = "";
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班轧钢高线信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+                return destinationStatistics;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询历史当班轧钢高线信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
+                return destinationStatistics;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
 
         LambdaQueryWrapper<RollHeight> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(RollHeight::getCcmNo, ccmNo)
                 .eq(RollHeight::getShiftGroup, shiftGroup)
-                .eq(RollHeight::getShift, shift)
-                .between(RollHeight::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollHeight::getShift, shift);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper.between(RollHeight::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper.between(RollHeight::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollHeight> rollHeightList = baseMapper.selectList(queryWrapper);
         if (oConvertUtils.listIsEmpty(rollHeightList)){
             return destinationStatistics;
@@ -151,8 +173,15 @@ public class RollHeightServiceImpl extends ServiceImpl<RollHeightMapper, RollHei
         LambdaQueryWrapper<RollHeightDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
         queryWrapperDetails.eq(RollHeightDetails::getCcmNo, ccmNo)
                 .eq(RollHeightDetails::getShift, shift)
-                .eq(RollHeightDetails::getShiftGroup, shiftGroup)
-                .between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollHeightDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapperDetails.between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapperDetails.between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollHeightDetails> rollHeightDetailsList = rollHeightDetailsService.list(queryWrapperDetails);
         if (oConvertUtils.listIsEmpty(rollHeightList)){
             return destinationStatistics;

+ 3 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/controller/RollOutShippController.java

@@ -179,8 +179,9 @@ public class RollOutShippController {
 
 	@ApiOperation(value="当班上若-通过铸机号班组班别查询", notes="当班上若-通过铸机号班组班别查询")
 	@GetMapping(value = "/queryOnDutyRollOutShippByCcmNo")
-	public Result<DestinationStatistics> queryOnDutyRollOutShippByCcmNo(@RequestParam(name="ccmNo") String ccmNo) {
-		DestinationStatistics destinationStatistics = rollOutShippService.queryOnDutyRollOutShippByCcmNo(ccmNo);
+	public Result<DestinationStatistics> queryOnDutyRollOutShippByCcmNo(@RequestParam(name="ccmNo") String ccmNo,
+																		@RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		DestinationStatistics destinationStatistics = rollOutShippService.queryOnDutyRollOutShippByCcmNo(ccmNo, changeShiftId);
 		if(destinationStatistics == null) {
 			return Result.ok("未找到当班对应数据");
 		}

+ 1 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/service/IRollOutShippService.java

@@ -13,5 +13,5 @@ import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShipp;
 public interface IRollOutShippService extends IService<RollOutShipp> {
     DestinationStatistics queryByCcmNoHandle(String ccmNo);
 
-    DestinationStatistics queryOnDutyRollOutShippByCcmNo(String ccmNo);
+    DestinationStatistics queryOnDutyRollOutShippByCcmNo(String ccmNo, String changeShiftId);
 }

+ 50 - 22
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/service/impl/RollOutShippServiceImpl.java

@@ -116,33 +116,54 @@ public class RollOutShippServiceImpl extends ServiceImpl<RollOutShippMapper, Rol
     }
 
     @Override
-    public DestinationStatistics queryOnDutyRollOutShippByCcmNo(String ccmNo) {
+    public DestinationStatistics queryOnDutyRollOutShippByCcmNo(String ccmNo, String changeShiftId) {
 
         DestinationStatistics destinationStatistics = new DestinationStatistics();
 
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        if (oConvertUtils.isEmpty(shiftGroup) || oConvertUtils.isEmpty(shift)){
-            return destinationStatistics;
-        }
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper2 = new LambdaQueryWrapper<>();
-        queryWrapper2.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper2);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班轧钢上若信息失败,交班记录为空!", ccmNo + "失败时间:"+new Date());
-            return destinationStatistics;
+        String shiftGroup = "";
+        String shift = "";
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班轧钢上若信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+                return destinationStatistics;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询历史当班轧钢上若信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+                return destinationStatistics;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
+
         LambdaQueryWrapper<RollOutShipp> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(RollOutShipp::getCcmNo, ccmNo)
                 .eq(RollOutShipp::getShiftGroup, shiftGroup)
-                .eq(RollOutShipp::getShift, shift)
-                .between(RollOutShipp::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollOutShipp::getShift, shift);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper.between(RollOutShipp::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper.between(RollOutShipp::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollOutShipp> rollOutShippsList = baseMapper.selectList(queryWrapper);
         if (oConvertUtils.listIsEmpty(rollOutShippsList)){
             return destinationStatistics;
@@ -157,8 +178,15 @@ public class RollOutShippServiceImpl extends ServiceImpl<RollOutShippMapper, Rol
         LambdaQueryWrapper<RollOutShippDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
         queryWrapperDetails.eq(RollOutShippDetails::getCcmNo, ccmNo)
                 .eq(RollOutShippDetails::getShift, shift)
-                .eq(RollOutShippDetails::getShiftGroup, shiftGroup)
-                .between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollOutShippDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapperDetails.between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapperDetails.between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapperDetails);
         if (oConvertUtils.listIsEmpty(rollOutShippDetailsList)){
             return destinationStatistics;

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

@@ -598,36 +598,41 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 
 	@ApiOperation(value="当班行车吊运信息-班次实绩", notes="当班行车吊运信息-班次实绩")
 	@GetMapping(value = "/queryOnDutyLiftingBillInfo")
-	public Result<OnDutyLiftingBillInfo> queryOnDutyLiftingBillInfoHandle(@RequestParam(name="ccmNo") String ccmNo) {
-		OnDutyLiftingBillInfo onDutyLiftingBillInfo = storageBillService.queryOnDutyLiftingBillInfoHandle(ccmNo);
+	public Result<OnDutyLiftingBillInfo> queryOnDutyLiftingBillInfoHandle(@RequestParam(name="ccmNo") String ccmNo,
+																		  @RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		OnDutyLiftingBillInfo onDutyLiftingBillInfo = storageBillService.queryOnDutyLiftingBillInfoHandle(ccmNo, changeShiftId);
 		return Result.OK(onDutyLiftingBillInfo);
 	}
 
 	@ApiOperation(value="当班正在装运信息-班次实绩", notes="当班正在装运信息-班次实绩")
 	@GetMapping(value = "/queryOnDutyStorageBillInfo")
-	public Result<OnDutyStorageBill> queryOnDutyStorageBillInfoHandle(@RequestParam(name="ccmNo") String ccmNo) {
-		OnDutyStorageBill result = storageBillService.queryOnDutyStorageBillInfoHandle(ccmNo);
+	public Result<OnDutyStorageBill> queryOnDutyStorageBillInfoHandle(@RequestParam(name="ccmNo") String ccmNo,
+																	  @RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		OnDutyStorageBill result = storageBillService.queryOnDutyStorageBillInfoHandle(ccmNo, changeShiftId);
 		return Result.OK(result);
 	}
 
 	@ApiOperation(value="当班所有装运信息-班次实绩", notes="当班所有装运信息-班次实绩")
 	@GetMapping(value = "/queryOnDutyAllStorageBillInfo")
-	public Result<OnDutyStorageBillStatistics> queryOnDutyAllStorageBillInfoHandle(@RequestParam(name="ccmNo") String ccmNo) {
-		OnDutyStorageBillStatistics result = storageBillService.queryOnDutyAllStorageBillInfoHandle(ccmNo);
+	public Result<OnDutyStorageBillStatistics> queryOnDutyAllStorageBillInfoHandle(@RequestParam(name="ccmNo") String ccmNo,
+																				   @RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		OnDutyStorageBillStatistics result = storageBillService.queryOnDutyAllStorageBillInfoHandle(ccmNo, changeShiftId);
 		return Result.OK(result);
 	}
 
 	@ApiOperation(value="当班明细热送热装堆垛-班次看板实绩", notes="当班明细热送热装堆垛-班次看板实绩")
 	@GetMapping(value = "/queryOnDutyDetail")
-	public Result<OnDutyDetailStatistics> queryOnDutyDeatailHandle(@RequestParam(name="ccmNo") String ccmNo) {
-		OnDutyDetailStatistics result = storageBillService.queryOnDutyDeatailHandle(ccmNo);
+	public Result<OnDutyDetailStatistics> queryOnDutyDeatailHandle(@RequestParam(name="ccmNo") String ccmNo,
+																   @RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		OnDutyDetailStatistics result = storageBillService.queryOnDutyDeatailHandle(ccmNo, changeShiftId);
 		return Result.OK(result);
 	}
 
 	@ApiOperation(value="当班定尺分组总支数出坯量统计", notes="当班定尺分组总支数出坯量统计")
 	@GetMapping(value = "/queryOnDutySize")
-	public Result<List<OnDutySizeVo>> queryOnDutySize(@RequestParam(name="ccmNo") String ccmNo) {
-		List<OnDutySizeVo> onDutySizeVos = storageBillService.queryOnDutySize(ccmNo);
+	public Result<List<OnDutySizeVo>> queryOnDutySize(@RequestParam(name="ccmNo") String ccmNo,
+													  @RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		List<OnDutySizeVo> onDutySizeVos = storageBillService.queryOnDutySize(ccmNo, changeShiftId);
 		return Result.OK(onDutySizeVos);
 	}
 }

+ 5 - 7
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/IStorageBillService.java

@@ -43,15 +43,13 @@ public interface IStorageBillService extends IService<StorageBill> {
 
     OnDutyInfo queryOnDutyInfoHandle(String ccmNo);
 
-    OnDutyLiftingBillInfo queryOnDutyLiftingBillInfoHandle(String ccmNo);
+    OnDutyLiftingBillInfo queryOnDutyLiftingBillInfoHandle(String ccmNo, String changeShiftId);
 
-    JSONObject queryOnDutySteelRollingInfoHandle(String ccmNo);
+    OnDutyStorageBill queryOnDutyStorageBillInfoHandle(String ccmNo, String changeShiftId);
 
-    OnDutyStorageBill queryOnDutyStorageBillInfoHandle(String ccmNo);
+    OnDutyStorageBillStatistics queryOnDutyAllStorageBillInfoHandle(String ccmNo, String changeShiftId);
 
-    OnDutyStorageBillStatistics queryOnDutyAllStorageBillInfoHandle(String ccmNo);
+    OnDutyDetailStatistics queryOnDutyDeatailHandle(String ccmNo, String changeShiftId);
 
-    OnDutyDetailStatistics queryOnDutyDeatailHandle(String ccmNo);
-
-    List<OnDutySizeVo> queryOnDutySize(String ccmNo);
+    List<OnDutySizeVo> queryOnDutySize(String ccmNo, String changeShiftId);
 }

+ 294 - 125
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/impl/StorageBillServiceImpl.java

@@ -1311,30 +1311,57 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
     }
 
     @Override
-    public OnDutyLiftingBillInfo queryOnDutyLiftingBillInfoHandle(String ccmNo) {
+    public OnDutyLiftingBillInfo queryOnDutyLiftingBillInfoHandle(String ccmNo, String changeShiftId) {
         OnDutyLiftingBillInfo onDutyLiftingBillInfo = new OnDutyLiftingBillInfo();
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班行车吊运信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
-            return onDutyLiftingBillInfo;
+
+        String shiftGroup = "";
+        String shift = "";
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班行车吊运信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+                return onDutyLiftingBillInfo;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班历史行车吊运信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+                return onDutyLiftingBillInfo;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
+
         // 根据铸机号、班组、班别、交班的创建时间,查询当班行车吊运单信息,
         LambdaQueryWrapper<BilletLiftingBill> queryWrapper2 = new LambdaQueryWrapper<>();
-        queryWrapper2.eq(BilletLiftingBill::getCcmNo, ccmNo)
-                .eq(BilletLiftingBill::getShift, shift)
-                .eq(BilletLiftingBill::getShiftGroup, shiftGroup)
-                .between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date())
-                .groupBy(BilletLiftingBill::getVehicleNumber);
+        if (oConvertUtils.isEmpty(changeShiftId)){
+            queryWrapper2.eq(BilletLiftingBill::getCcmNo, ccmNo)
+                    .eq(BilletLiftingBill::getShift, shift)
+                    .eq(BilletLiftingBill::getShiftGroup, shiftGroup)
+                    .between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date())
+                    .groupBy(BilletLiftingBill::getVehicleNumber);
+        }else {
+            // 历史当班行车吊运信息
+            queryWrapper2.eq(BilletLiftingBill::getCcmNo, ccmNo)
+                    .eq(BilletLiftingBill::getShift, shift)
+                    .eq(BilletLiftingBill::getShiftGroup, shiftGroup)
+                    .between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime())
+                    .groupBy(BilletLiftingBill::getVehicleNumber);
+        }
         List<BilletLiftingBill> billetLiftingBillList = billetLiftingBillService.list(queryWrapper2);
         if (oConvertUtils.listIsEmpty(billetLiftingBillList)){
             log.info("{}{}", "查询当班行车吊运信息为空!", ccmNo + "失败时间:" + new Date());
@@ -1348,11 +1375,11 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             details.setVehicleNumber(vehicleNumber);
             details.setChangeShiftCreateTime(billetHotsendChangeShift.getCreateTime());
             // 热送统计
-            countAndSet(details, billetHotsendChangeShift, ccmNo, shift, shiftGroup, vehicleNumber, "0","hotSendAmont", "hotSendWeight");
+            countAndSet(details, billetHotsendChangeShift, ccmNo, shift, shiftGroup, vehicleNumber, "0","hotSendAmont", changeShiftId);
             // 热装统计
-            countAndSet(details, billetHotsendChangeShift, ccmNo, shift, shiftGroup, vehicleNumber, "1","hotChargingAmont", "hotChargingWeight");
+            countAndSet(details, billetHotsendChangeShift, ccmNo, shift, shiftGroup, vehicleNumber, "1","hotChargingAmont", changeShiftId);
             // 堆垛统计
-            countAndSet(details, billetHotsendChangeShift, ccmNo, shift, shiftGroup, vehicleNumber, "2","stackingAmont", "amontWeight");
+            countAndSet(details, billetHotsendChangeShift, ccmNo, shift, shiftGroup, vehicleNumber, "2","stackingAmont", changeShiftId);
 
             allDetailsList.add(details);
         }
@@ -1364,15 +1391,18 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
     private void countAndSet(OnDutyLiftingBillDetails details, BilletHotsendChangeShift billetHotsendChangeShift,
                                     String ccmNo, String shift, String shiftGroup, String vehicleNumber,
-                                    String liftingType, String amountField, String weightField) {
+                                    String liftingType, String amountField, String changeShiftId) {
         LambdaQueryWrapper<BilletLiftingBill> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(BilletLiftingBill::getCcmNo, ccmNo)
                 .eq(BilletLiftingBill::getShift, shift)
                 .eq(BilletLiftingBill::getShiftGroup, shiftGroup)
                 .eq(BilletLiftingBill::getVehicleNumber, vehicleNumber)
-                .eq(BilletLiftingBill::getLiftingType, liftingType)
-                .between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
-
+                .eq(BilletLiftingBill::getLiftingType, liftingType);
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            queryWrapper.between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        }else {
+            queryWrapper.between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<BilletLiftingBill> billList = billetLiftingBillService.list(queryWrapper);
         int amount;
         double weight;
@@ -1400,34 +1430,41 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
     }
 
     @Override
-    public JSONObject queryOnDutySteelRollingInfoHandle(String ccmNo) {
-        JSONObject result = new JSONObject();
-
-
-
-
-        return result;
-    }
-
-    @Override
-    public OnDutyStorageBill queryOnDutyStorageBillInfoHandle(String ccmNo) {
+    public OnDutyStorageBill queryOnDutyStorageBillInfoHandle(String ccmNo, String changeShiftId) {
         OnDutyStorageBill onDutyStorageBill = new OnDutyStorageBill();
 
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班装运单信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
-            return onDutyStorageBill;
+        String shiftGroup = "";
+        String shift = "";
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班正在装运信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+                return onDutyStorageBill;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询历史当班装运单信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+                return onDutyStorageBill;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
+
         // 根据铸机号、班组、班别、licensePlate不等于”辊道“或者”堆垛辊道“,amountTotal不等于0 ,查询当班装运单信息
         LambdaQueryWrapper<StorageBill> queryWrapper2 = new LambdaQueryWrapper<>();
         queryWrapper2.eq(StorageBill::getCcmNo, ccmNo)
@@ -1435,8 +1472,15 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                 .eq(StorageBill::getShiftGroup, shiftGroup)
                 .notIn(StorageBill::getLicensePlate, "辊道", "堆垛辊道")
                 .gt(StorageBill::getAmountTotal, 0)
-                .isNull(StorageBill::getOutTime)
-                .between(StorageBill::getCreateTime,billetHotsendChangeShift.getCreateTime(), new Date());
+                .isNull(StorageBill::getOutTime);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper2.between(StorageBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper2.between(StorageBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<StorageBill> storageBillList = baseMapper.selectList(queryWrapper2);
         if (oConvertUtils.listIsEmpty(storageBillList)){
             log.info("{}{}", "查询当班装运单信息为空!", ccmNo);
@@ -1504,32 +1548,57 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
     }
 
     @Override
-    public OnDutyStorageBillStatistics queryOnDutyAllStorageBillInfoHandle(String ccmNo) {
+    public OnDutyStorageBillStatistics queryOnDutyAllStorageBillInfoHandle(String ccmNo, String changeShiftId) {
         OnDutyStorageBillStatistics onDutyStorageBillStatistics = new OnDutyStorageBillStatistics();
 
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班装运单信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
-            return onDutyStorageBillStatistics;
+        String shiftGroup = "";
+        String shift = "";
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班装运单信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+                return onDutyStorageBillStatistics;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询历史当班装运单信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+                return onDutyStorageBillStatistics;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
+
+
         // 根据铸机号、班组、班别、licensePlate不等于”辊道“或者”堆垛辊道“,amountTotal不等于0 ,查询当班装运单信息
         LambdaQueryWrapper<StorageBill> queryWrapper2 = new LambdaQueryWrapper<>();
         queryWrapper2.eq(StorageBill::getCcmNo, ccmNo)
                 .eq(StorageBill::getShift, shift)
                 .eq(StorageBill::getShiftGroup, shiftGroup)
                 .notIn(StorageBill::getLicensePlate, "辊道", "堆垛辊道")
-                .gt(StorageBill::getAmountTotal, 0)
-                .between(StorageBill::getCreateTime,billetHotsendChangeShift.getCreateTime(), new Date());
+                .gt(StorageBill::getAmountTotal, 0);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper2.between(StorageBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper2.between(StorageBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<StorageBill> storageBillList = baseMapper.selectList(queryWrapper2);
         if (oConvertUtils.listIsEmpty(storageBillList)){
             log.info("{}{}", "查询当班装运单信息为空!", ccmNo);
@@ -1538,9 +1607,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         Integer allCarNum = storageBillList.stream()
                 .map(StorageBill::getCarNum)
                 .reduce(0, Integer::sum);
-        Integer amountTotal = storageBillList.stream()
-                .map(StorageBill::getAmountTotal)
-                .reduce(0, Integer::sum);
+
         List<DestinationStatisticsDetails> statisticsDetailsList1 = new ArrayList<>();
         List<DestinationStatisticsDetails> statisticsDetailsList2 = new ArrayList<>();
         List<DestinationStatisticsDetails> statisticsDetailsList3 = new ArrayList<>();
@@ -1680,7 +1747,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         BigDecimal bd = BigDecimal.valueOf(finalBlankOutputs).setScale(4, BigDecimal.ROUND_HALF_UP);
 
 
-        log.info("{}{}", "钢坯热送单班统计查询结果:", JSON.toJSON(mergedList));
+        log.info("{}{}", "当班装运单信息查询结果:", JSON.toJSON(mergedList));
         onDutyStorageBillStatistics.setAllCarNum(allCarNum);
         onDutyStorageBillStatistics.setCounts(finalAmountTotal);
         onDutyStorageBillStatistics.setBlankOutputs(bd);
@@ -1691,22 +1758,38 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
     }
 
     @Override
-    public OnDutyDetailStatistics queryOnDutyDeatailHandle(String ccmNo) {
+    public OnDutyDetailStatistics queryOnDutyDeatailHandle(String ccmNo, String changeShiftId) {
         OnDutyDetailStatistics onDutyDetailStatistics = new OnDutyDetailStatistics();
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班热送热装堆垛明细信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
-            return onDutyDetailStatistics;
+        String shiftGroup = "";
+        String shift = "";
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("查询当班明细信息失败,交班记录为空!{} 失败时间:{}", ccmNo, new Date());
+                return onDutyDetailStatistics;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("查询历史当班明细信息失败,交班记录为空!{} 失败时间:{}", ccmNo, new Date());
+                return onDutyDetailStatistics;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
 
         int hotSendSum = 0;
@@ -1717,10 +1800,19 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         double stackingTotalWeight = 0d;
         // 根据铸机号、班组、班别、时间范围。查询棒一明细表
         LambdaQueryWrapper<RollClubOneDetails> queryWrapper1 = new LambdaQueryWrapper<>();
+        // 添加通用的查询条件
         queryWrapper1.eq(RollClubOneDetails::getCcmNo, ccmNo)
                 .eq(RollClubOneDetails::getShift, shift)
-                .eq(RollClubOneDetails::getShiftGroup, shiftGroup)
-                .between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollClubOneDetails::getShiftGroup, shiftGroup);
+
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper1.between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper1.between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubOneDetails> rollClubOneDetailsList = rollClubOneDetailsService.list(queryWrapper1);
         if (oConvertUtils.listIsNotEmpty(rollClubOneDetailsList)){
             // 棒一热送总数
@@ -1733,8 +1825,16 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollClubTwoDetails> queryWrapper2 = new LambdaQueryWrapper<>();
         queryWrapper2.eq(RollClubTwoDetails::getCcmNo, ccmNo)
                 .eq(RollClubTwoDetails::getShift, shift)
-                .eq(RollClubTwoDetails::getShiftGroup, shiftGroup)
-                .between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollClubTwoDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper2.between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper2.between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
+
         List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper2);
         if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsList)){
             // 棒二热装总支数 获取堆垛编号为空的条数,即为热装
@@ -1763,8 +1863,15 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollClubThreeDetails> queryWrapper3 = new LambdaQueryWrapper<>();
         queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo)
                 .eq(RollClubThreeDetails::getShift, shift)
-                .eq(RollClubThreeDetails::getShiftGroup, shiftGroup)
-                .between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollClubThreeDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper3.between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper3.between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapper3);
         if (oConvertUtils.listIsNotEmpty(rollClubThreeDetailsList)){
             // 棒三热装总支数
@@ -1791,8 +1898,15 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollHeightDetails> queryWrapper4 = new LambdaQueryWrapper<>();
         queryWrapper4.eq(RollHeightDetails::getCcmNo, ccmNo)
                 .eq(RollHeightDetails::getShift, shift)
-                .eq(RollHeightDetails::getShiftGroup, shiftGroup)
-                .between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollHeightDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper4.between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper4.between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollHeightDetails> rollHeightDetailsList = rollHeightDetailsService.list(queryWrapper4);
         if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsList)){
             // 高线总支数    高线属于热送
@@ -1808,8 +1922,15 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollOutShippDetails> queryWrapper5 = new LambdaQueryWrapper<>();
         queryWrapper5.eq(RollOutShippDetails::getCcmNo, ccmNo)
                 .eq(RollOutShippDetails::getShift, shift)
-                .eq(RollOutShippDetails::getShiftGroup, shiftGroup)
-                .between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollOutShippDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper5.between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper5.between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapper5);
         if (oConvertUtils.listIsNotEmpty(rollOutShippDetailsList)){
             // 上若热装总支数
@@ -1843,31 +1964,55 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
     }
 
     @Override
-    public List<OnDutySizeVo> queryOnDutySize(String ccmNo) {
+    public List<OnDutySizeVo> queryOnDutySize(String ccmNo, String changeShiftId) {
         List<OnDutySizeVo> list = new ArrayList<>();
         List<SizeSummary> summaryList = new ArrayList<>();
-        // 从 Redis 获取班次信息
-        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-        String shift = getShiftInfo(ccmNo, "class:shift:%s");
-        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                .eq(BilletHotsendChangeShift::getShift, shift)
-                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                .last("limit 1");
-        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-        if (billetHotsendChangeShift == null){
-            log.info("{}{}", "查询当班定尺明细,明细记录为空!", ccmNo + "失败时间:" + new Date());
-            return list;
+
+        String shiftGroup = "";
+        String shift = "";
+
+        BilletHotsendChangeShift billetHotsendChangeShift;
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            // 从 Redis 获取班次信息
+            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+            shift = getShiftInfo(ccmNo, "class:shift:%s");
+            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                    .eq(BilletHotsendChangeShift::getShift, shift)
+                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                    .last("limit 1");
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询当班定尺明细,明细记录为空!", ccmNo + "失败时间:" + new Date());
+                return list;
+            }
+        }else {
+            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+            if (billetHotsendChangeShift == null){
+                log.info("{}{}", "查询历史班次定尺明细,明细记录为空!", ccmNo + "失败时间:" + new Date());
+                return list;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
 
         // 根据铸机号、班组、班别、交班的创建时间,查询棒一符合条件的信息
         LambdaQueryWrapper<RollClubOneDetails> queryWrapper1 = new LambdaQueryWrapper<>();
         queryWrapper1.eq(RollClubOneDetails::getCcmNo, ccmNo)
                 .eq(RollClubOneDetails::getShift, shift)
-                .eq(RollClubOneDetails::getShiftGroup, shiftGroup)
-                .between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollClubOneDetails::getShiftGroup, shiftGroup);
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper1.between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper1.between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubOneDetails> list1 = rollClubOneDetailsService.list(queryWrapper1);
 
         // 根据 size 分组,并统计总支数和总 BlankOutput
@@ -1899,8 +2044,14 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollClubTwoDetails> queryWrapper2 = new LambdaQueryWrapper<>();
         queryWrapper2.eq(RollClubTwoDetails::getCcmNo, ccmNo)
                 .eq(RollClubTwoDetails::getShift, shift)
-                .eq(RollClubTwoDetails::getShiftGroup, shiftGroup)
-                .between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollClubTwoDetails::getShiftGroup, shiftGroup);
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper2.between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper2.between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubTwoDetails> list2 = rollClubTwoDetailsService.list(queryWrapper2);
 
         // 根据 size 分组,并统计总支数和总 BlankOutput
@@ -1934,8 +2085,14 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollClubThreeDetails> queryWrapper3 = new LambdaQueryWrapper<>();
         queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo)
                 .eq(RollClubThreeDetails::getShift, shift)
-                .eq(RollClubThreeDetails::getShiftGroup, shiftGroup)
-                .between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollClubThreeDetails::getShiftGroup, shiftGroup);
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper3.between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper3.between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollClubThreeDetails> list3 = rollClubThreeDetailsService.list(queryWrapper3);
 
         // 根据 size 分组,并统计总支数和总 BlankOutput
@@ -1969,8 +2126,14 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollHeightDetails> queryWrapper4 = new LambdaQueryWrapper<>();
         queryWrapper4.eq(RollHeightDetails::getCcmNo, ccmNo)
                 .eq(RollHeightDetails::getShift, shift)
-                .eq(RollHeightDetails::getShiftGroup, shiftGroup)
-                .between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollHeightDetails::getShiftGroup, shiftGroup);
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper4.between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper4.between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollHeightDetails> list4 = rollHeightDetailsService.list(queryWrapper4);
 
         // 根据 size 分组,并统计总支数和总 BlankOutput
@@ -2004,8 +2167,14 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollOutShippDetails> queryWrapper5 = new LambdaQueryWrapper<>();
         queryWrapper5.eq(RollOutShippDetails::getCcmNo, ccmNo)
                 .eq(RollOutShippDetails::getShift, shift)
-                .eq(RollOutShippDetails::getShiftGroup, shiftGroup)
-                .between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(RollOutShippDetails::getShiftGroup, shiftGroup);
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper5.between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper5.between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
         List<RollOutShippDetails> list5 = rollOutShippDetailsService.list(queryWrapper5);
 
         // 根据 size 分组,并统计总支数和总 BlankOutput