wangxin hace 2 meses
padre
commit
ab5631d935

+ 11 - 0
src/main/java/cn/ezhizao/project/business/controller/BizOutsourcedOrderController.java

@@ -178,6 +178,17 @@ private IBizDayworkService bizDayworkService;
         BizOutsourcedOrderDetail detail = bizOutsourcedOrderDetailService.getById(bizOutsourcedOrderDetail.getDetailId());
         detail.setNewCarrierCount(bizOutsourcedOrderDetail.getCarrierIds().size());
         List<BizCarrier> carriers = bizCarrierService.query().in("id", bizOutsourcedOrderDetail.getCarrierIds()).list();
+
+        // 获取carriers中所有categoryId的集合,判断是载具类型是否一致
+        Set<Long> categoryIds = carriers.stream()
+                .map(BizCarrier::getCategoryId) // 提取categoryId
+                .collect(Collectors.toSet());   // 收集到Set中
+
+        // 判断categoryId的数量是否大于1
+        if (categoryIds.size() > 1) {
+            return AjaxResult.error("载具分类不一致,请确保所有载具属于同一分类。");
+        }
+
         // 获取箱类型盘点是否有一箱多批的箱子
         List<BizCarrierCategory> bizCarrierCategories = bizCarrierCategoryService.query().in( "id", carriers.isEmpty() ? Collections.singletonList(0L): carriers.stream().map(BizCarrier::getCategoryId).collect(Collectors.toList())).list();
         if (bizCarrierCategories.stream().anyMatch(v -> v.getIsAllowMore().equals(1)) && bizCarrierCategories.stream().anyMatch(v -> v.getIsAllowMore().equals(0))) {