Pārlūkot izejas kodu

利库平衡管理模块-bug修改

wangqiang 2 gadi atpakaļ
vecāks
revīzija
b6c0132f2a
14 mainītis faili ar 837 papildinājumiem un 205 dzēšanām
  1. 1 1
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/constant/AreaCodeFlagEnum.java
  2. 0 2
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/entity/LikuDetail.java
  3. 74 0
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/entity/LikuDetailDo.java
  4. 2 0
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/entity/MaterialReportDetails.java
  5. 4 3
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/mapper/MaterialReportDetailsMapper.java
  6. 27 0
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/mapper/xml/MaterialReportDetailsMapper.xml
  7. 6 1
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/service/MaterialReportDetailsService.java
  8. 510 0
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/utils/ExcelUtil.java
  9. 71 179
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/utils/ExportUtil.java
  10. 109 4
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/web/MaterialReportDetailsControllerTest.java
  11. 13 10
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/reportPerson/service/ReportPersonService.java
  12. 4 2
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/transitMaterialGoods/mapper/xml/TransitMaterialGoodsMapper.xml
  13. 14 1
      src/main/java/com/jeeplus/modules/sg/balancedlibrary/transitMaterialGoods/web/TransitMaterialGoodsController.java
  14. 2 2
      src/main/webapp/webpage/modules/sg/balancedlibrary/transitMaterialGoods/transitMaterialGoodsList.jsp

+ 1 - 1
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/constant/AreaCodeFlagEnum.java

