Quellcode durchsuchen

新增查询钢坯基础信息去展示当班轧钢跟当班定尺的信息接口

lingpeng.li vor 2 Monaten
Ursprung
Commit
a7d20e89ca

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

@@ -16,6 +16,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.actualControl.heatsActuals.entity.HeatsActuals;
 import org.jeecg.modules.actualControl.heatsActuals.service.IHeatsActualsService;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
@@ -1121,4 +1122,20 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 		StorageBillStatistics result = storageBillService.queryOnDutyStorageBillStatisticsHandle(ccmNo, changeShiftId);
 		return Result.OK(result);
 	}
+
+	/**
+	 * 查询钢坯基础信息去展示当班轧钢跟当班定尺的信息
+	 *
+	 * @param ccmNo
+	 * @param changeShiftId
+	 * @return
+	 */
+	@ApiOperation(value="查询钢坯基础信息去展示当班轧钢跟当班定尺的信息", notes="查询未发车的车辆信息-通过铸机号查询")
+	@GetMapping(value = "/queryBilletBasicInfo")
+	public Result<List<BilletBasicInfo>> queryBilletBasicInfo(@RequestParam(name="ccmNo") String ccmNo,
+															  @RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+
+		List<BilletBasicInfo> billetBasicInfoList = storageBillService.queryBilletBasicInfoHandle(ccmNo, changeShiftId);
+		return Result.OK(billetBasicInfoList);
+	}
 }

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

@@ -2,6 +2,7 @@ package org.jeecg.modules.billet.storageBill.service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsendDetailsVo;
 import org.jeecg.modules.billet.storageBill.entity.*;
 import org.jeecg.modules.billet.storageBill.vo.OnDutySizeVo;
@@ -60,4 +61,6 @@ public interface IStorageBillService extends IService<StorageBill> {
     List<OnDutySizeVo> queryOnDutySize(String ccmNo, String changeShiftId);
 
     StorageBillStatistics queryOnDutyStorageBillStatisticsHandle(String ccmNo, String changeShiftId);
+
+    List<BilletBasicInfo> queryBilletBasicInfoHandle(String ccmNo, String changeShiftId);
 }

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

@@ -1852,9 +1852,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
         // 根据铸机号、班组、班别、时间范围。查询棒二明细表
         LambdaQueryWrapper<StackingUpLog> stackingUpLogQueryWrapper = new LambdaQueryWrapper<>();
-        stackingUpLogQueryWrapper.eq(StackingUpLog::getCcmNo, ccmNo)
-                .eq(StackingUpLog::getShift, shift)
-                .eq(StackingUpLog::getShiftGroup, shiftGroup);
+        stackingUpLogQueryWrapper.eq(StackingUpLog::getCcmNo, ccmNo);
         // 检查 billetHotsendChangeShift 是否为空
         if (oConvertUtils.isEmpty(changeShiftId)) {
             // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
@@ -2415,6 +2413,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             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);
@@ -2443,8 +2442,6 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         // 根据铸机号、班组、班别,amountTotal不等于0 ,查询当班装运单信息
         LambdaQueryWrapper<StorageBill> queryWrapper2 = new LambdaQueryWrapper<>();
         queryWrapper2.eq(StorageBill::getCcmNo, ccmNo)
-                .eq(StorageBill::getShift, shift)
-                .eq(StorageBill::getShiftGroup, shiftGroup)
                 .notIn(StorageBill::getLicensePlate, Arrays.asList("辊道", "堆垛辊道"))
                 .gt(StorageBill::getAmountTotal, 0);
         // 检查 billetHotsendChangeShift 是否为空
@@ -2483,8 +2480,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         for (StorageBill storageBill : storageBillList) {
             if ("棒二".equals(storageBill.getDestination())) {
                 LambdaQueryWrapper<RollClubTwoDetails> queryWrapper3 = new LambdaQueryWrapper<>();
-                queryWrapper3.eq(RollClubTwoDetails::getCcmNo, ccmNo).eq(RollClubTwoDetails::getStorageBillId, storageBill.getId())
-                        .eq(RollClubTwoDetails::getShift, shift).eq(RollClubTwoDetails::getShiftGroup, shiftGroup);
+                queryWrapper3.eq(RollClubTwoDetails::getCcmNo, ccmNo).eq(RollClubTwoDetails::getStorageBillId, storageBill.getId());
                 List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper3);
                 if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsList)) {
                     rollClubTwoDetailsListAll.addAll(rollClubTwoDetailsList);
@@ -2493,8 +2489,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
             if ("棒三".equals(storageBill.getDestination())) {
                 LambdaQueryWrapper<RollClubThreeDetails> queryWrapper3 = new LambdaQueryWrapper<>();
-                queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo).eq(RollClubThreeDetails::getStorageBillId, storageBill.getId())
-                        .eq(RollClubThreeDetails::getShift, shift).eq(RollClubThreeDetails::getShiftGroup, shiftGroup);
+                queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo).eq(RollClubThreeDetails::getStorageBillId, storageBill.getId());
                 List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapper3);
                 if (oConvertUtils.listIsNotEmpty(rollClubThreeDetailsList)) {
                     log.info("{}{}", "装运单对应的棒三明细总数:", rollClubThreeDetailsList.size());
@@ -2504,8 +2499,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
             if ("上若".equals(storageBill.getDestination())) {
                 LambdaQueryWrapper<RollOutShippDetails> queryWrapper3 = new LambdaQueryWrapper<>();
-                queryWrapper3.eq(RollOutShippDetails::getCcmNo, ccmNo).eq(RollOutShippDetails::getStorageBillId, storageBill.getId())
-                        .eq(RollOutShippDetails::getShift, shift).eq(RollOutShippDetails::getShiftGroup, shiftGroup);
+                queryWrapper3.eq(RollOutShippDetails::getCcmNo, ccmNo).eq(RollOutShippDetails::getStorageBillId, storageBill.getId());
                 List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapper3);
                 if (oConvertUtils.listIsNotEmpty(rollOutShippDetailsList)) {
                     rollOutShippDetailsListAll.addAll(rollOutShippDetailsList);
@@ -2620,6 +2614,60 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         return storageBillStatistics;
     }
 
+    @Override
+    public List<BilletBasicInfo> queryBilletBasicInfoHandle(String ccmNo, String changeShiftId) {
+        List<BilletBasicInfo> list = new ArrayList<>();
+
+        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<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(BilletBasicInfo::getCcmNo, ccmNo)
+                .eq(BilletBasicInfo::getShift, shift)
+                .eq(BilletBasicInfo::getShiftGroup, shiftGroup);
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper.between(BilletBasicInfo::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper.between(BilletBasicInfo::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
+        }
+        list = billetBasicInfoService.list(queryWrapper);
+
+        return list;
+    }
+
 
     // 计算整数总和的方法
     private int calculateIntSum(List<DestinationStatisticsDetails> list) {