فهرست منبع

当班信息兼容历史记录

qiangxuan 4 ماه پیش
والد
کامیت
114a40602d

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

@@ -634,8 +634,9 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 
 	@ApiOperation(value="当班信息汇总-班次实绩", notes="当班信息汇总-班次实绩")
 	@GetMapping(value = "/queryOnDutyInfo")
-	public Result<OnDutyInfo> queryOnDutyInfoHandle(@RequestParam(name="ccmNo") String ccmNo) {
-		OnDutyInfo result = storageBillService.queryOnDutyInfoHandle(ccmNo);
+	public Result<OnDutyInfo> queryOnDutyInfoHandle(@RequestParam(name="ccmNo") String ccmNo,
+													@RequestParam(name="changeShiftId", required = false) String changeShiftId) {
+		OnDutyInfo result = storageBillService.queryOnDutyInfoHandle(ccmNo, changeShiftId);
 		return Result.OK(result);
 	}
 

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

@@ -41,7 +41,7 @@ public interface IStorageBillService extends IService<StorageBill> {
 
     JSONObject ondutyStatisticsExport(String ccmNo, String ondutyDate);
 
-    OnDutyInfo queryOnDutyInfoHandle(String ccmNo);
+    OnDutyInfo queryOnDutyInfoHandle(String ccmNo, String changeShiftId);
 
     OnDutyLiftingBillInfo queryOnDutyLiftingBillInfoHandle(String ccmNo, String changeShiftId);
 

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

@@ -1276,35 +1276,59 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
     }
 
     @Override
-    public OnDutyInfo queryOnDutyInfoHandle(String ccmNo) {
+    public OnDutyInfo queryOnDutyInfoHandle(String ccmNo, String changeShiftId) {
         log.info("{}{}", "查询当班信息开始!", ccmNo + "开始时间:"+new Date());
 
         OnDutyInfo onDutyInfo = new OnDutyInfo();
-        // 从 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 onDutyInfo;
+
+
+        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 onDutyInfo;
+            }
+        }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 onDutyInfo;
+            }
+            shiftGroup = billetHotsendChangeShift.getShiftGroup();
+            shift = billetHotsendChangeShift.getShift();
         }
+
         onDutyInfo.setBilletHotsendChangeShift(billetHotsendChangeShift);
         // 根据铸机号、炉号、班组、班别、交班的创建时间,查询钢坯基础信息
         LambdaQueryWrapper<BilletBasicInfo> queryWrapper2 = new LambdaQueryWrapper<>();
         queryWrapper2.eq(BilletBasicInfo::getCcmNo, ccmNo)
                 .eq(BilletBasicInfo::getHeatNo, billetHotsendChangeShift.getHeatNo())
                 .eq(BilletBasicInfo::getShift, shift)
-                .eq(BilletBasicInfo::getShiftGroup, shiftGroup)
-                .between(BilletBasicInfo::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+                .eq(BilletBasicInfo::getShiftGroup, shiftGroup);
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            queryWrapper2.between(BilletBasicInfo::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        }else {
+            queryWrapper2.between(BilletBasicInfo::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getUpdateTime());
+        }
+
         List<BilletBasicInfo> billetBasicInfoList2 = billetBasicInfoService.list(queryWrapper2);
-        if (oConvertUtils.listIsNotEmpty(billetBasicInfoList2)){
+        if (oConvertUtils.listIsNotEmpty(billetBasicInfoList2) && oConvertUtils.isEmpty(changeShiftId)){
             // 当班浇铸炉号总支数
             onDutyInfo.setCurrentCastingFurnaceAmount(billetBasicInfoList2.size());
             // 计算 billetWeight 的总和