@@ -3,7 +3,7 @@ package com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.constant;
 public enum AreaCodeFlagEnum {
 
     //HLA2-市公司 HLD1-扬中 HLB1-丹阳 句容-HLC1 未知地区-NO_PLACE
-    HLA2("市公司",0,"HLA2"),HLD1("扬中",1,"HLD1"),HLB1("丹阳",2,"HLB1"),HLC1("句容",3,"HLC1"),NO_PLACE("未知地区",4,"NO_PLACE");
+    HLA2("镇江大港仓库",0,"HLA2"),HLD1("扬中普庆仓库",1,"HLD1"),HLB1("丹阳阜阳仓库",2,"HLB1"),HLC1("句容福地仓库",3,"HLC1"),NO_PLACE("未知地区",4,"NO_PLACE");
 
     private final String area;
     private final Integer num;

+ 0 - 2
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/entity/LikuDetail.java

@@ -5,8 +5,6 @@ package com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity;
  */
 public class LikuDetail {
 
-
-
     private String reportingArea;//上报地区
     private String nameOfReserve;//物料申请所属项目
     private String materialCode;//物料编码

+ 74 - 0
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/entity/LikuDetailDo.java

@@ -0,0 +1,74 @@
+package com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity;
+
+import com.jeeplus.core.persistence.DataEntity;
+
+/**
+ * 查看详情
+ * @author: 王强
+ * @create: 2022-10-20 15:12
+ **/
+public class LikuDetailDo extends DataEntity<LikuDetailDo> {
+
+    private String comparisonType;//利库类型
+    private Double numberNiches;//利库数量
+    private String batch;//利库批次号
+    private String warehouse;//库存地
+
+    /**
+     * 储备项目名称
+     * */
+    private String nameOfReserve;
+
+    /**
+     * 物料编码
+     * */
+    private String materialCode;
+
+    public String getComparisonType() {
+        return comparisonType;
+    }
+
+    public void setComparisonType(String comparisonType) {
+        this.comparisonType = comparisonType;
+    }
+
+    public Double getNumberNiches() {
+        return numberNiches;
+    }
+
+    public void setNumberNiches(Double numberNiches) {
+        this.numberNiches = numberNiches;
+    }
+
+    public String getBatch() {
+        return batch;
+    }
+
+    public void setBatch(String batch) {
+        this.batch = batch;
+    }
+
+    public String getWarehouse() {
+        return warehouse;
+    }
+
+    public void setWarehouse(String warehouse) {
+        this.warehouse = warehouse;
+    }
+
+    public String getNameOfReserve() {
+        return nameOfReserve;
+    }
+
+    public void setNameOfReserve(String nameOfReserve) {
+        this.nameOfReserve = nameOfReserve;
+    }
+
+    public String getMaterialCode() {
+        return materialCode;
+    }
+
+    public void setMaterialCode(String materialCode) {
+        this.materialCode = materialCode;
+    }
+}

+ 2 - 0
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/entity/MaterialReportDetails.java

@@ -12,6 +12,7 @@ import java.util.List;
  * @version 1.0
  */
 public class MaterialReportDetails extends DataEntity<MaterialReportDetails> {
+
     /**
      * 上报地区
      * */
@@ -696,4 +697,5 @@ public class MaterialReportDetails extends DataEntity<MaterialReportDetails> {
     public void setLiKuAmount(String liKuAmount) {
         this.liKuAmount = liKuAmount;
     }
+
 }

+ 4 - 3
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/mapper/MaterialReportDetailsMapper.java

@@ -5,10 +5,8 @@ package com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.mapper;
 
 import com.jeeplus.core.persistence.BaseMapper;
 import com.jeeplus.core.persistence.annotation.MyBatisMapper;
-import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.entity.LiKuResourcePool;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.LikuDetail;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.MaterialReportDetails;
-import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -23,5 +21,8 @@ public interface MaterialReportDetailsMapper extends BaseMapper<MaterialReportDe
 
     void delAll();
 
+    //LikuDetail
     List<LikuDetail>  getLikuDetails(MaterialReportDetails report);
-}
+
+    List<MaterialReportDetails>  getLikuDetailsNew(MaterialReportDetails report);
+}

+ 27 - 0
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/mapper/xml/MaterialReportDetailsMapper.xml

@@ -336,5 +336,32 @@
         </if>
         order by r.reportingArea,r.nameOfReserve,r.materialCode,r.extendedCoding
     </select>
+    <select id="getLikuDetailsNew"
+            resultType="com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.MaterialReportDetails">
+        select
+        <include refid="resourceColumns"/>
+
+        from bla_material_report a
+        where
+        a.id is not null
+        <if test="id != null and id != ''">
+            AND a.id = #{id}
+        </if>
+        <if test="nameOfReserve != null and nameOfReserve != ''">
+            and a.nameOfReserve like concat('%',#{nameOfReserve},'%')
+        </if>
+        <if test="materialCode != null and materialCode != ''">
+            AND a.materialCode like concat('%',#{materialCode},'%')
+        </if>
+        <if test="numberOfNiches != null">
+            <if test="numberOfNiches == 0">
+                AND a.numberOfNiches = 0
+            </if>
+            <if test="numberOfNiches == 1">
+                AND a.numberOfNiches >0
+            </if>
+        </if>
+        order by a.reportingArea,a.nameOfReserve,a.materialCode,a.extendedCoding
+    </select>
 
 </mapper>

+ 6 - 1
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/service/MaterialReportDetailsService.java

@@ -88,6 +88,10 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
         return mapper.getLikuDetails(report);
     }
 
+    public List<MaterialReportDetails> getLikuDetailsNew(MaterialReportDetails report) {
+        return mapper.getLikuDetailsNew(report);
+    }
+
     @Transactional(readOnly = false)
     public AjaxJson liKuBalance(List<MaterialReportDetails> materialReportDetailsList) {
         AjaxJson j = new AjaxJson();
@@ -98,6 +102,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
         List<LiKuResourcePool> liKuIsNotSegmentPoolList = new ArrayList<>();
 
         List<LiKuResourcePool> liKuPoolList = liKuResourcePoolMapper.findLiKuList(null, null);
+
         //如果利库资源池为空时 则直接返回结果提示
         if (liKuPoolList == null || liKuPoolList.size() == 0) {
             j.setMsg("请先导入利库资源池!");
@@ -155,7 +160,6 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
         //根据 段长非段长区分 初始化
         materialReportDetailsList.forEach(l -> {
 
-
             //如果申请数量为空
             if (null == l.getTotal()) {
                 l.setTotal(0.0);
@@ -453,6 +457,7 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
         //将处理结果上报物资重新添加进数据库中
         materialResultList.forEach(DataEntity::preInsert);
         materialReportDetailsMapper.insertList(materialResultList);
+
         j.setSuccess(true);
         j.setMsg("已成功导入 " + materialResultList.size() + " 条物资上报明细记录");
 

+ 510 - 0
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/utils/ExcelUtil.java

@@ -6,8 +6,15 @@ package com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.utils;
 import com.google.common.collect.Lists;
 import com.jeeplus.common.utils.Reflections;
 import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.entity.LiKuResourcePool;
+import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.utils.OptimalUtil;
 import com.jeeplus.modules.sg.balancedlibrary.materialQuota.entity.MaterialQuota;
+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;
+import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.MaterialReportDetails;
 import com.jeeplus.modules.sg.balancedlibrary.onPassageMaterials.entity.MaterialInformation;
+import com.jeeplus.modules.sg.balancedlibrary.reportPerson.entity.ReportPerson;
 import com.jeeplus.modules.sg.balancedlibrary.standardMaterials.entity.StandardMaterials;
 import com.jeeplus.modules.sg.balancedlibrary.transitMaterialGoods.entity.TransitMaterialGoods;
 import com.jeeplus.modules.sys.entity.Area;
@@ -35,6 +42,8 @@ import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * 专门处理导入项目物资后验证问题
@@ -528,6 +537,361 @@ public class ExcelUtil {
 
 	/**
 	 * 在途验证项目需求物资
+	 */
+	public void dealVerifyZtNew(List<MaterialReportDetails> materialReportDetailsList,
+								List<LiKuResourcePool> liKuPoolList,
+								List<ReportPerson> departmentByPerson){
+		//段长利库池
+		List<LiKuResourcePool> liKuIsSegmentPoolList = new ArrayList<>();
+		//非段长利库池
+		List<LiKuResourcePool> liKuIsNotSegmentPoolList = new ArrayList<>();
+
+//		List<LiKuResourcePool> liKuPoolList = liKuResourcePoolMapper.findLiKuList(null, null);
+
+		//循环初始化
+		liKuPoolList.forEach(liKuResourcePool -> {
+			//如果总量为空
+			if (com.jeeplus.common.utils.StringUtils.isBlank(liKuResourcePool.getInventoryAmount())) {
+				liKuResourcePool.setInventoryAmount("0");
+			}
+			//初始化剩余数量
+			liKuResourcePool.setRemaining(liKuResourcePool.getInventoryAmount());
+			//初始化利库数量
+			liKuResourcePool.setNumberOfNiches("0");
+
+
+			//添加地区枚举标识
+			if (liKuResourcePool.getInvLocation().equals(AreaCodeFlagEnum.HLA2.getCode())) {
+				liKuResourcePool.setLiKuFlag(AreaCodeFlagEnum.HLA2);
+			} else if (liKuResourcePool.getInvLocation().equals(AreaCodeFlagEnum.HLB1.getCode())) {
+				liKuResourcePool.setLiKuFlag(AreaCodeFlagEnum.HLB1);
+			} else if (liKuResourcePool.getInvLocation().equals(AreaCodeFlagEnum.HLC1.getCode())) {
+				liKuResourcePool.setLiKuFlag(AreaCodeFlagEnum.HLC1);
+			} else if (liKuResourcePool.getInvLocation().equals(AreaCodeFlagEnum.HLD1.getCode())) {
+				liKuResourcePool.setLiKuFlag(AreaCodeFlagEnum.HLD1);
+			} else {
+				liKuResourcePool.setLiKuFlag(AreaCodeFlagEnum.NO_PLACE);
+			}
+
+			//添加标识 分组 段长数据 非段长数据 单位转换 先把千米转换为米
+			if (liKuResourcePool.getUnitOfMeasurement().equals(MaterialsUnitFlagEnum.M.getUnit()) || liKuResourcePool.getUnitOfMeasurement().equals(MaterialsUnitFlagEnum.KM.getUnit())) {
+				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);
+			}
+		});
+
+		//排序    地区-》库龄降序-》数量大小降序-》批次号-》扩展编码升序
+		List<LiKuResourcePool> liKuIsSegmentPoolSortList = getSortLiKuPool(liKuIsSegmentPoolList);
+		List<LiKuResourcePool> liKuIsNotSegmentPoolSortList = getSortLiKuPool(liKuIsNotSegmentPoolList);
+
+		/*************************************************物资上报明细***************************************/
+		//物资上报 段长物资
+		List<MaterialReportDetails> materialIsSegmentList = new ArrayList<>();
+		//物资上报 非段长物资
+		List<MaterialReportDetails> materialIsNotSegmentList = new ArrayList<>();
+		//根据 段长非段长区分 初始化
+		materialReportDetailsList.forEach(l -> {
+
+
+			//如果申请数量为空
+			if (null == l.getTotal()) {
+				l.setTotal(0.0);
+			}
+			//初始化利库数量
+			l.setNumberOfNiches(0.0);
+			//初始化申请数量
+			l.setNumberOfApplications(l.getTotal());
+			//添加地区标识
+			if (l.getReportingArea().equals(AreaCodeFlagEnum.HLA2.getArea())) {
+				l.setAreaCodeFlagEnum(AreaCodeFlagEnum.HLA2);
+			} else if (l.getReportingArea().equals(AreaCodeFlagEnum.HLD1.getArea())) {
+				l.setAreaCodeFlagEnum(AreaCodeFlagEnum.HLD1);
+			} else if (l.getReportingArea().equals(AreaCodeFlagEnum.HLB1.getArea())) {
+				l.setAreaCodeFlagEnum(AreaCodeFlagEnum.HLB1);
+			} else if (l.getReportingArea().equals(AreaCodeFlagEnum.HLC1.getArea())) {
+				l.setAreaCodeFlagEnum(AreaCodeFlagEnum.HLC1);
+			} else {
+				l.setAreaCodeFlagEnum(AreaCodeFlagEnum.NO_PLACE);
+			}
+
+			//单位转换为米
+			if (l.getUnit().equals(MaterialsUnitFlagEnum.KM.getUnit())) {
+				l.setTotal((BigDecimal.valueOf(l.getTotal()).multiply(new BigDecimal(1000))).doubleValue());
+			}
+			if (l.getUnit().equals(MaterialsUnitFlagEnum.M.getUnit()) || l.getUnit().equals(MaterialsUnitFlagEnum.KM.getUnit())) {
+				l.setNumberOfApplications(l.getTotal());
+				materialIsSegmentList.add(l);
+			} else {
+				materialIsNotSegmentList.add(l);
+			}
+		});
+		//排序
+		List<MaterialReportDetails> materialIsSegmentSortList = getSortMaterialReport(materialIsSegmentList);
+		List<MaterialReportDetails> materialIsNotSegmentSortList = getSortMaterialReport(materialIsNotSegmentList);
+
+		/********************************************物资匹配利库比较***************************************************/
+
+		//非段长物资比较 本地库 物资匹配利库
+		materialIsNotSegmentSortList.forEach(l -> {
+			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 -> {
+					//上报物资对象,利库池对象,地区标识, 地区替换标识,段长非段长标识
+					liKuCompareMaterial(l, liKuResourcePool, AreaTypeFlagEnum.LOCAL, null, MaterialsUnitFlagEnum.IS_NOT_SEGMENT);
+				});
+			}
+		});
+		//非段长物资比较 跨区库 物资匹配利库
+		materialIsNotSegmentSortList.forEach(l -> {
+			//如果总量与利库数量不同
+			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 -> {
+					//上报物资对象,利库池对象,地区标识, 地区替换标识,段长非段长标识
+					liKuCompareMaterial(l, liKuResourcePool, AreaTypeFlagEnum.SPAN, null, MaterialsUnitFlagEnum.IS_NOT_SEGMENT);
+				});
+			}
+		});
+		//非段长物资替代 本地库
+		materialIsNotSegmentSortList.forEach(l -> {
+			//如果总量与利库数量不同
+			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 -> {
+					//上报物资对象,利库池对象,地区标识, 地区替换标识,段长非段长标识
+					liKuCompareMaterial(l, liKuResourcePool, AreaTypeFlagEnum.LOCAL, AreaTypeFlagEnum.LOCAL_REPLACEMENT, MaterialsUnitFlagEnum.IS_NOT_SEGMENT);
+				});
+			}
+		});
+		//非段长物资代替 跨区库
+		materialIsNotSegmentSortList.forEach(l -> {
+			//如果总量与利库数量不同
+			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 -> {
+					//上报物资对象,利库池对象,地区标识, 地区替换标识,段长非段长标识
+					liKuCompareMaterial(l, liKuResourcePool, AreaTypeFlagEnum.SPAN, AreaTypeFlagEnum.SPAN_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.LOCAL, null, MaterialsUnitFlagEnum.IS_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, null, 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.SPAN, null, MaterialsUnitFlagEnum.IS_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_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_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_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_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_SEGMENT);
+			});
+		});
+
+		//利库合并 并排序 将利库段长/非段长集合转换为流的形式进行合并,在此基础上对该流进行处理数据,把处理完的流转换为集合进行排序
+		List<LiKuResourcePool> sortLiKuPoolList = getSortLiKuPool(Stream.concat(liKuIsNotSegmentPoolSortList.stream(), liKuIsSegmentPoolSortList.stream()).map(m -> {
+			//如过单位为千米 说明该对象物资被转换为米进行操作,重新转换为千米
+			if (m.getUnitOfMeasurement().equals(MaterialsUnitFlagEnum.KM.getUnit())) {
+				if (com.jeeplus.common.utils.StringUtils.isNotBlank(m.getNumberOfNiches())) {
+					m.setNumberOfNiches(new BigDecimal(m.getNumberOfNiches()).divide(new BigDecimal(1000)).toString());
+				}
+				if (com.jeeplus.common.utils.StringUtils.isNotBlank(m.getRemaining())) {
+					m.setRemaining(new BigDecimal(m.getRemaining()).divide(new BigDecimal(1000)).toString());
+				}
+			}
+			return m;
+		}).collect(Collectors.toList()));
+
+		//上报资源合并 段长/非段长集合转换为流进行合并,在此基础上对该流进行数据处理,把处理完的流转换为集合进行排序
+		List<MaterialReportDetails> materialResultList = Stream.concat(materialIsNotSegmentList.stream(), materialIsSegmentList.stream()).map(m -> {
+
+
+			//调用字符串处理方法,处理上报资源中多余,
+			m.setLocalWareBatch(interceptString(m.getLocalWareBatch()));
+			m.setLocalWareHouse(interceptString(m.getLocalWareHouse()));
+			m.setNumberOfLocal(interceptString(m.getNumberOfLocal()));
+
+			m.setRegionalBatch(interceptString(m.getRegionalBatch()));
+			m.setRegionalHouse(interceptString(m.getRegionalHouse()));
+			m.setNumberOfRegional(interceptString(m.getNumberOfRegional()));
+
+			m.setLocalReplacementExtendedCoding(interceptString(m.getLocalReplacementExtendedCoding()));
+			m.setLocalReplacementExtendedDescription(interceptString(m.getLocalReplacementExtendedDescription()));
+			m.setLocalReplacementBatch(interceptString(m.getLocalReplacementBatch()));
+			m.setLocalReplacementHouse(interceptString(m.getLocalReplacementHouse()));
+			m.setLocalReplacementNumber(interceptString(m.getLocalReplacementNumber()));
+
+			m.setRegionalReplacementExtendedCoding(interceptString(m.getRegionalReplacementExtendedCoding()));
+			m.setRegionalReplacementExtendedDescription(interceptString(m.getRegionalReplacementExtendedDescription()));
+			m.setRegionalReplacementBatch(interceptString(m.getRegionalReplacementBatch()));
+			m.setRegionalReplacementHouse(interceptString(m.getRegionalReplacementHouse()));
+			m.setRegionalReplacementNumber(interceptString(m.getRegionalReplacementNumber()));
+
+			//设置提报人及提报部门
+			m.setReportPerson(m.getReportPerson());
+			if (m.getReportDepartment().equals("")) {
+				//根据提报人找到提报部门
+//				List<ReportPerson> departmentByPerson = personMapper.getDepartmentByPerson();
+				departmentByPerson.forEach(de->{
+					if (de.getReportPerson().equals(m.getReportPerson())){
+						m.setReportDepartment(de.getReportDepartment());
+					}
+				});
+
+			}else {
+				m.setReportDepartment(m.getReportDepartment());
+			}
+			m.setRemark(m.getRemark());
+			m.setLiKuAmount(m.getLiKuAmount());
+
+			//如过单位为千米 说明该对象物资被转换为米进行操作,重新转换为千米
+			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());
+	}
+
+	/**
+	 * 在途验证项目需求物资
 	 * @param standardList
 	 * @param preferredCodes
 	 * @param quotaList
@@ -714,5 +1078,151 @@ public class ExcelUtil {
 		}
 	}
 
+	/**
+	 * 处理多余字符串
+	 */
+	private String interceptString(String str) {
+		if (com.jeeplus.common.utils.StringUtils.isNotBlank(str)) {
+			return str.substring(0, str.length() - 1);
+		}
+		return null;
+	}
+
+	/**
+	 * 利库排序 地区-》库龄降序-》数量大小降序-》批次号-》物料编码升序
+	 *
+	 * @param liKuPoolList 利库池
+	 * @return
+	 */
+	private List<LiKuResourcePool> getSortLiKuPool(List<LiKuResourcePool> liKuPoolList) {
+		return liKuPoolList.stream().sorted((liKuSort1, liKuSort2) -> {
+			if (liKuSort1.getLiKuFlag().getNum().compareTo(liKuSort2.getLiKuFlag().getNum()) == 0) {
+				//库龄按照月排序
+				if (liKuSort1.getMonthStorage().compareTo(liKuSort2.getMonthStorage()) == 0) {
+					//库龄按照日降序
+					if (liKuSort1.getDaysStorage().compareTo(liKuSort2.getDaysStorage()) == 0) {
+						//数量按大小降序
+						if (new BigDecimal(liKuSort1.getInventoryAmount()).compareTo(new BigDecimal(liKuSort2.getInventoryAmount())) == 0) {
+							//批次号自然顺序
+							if (liKuSort1.getBatch().compareTo(liKuSort2.getBatch()) == 0) {
+								//扩展编码升序
+								return new BigDecimal(liKuSort1.getExtendedCoding()).compareTo(new BigDecimal(liKuSort2.getExtendedCoding()));
+							} else {
+								return liKuSort1.getBatch().compareTo(liKuSort2.getBatch());
+							}
+						} else {
+							return new BigDecimal(liKuSort2.getInventoryAmount()).compareTo(new BigDecimal(liKuSort1.getInventoryAmount()));
+						}
+					} else {
+						return liKuSort2.getDaysStorage() - liKuSort1.getDaysStorage();
+					}
+				} else {
+					return liKuSort2.getMonthStorage() - (liKuSort1.getMonthStorage());
+				}
+			} else {
+				return liKuSort1.getLiKuFlag().getNum() - liKuSort2.getLiKuFlag().getNum();
+			}
+		}).collect(Collectors.toList());
+	}
+
+	/**
+	 * 上报资源排序 地区-》需求数量-》扩展编码
+	 *
+	 * @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) {
+					//扩展编码比较     如果扩展编码为空值 为不影响排序比较  用Integer最大值来进行代替比较 排序到最后
+					return new BigDecimal(com.jeeplus.common.utils.StringUtils.isBlank(material1.getExtendedCoding()) ? String.valueOf(Integer.MAX_VALUE) : material1.getExtendedCoding())
+							.compareTo(new BigDecimal(com.jeeplus.common.utils.StringUtils.isBlank(material2.getExtendedCoding()) ? String.valueOf(Integer.MAX_VALUE) : material2.getExtendedCoding()));
+				} else {
+					return material2.getTotal().compareTo(material1.getTotal());
+				}
+			} else {
+				return material1.getAreaCodeFlagEnum().getNum() - material2.getAreaCodeFlagEnum().getNum();
+			}
+		}).collect(Collectors.toList());
+	}
 
+	/**
+	 * 计算处理库
+	 *
+	 * @param materialReportDetails 上报资源
+	 * @param liKuResourcePool      利库资源池
+	 * @param areaTypeFlagEnum      地区类型
+	 * @param replacement           地区替换类型
+	 */
+	private void liKuCompareMaterial(MaterialReportDetails materialReportDetails, LiKuResourcePool liKuResourcePool, AreaTypeFlagEnum areaTypeFlagEnum, AreaTypeFlagEnum replacement, MaterialsUnitFlagEnum judgingSegment) {
+		//如果相等直接结束方法 利库数+总数
+		if (materialReportDetails.getTotal().compareTo(materialReportDetails.getNumberOfNiches()) == 0 || new BigDecimal(liKuResourcePool.getRemaining()).compareTo(BigDecimal.ZERO) == 0) {
+			return;
+		}
+		//如果物料编码与扩展编码相同,说明是需要的物资
+		//利库池 利库数
+		BigDecimal liKu_liKuCount = new BigDecimal(liKuResourcePool.getNumberOfNiches());
+		//利库池剩余 量
+		BigDecimal liKu_remaining = new BigDecimal(liKuResourcePool.getRemaining());
+
+		//上报物资 申请数量
+		BigDecimal material_ApplicationCount = BigDecimal.valueOf(materialReportDetails.getNumberOfApplications());
+		//上报物资利库量
+		BigDecimal material_liKuCount = BigDecimal.valueOf(materialReportDetails.getNumberOfNiches());
+
+		//临时变量
+		BigDecimal temp = new BigDecimal(0);
+		if (material_ApplicationCount.compareTo(liKu_remaining) > 0) {
+			temp = liKu_remaining;//可能利库池剩余数量不够
+		} else {
+			temp = material_ApplicationCount;//利库池数量满足 上报需求
+		}
+
+		//利库池 剩余量
+		liKuResourcePool.setRemaining(liKu_remaining.subtract(temp).toString());
+		//利库量
+		liKuResourcePool.setNumberOfNiches(new BigDecimal(liKuResourcePool.getNumberOfNiches()).add(temp).toString());
+		//物资  申请数量
+		materialReportDetails.setNumberOfApplications(material_ApplicationCount.subtract(temp).doubleValue());
+		//物资  利库量
+		materialReportDetails.setNumberOfNiches(material_liKuCount.add(temp).doubleValue());
+		if (materialReportDetails.getUnit().equals(MaterialsUnitFlagEnum.KM.getUnit())) {
+			temp = temp.divide(new BigDecimal(1000));
+		}
+		//如果代替标识为空则
+		if (replacement == null) {
+			//传递标识,根据标识来判断本地/跨库 所有结束后统一处理多余,
+			if (AreaTypeFlagEnum.LOCAL == areaTypeFlagEnum) {
+				//拼接本地库批次号
+				materialReportDetails.setLocalWareBatch(materialReportDetails.getLocalWareBatch() + liKuResourcePool.getBatch() + ",");
+				materialReportDetails.setLocalWareHouse(materialReportDetails.getLocalWareHouse() + liKuResourcePool.getInvLocation() + ",");
+				materialReportDetails.setNumberOfLocal(materialReportDetails.getNumberOfLocal() + temp.setScale(3, BigDecimal.ROUND_HALF_UP) + ",");
+			} else {
+				//拼接跨区批次号
+				materialReportDetails.setRegionalBatch(materialReportDetails.getRegionalBatch() + liKuResourcePool.getBatch() + ",");
+				materialReportDetails.setRegionalHouse(materialReportDetails.getRegionalHouse() + liKuResourcePool.getInvLocation() + ",");
+				materialReportDetails.setNumberOfRegional(materialReportDetails.getNumberOfRegional() + temp.setScale(3, BigDecimal.ROUND_HALF_UP) + ",");
+			}
+		} else {
+			//区分本地利库与跨区利库替换
+			if (AreaTypeFlagEnum.LOCAL_REPLACEMENT == replacement) {
+				//拼接本地利库
+				materialReportDetails.setLocalReplacementExtendedCoding(materialReportDetails.getLocalReplacementExtendedCoding() + liKuResourcePool.getExtendedCoding() + ",");
+				materialReportDetails.setLocalReplacementExtendedDescription(materialReportDetails.getLocalReplacementExtendedDescription() + liKuResourcePool.getExtendedDescription() + ",");
+				materialReportDetails.setLocalReplacementBatch(materialReportDetails.getLocalReplacementBatch() + liKuResourcePool.getBatch() + ",");
+				materialReportDetails.setLocalReplacementHouse(materialReportDetails.getLocalReplacementHouse() + liKuResourcePool.getInvLocation() + ",");
+				materialReportDetails.setLocalReplacementNumber(materialReportDetails.getLocalReplacementNumber() + temp.setScale(3, 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.setScale(3, BigDecimal.ROUND_HALF_UP) + ",");
+			}
+		}
+	}
 }

+ 71 - 179
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/utils/ExportUtil.java

@@ -1,6 +1,7 @@
 package com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.utils;
 
 import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.entity.LiKuResourcePool;
 import com.jeeplus.modules.sg.balancedlibrary.materialQuota.entity.MaterialQuota;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.LikuDetail;
@@ -87,13 +88,37 @@ public class ExportUtil {
         //在途物资统计表与项目物资需求表比较  在途物资统计表J列>=项目物资需求表H列 标识
         List<String> flagList = new ArrayList<>();
 
-        //在途物资统计表 去重汇总统计
+
+        //在途物资统计表 去重汇总统计   key是物料编码-部门 , value 是 去重汇总后的  合同数量
         goodsList.forEach(opm -> {
             if (com.jeeplus.common.utils.StringUtils.isBlank(opm.getContractCount())) {
                 opm.setContractCount("0");
             }
             //根据提报人 找到对应部门
-            String reportPersonOfDepartment = reportPersonMap.get(opm.getPlanner());
+            String reportPersonOfDepartment = "";
+//            if (opm.getFactory().equals("01L0") || opm.getFactory().equals("01L2") || opm.getFactory().equals("01L3")){
+//                //直接获取到提报部门
+//                reportPersonOfDepartment = reportPersonMap.get(opm.getPlanner());
+//            }
+            if (StringUtils.isNotEmpty(opm.getFactory())){
+                switch (opm.getFactory()){
+                    case "01L1":
+                        reportPersonOfDepartment = "丹阳";
+                        break;
+                    case "01L2":
+                        reportPersonOfDepartment = "句容";
+                        break;
+                    case "01L3":
+                        reportPersonOfDepartment = "扬中";
+                        break;
+                    case "01L0":
+                        //根据提报人找到提报部门
+                        reportPersonOfDepartment = reportPersonMap.get(opm.getPlanner());
+                        break;
+                }
+            }
+
+
             //如果没有部门 表示空部门 物料编码-部门
             String key = "";
             if (reportPersonOfDepartment == null) {
@@ -101,15 +126,20 @@ public class ExportUtil {
             } else {
                 key = opm.getMaterialCode() + "-" + reportPersonOfDepartment;
             }
+            //如果 包含 key
             if (onPassageMaterialsMap.containsKey(key)) {
+                //设置值,合同数量相加
                 onPassageMaterialsMap.put(key, new BigDecimal(opm.getContractCount()).add(onPassageMaterialsMap.get(key)));
             } else {
+                //如果物料编码不为空
                 if (com.jeeplus.common.utils.StringUtils.isNotBlank(opm.getMaterialCode())) {
                     onPassageMaterialsMap.put(key, new BigDecimal(opm.getContractCount()));
                 }
             }
         });
-        //项目物资需求表 去重汇总统计
+        //存放单位
+        Map companyMap = new HashMap();
+        //项目物资需求表 去重汇总统计   key是 物料编码-部门,value是 需求表去重汇总后的总量
         reportList.forEach(m -> {
             if (com.jeeplus.common.utils.StringUtils.isBlank(m.getTotal().toString())) {
                 m.setTotal(0.0);
@@ -122,9 +152,11 @@ public class ExportUtil {
 //            likuCMap.put(key,m);
             if (materialInformationMap.containsKey(key)) {
                 materialInformationMap.put(key, new BigDecimal(m.getTotal()).add(materialInformationMap.get(key)));
+                companyMap.put(key,m.getUnit());
             } else {
                 if (com.jeeplus.common.utils.StringUtils.isNotBlank(m.getMaterialCode())) {
                     materialInformationMap.put(key, new BigDecimal(m.getTotal()));
+                    companyMap.put(key,m.getUnit());
                 }
             }
         });
@@ -142,56 +174,14 @@ public class ExportUtil {
         reportList.forEach(l -> {
             String key = l.getMaterialCode() + "-" + l.getReportDepartment();
             if (flagList.contains(key)) {
-                l.setRemarkText("在途已有" + onPassageMaterialsMap.get(key) + "单位,请核实本次需求");
+                //单位拼接   物资需求表的g列
+                l.setRemarkText("在途已有" + onPassageMaterialsMap.get(key) + companyMap.get(key) +",请核实本次需求");
                 test.put(l.getMaterialCode(),l.getRemarkText());
             }
         });
         try {
             int rowNum = 2;
-            /*//处理利库汇总情况
-            Sheet sheet1 = workbook.getSheetAt(0);
-            if(reportList!=null&&reportList.size()>0){
-                for(int i=0;i<reportList.size();i++){
-                    MaterialReportDetails report = reportList.get(i);
-                    //当利库数量不为0时 标红
-                    Double likuAmount = report.getNumberOfNiches();
-                    int color = 0;
-                    if(likuAmount>0) color=1;
-                    Row row = sheet1.createRow(rowNum+i);
-                    Cell cell0 = crateCell(workbook,row,0,color); //上报地区
-                    Cell cell1 = crateCell(workbook,row,1,color); //储备项目名称
-                    Cell cell2 = crateCell(workbook,row,2,color); //物料编码
-                    Cell cell3 = crateCell(workbook,row,3,color); //物料名称
-                    Cell cell4 = crateCell(workbook,row,4,color); //扩展编码
-                    Cell cell5 = crateCell(workbook,row,5,color); //扩展描述
-                    Cell cell6 = crateCell(workbook,row,6,color); //单位
-                    Cell cell7 = crateCell(workbook,row,7,color); //总量
-                    Cell cell8 = crateCell(workbook,row,8,color); //单重
-                    Cell cell9 = crateCell(workbook,row,9,color); //总重
-                    Cell cell10 = crateCell(workbook,row,10,color); //甲乙供
-                    Cell cell11 = crateCell(workbook,row,11,color);//提报人
-                    Cell cell12 = crateCell(workbook,row,12,color);//提报部门
-                    Cell cell13 = crateCell(workbook,row,13,color); //利库数量
-                    Cell cell14 = crateCell(workbook,row,14,color); //申请数量
-
-                    cell0.setCellValue(getString(report.getReportingArea()));
-                    cell1.setCellValue(getString(report.getNameOfReserve()));
-                    cell2.setCellValue(getString(report.getMaterialCode()));
-                    cell3.setCellValue(getString(report.getMaterialName()));
-                    cell4.setCellValue(getString(report.getExtendedCoding()));
-                    cell5.setCellValue(getString(report.getExtendedDescription()));
-                    cell6.setCellValue(getString(report.getUnit()));
-                    cell7.setCellValue(getDouble(report.getTotal()));
-                    cell8.setCellValue(getString(report.getUnitWeight()));
-                    cell9.setCellValue(getString(report.getTotalWeight()));
-                    cell10.setCellValue(getString(report.getSupplied()));
-                    cell11.setCellValue(getString(report.getReportPerson()));//提报人
-                    cell12.setCellValue(getString(report.getReportDepartment()));//提报部门
-                    cell13.setCellValue(getDouble(report.getNumberOfNiches()));
-                    cell14.setCellValue(getDouble(report.getNumberOfApplications()));
 
-                }
-            }*/
             //隐藏利库汇总情况sheet
             workbook.setSheetHidden(workbook.getSheetIndex("利库汇总情况"),1);
             //利库明细情况
@@ -268,7 +258,12 @@ public class ExportUtil {
                     cell13.setCellValue(getString(report.getRemark()));//备注
                     //标准物料、大类、中类、小类
                     cell14.setCellValue(stanMater.get(report.getMaterialCode()).getPurchaseStandardId());
-                    cell15.setCellValue(stanMater.get(report.getMaterialCode()).getBigCategoryDescript());
+                    String daLei = stanMater.get(report.getMaterialCode()).getBigCategoryDescript();
+                    if (daLei.equals("一次设备") || daLei.equals("二次设备") || daLei.equals("智能二次设备") || daLei.equals("装置性材料")){
+                        cell15.setCellValue(daLei);
+                    }else {
+                        cell15.setCellValue("");
+                    }
                     cell16.setCellValue(stanMater.get(report.getMaterialCode()).getMiddleCategoryDescript());
                     cell17.setCellValue(stanMater.get(report.getMaterialCode()).getSmallCategoryDescript());
                     //小类是否在清单内(区域)、优选标识
@@ -296,10 +291,20 @@ public class ExportUtil {
                     cell22.setCellValue("");
 
                     //库存批次 由本地利库批次号、跨区利库批次号、本地替代利库利库批次号、跨区替代利库利库批次号拼接组成
-                    String pc = changeVal02(report.getLocalWareBatch())
-                            + changeVal02(report.getRegionalBatch())
-                            + changeVal02(report.getLocalReplacementBatch())
-                            + changeVal02(report.getRegionalReplacementBatch());
+                    String pc = null;
+                    if (StringUtils.isNotEmpty(changeVal02(report.getLocalWareBatch()))){
+                        pc = changeVal02(report.getLocalWareBatch());
+                    }
+                    if (StringUtils.isNotEmpty(changeVal02(report.getRegionalBatch()))){
+                        pc = pc + "," + changeVal02(report.getRegionalBatch());
+                    }
+                    if (StringUtils.isNotEmpty(changeVal02(report.getLocalReplacementBatch()))){
+                        pc = pc + "," + changeVal02(report.getLocalReplacementBatch());
+                    }
+                    if (StringUtils.isNotEmpty(changeVal02(report.getRegionalReplacementBatch()))){
+                        pc = pc + "," + changeVal02(report.getRegionalReplacementBatch());
+                    }
+
                     cell24.setCellValue(pc);
                     //库存计划编制人
                     LiKuResourcePool liKuResourcePool = likuMap.get(pc);
@@ -311,8 +316,20 @@ public class ExportUtil {
                         cell25.setCellValue(liKuResourcePool.getInventoryAmount());
                     }
                     //库存地点  由本地利库库存地、跨区利库库存地、本地替代利库利库库存地、跨区替代利库利库库存地根据规则拼接
-                    String area = changeVal(report.getLocalWareHouse()) + "-" + changeVal(report.getRegionalHouse()) + "-" +
-                            changeVal(report.getLocalReplacementHouse()) + "-" + changeVal(report.getRegionalReplacementHouse());
+                    String area = null;
+                    if (StringUtils.isNotEmpty(changeVal02(report.getLocalWareHouse()))){
+                        area = changeVal02(report.getLocalWareHouse());
+                    }
+                    if (StringUtils.isNotEmpty(changeVal02(report.getRegionalHouse()))){
+                        area = area + "," + changeVal02(report.getRegionalHouse());
+                    }
+                    if (StringUtils.isNotEmpty(changeVal02(report.getLocalReplacementHouse()))){
+                        area = area + "," + changeVal02(report.getLocalReplacementHouse());
+                    }
+                    if (StringUtils.isNotEmpty(changeVal02(report.getRegionalReplacementHouse()))){
+                        area = area + "," + changeVal02(report.getRegionalReplacementHouse());
+                    }
+
                     cell26.setCellValue(area);
 
                     cell27.setCellValue(getDouble(report.getNumberOfNiches()));//利库数量
@@ -335,131 +352,6 @@ public class ExportUtil {
                     cell44.setCellValue(getString(report.getRegionalReplacementNumber()));
                 }
             }
-            //创建一个新的sheet
-            /*//表头
-            String []title = {"上报地区","储备项目名称","物料编码","物料名称","扩展编码","扩展描述","单位","总量",
-                                "单重/kg","总重/吨","甲乙供","提报人","提报部门","备注","采购标准标识","三级清单物料",
-                                "物资数量校验","在途物资统计校验"};
-            //获取数据
-            //采购标准标识
-            Map<String,StandardMaterials> standardMap = new HashMap<>();
-            for(StandardMaterials standard:standardList){
-                standardMap.put(standard.getMaterialCode(),standard);
-            }
-            //三级清单物料
-            Map<String,MaterialQuota> quotaMap = new HashMap<>();
-            for(MaterialQuota quota:quotaList){
-                quotaMap.put(quota.getMaterialCode(),quota);
-            }
-            //在途物资统计校验
-            //在途物资统计表 key=统计物料编码-部门 去重汇总统计
-            Map<String, BigDecimal> onPassageMaterialsMap = new HashMap<>();
-            //项目物资需求表 key=统计物料编码-部门 去重汇总统计
-            Map<String, BigDecimal> materialInformationMap = new HashMap<>();
-            //在途物资统计表与项目物资需求表比较  在途物资统计表J列>=项目物资需求表H列 标识
-            List<String> flagList = new ArrayList<>();
-            //在途物资统计表 去重汇总统计
-            goodsList.forEach(opm -> {
-                if (com.jeeplus.common.utils.StringUtils.isBlank(opm.getContractCount())) {
-                    opm.setContractCount("0");
-                }
-                //根据提报人 找到对应部门
-                String reportPersonOfDepartment = reportPersonMap.get(opm.getPlanner());
-                //如果没有部门 表示空部门 物料编码-部门
-                String key = "";
-                if (reportPersonOfDepartment == null) {
-                    key = opm.getMaterialCode() + "-";
-                } else {
-                    key = opm.getMaterialCode() + "-" + reportPersonOfDepartment;
-                }
-                if (onPassageMaterialsMap.containsKey(key)) {
-                    onPassageMaterialsMap.put(key, new BigDecimal(opm.getContractCount()).add(onPassageMaterialsMap.get(key)));
-                } else {
-                    if (com.jeeplus.common.utils.StringUtils.isNotBlank(opm.getMaterialCode())) {
-                        onPassageMaterialsMap.put(key, new BigDecimal(opm.getContractCount()));
-                    }
-                }
-            });
-            //项目物资需求表 去重汇总统计
-            reportList.forEach(m -> {
-                if (com.jeeplus.common.utils.StringUtils.isBlank(m.getTotal().toString())) {
-                    m.setTotal(0.0);
-                }
-                //物料编码-部门
-                if (m.getReportDepartment() == null){
-                    m.setReportDepartment("");
-                }
-                String key = m.getMaterialCode() + "-" + m.getReportDepartment();
-                if (materialInformationMap.containsKey(key)) {
-                    materialInformationMap.put(key, new BigDecimal(m.getTotal()).add(materialInformationMap.get(key)));
-                } else {
-                    if (com.jeeplus.common.utils.StringUtils.isNotBlank(m.getMaterialCode())) {
-                        materialInformationMap.put(key, new BigDecimal(m.getTotal()));
-                    }
-                }
-            });
-
-            //两表比较 添加标识
-            materialInformationMap.forEach((k, v) -> {
-                if (onPassageMaterialsMap.containsKey(k)) {
-                    if (onPassageMaterialsMap.get(k).compareTo(v) >= 0) {
-                        flagList.add(k);
-                    }
-                }
-            });
-            Map<String,String> test = new HashMap<>();
-            //根据标识在原表中追加备注
-            reportList.forEach(l -> {
-                String key = l.getMaterialCode() + "-" + l.getReportDepartment();
-                if (flagList.contains(key)) {
-                    l.setRemarkText("在途已有" + onPassageMaterialsMap.get(key) + "单位,请核实本次需求");
-                    test.put(l.getMaterialCode(),l.getRemarkText());
-                }
-            });
-
-            //赋值操作
-            String [][] content = new String[reportList.size()][18];
-            for (int i=0;i<reportList.size();i++){
-                content[i] = new String[title.length];
-                MaterialReportDetails mater = reportList.get(i);
-                content[i][0] = mater.getReportingArea();
-                content[i][1] = mater.getNameOfReserve();
-                content[i][2] = mater.getMaterialCode();
-                content[i][3] = mater.getMaterialName();
-                content[i][4] = mater.getExtendedCoding();
-                content[i][5] = mater.getExtendedDescription();
-                content[i][6] = mater.getUnit();
-                content[i][7] = mater.getTotal().toString();
-                content[i][8] = mater.getUnitWeight();
-                content[i][9] = mater.getTotalWeight();
-                content[i][10] = mater.getSupplied();
-                content[i][11] = mater.getReportPerson();
-                content[i][12] = mater.getReportDepartment();
-                content[i][13] = mater.getRemark();
-                content[i][14] = standardMap.get(mater.getMaterialCode()).getPurchaseStandardId();//采购标准标识
-                if (preferredCodes.contains(mater.getMaterialCode())){
-                    content[i][15] = "优选";//三级清单物料
-                }else {
-                    content[i][15] = "非优选";//三级清单物料
-                }
-                MaterialQuota quota = quotaMap.get(mater.getMaterialCode());
-                if(quota!=null){
-                    Double quotaNum = quota.getQuota();
-                    if(quotaNum!=null){
-                        if(mater.getTotal()!=null&& mater.getTotal()>quotaNum){
-                            content[i][16] = "超限额";
-                        }
-                    }
-                }
-                if (test.get(mater.getMaterialCode()) != null){
-                    content[i][17] = test.get(mater.getMaterialCode());
-                }
-
-            }
-
-            CreateSheetUtil util = new CreateSheetUtil();
-            util.createSheet("export",title,content,workbook,reportList,standardList,preferredCodes,quotaList,goodsList,reportPersonMap);
-*/
 
             String fileName = "物资上报利库情况表" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
             String str = URLEncoder.encode(fileName, "UTF8");

+ 109 - 4
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/web/MaterialReportDetailsControllerTest.java

@@ -16,6 +16,7 @@ import com.jeeplus.modules.sg.balancedlibrary.materialQuota.entity.MaterialQuota
 import com.jeeplus.modules.sg.balancedlibrary.materialQuota.service.MaterialQuotaService;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.CompareHistory;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.LikuDetail;
+import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.LikuDetailDo;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.MaterialReportDetails;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.service.CompareHistoryService;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.service.MaterialReportDetailsService;
@@ -127,10 +128,101 @@ public class MaterialReportDetailsControllerTest extends BaseController {
     @RequiresPermissions("sg:balancedlibrary:MaterialReportDetails:list")
     @RequestMapping(value = "likuResultsData")
     public Map<String, Object> likuResultsData(MaterialReportDetails entity, HttpServletRequest request, HttpServletResponse response, Model model) {
-        List<LikuDetail> list = service.getLikuDetails(entity);
+//        List<LikuDetail> list = service.getLikuDetails(entity);
+        List<MaterialReportDetails> list = service.getLikuDetailsNew(entity);
+        //对数据进行拆分       拼接的数据有 本地利库批次号等后面的字段
+        List<LikuDetailDo> details = new ArrayList<>();
+        for (int i=0;i<list.size();i++){
+            //对本地利库批次号进行拆分
+            //获得 本地利库批次号数组 本地利库库存地  本地利库数量
+            String[] localWareBatch = splitTest(list.get(i).getLocalWareBatch());
+            String[] localWareHouse = splitTest(list.get(i).getLocalWareHouse());
+            String[] numberOfLocal = splitTest(list.get(i).getNumberOfLocal());
+
+            //对跨区利库批次号进行拆分
+            // 获得  跨区利库批次号  跨区利库库存地  跨区利库数量
+            String[] regionalBatch = splitTest(list.get(i).getRegionalBatch());
+            String[] regionalHouse = splitTest(list.get(i).getRegionalHouse());
+            String[] numberOfRegional = splitTest(list.get(i).getNumberOfRegional());
+
+            //对本地替代利库利库批次号进行拆分
+            //获得  本地替代利库利库批次号  本地替代利库利库库存地  本地替代利库利库数量
+            String[] localReplacementBatch = splitTest(list.get(i).getLocalReplacementBatch());
+            String[] localReplacementHouse = splitTest(list.get(i).getLocalReplacementHouse());
+            String[] localReplacementNumber = splitTest(list.get(i).getLocalReplacementNumber());
+
+            //对跨区替代利库利库批次号进行拆分
+            //获得  跨区替代利库利库批次号  跨区替代利库利库库存地  跨区替代利库利库数量
+            String[] regionalReplacementBatch = splitTest(list.get(i).getRegionalReplacementBatch());
+            String[] regionalReplacementHouse = splitTest(list.get(i).getRegionalReplacementHouse());
+            String[] regionalReplacementNumber = splitTest(list.get(i).getRegionalReplacementNumber());
+
+            //进行赋值操作
+            //本地利库
+            for (int j=0;j<localWareBatch.length;j++){
+                LikuDetailDo detailDo = new LikuDetailDo();
+                detailDo.setNameOfReserve(list.get(i).getNameOfReserve());
+                detailDo.setMaterialCode(list.get(i).getMaterialCode());
+                //设置 利库类型
+                detailDo.setComparisonType("本地利库");
+                //批次号
+                detailDo.setBatch(localWareBatch[j]);
+                //库存地
+                detailDo.setWarehouse(localWareHouse[j]);
+                //利库数量
+                detailDo.setNumberNiches(Double.valueOf(numberOfLocal[j]));
+                details.add(detailDo);
+            }
+            //跨区利库
+            for (int j=0;j<regionalBatch.length;j++){
+                LikuDetailDo detailDo = new LikuDetailDo();
+                detailDo.setNameOfReserve(list.get(i).getNameOfReserve());
+                detailDo.setMaterialCode(list.get(i).getMaterialCode());
+                //设置 利库类型
+                detailDo.setComparisonType("跨区利库");
+                //批次号
+                detailDo.setBatch(regionalBatch[j]);
+                //库存地
+                detailDo.setWarehouse(regionalHouse[j]);
+                //利库数量
+                detailDo.setNumberNiches(Double.valueOf(numberOfRegional[j]));
+                details.add(detailDo);
+            }
+            //本地替代利库
+            for (int j=0;j<localReplacementBatch.length;j++){
+                LikuDetailDo detailDo = new LikuDetailDo();
+                detailDo.setNameOfReserve(list.get(i).getNameOfReserve());
+                detailDo.setMaterialCode(list.get(i).getMaterialCode());
+                //设置 利库类型
+                detailDo.setComparisonType("本地替代利库");
+                //批次号
+                detailDo.setBatch(localReplacementBatch[j]);
+                //库存地
+                detailDo.setWarehouse(localReplacementHouse[j]);
+                //利库数量
+                detailDo.setNumberNiches(Double.valueOf(localReplacementNumber[j]));
+                details.add(detailDo);
+            }
+            //跨区替代利库
+            for (int j=0;j<regionalReplacementBatch.length;j++){
+                LikuDetailDo detailDo = new LikuDetailDo();
+                detailDo.setNameOfReserve(list.get(i).getNameOfReserve());
+                detailDo.setMaterialCode(list.get(i).getMaterialCode());
+                //设置 利库类型
+                detailDo.setComparisonType("跨区替代利库");
+                //批次号
+                detailDo.setBatch(regionalReplacementBatch[j]);
+                //库存地
+                detailDo.setWarehouse(regionalReplacementHouse[j]);
+                //利库数量
+                detailDo.setNumberNiches(Double.valueOf(regionalReplacementNumber[j]));
+                details.add(detailDo);
+            }
+        }
+
         Map<String, Object> map = new HashMap<String, Object>();
-        map.put("rows", list);
-        map.put("total", list.size());
+        map.put("rows", details);
+        map.put("total", details.size());
         return map;
     }
 
@@ -226,6 +318,7 @@ public class MaterialReportDetailsControllerTest extends BaseController {
         List<StandardMaterials> standardList = standardMaterialsService.findAllList(new StandardMaterials());
         List<String> preferredCodes = preferredMaterialsService.findAllCodes();
         List<MaterialQuota> quotaList = materialQuotaService.findAllList(new MaterialQuota());
+        //在途物资数据
         List<TransitMaterialGoods> goodsList = goodsService.getAllGoods();
         //从数据库中获取所有的提报人与部门
         Map<String, String> reportPersonMap = goodsService.getReportPerson();
@@ -1025,8 +1118,20 @@ public class MaterialReportDetailsControllerTest extends BaseController {
         ExcelUtil util = new ExcelUtil();
         util.exportFile(response,fileName,session.getId());
 
+    }
 
-
+    /**
+     * 拆分工具
+     * @param test
+     * @return
+     */
+    public String[] splitTest(String test){
+        String[] split = new String[0];
+        if (StringUtils.isNotEmpty(test)){
+            //得到每一个本地利库批次号
+            split = test.split(",");
+        }
+        return split;
     }
 
 

+ 13 - 10
src/main/java/com/jeeplus/modules/sg/balancedlibrary/reportPerson/service/ReportPersonService.java

@@ -5,13 +5,8 @@ package com.jeeplus.modules.sg.balancedlibrary.reportPerson.service;
 
 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.replaceMaterial.entity.ReplaceMaterial;
-import com.jeeplus.modules.sg.balancedlibrary.replaceMaterial.mapper.ReplaceMaterialMapper;
 import com.jeeplus.modules.sg.balancedlibrary.reportPerson.entity.ReportPerson;
 import com.jeeplus.modules.sg.balancedlibrary.reportPerson.mapper.ReportPersonMapper;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -26,27 +21,35 @@ import java.util.List;
 @Transactional(readOnly = true)
 public class ReportPersonService extends CrudService<ReportPersonMapper, ReportPerson> {
 
+	/**
+	 * 查出所有的 部门信息
+	 * @return
+	 */
+	public List<ReportPerson> getDepartmentByPerson(){
+		return mapper.getDepartmentByPerson();
+	}
+
 	@Override
 	public ReportPerson get(String id) {
 		return super.get(id);
 	}
-	
+
 	@Override
 	public List<ReportPerson> findList(ReportPerson entity) {
 		return super.findList(entity);
 	}
-	
+
 	@Override
 	public Page<ReportPerson> findPage(Page<ReportPerson> page, ReportPerson entity) {
 		return super.findPage(page, entity);
 	}
-	
+
 	@Override
 	@Transactional(readOnly = false)
 	public void save(ReportPerson entity) {
 		super.save(entity);
 	}
-	
+
 	@Override
 	@Transactional(readOnly = false)
 	public void delete(ReportPerson entity) {
@@ -58,4 +61,4 @@ public class ReportPersonService extends CrudService<ReportPersonMapper, ReportP
 		mapper.insertList(list);
 	}
 
-}
+}

+ 4 - 2
src/main/java/com/jeeplus/modules/sg/balancedlibrary/transitMaterialGoods/mapper/xml/TransitMaterialGoodsMapper.xml

@@ -19,7 +19,8 @@
         del_flag,
         materialCode,
         contractCount,
-        planner
+        planner,
+        factory
         )VALUES
         <foreach collection="list" item="item" index="index" separator=",">
             (
@@ -31,7 +32,8 @@
             #{item.delFlag},
             #{item.materialCode},
             #{item.contractCount},
-            #{item.planner}
+            #{item.planner},
+            #{item.factory}
             )
         </foreach>
     </insert>

+ 14 - 1
src/main/java/com/jeeplus/modules/sg/balancedlibrary/transitMaterialGoods/web/TransitMaterialGoodsController.java

@@ -8,12 +8,14 @@ import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.core.persistence.Page;
 import com.jeeplus.core.web.BaseController;
+import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.service.LiKuResourcePoolService;
 import com.jeeplus.modules.sg.balancedlibrary.materialQuota.entity.MaterialQuota;
 import com.jeeplus.modules.sg.balancedlibrary.materialQuota.service.MaterialQuotaService;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.utils.ExcelUtil;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.utils.ExportUtil;
 import com.jeeplus.modules.sg.balancedlibrary.onPassageMaterials.entity.MaterialInformation;
 import com.jeeplus.modules.sg.balancedlibrary.preferredMaterials.service.PreferredMaterialsService;
+import com.jeeplus.modules.sg.balancedlibrary.reportPerson.service.ReportPersonService;
 import com.jeeplus.modules.sg.balancedlibrary.standardMaterials.entity.StandardMaterials;
 import com.jeeplus.modules.sg.balancedlibrary.standardMaterials.service.StandardMaterialsService;
 import com.jeeplus.modules.sg.balancedlibrary.transitMaterialGoods.entity.GoodsInfo;
@@ -53,6 +55,12 @@ public class TransitMaterialGoodsController extends BaseController {
     private TransitMaterialGoodsService service;
 
     @Autowired
+    private LiKuResourcePoolService poolService;
+
+    @Autowired
+    private ReportPersonService personService;
+
+    @Autowired
     private StandardMaterialsService standardMaterialsService;
 
     @Autowired
@@ -108,6 +116,7 @@ public class TransitMaterialGoodsController extends BaseController {
 //            ImportExcel materialInformationFile = new ImportExcel(file[1], 1, 0);
             //转换为集合
             List<TransitMaterialGoods> onPassageMaterialsList = onPassageMaterialsFile.getDataList(TransitMaterialGoods.class);
+
             service.insertList(onPassageMaterialsList);
 //            List<MaterialGoodsInfo> materialInformationList = materialInformationFile.getDataList(MaterialGoodsInfo.class);
 
@@ -208,12 +217,16 @@ public class TransitMaterialGoodsController extends BaseController {
             Map<String, String> reportPersonMap = service.getReportPerson();
 
             ExcelUtil util = new ExcelUtil(file,1,0);
-
+            //物资上报明细数据列表
+//            List<MaterialReportDetails> materialReportDetailsList = materialInformationFile.getDataList(MaterialReportDetails.class);
+//            List<LiKuResourcePool> liKuPoolList = poolService.findLiKuList(null,null);
+//            List<ReportPerson> reportPeople = personService.getDepartmentByPerson();
             List<StandardMaterials> standardList = standardMaterialsService.findAllList(new StandardMaterials());
             List<String> preferredCodes = preferredMaterialsService.findAllCodes();
             List<MaterialQuota> quotaList = materialQuotaService.findAllList(new MaterialQuota());
             List<TransitMaterialGoods> goodsList = service.getAllGoods();
             util.dealVerifyZt(standardList,preferredCodes,quotaList,goodsList,materList,reportPersonMap);
+//            util.dealVerifyZtNew(materialReportDetailsList,liKuPoolList,reportPeople);
 
             HttpSession session = request.getSession();
             session.setAttribute(ValidationUtils.REQUIRED_MATERIAL_VERIFY,file.getOriginalFilename());

+ 2 - 2
src/main/webapp/webpage/modules/sg/balancedlibrary/transitMaterialGoods/transitMaterialGoodsList.jsp

@@ -53,11 +53,11 @@
 				<i class="fa fa-file-excel-o"></i> 导出
 			</button>
 		 </shiro:hasPermission>
-		<shiro:hasPermission name="sg:balancedlibrary:transitMaterialGoods:import">
+		<%--<shiro:hasPermission name="sg:balancedlibrary:transitMaterialGoods:import">
 			<button id="importMaterial" class="btn btn-info">
 				<i class="fa fa-folder-open-o"></i> 导入项目物资需求表
 			</button>
-		</shiro:hasPermission>
+		</shiro:hasPermission>--%>
 	</div>
 
 	<!-- 表格 -->