| 
					
				 | 
			
			
				@@ -13,6 +13,7 @@ import com.jeeplus.core.persistence.Page; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jeeplus.core.service.CrudService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.entity.LiKuResourcePool; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.mapper.LiKuResourcePoolMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.utils.OptimalUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.constant.AreaCodeFlagEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.constant.AreaTypeFlagEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.constant.MaterialsUnitFlagEnum; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Collections; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Stream; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -99,7 +101,6 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<LiKuResourcePool> liKuPoolList = liKuResourcePoolMapper.findLiKuList(null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //如果利库资源池为空时 则直接返回结果提示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (liKuPoolList == null || liKuPoolList.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            j.setSuccess(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             j.setMsg("请先导入利库资源池!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -128,7 +129,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //添加标识 分组 段长数据 非段长数据 单位转换 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (liKuResourcePool.getUnitOfMeasurement().equals(MaterialsUnitFlagEnum.M.getUnit()) || liKuResourcePool.getUnitOfMeasurement().equals(MaterialsUnitFlagEnum.KM.getUnit())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (StringUtils.isNotBlank(liKuResourcePool.getLengthOfCable())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                /*if (StringUtils.isNotBlank(liKuResourcePool.getLengthOfCable())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String[] split = liKuResourcePool.getLengthOfCable().split(";"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     for (int i = 0; i < split.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         //拆分成新的对象添加集合中 拆分段长为剩余 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -147,16 +148,15 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         liKuIsSegmentPoolList.add(ResourcePool); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (liKuResourcePool.getUnitOfMeasurement().equals(MaterialsUnitFlagEnum.KM.getUnit())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        liKuResourcePool.setUnitOfMeasurement(MaterialsUnitFlagEnum.M.getUnit()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        liKuResourcePool.setInventoryAmount(new BigDecimal(liKuResourcePool.getInventoryAmount()).multiply(new BigDecimal(1000)).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        liKuResourcePool.setLengthOfCable(liKuResourcePool.getInventoryAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        liKuResourcePool.setRemaining(liKuResourcePool.getInventoryAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    liKuIsSegmentPoolList.add(liKuResourcePool); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else {}*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (liKuResourcePool.getUnitOfMeasurement().equals(MaterialsUnitFlagEnum.KM.getUnit())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    liKuResourcePool.setInventoryAmount(new BigDecimal(liKuResourcePool.getInventoryAmount()).multiply(new BigDecimal(1000)).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    liKuResourcePool.setLengthOfCable(liKuResourcePool.getInventoryAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    liKuResourcePool.setRemaining(liKuResourcePool.getInventoryAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                liKuIsSegmentPoolList.add(liKuResourcePool); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                /*}*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 liKuIsNotSegmentPoolList.add(liKuResourcePool); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -184,36 +184,41 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             l.setNumberOfNiches(0.0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //初始化申请数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             l.setNumberOfApplications(l.getTotal()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(l.getReportingArea().equals(AreaCodeFlagEnum.HLA2.getArea())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (l.getReportingArea().equals(AreaCodeFlagEnum.HLA2.getArea())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 l.setAreaCodeFlagEnum(AreaCodeFlagEnum.HLA2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else if(l.getReportingArea().equals(AreaCodeFlagEnum.HLD1.getArea())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (l.getReportingArea().equals(AreaCodeFlagEnum.HLD1.getArea())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 l.setAreaCodeFlagEnum(AreaCodeFlagEnum.HLD1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else if(l.getReportingArea().equals(AreaCodeFlagEnum.HLB1.getArea())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (l.getReportingArea().equals(AreaCodeFlagEnum.HLB1.getArea())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 l.setAreaCodeFlagEnum(AreaCodeFlagEnum.HLB1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else if(l.getReportingArea().equals(AreaCodeFlagEnum.HLC1.getArea())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (l.getReportingArea().equals(AreaCodeFlagEnum.HLC1.getArea())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 l.setAreaCodeFlagEnum(AreaCodeFlagEnum.HLC1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 l.setAreaCodeFlagEnum(AreaCodeFlagEnum.NO_PLACE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //单位转换为米 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (l.getUnit().equals(MaterialsUnitFlagEnum.KM.getUnit())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 l.setTotal((BigDecimal.valueOf(l.getTotal()).multiply(new BigDecimal(1000))).doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                l.setUnit(MaterialsUnitFlagEnum.M.getUnit()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 l.setNumberOfApplications(l.getTotal()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (l.getUnit().equals(MaterialsUnitFlagEnum.M.getUnit())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (l.getUnit().equals(MaterialsUnitFlagEnum.M.getUnit()) || l.getUnit().equals(MaterialsUnitFlagEnum.KM.getUnit())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialIsSegmentList.add(l); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialIsNotSegmentList.add(l); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<MaterialReportDetails> materialIsSegmentSortList = getSortMaterialReport(materialIsSegmentList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<MaterialReportDetails> materialIsNotSegmentSortList = getSortMaterialReport(materialIsNotSegmentList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /*materialIsNotSegmentSortList.forEach(m->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            System.out.println(m.getAreaCodeFlagEnum().getArea() + "-----" + m.getTotal() +"-------"+ m.getExtendedCoding()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        });*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /********************************************物资利库比较***************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //非段长物资比较 本地库 物资匹配利库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        materialIsNotSegmentList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        materialIsNotSegmentSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //优先匹配最佳 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             /*liKuIsNotSegmentPoolSortList.stream().filter(liKu -> liKu.getLiKuFlag().getArea().equals(l.getReportingArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     && Double.valueOf(liKu.getRemaining()).compareTo(l.getTotal()) >= 0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -231,7 +236,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //非段长物资比较 跨区库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        materialIsNotSegmentList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        materialIsNotSegmentSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //需求数量与利库数量不同 去其他地区找 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             /*if (l.getTotal().compareTo(l.getNumberOfNiches()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //优先匹配最佳 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -252,7 +257,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //非段长物资替代 本地库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        materialIsNotSegmentList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        materialIsNotSegmentSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //如果本地库 区域库依旧没找到 则启用代替 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             /*if (l.getTotal().compareTo(l.getNumberOfNiches()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //过滤出 本地库物料编码相同 最优选择 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -265,13 +270,13 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (l.getTotal().compareTo(l.getNumberOfNiches()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 liKuIsNotSegmentPoolSortList.stream().filter(liKu -> liKu.getLiKuFlag().getArea().equals(l.getReportingArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && l.getMaterialCode().equals(liKu.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        && !l.getExtendedCoding() .equals(liKu.getExtendedCoding()) ).forEach(liKuResourcePool -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && !l.getExtendedCoding().equals(liKu.getExtendedCoding())).forEach(liKuResourcePool -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     liKuCompareMaterial(l, liKuResourcePool, AreaTypeFlagEnum.LOCAL, AreaTypeFlagEnum.LOCAL_REPLACEMENT, MaterialsUnitFlagEnum.IS_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //非段长物资代替 库区库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        materialIsNotSegmentList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        materialIsNotSegmentSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //如果本地库 区域库依旧没找到 则启用代替 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             /*if (l.getTotal().compareTo(l.getNumberOfNiches()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //过滤出 本地库物料编码相同 最优选择 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -284,27 +289,41 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (l.getTotal().compareTo(l.getNumberOfNiches()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 liKuIsNotSegmentPoolSortList.stream().filter(liKu -> !liKu.getLiKuFlag().getArea().equals(l.getReportingArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && l.getMaterialCode().equals(liKu.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        && !l.getExtendedCoding() .equals(liKu.getExtendedCoding())).forEach(liKuResourcePool -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && !l.getExtendedCoding().equals(liKu.getExtendedCoding())).forEach(liKuResourcePool -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     liKuCompareMaterial(l, liKuResourcePool, AreaTypeFlagEnum.SPAN, AreaTypeFlagEnum.SPAN_REPLACEMENT, MaterialsUnitFlagEnum.IS_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //段长物资比较 本地库 利库匹配物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /***********************************************本地库 段长匹配**********************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资 本地库比较 最优 上报物资匹配利库池 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        materialIsSegmentSortList.forEach(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //过滤 本地库 物料编码 扩展编码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<LiKuResourcePool> collect = liKuIsSegmentPoolSortList.stream().filter(liKu -> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    liKu.getLiKuFlag().getArea().equals(m.getReportingArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && m.getMaterialCode().equals(liKu.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && m.getExtendedCoding().equals(liKu.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OptimalUtil optimalUtil = new OptimalUtil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //返回最优解 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            optimalUtil.getOptimalReverse(m.getTotal(), collect).forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                liKuCompareMaterial(m, l, AreaTypeFlagEnum.LOCAL, null, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资 本地库比较 最优 利库池匹配上报物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //最优选择 过滤本地库  物料编码  扩展编码 段长大于上报物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            materialIsSegmentList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<MaterialReportDetails> collect = materialIsSegmentSortList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    && material.getExtendedCoding().equals(l.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) == 0).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            liKuCompareMaterial(materialReportDetails, l, AreaTypeFlagEnum.LOCAL, null, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    && material.getExtendedCoding().equals(l.getExtendedCoding())).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OptimalUtil optimalUtil = new OptimalUtil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            optimalUtil.getOptimal(Double.parseDouble(l.getLengthOfCable()), collect).forEach(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                liKuCompareMaterial(m, l, AreaTypeFlagEnum.LOCAL, null, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资比较 本地库 利库匹配物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                materialIsSegmentList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialIsSegmentSortList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && material.getExtendedCoding().equals(l.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) > 0).forEach(materialReportDetails -> { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -315,10 +334,131 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //段长物资比较 跨区库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /***********************************************************跨区库 段长匹配***********************************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资 跨区库比较 最优 上报物资匹配利库池 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        materialIsSegmentSortList.forEach(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //过滤 跨区库 物料编码 扩展编码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<LiKuResourcePool> collect = liKuIsSegmentPoolSortList.stream().filter(liKu -> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    !liKu.getLiKuFlag().getArea().equals(m.getReportingArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && m.getMaterialCode().equals(liKu.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && m.getExtendedCoding().equals(liKu.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OptimalUtil optimalUtil = new OptimalUtil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //返回最优解 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            optimalUtil.getOptimalReverse(m.getTotal(), collect).forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                liKuCompareMaterial(m, l, AreaTypeFlagEnum.SPAN, null, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资 跨区库比较 最优 利库池匹配上报物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<MaterialReportDetails> collect = materialIsSegmentSortList.stream().filter(material -> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    && material.getExtendedCoding().equals(l.getExtendedCoding())).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OptimalUtil optimalUtil = new OptimalUtil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            optimalUtil.getOptimal(Double.parseDouble(l.getLengthOfCable()), collect).forEach(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                liKuCompareMaterial(m, l, AreaTypeFlagEnum.SPAN, null, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资比较 跨区库 利库匹配物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialIsSegmentSortList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && material.getExtendedCoding().equals(l.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) > 0).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.valueOf(materialReportDetails.getTotal())) >= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                liKuCompareMaterial(materialReportDetails, l, AreaTypeFlagEnum.SPAN, null, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /*************************************************************本地库-代替 段长*******************************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资 本地库比较 最优 上报物资匹配利库池 替代 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        materialIsSegmentSortList.forEach(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //过滤 本地库 物料编码 扩展编码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<LiKuResourcePool> collect = liKuIsSegmentPoolSortList.stream().filter(liKu -> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    liKu.getLiKuFlag().getArea().equals(m.getReportingArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && m.getMaterialCode().equals(liKu.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && !m.getExtendedCoding().equals(liKu.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OptimalUtil optimalUtil = new OptimalUtil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //返回最优解 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            optimalUtil.getOptimalReverse(m.getTotal(), collect).forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                liKuCompareMaterial(m, l, AreaTypeFlagEnum.LOCAL,  AreaTypeFlagEnum.LOCAL_REPLACEMENT, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资 本地库比较 最优 利库池匹配上报物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<MaterialReportDetails> collect = materialIsSegmentSortList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    && !material.getExtendedCoding().equals(l.getExtendedCoding())).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OptimalUtil optimalUtil = new OptimalUtil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            optimalUtil.getOptimal(Double.parseDouble(l.getLengthOfCable()), collect).forEach(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                liKuCompareMaterial(m, l, AreaTypeFlagEnum.LOCAL,  AreaTypeFlagEnum.LOCAL_REPLACEMENT, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资比较 本地库 利库匹配物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialIsSegmentSortList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && !material.getExtendedCoding().equals(l.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) > 0).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.valueOf(materialReportDetails.getTotal())) >= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                liKuCompareMaterial(materialReportDetails, l, AreaTypeFlagEnum.LOCAL,  AreaTypeFlagEnum.LOCAL_REPLACEMENT, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /*****************************************************跨区库 段长 替代 ****************************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资 跨区库比较 最优 上报物资匹配利库池 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        materialIsSegmentSortList.forEach(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //过滤 跨区库 物料编码 扩展编码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<LiKuResourcePool> collect = liKuIsSegmentPoolSortList.stream().filter(liKu -> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    !liKu.getLiKuFlag().getArea().equals(m.getReportingArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && m.getMaterialCode().equals(liKu.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && !m.getExtendedCoding().equals(liKu.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OptimalUtil optimalUtil = new OptimalUtil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //返回最优解 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            optimalUtil.getOptimalReverse(m.getTotal(), collect).forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                liKuCompareMaterial(m, l, AreaTypeFlagEnum.SPAN, AreaTypeFlagEnum.SPAN_REPLACEMENT, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资 跨区库比较 最优 利库池匹配上报物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<MaterialReportDetails> collect = materialIsSegmentSortList.stream().filter(material -> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && !material.getExtendedCoding().equals(l.getExtendedCoding())).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OptimalUtil optimalUtil = new OptimalUtil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            optimalUtil.getOptimal(Double.parseDouble(l.getLengthOfCable()), collect).forEach(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                liKuCompareMaterial(m, l, AreaTypeFlagEnum.SPAN, AreaTypeFlagEnum.SPAN_REPLACEMENT, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资比较 跨区库 利库匹配物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialIsSegmentSortList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && !material.getExtendedCoding().equals(l.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) > 0).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.valueOf(materialReportDetails.getTotal())) >= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                liKuCompareMaterial(materialReportDetails, l, AreaTypeFlagEnum.SPAN, AreaTypeFlagEnum.SPAN_REPLACEMENT, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //段长物资比较 跨区库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /*liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //最优选择 过滤本地库  物料编码  扩展编码 段长大于上报物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            materialIsSegmentList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            materialIsSegmentSortList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     && material.getExtendedCoding().equals(l.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) == 0).forEach(materialReportDetails -> { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -328,7 +468,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                materialIsSegmentList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialIsSegmentSortList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && material.getExtendedCoding().equals(l.getExtendedCoding()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) > 0).forEach(materialReportDetails -> { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -342,7 +482,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //段长物资替换 本地库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //最优选择 过滤本地库  物料编码  扩展编码 段长大于上报物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            materialIsSegmentList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            materialIsSegmentSortList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) == 0).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -351,7 +491,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                materialIsSegmentList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialIsSegmentSortList.stream().filter(material -> material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) > 0).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.valueOf(materialReportDetails.getTotal())) >= 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -364,33 +504,32 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //段长物资替换 跨区库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         liKuIsSegmentPoolSortList.forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //最优选择 过滤本地库  物料编码  扩展编码 段长大于上报物资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            materialIsSegmentList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            materialIsSegmentSortList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) == 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    && !l.getExtendedCoding() .equals(material.getExtendedCoding())).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    && !l.getExtendedCoding().equals(material.getExtendedCoding())).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             liKuCompareMaterial(materialReportDetails, l, AreaTypeFlagEnum.SPAN, AreaTypeFlagEnum.SPAN_REPLACEMENT, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                materialIsSegmentList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialIsSegmentSortList.stream().filter(material -> !material.getReportingArea().equals(l.getLiKuFlag().getArea()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && material.getMaterialCode().equals(l.getMaterialCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         && new BigDecimal(l.getLengthOfCable()).compareTo(BigDecimal.valueOf(material.getTotal())) > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        && !l.getExtendedCoding() .equals(material.getExtendedCoding())).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        && !l.getExtendedCoding().equals(material.getExtendedCoding())).forEach(materialReportDetails -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             if (new BigDecimal(l.getRemaining()).compareTo(BigDecimal.valueOf(materialReportDetails.getTotal())) >= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 liKuCompareMaterial(materialReportDetails, l, AreaTypeFlagEnum.SPAN, AreaTypeFlagEnum.SPAN_REPLACEMENT, MaterialsUnitFlagEnum.IS_NOT_SEGMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        });*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //段长非段长合并 排序 处理拆分段长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<LiKuResourcePool> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /*List<LiKuResourcePool> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         liKuIsSegmentPoolSortList.stream().map(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             m.setLengthOfCable(m.getRemaining() + ";"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return m; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }).forEach(l -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (tempList.size() != 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -410,7 +549,6 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         //修改 利库数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         temp.setNumberOfNiches((new BigDecimal(temp.getNumberOfNiches()).add(new BigDecimal(l.getNumberOfNiches()))).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         flag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -420,10 +558,18 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 tempList.add(l); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        });*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //利库合并 并排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<LiKuResourcePool> sortLiKuPoolList = getSortLiKuPool(Stream.concat(liKuIsNotSegmentPoolSortList.stream(), tempList.stream()).map(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            m.setLengthOfCable(interceptString(m.getLengthOfCable())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<LiKuResourcePool> sortLiKuPoolList = getSortLiKuPool(Stream.concat(liKuIsNotSegmentPoolSortList.stream(), liKuIsSegmentPoolSortList.stream()).map(m -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (m.getUnitOfMeasurement().equals(MaterialsUnitFlagEnum.KM.getUnit())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (StringUtils.isNotBlank(m.getNumberOfNiches())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    m.setNumberOfNiches(new BigDecimal(m.getNumberOfNiches()).divide(new BigDecimal(1000)).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (StringUtils.isNotBlank(m.getRemaining())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    m.setRemaining(new BigDecimal(m.getRemaining()).divide(new BigDecimal(1000)).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return m; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }).collect(Collectors.toList())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //上报资源合并 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -448,17 +594,26 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             m.setRegionalReplacementBatch(interceptString(m.getRegionalReplacementBatch())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             m.setRegionalReplacementHouse(interceptString(m.getRegionalReplacementHouse())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             m.setRegionalReplacementNumber(interceptString(m.getRegionalReplacementNumber())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (m.getUnit().equals(MaterialsUnitFlagEnum.KM.getUnit())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BigDecimal convert = new BigDecimal(1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (m.getTotal() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    m.setTotal(BigDecimal.valueOf(m.getTotal()).divide(convert).doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (m.getNumberOfNiches() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    m.setNumberOfNiches(BigDecimal.valueOf(m.getNumberOfNiches()).divide(convert).doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (m.getNumberOfApplications() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    m.setNumberOfApplications(BigDecimal.valueOf(m.getNumberOfApplications()).divide(convert).doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return m; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /***************************************存储数据库************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //清除利库池 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        liKuResourcePoolMapper.clearLiKuResource(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         materialReportDetailsMapper.delAll(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sortLiKuPoolList.forEach(DataEntity::preInsert); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        liKuResourcePoolMapper.insertList(sortLiKuPoolList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        liKuResourcePoolMapper.updateAllList(sortLiKuPoolList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         materialResultList.forEach(DataEntity::preInsert); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         materialReportDetailsMapper.insertList(materialResultList); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -522,7 +677,9 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /*} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             materialReportDetails.setNumberOfNiches(material_liKuCount.add(temp).doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (materialReportDetails.getUnit().equals(MaterialsUnitFlagEnum.KM.getUnit())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            temp = temp.divide(new BigDecimal(1000)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //如果代替标识为空则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (replacement == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //传递标识,根据标识来判断本地/跨库 所有结束后统一处理多余, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -530,12 +687,12 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //拼接本地库批次号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setLocalWareBatch(materialReportDetails.getLocalWareBatch() + liKuResourcePool.getBatch() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setLocalWareHouse(materialReportDetails.getLocalWareHouse() + liKuResourcePool.getInvLocation() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                materialReportDetails.setNumberOfLocal(materialReportDetails.getNumberOfLocal() + temp + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialReportDetails.setNumberOfLocal(materialReportDetails.getNumberOfLocal() + temp.setScale(2, BigDecimal.ROUND_HALF_UP) + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //拼接跨区批次号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setRegionalBatch(materialReportDetails.getRegionalBatch() + liKuResourcePool.getBatch() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setRegionalHouse(materialReportDetails.getRegionalHouse() + liKuResourcePool.getInvLocation() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                materialReportDetails.setNumberOfRegional(materialReportDetails.getNumberOfRegional() + temp + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialReportDetails.setNumberOfRegional(materialReportDetails.getNumberOfRegional() + temp.setScale(2, BigDecimal.ROUND_HALF_UP) + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //区分本地利库与跨区利库替换 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -544,16 +701,15 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setLocalReplacementExtendedDescription(materialReportDetails.getLocalReplacementExtendedDescription() + liKuResourcePool.getExtendedDescription() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setLocalReplacementBatch(materialReportDetails.getLocalReplacementBatch() + liKuResourcePool.getBatch() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setLocalReplacementHouse(materialReportDetails.getLocalReplacementHouse() + liKuResourcePool.getInvLocation() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                materialReportDetails.setLocalReplacementNumber(materialReportDetails.getLocalReplacementNumber() + temp + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialReportDetails.setLocalReplacementNumber(materialReportDetails.getLocalReplacementNumber() + temp.setScale(2, BigDecimal.ROUND_HALF_UP) + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setRegionalReplacementExtendedCoding(materialReportDetails.getRegionalReplacementExtendedCoding() + liKuResourcePool.getExtendedCoding() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setRegionalReplacementExtendedDescription(materialReportDetails.getRegionalReplacementExtendedDescription() + liKuResourcePool.getExtendedDescription() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setRegionalReplacementBatch(materialReportDetails.getRegionalReplacementBatch() + liKuResourcePool.getBatch() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 materialReportDetails.setRegionalReplacementHouse(materialReportDetails.getRegionalReplacementHouse() + liKuResourcePool.getInvLocation() + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                materialReportDetails.setRegionalReplacementNumber(materialReportDetails.getRegionalReplacementNumber() + temp + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                materialReportDetails.setRegionalReplacementNumber(materialReportDetails.getRegionalReplacementNumber() + temp.setScale(2, BigDecimal.ROUND_HALF_UP) + ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -595,21 +751,23 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 上报资源排序 地区-》需求数量-》扩展编码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param materialReportDetailsList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private List<MaterialReportDetails> getSortMaterialReport(List<MaterialReportDetails> materialReportDetailsList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return materialReportDetailsList.stream().sorted((material1,material2)->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(material1.getAreaCodeFlagEnum()==material2.getAreaCodeFlagEnum()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(material1.getTotal().compareTo(material2.getTotal())==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private List<MaterialReportDetails> getSortMaterialReport(List<MaterialReportDetails> materialReportDetailsList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return materialReportDetailsList.stream().sorted((material1, material2) -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (material1.getAreaCodeFlagEnum() == material2.getAreaCodeFlagEnum()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (material1.getTotal().compareTo(material2.getTotal()) == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return new BigDecimal(material1.getExtendedCoding()).compareTo(new BigDecimal(material2.getExtendedCoding())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return material2.getTotal().compareTo(material1.getTotal()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return material1.getAreaCodeFlagEnum().getNum() - material2.getAreaCodeFlagEnum().getNum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |