Browse Source

操作工热装和起垛逻辑优化处理

qiangxuan 1 month ago
parent
commit
3d31c7d612

+ 9 - 5
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/controller/BilletHotsendBaseController.java

@@ -167,7 +167,6 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
         billetHotsend.setIsUpd(false);
         billetHotsendDetailsVo.setBilletHotsend(billetHotsend);
 
-
         LambdaQueryWrapper<BilletBasicInfo> queryWrapper2 = new LambdaQueryWrapper<>();
         queryWrapper2.eq(BilletBasicInfo::getCcmNo, hotChargeVo.getCcmNo())
                 .eq(BilletBasicInfo::getHeatNo, hotChargeVo.getHeatNo())
@@ -180,9 +179,9 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
             queryWrapper2.eq(BilletBasicInfo::getLength, hotChargeVo.getLength());
         }
         List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper2);
-        if (oConvertUtils.listIsEmpty(billetBasicInfoList)) {
-            log.info("{}{}", "钢坯实绩不存在,热装操作失败!", JSON.toJSON(hotChargeVo));
-            return Result.error("钢坯实绩不存在,热装操作失败!");
+        if (oConvertUtils.listIsEmpty(billetBasicInfoList) || billetBasicInfoList.size() < 4) {
+            log.info("{}{}", "钢坯实绩不存在或不足4支,热装操作失败!", JSON.toJSON(hotChargeVo));
+            return Result.error("钢坯实绩为空或不足4支,热装操作失败!");
         }
         log.info("{}{}", "推钢室操作工,<热装>操作:", JSON.toJSON(billetBasicInfoList));
         List<RollClubCommon> rollClubCommonList = new ArrayList<>();
@@ -194,7 +193,11 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
                 .stream()
                 .filter(entry -> entry.getValue().size() == 4)
                 .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
-
+        if (groupByAssemblyNumber == null || groupByAssemblyNumber.isEmpty()) {
+            // 处理结果为空的情况(没有符合条件的分组)
+            log.info("{}{}", "热装-分组后钢坯可用信息为空:", JSON.toJSON(groupByAssemblyNumber));
+            return Result.error("分组可用钢坯为空,热装操作失败!");
+        }
         // 获取第一个分组的第一条记录
         Optional<BilletBasicInfo> firstBilletInfo = groupByAssemblyNumber.values().stream()
                 .filter(list -> !list.isEmpty())
@@ -227,6 +230,7 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
         if (jsonObject.containsKey("fail")) {
             return Result.OK((String) jsonObject.get("fail"));
         }
+        log.info(">>>>>>>>>>>>B端推钢室界面<热装>成功!");
         return Result.OK((String) jsonObject.get("success"));
     }
 

+ 10 - 5
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/controller/StackingAndLoadingVehiclesController.java

@@ -210,15 +210,19 @@ public class StackingAndLoadingVehiclesController extends JeecgController<Stacki
 			 queryWrapper2.eq(BilletBasicInfo::getLength, stackingAddParams.getLength());
 		 }
 		 List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper2);
-		 if (oConvertUtils.listIsEmpty(billetBasicInfoList)){
-			 log.info("{}{}", "钢坯实绩不存在,起垛操作失败!", JSON.toJSON(stackingAddParams));
-			 return Result.error("钢坯实绩不存在,起垛操作失败!");
+		 if (oConvertUtils.listIsEmpty(billetBasicInfoList) || billetBasicInfoList.size() < 4){
+			 log.info("{}{}", "钢坯实绩不存在,推钢室起垛操作失败:", JSON.toJSON(stackingAddParams));
+			 return Result.error("钢坯实绩不存在或不足4支,起垛失败!");
 		 }
 		 log.info("{}{}", "推钢室操作工,<起垛>操作钢坯实绩信息:", JSON.toJSON(billetBasicInfoList));
 		 // 按assemblyNumber分组,并过滤出数量为4的组
 		 // 2025/5/26  按总数数量为4分组、并且每组是同一炉的钢坯
 		 Map<String, List<BilletBasicInfo>> groupByAssemblyNumber  = groupAndFilterByHeatNo(billetBasicInfoList, 4);
-
+		 if (groupByAssemblyNumber == null || groupByAssemblyNumber.isEmpty()) {
+			 // 处理结果为空的情况(没有符合条件的分组)
+			 log.info("{}{}", "起垛-分组后钢坯可用信息为空:", JSON.toJSON(groupByAssemblyNumber));
+			 return Result.error("分组可用钢坯为空,起垛失败!");
+		 }
 		 List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = new ArrayList<>();
 		 List<RollClubCommon> rollClubCommonList = new ArrayList<>();
 
@@ -271,12 +275,13 @@ public class StackingAndLoadingVehiclesController extends JeecgController<Stacki
 		 loadingParams.setStackingAndLoadingVehiclesList(stackingAndLoadingVehiclesList);
 		 loadingParams.setRollClubCommonList(rollClubCommonList);
 
-		 log.info(">>>>>>>>>>>>B端操作工推钢室-新增堆垛信息:"+ JSON.toJSON(loadingParams));
+		 log.info(">>>>>>>>>>>>B端推钢室操作工-新增堆垛信息:"+ JSON.toJSON(loadingParams));
 
 		 JSONObject jsonObject = stackingAndLoadingVehiclesService.addStackInfo(loadingParams);
 		 if (jsonObject.containsKey("fail")){
 			 return Result.OK((String) jsonObject.get("fail"));
 		 }
+		 log.info(">>>>>>>>>>>>B端推钢室界面<起垛>成功!");
 		 return Result.OK((String) jsonObject.get("success"));
 	 }