Ver código fonte

物资上报 扩展编码排序为空问题

chenyuesheng 2 anos atrás
pai
commit
d4cf1099c8

+ 12 - 7
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/service/MaterialReportDetailsService.java

@@ -109,7 +109,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
         //循环初始化
         liKuPoolList.forEach(liKuResourcePool -> {
             //如果总量为空
-            if(StringUtils.isBlank(liKuResourcePool.getInventoryAmount())){
+            if (StringUtils.isBlank(liKuResourcePool.getInventoryAmount())) {
                 liKuResourcePool.setInventoryAmount("0");
             }
             //初始化剩余数量
@@ -156,8 +156,10 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
         List<MaterialReportDetails> materialIsNotSegmentList = new ArrayList<>();
         //根据 段长非段长区分 初始化
         materialReportDetailsList.forEach(l -> {
+
+
             //如果申请数量为空
-            if(null==l.getTotal()){
+            if (null == l.getTotal()) {
                 l.setTotal(0.0);
             }
             //初始化利库数量
@@ -232,7 +234,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
                 });
             }
         });
-        //非段长物资代替 区库
+        //非段长物资代替 区库
         materialIsNotSegmentSortList.forEach(l -> {
             //如果总量与利库数量不同
             if (l.getTotal().compareTo(l.getNumberOfNiches()) != 0) {
@@ -388,7 +390,9 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
         }).collect(Collectors.toList()));
 
         //上报资源合并 段长/非段长集合转换为流进行合并,在此基础上对该流进行数据处理,把处理完的流转换为集合进行排序
-        List<MaterialReportDetails> materialResultList = getSortMaterialReport(Stream.concat(materialIsNotSegmentList.stream(), materialIsSegmentList.stream()).map(m -> {
+        List<MaterialReportDetails> materialResultList = Stream.concat(materialIsNotSegmentList.stream(), materialIsSegmentList.stream()).map(m -> {
+
+
             //调用字符串处理方法,处理上报资源中多余,
             m.setLocalWareBatch(interceptString(m.getLocalWareBatch()));
             m.setLocalWareHouse(interceptString(m.getLocalWareHouse()));
@@ -423,7 +427,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
                 }
             }
             return m;
-        }).collect(Collectors.toList()));
+        }).collect(Collectors.toList());
 
         /***************************************存储数据库************************************************/
         //更新利库池
@@ -575,8 +579,9 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
             if (material1.getAreaCodeFlagEnum() == material2.getAreaCodeFlagEnum()) {
                 //总量比较
                 if (material1.getTotal().compareTo(material2.getTotal()) == 0) {
-                    //扩展编码比较
-                    return new BigDecimal(material1.getExtendedCoding()).compareTo(new BigDecimal(material2.getExtendedCoding()));
+                    //扩展编码比较     如果扩展编码为空值 为不影响排序比较  用Integer最大值来进行代替比较 排序到最后
+                    return new BigDecimal(StringUtils.isBlank(material1.getExtendedCoding()) ? String.valueOf(Integer.MAX_VALUE) : material1.getExtendedCoding())
+                            .compareTo(new BigDecimal(StringUtils.isBlank(material2.getExtendedCoding()) ? String.valueOf(Integer.MAX_VALUE) : material2.getExtendedCoding()));
                 } else {
                     return material2.getTotal().compareTo(material1.getTotal());
                 }