蔡德晨 5 years atrás
parent
commit
084957815f

+ 26 - 1
src/main/java/com/jeeplus/common/utils/excel/ImportExcel.java

@@ -126,6 +126,11 @@ public class ImportExcel {
 		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex);
 	}
 
+	public ImportExcel(MultipartFile multipartFile, int headerNum, String sheetName)
+			throws InvalidFormatException, IOException {
+		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetName);
+	}
+
 	/**
 	 * 构造函数
 	 * @param path 导入文件对象
@@ -152,6 +157,25 @@ public class ImportExcel {
 		this.headerNum = headerNum;
 		log.debug("Initialize success.");
 	}
+
+	public ImportExcel(String fileName, InputStream is, int headerNum, String sheetName)
+			throws InvalidFormatException, IOException {
+		if (StringUtils.isBlank(fileName)){
+			throw new RuntimeException("导入文档为空!");
+		}else if(fileName.toLowerCase().endsWith("xls")){
+			this.wb = new HSSFWorkbook(is);
+		}else if(fileName.toLowerCase().endsWith("xlsx")){
+			this.wb = new XSSFWorkbook(is);
+		}else{
+			throw new RuntimeException("文档格式不正确!");
+		}
+		if (this.wb.getSheet(sheetName) == null) {
+			throw new RuntimeException("缺少" + sheetName);
+		}
+		this.sheet = this.wb.getSheet(sheetName);
+		this.headerNum = headerNum;
+		log.debug("Initialize success.");
+	}
 	
 	/**
 	 * 获取行对象
@@ -214,7 +238,8 @@ public class ImportExcel {
 				} else if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
 					val = cell.getStringCellValue();
 				} else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
-					val = cell.getCellFormula();
+//					val = cell.getCellFormula();
+					val = cell.getNumericCellValue();
 				} else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
 					val = cell.getBooleanCellValue();
 				} else if (cell.getCellType() == Cell.CELL_TYPE_ERROR) {

+ 23 - 3
src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/entity/MaterialInfo.java

@@ -1,5 +1,6 @@
 package com.jeeplus.modules.sg.managementcenter.materialinfo.entity;
 
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
 import com.jeeplus.core.persistence.DataEntity;
 
 public class MaterialInfo extends DataEntity<MaterialInfo> {
@@ -8,13 +9,23 @@ public class MaterialInfo extends DataEntity<MaterialInfo> {
     private String materialName;         //物料名称
     private String extendDescription;    //扩展描述
     private String unit;              //单位
-    private Integer totalCount;      //总量
+    private Double totalCount;      //总量
     private Double weightKg;        //单重/kg
     private Double weightTon;      //总重/吨
     private String supplyType;   //甲乙供
     private String note;      //备注
+    private String state;     //状态,与标准比对,1:相同 2,不相同
 
 
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    @ExcelField(title="储备项目名称", align=2, sort=1)
     public String getProjectName() {
         return projectName;
     }
@@ -23,6 +34,7 @@ public class MaterialInfo extends DataEntity<MaterialInfo> {
         this.projectName = projectName;
     }
 
+    @ExcelField(title="物料编码", align=2, sort=2)
     public String getMaterialCode() {
         return materialCode;
     }
@@ -31,6 +43,7 @@ public class MaterialInfo extends DataEntity<MaterialInfo> {
         this.materialCode = materialCode;
     }
 
+    @ExcelField(title="物料名称", align=2, sort=3)
     public String getMaterialName() {
         return materialName;
     }
@@ -39,6 +52,7 @@ public class MaterialInfo extends DataEntity<MaterialInfo> {
         this.materialName = materialName;
     }
 
+    @ExcelField(title="扩展描述", align=2, sort=4)
     public String getExtendDescription() {
         return extendDescription;
     }
@@ -47,6 +61,7 @@ public class MaterialInfo extends DataEntity<MaterialInfo> {
         this.extendDescription = extendDescription;
     }
 
+    @ExcelField(title="单位", align=2, sort=5)
     public String getUnit() {
         return unit;
     }
@@ -55,14 +70,16 @@ public class MaterialInfo extends DataEntity<MaterialInfo> {
         this.unit = unit;
     }
 
-    public Integer getTotalCount() {
+    @ExcelField(title="总重", align=2, sort=6)
+    public Double getTotalCount() {
         return totalCount;
     }
 
-    public void setTotalCount(Integer totalCount) {
+    public void setTotalCount(Double totalCount) {
         this.totalCount = totalCount;
     }
 
+    @ExcelField(title="单重/kg", align=2, sort=7)
     public Double getWeightKg() {
         return weightKg;
     }
@@ -71,6 +88,7 @@ public class MaterialInfo extends DataEntity<MaterialInfo> {
         this.weightKg = weightKg;
     }
 
+    @ExcelField(title="总重/吨", align=2, sort=8)
     public Double getWeightTon() {
         return weightTon;
     }
@@ -79,6 +97,7 @@ public class MaterialInfo extends DataEntity<MaterialInfo> {
         this.weightTon = weightTon;
     }
 
+    @ExcelField(title="甲乙供", align=2, sort=9)
     public String getSupplyType() {
         return supplyType;
     }
@@ -87,6 +106,7 @@ public class MaterialInfo extends DataEntity<MaterialInfo> {
         this.supplyType = supplyType;
     }
 
+    @ExcelField(title="备注", align=2, sort=10)
     public String getNote() {
         return note;
     }

+ 24 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/mapper/MaterialInfoMapper.java

@@ -0,0 +1,24 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialinfo.mapper;
+
+import com.jeeplus.core.persistence.BaseMapper;
+import com.jeeplus.core.persistence.annotation.MyBatisMapper;
+import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
+import com.jeeplus.modules.sg.managementcenter.materialinfo.entity.MaterialInfo;
+import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+@MyBatisMapper
+public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
+	int insertList(@Param("list") List<MaterialInfo> list);
+	List<MaterialInfo> findSat(String batch);
+	List<MaterialInfo> findProjectName();
+	List<MaterialInfo> findByList(@Param("list") List<MaterialProject> list);
+	void deleteByPro(String projectName);
+
+}

+ 235 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/mapper/xml/MaterialInfoMapper.xml

@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jeeplus.modules.sg.managementcenter.materialinfo.mapper.MaterialInfoMapper">
+    
+	<sql id="infoColumns">
+		a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.project_name AS "projectName",
+		a.material_code AS "materialCode",
+		a.material_name AS "materialName",
+		a.extend_description AS "extendDescription",
+		a.unit AS "unit",
+		a.total_count AS "totalCount",
+		a.weight_kg AS "weightKg",
+		a.weight_ton AS "weightTon",
+		a.supply_type AS "supplyType",
+		a.note AS "note",
+		a.state AS "state"
+	</sql>
+
+    
+	<select id="get" resultType="MaterialInfo" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM xm_material_data a
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="MaterialInfo" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM xm_material_data a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+			<if test="projectName != null and projectName != '' ">
+				AND project_name = #{projectName}
+			</if>
+		</where>
+		ORDER BY a.material_code DESC
+		<!--<choose>-->
+			<!--<when test="page !=null and page.orderBy != null and page.orderBy != ''">-->
+				<!--ORDER BY a.update_date DESC-->
+			<!--</when>-->
+			<!--<otherwise>-->
+				<!--ORDER BY a.update_date DESC-->
+			<!--</otherwise>-->
+		<!--</choose>-->
+	</select>
+	
+	<select id="findAllList" resultType="MaterialInfo" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM xm_material_data a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert">
+		INSERT INTO xm_material_data(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			project_name,
+		    material_code,
+		    material_name,
+		    extend_description ,
+		    unit ,
+		    total_count,
+		     weight_kg,
+		    weight_ton,
+		    supply_type,
+		    note
+		) VALUES (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{projectName},
+			#{materialCode},
+			#{materialName},
+			#{extendDescription},
+			#{unit},
+			#{totalCount},
+			#{weightKg},
+			#{weightTon},
+			#{supplyType},
+			#{note}
+		)
+	</insert>
+
+    <insert id="insertList">
+        replace INTO xm_material_data(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+		    project_name,
+		    material_code,
+		    material_name,
+		    extend_description ,
+		    unit ,
+		    total_count,
+		    weight_kg,
+		    weight_ton,
+		    supply_type,
+		    note,
+		    state
+		) VALUES
+        <foreach collection="list" item="item" index="index" separator="," >
+		(
+			#{item.id},
+			#{item.createBy.id},
+			#{item.createDate},
+			#{item.updateBy.id},
+			#{item.updateDate},
+			#{item.remarks},
+			#{item.delFlag},
+			#{item.projectName},
+			#{item.materialCode},
+			#{item.materialName},
+			#{item.extendDescription},
+			#{item.unit},
+			#{item.totalCount},
+			#{item.weightKg},
+			#{item.weightTon},
+			#{item.supplyType},
+			#{item.note},
+			#{item.state}
+		)
+        </foreach>
+	</insert>
+	
+	<update id="update">
+		UPDATE xm_material_data SET
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			remarks = #{remarks},
+			start_date = #{startDate},
+			project_id = #{projectId},
+			end_date = #{endDate},
+			approval_number = #{approvalNumber},
+			building_fee = #{buildingFee},
+			install_fee = #{installFee},
+			equipment_fee = #{equipmentFee},
+			material_fee = #{materialFee},
+			design_fee = #{designFee},
+			supervision_fee = #{supervisionFee},
+			preliminaryWork_fee = #{preliminaryWorkFee},
+			damages = #{damages},
+			management_fee = #{managementFee},
+			total_fee = #{totalFee}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM xm_material_data
+		WHERE id = #{id}
+	</update>
+
+	<delete id="deleteByPro">
+		DELETE FROM xm_material_data
+		WHERE project_name = #{projectName}
+	</delete>
+	
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE xm_material_data SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="TestNote" statementType="STATEMENT">
+		select * FROM xm_material_data  where ${propertyName} = '${value}'
+	</select>
+
+
+	<select id="findSat" resultType="MaterialInfo" parameterType="String">
+		select a.material_code as materialCode,
+		a.material_description as materialName,
+		a.extend_description as extendDescription
+		from xm_material_standard a
+		<where>
+			a.batch = #{batch}
+		</where>
+	</select>
+
+	<select id="findProjectName" resultType="MaterialInfo" parameterType="String">
+		SELECT DISTINCT(project_name) AS projectName
+		<where>
+			project_name = #{projectName}
+		</where>
+	</select>
+
+	<select id="findByList" resultType="MaterialInfo">
+		SELECT
+		   <include refid="infoColumns"/>
+		FROM xm_material_data a
+		<where>
+		 a.project_name in
+		<foreach collection="list" item="item" open="(" close=")" separator=",">
+			#{item.reserveProjectName}
+		</foreach>
+		</where>
+	</select>
+</mapper>

+ 248 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/service/MaterialInfoService.java

@@ -0,0 +1,248 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialinfo.service;
+
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.core.service.CrudService;
+import com.jeeplus.modules.sg.financial.settlement.util.ExcelWriter;
+import com.jeeplus.modules.sg.managementcenter.materialinfo.entity.MaterialInfo;
+import com.jeeplus.modules.sg.managementcenter.materialinfo.mapper.MaterialInfoMapper;
+import com.jeeplus.modules.sg.managementcenter.materialinfo.util.MaterialReplaceUtil;
+import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
+import com.jeeplus.modules.sg.managementcenter.materialproject.service.MaterialProjectService;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+
+@Service
+@Transactional(readOnly = true)
+public class MaterialInfoService extends CrudService<MaterialInfoMapper, MaterialInfo> {
+
+	@Autowired
+	private MaterialInfoMapper materialInfoMapper;
+	@Autowired
+	private MaterialProjectService materialProjectService;
+
+	public MaterialInfo get(String id) {
+		return super.get(id);
+	}
+	
+	public List<MaterialInfo> findList(MaterialInfo materialInfo) {
+		return super.findList(materialInfo);
+	}
+
+	public List<MaterialInfo> findProjectName(){
+		return materialInfoMapper.findProjectName();
+	}
+	
+	public Page<MaterialInfo> findPage(Page<MaterialInfo> page, MaterialInfo materialInfo) {
+		return super.findPage(page, materialInfo);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(MaterialInfo materialInfo) {
+		super.save(materialInfo);
+	}
+
+	@Transactional(readOnly = false)
+	public void saveList(List<MaterialInfo> list) {
+		for(MaterialInfo maintainData : list){
+			maintainData.preInsert();
+		}
+		materialInfoMapper.insertList(list);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(MaterialInfo materialInfo) {
+		super.delete(materialInfo);
+	}
+
+	@Transactional(readOnly = false)
+	public void deleteByPro(String projectName) {
+		materialInfoMapper.deleteByPro(projectName);
+	}
+
+
+    @Transactional(readOnly = false)
+	public void export(MultipartFile file,String batch) throws IOException, InvalidFormatException {
+		ImportExcel mo = new ImportExcel(file,1,"模块表");
+		ImportExcel importExcel = new ImportExcel(file,1,"领料清单");
+		Row row = mo.getRow(0);
+		String projectName = (String) mo.getCellValue(row, 1);
+		List<MaterialInfo> materialInfos = getData(importExcel,projectName);   //sheet页数据
+		List<MaterialInfo> list = replaceDate(materialInfos);          //对比替换数据
+		List<MaterialInfo> list1 = getNewData(list);      //合并后数据
+		List<MaterialInfo> standardList = materialInfoMapper.findSat(batch);     //标准库数据
+		List<MaterialInfo> newList = compareData(list1,standardList);    //比对之后的数据
+		saveList(newList);
+		MaterialProject materialProject = new MaterialProject();
+		materialProject.setReserveProjectName(projectName);
+		materialProject.setSuppliesBatch(batch);
+        materialProjectService.save(materialProject);
+	}
+
+
+	public List<MaterialInfo> findByBatch(List<MaterialProject> list){
+		List<MaterialInfo> list1 = materialInfoMapper.findByList(list);
+		 List<MaterialInfo> list2 = getNewData(list1); //合并数据
+		 return list2;
+	}
+
+
+
+
+	/**
+	 * 获取sheet中数据
+	 * @param importExcel
+	 * @param projectName
+	 * @return
+	 */
+	private List<MaterialInfo> getData(ImportExcel importExcel,String projectName)  {
+		int lastRow = importExcel.getLastDataRowNum();
+		List<MaterialInfo> list = new ArrayList<>();
+		MaterialInfo maintainData = null;
+		for(int i=1; i<lastRow;i++){
+			maintainData = new MaterialInfo();
+			Row row = importExcel.getRow(i);
+			String materialCode = (String) importExcel.getCellValue(row,1);
+			if(StringUtils.isNotBlank(materialCode)) {
+				maintainData.setProjectName(projectName);
+				maintainData.setMaterialCode(materialCode);
+			    maintainData.setMaterialName((String) importExcel.getCellValue(row,2));
+			    maintainData.setExtendDescription((String) importExcel.getCellValue(row,3));
+			    maintainData.setUnit((String) importExcel.getCellValue(row,4));
+			    maintainData.setTotalCount(getDouble(importExcel,row,5));
+			    maintainData.setWeightKg(getDouble(importExcel,row,6));
+			    maintainData.setWeightTon(getDouble(importExcel,row,7));
+				maintainData.setSupplyType((String) importExcel.getCellValue(row,8));
+				maintainData.setNote((String) importExcel.getCellValue(row,9));
+				list.add(maintainData);
+			}
+		}
+		return list;
+	}
+
+	/**
+	 * 合并数据
+	 * @param materialInfos
+	 * @return
+	 */
+	private List<MaterialInfo> getNewData(List<MaterialInfo> materialInfos) {
+		double totalCount = 0.00;
+		double weightTon = 0.00;
+		List<MaterialInfo> list = new ArrayList<>();
+		for(int i=0;i<materialInfos.size();i++){
+			MaterialInfo materialInfo = materialInfos.get(i);
+            String projectName = materialInfo.getProjectName();
+            String code = materialInfo.getMaterialCode();
+            String name = materialInfo.getMaterialName();
+            String des = materialInfo.getExtendDescription();
+            totalCount = materialInfo.getTotalCount();
+            weightTon = materialInfo.getWeightTon();
+            String note = materialInfo.getNote();
+            if(projectName != null){
+            	for(int j=i+1;j<materialInfos.size();j++){
+					MaterialInfo materialInfo1 = materialInfos.get(j);
+					String code1 = materialInfo1.getMaterialCode();
+					String name1 = materialInfo1.getMaterialName();
+					String des1 = materialInfo1.getExtendDescription();
+					String note1 = materialInfo1.getNote();
+					double totalCount1 = materialInfo1.getTotalCount();
+					double weightTon1 = materialInfo1.getWeightTon();
+					if(code.equals(code1) && des.equals(des1) && name.equals(name1) && note.equals(note1)){
+                          totalCount = totalCount + totalCount1;
+                          weightTon = weightTon + weightTon1;
+						  materialInfo1.setProjectName(null);
+					}
+				}
+				materialInfo.setTotalCount(totalCount);
+				materialInfo.setWeightTon(weightTon);
+				list.add(materialInfo);
+			}
+
+		}
+		return list;
+	}
+
+	/**
+	 * 对比替换数据
+	 * @param list
+	 * @return
+	 */
+	private List<MaterialInfo> replaceDate(List<MaterialInfo> list) {
+		for(MaterialInfo materialInfo : list){
+			String code = materialInfo.getMaterialCode();
+			String name = materialInfo.getMaterialName();
+			String des = materialInfo.getExtendDescription();
+			for(int i=0;i< MaterialReplaceUtil.exportCode.length;i++){
+				if(code.equals(MaterialReplaceUtil.exportCode[i]) && name.equals(MaterialReplaceUtil.exportName[i])
+						&& des.equals(MaterialReplaceUtil.exportDes[i])){
+					materialInfo.setMaterialCode(MaterialReplaceUtil.replaceCode[i]);
+					materialInfo.setMaterialName(MaterialReplaceUtil.replaceName[i]);
+					materialInfo.setExtendDescription(MaterialReplaceUtil.replaceDes[i]);
+					break;
+				}
+			}
+		}
+		return list;
+	}
+
+	/**
+	 * 数据和标准库比对
+	 * @param list
+	 * @param standardList
+	 * @return
+	 */
+	private List<MaterialInfo> compareData(List<MaterialInfo> list, List<MaterialInfo> standardList) {
+		for(MaterialInfo materialInfo : list){
+			String code = materialInfo.getMaterialCode();
+			String name = materialInfo.getMaterialName();
+			String des = materialInfo.getExtendDescription();
+			materialInfo.setState("0");
+			for(MaterialInfo materialInfo1 : standardList){
+				String code1 = materialInfo1.getMaterialCode();
+				String name1 = materialInfo1.getMaterialName();
+				String des1 = materialInfo1.getExtendDescription();
+				if(code.equals(code1) && name.equals(name1) && des.equals(des1)){
+					materialInfo.setState("1");
+					break;
+				}
+			}
+		}
+		return list;
+	}
+
+
+	private double getDouble(ImportExcel importExcel,Row row,int col){
+		double d = 0.00;
+		Object o = importExcel.getCellValue(row,col);
+		if(!o.equals("")){
+			d = Double.parseDouble(o.toString());
+		}
+		return d;
+	}
+
+
+
+
+
+
+
+
+
+	
+}

+ 68 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/util/MaterialReplaceUtil.java

@@ -0,0 +1,68 @@
+package com.jeeplus.modules.sg.managementcenter.materialinfo.util;
+
+public class MaterialReplaceUtil {
+    public static String[] exportCode = {
+            "500107562", "500017402", "500017402", "500017402", "500017402", "500017402",
+            "500017402", "500017402", "500017396", "500050121", "500050121", "500050121",
+            "500134504", "500134497", "500132919", "500021647"
+    };
+    public static String[] replaceCode = {
+            "500107562", "500118948", "500118948", "500118948", "500118948", "500118948",
+            "500118948", "500118948", "500118948", "500118948", "500118948", "500118948",
+            "500134504", "500134497", "500132919", "500107555"
+
+    };
+    public static String[] exportName = {
+            "电缆分支箱,AC400V,塑壳断路器,七路,630A", "线路角铁横担,∠75×8,1500mm,不计孔距,双侧",
+            "线路角铁横担,∠75×8,1500mm,不计孔距,双侧", "线路角铁横担,∠75×8,1500mm,不计孔距,双侧",
+            "线路角铁横担,∠75×8,1500mm,不计孔距,双侧", "线路角铁横担,∠75×8,1500mm,不计孔距,双侧",
+            "线路角铁横担,∠75×8,1500mm,不计孔距,双侧", "线路角铁横担,∠75×8,1500mm,不计孔距,双侧",
+            "线路角铁横担,∠75×8,1500mm,不计孔距,单侧", "普通螺栓,M18,300mm,铁,热浸锌,配螺母",
+            "普通螺栓,M18,300mm,铁,热浸锌,配螺母", "普通螺栓,M18,300mm,铁,热浸锌,配螺母",
+            "10kV柱上变压器台成套设备,ZA-1-CX,400kVA,15m", "10kV柱上变压器台成套设备,ZA-1-ZX,400kVA,15m",
+            "配电箱,户外,4回路400kVA-使用环境:户外,回路数:4回路400kVA", "电缆分支箱,AC400V,塑壳断路器,四路,400A"
+    };
+    public static String[] replaceName = {
+            "电缆分支箱,AC400V,塑壳断路器,七路,630A", "铁构件", "铁构件", "铁构件", "铁构件", "铁构件",
+            "铁构件", "铁构件", "铁构件", "铁构件", "铁构件", "铁构件", "10kV柱上变压器台成套设备,ZA-1-CX,400kVA,15m",
+            "10kV柱上变压器台成套设备,ZA-1-ZX,400kVA,15m", "配电箱,户外,4回路400kVA", "电缆分支箱,AC400V,塑壳断路器,四路,400A"
+    };
+    public static String[] exportDes = {
+            "电缆分支箱,AC400V,塑壳断路器,七路,630A。进线隔离开关400A,出线塑壳断路器,6×160A,304不锈钢,落地式,户外",
+            "配农网用,成套杆头,Z-S-190/12(15)",
+            "配农网用,成套杆头,ZJ-S-190/12(15)",
+            "配农网用,成套杆头,NJ1-S-350/15",
+            "配农网用,成套杆头,NJ1-S-190/12(15)",
+            "配农网用,成套杆头,2Z-V-190/15",
+            "配农网用,成套杆头,2ZJ-V-350/15",
+            "配农网用,成套杆头,2NJ1-V-190/15",
+            "线路角铁横担,∠75×8,1500mm,不计孔距,单侧。垫铁-50×5×272,适用杆径直径(mm)240-265",
+            "普通螺栓,M18,300mm,铁,热浸锌,配螺母。双头螺栓,ST-410,M18,210mm,螺母4个,平垫2个,弹垫2个",
+            "普通螺栓,M18,300mm,铁,热浸锌,配螺母。双头螺栓,ST-430,M18,230mm,螺母4个,平垫2个,弹垫2个",
+            "普通螺栓,M18,300mm,铁,热浸锌,配螺母。双头螺栓,ST-450,M18,250mm,螺母4个,平垫2个,弹垫2个",
+            "10kV柱上变压器台成套设备,ZA-1-CX,400kVA,15m。S13油浸变压器侧装,避雷器,配电箱进线刀熔开关,出线3回塑壳断路器带漏电保护,配智能电容,绝缘导线引线",
+            "10kV柱上变压器台成套设备,ZA-1-ZX,400kVA,15m。S13油浸变压器正装,避雷器,配电箱进线刀熔开关,出线3回塑壳断路器带漏电保护,配智能电容,绝缘导线引线",
+            "配电箱,户外,4回路400kVA。低压综合配电箱,AC380V,400kVA,四路,无补偿,进线熔断器式隔离开关,出线塑壳断路器,带剩余电流保护,电子式,带通信功能",
+            "电缆分支箱,AC400V,塑壳断路器,四路,400A。进线隔离开关400A,出线塑壳断路器,3×250A,SMC,落地式,户外"
+
+   };
+    public static String[] replaceDes = {
+            "电缆分支箱,AC400V,塑壳断路器,七路,630A。进线隔离开关630A,出线塑壳断路器,2×250A+4×160A,304不锈钢,落地式,户外",
+            "成套件,线路角铁横担,10kV单回路三角排列直线(单层、单横担)杆头,Z-S-190/12(15)",
+            "成套件,线路角铁横担,10kV单回路三角排列直线转角(单层、双横担)杆头,ZJ-S-190/12(15)",
+            "成套件,线路角铁横担,10kV单回路三角排列耐张转角(单层、双横担)杆头,NJ1-S-350/15",
+            "成套件,线路角铁横担,10kV单回路三角排列耐张转角(单层、双横担)杆头,NJ1-S-190/12(15)",
+            "成套件,线路角铁横担,10kV双回路垂直排列直线(单层、单横担)杆头,2Z-V-190/15",
+            "成套件,线路角铁横担,10kV双回路垂直排列直线转角(单层、双横担)杆头,2ZJ-V-350/15",
+            "成套件,线路角铁横担,10kV双回路垂直排列耐张转角(单层、双横担)杆头,2NJ1-V-190/15",
+            "成套件,线路角铁横担,∠75×8,1500mm,不计孔距,单侧。垫铁-50×5×272,适用杆径直径(mm)240-265",
+            "双头螺栓,ST-410,M18,210mm,螺母4个,平垫2个,弹垫2个",
+            "双头螺栓,ST-430,M18,230mm,螺母4个,平垫2个,弹垫2个",
+            "双头螺栓,ST-450,M18,250mm,螺母4个,平垫2个,弹垫2个",
+            "S13油浸叠铁芯变压器侧装,避雷器,配电箱进线刀熔开关,出线3回塑壳断路器带漏电保护,配智能电容,绝缘导线引线",
+            "S13油浸叠铁芯变压器正装,避雷器,配电箱进线刀熔开关,出线3回塑壳断路器带漏电保护,配智能电容,绝缘导线引线",
+            "配电箱,户外,4回路400kVA。低压综合配电箱,AC380V,400kVA,四路,无补偿,进线熔断器式隔离开关,出线塑壳断路器,带剩余电流保护,电子式,带通信功能",
+            "电缆分支箱,AC400V,塑壳断路器,四路,400A。进线隔离开关400A,出线塑壳断路器,3×250A,SMC,落地式,户外"
+};
+
+}

+ 196 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/web/MaterialInfoController.java

@@ -0,0 +1,196 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialinfo.web;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.StringUtils;
+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.managementcenter.materialinfo.entity.MaterialInfo;
+import com.jeeplus.modules.sg.managementcenter.materialinfo.service.MaterialInfoService;
+import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
+import com.jeeplus.modules.sg.managementcenter.materialproject.service.MaterialProjectService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 数据维护
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/managementcenter/materialinfo")
+public class MaterialInfoController extends BaseController {
+
+	@Autowired
+	private MaterialInfoService materialInfoService;
+	@Autowired
+	private MaterialProjectService materialProjectService;
+	
+	@ModelAttribute
+	public MaterialInfo get(@RequestParam(required=false) String id) {
+		MaterialInfo entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = materialInfoService.get(id);
+		}
+		if (entity == null){
+			entity = new MaterialInfo();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 列表页面
+	 */
+	@RequiresPermissions("managementcenter:materialinfo:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(MaterialInfo materialInfo, Model model) {
+		model.addAttribute("materialInfo", materialInfo);
+		return "modules/sg/managementcenter/materialinfo/materialInfoList";
+	}
+	
+		/**
+	 * 列表数据
+	 */
+		@ResponseBody
+		@RequiresPermissions("managementcenter:materialinfo:list")
+		@RequestMapping(value = "data")
+		public Map<String, Object> data(MaterialInfo materialInfo, HttpServletRequest request, HttpServletResponse response, Model model) {
+			Page<MaterialInfo> page = materialInfoService.findPage(new Page<MaterialInfo>(request, response), materialInfo);
+			return getBootstrapData(page);
+		}
+
+
+
+
+	
+	/**
+	 * 删除
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialinfo:del")
+	@RequestMapping(value = "delete")
+	public AjaxJson delete(MaterialInfo materialInfo) {
+		AjaxJson j = new AjaxJson();
+		materialInfoService.delete(materialInfo);
+		j.setMsg("删除成功");
+		return j;
+	}
+	
+	/**
+	 * 批量删除
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialinfo:del")
+	@RequestMapping(value = "deleteAll")
+	public AjaxJson deleteAll(String ids) {
+		AjaxJson j = new AjaxJson();
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			materialInfoService.delete(materialInfoService.get(id));
+		}
+		j.setMsg("删除成功");
+		return j;
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialinfo:export")
+    @RequestMapping(value = "export")
+    public AjaxJson exportFile(MaterialInfo materialInfo, HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		try {
+//            String fileName = DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+//            Page<MaintainData> page = dataMaintenanceService.findPage(new Page<MaintainData>(request, response, -1), maintainData);
+//    		new ExportExcel(null, MaintainData.class).setDataList(page.getList()).write(response, fileName).dispose();
+//			dataMaintenanceService.export(maintainData,response);
+    		j.setSuccess(true);
+    		j.setMsg("导出成功!");
+    		return j;
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg("导出失败!失败信息:"+e.getMessage());
+		}
+			return j;
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialinfo:import")
+    @RequestMapping(value = "import")
+   	public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) {
+		String batch = request.getParameter("batch");
+		AjaxJson j = new AjaxJson();
+		try {
+			materialInfoService.export(file,batch);
+			j.setMsg("导入成功");
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg("导入失败!失败信息:"+e.getMessage());
+		}
+		return j;
+    }
+
+
+
+	/**
+	 * 导入文件页面
+	 * @return
+	 */
+	@RequestMapping(value = "importExcel")
+	public String importExcel(Model model) {
+		List<MaterialProject> list = materialProjectService.findBatch();
+		model.addAttribute("batch",list);
+		return "modules/sg/managementcenter/materialinfo/importexcel";
+	}
+
+	@ResponseBody
+	@RequestMapping(value = "importValidation")
+	public AjaxJson importValidation(Model model) {
+		AjaxJson j = new AjaxJson();
+		List<MaterialInfo> list = materialInfoService.findProjectName();
+		if(list != null && list.size()>0){
+			j.setSuccess(true);
+		}else {
+			j.setSuccess(false);
+		}
+		return j;
+	}
+
+
+
+
+
+
+
+
+}

+ 4 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/service/MaterialProjectService.java

@@ -5,6 +5,7 @@ package com.jeeplus.modules.sg.managementcenter.materialproject.service;
 
 import com.jeeplus.core.persistence.Page;
 import com.jeeplus.core.service.CrudService;
+import com.jeeplus.modules.sg.managementcenter.materialinfo.service.MaterialInfoService;
 import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
 import com.jeeplus.modules.sg.managementcenter.materialproject.mapper.MaterialProjectMapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +20,8 @@ import java.util.List;
 public class MaterialProjectService extends CrudService<MaterialProjectMapper, MaterialProject> {
 	@Autowired
 	private MaterialProjectMapper materialProjectMapper;
+	@Autowired
+	private MaterialInfoService materialInfoService;
 
 	public MaterialProject get(String id) {
 		return super.get(id);
@@ -44,6 +47,7 @@ public class MaterialProjectService extends CrudService<MaterialProjectMapper, M
 	@Transactional(readOnly = false)
 	public void delete(MaterialProject materialProject) {
 		super.delete(materialProject);
+		materialInfoService.deleteByPro(materialProject.getReserveProjectName());
 	}
 	
 }

+ 17 - 11
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/web/MaterialProjectController.java

@@ -11,6 +11,8 @@ 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.managementcenter.materialinfo.entity.MaterialInfo;
+import com.jeeplus.modules.sg.managementcenter.materialinfo.service.MaterialInfoService;
 import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
 import com.jeeplus.modules.sg.managementcenter.materialproject.service.MaterialProjectService;
 import org.apache.shiro.authz.annotation.Logical;
@@ -27,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.ConstraintViolationException;
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
@@ -37,6 +40,8 @@ public class MaterialProjectController extends BaseController {
 
 	@Autowired
 	private MaterialProjectService materialProjectService;
+	@Autowired
+	private MaterialInfoService materialInfoService;
 	
 	@ModelAttribute
 	public MaterialProject get(@RequestParam(required=false) String id) {
@@ -61,7 +66,7 @@ public class MaterialProjectController extends BaseController {
 	}
 	
 		/**
-	 * 商品列表数据
+	 * 列表数据
 	 */
 	@ResponseBody
 	@RequiresPermissions("managementcenter:materialproject:list")
@@ -142,19 +147,20 @@ public class MaterialProjectController extends BaseController {
 	@ResponseBody
 	@RequiresPermissions("managementcenter:materialproject:export")
     @RequestMapping(value = "export")
-    public AjaxJson exportFile(MaterialProject materialProject, HttpServletRequest request, HttpServletResponse response) {
+    public AjaxJson exportFile(MaterialProject materialProject, HttpServletRequest request, HttpServletResponse response) throws IOException {
 		AjaxJson j = new AjaxJson();
-		try {
-            String fileName = "物料项目"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
-            Page<MaterialProject> page = materialProjectService.findPage(new Page<MaterialProject>(request, response, -1), materialProject);
-    		new ExportExcel("物料项目", MaterialProject.class).setDataList(page.getList()).write(response, fileName).dispose();
+//		try {
+            String fileName = "物料"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            List<MaterialProject> list = materialProjectService.findList(materialProject);
+            List<MaterialInfo> materialInfos = materialInfoService.findByBatch(list);
+    		new ExportExcel(null, MaterialInfo.class).setDataList(materialInfos).write(response, fileName).dispose();
     		j.setSuccess(true);
     		j.setMsg("导出成功!");
-    		return j;
-		} catch (Exception e) {
-			j.setSuccess(false);
-			j.setMsg("导出失败!失败信息:"+e.getMessage());
-		}
+//    		return j;
+//		} catch (Exception e) {
+//			j.setSuccess(false);
+//			j.setMsg("导出失败!失败信息:"+e.getMessage());
+//		}
 			return j;
     }
 

+ 39 - 0
src/main/webapp/webpage/modules/sg/managementcenter/materialinfo/importexcel.jsp

@@ -0,0 +1,39 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+    <title>导入Excel</title>
+    <meta name="decorator" content="ani"/>
+    <script>
+        function importExcel(url, fn) {
+            var importForm =$("#importForm")[0];
+            jp.loading('  正在导入,请稍等...');
+            jp.uploadFile(importForm, url,function (data) {
+               fn(data);
+            })
+        }
+    </script>
+</head>
+<body class="bg-white">
+    <div class="wrapper wrapper-content">
+        <div id="importBox" >
+            <form id="importForm" action="${url}" method="post" enctype="multipart/form-data"
+                  style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入,请稍等...');">
+             <div>
+                 <label class="label-item single-overflow pull-left" title="选择文件:">选择文件:</label>
+                <input id="uploadFile" name="file" type="file" class="form-control" style="width:300px"/>
+             </div>
+                <div>
+                    <label class="label-item single-overflow pull-left" title="选择物料库:">选择物料库:</label>
+                    <select name="batch"  class="form-control   simple-select" style="width:300px">
+                        <option value="" label=""/>
+                        <c:forEach var="item" items="${batch}">
+                            <option value="${item.suppliesBatch}" label="${item.suppliesBatch}"/>
+                        </c:forEach>
+                    </select>
+                </div> 
+            </form>
+        </div>
+    </div>
+</body>
+</html>

+ 240 - 0
src/main/webapp/webpage/modules/sg/managementcenter/materialinfo/materialInfoList.js

@@ -0,0 +1,240 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<script>
+$(document).ready(function() {
+	$('#dataTable').bootstrapTable({
+		 
+		  //请求方法
+               method: 'post',
+               //类型json
+               dataType: "json",
+               contentType: "application/x-www-form-urlencoded",
+               //显示检索按钮
+	           showSearch: true,
+               //显示刷新按钮
+               showRefresh: true,
+               //显示切换手机试图按钮
+               showToggle: true,
+               //显示 内容列下拉框
+    	       showColumns: true,
+    	       //显示到处按钮
+    	       showExport: true,
+    	       //显示切换分页按钮
+    	       showPaginationSwitch: true,
+    	       //最低显示2行
+    	       minimumCountColumns: 2,
+               //是否显示行间隔色
+               striped: true,
+               //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)     
+               cache: false,    
+               //是否显示分页(*)  
+               pagination: true,   
+                //排序方式 
+               sortOrder: "asc",  
+               //初始化加载第一页,默认第一页
+               pageNumber:1,   
+               //每页的记录行数(*)   
+               pageSize: 10,  
+               //可供选择的每页的行数(*)    
+               pageList: [10, 25, 50, 100],
+               //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据  
+               url: "${ctx}/managementcenter/materialinfo/data",
+               //默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
+               //queryParamsType:'',   
+               ////查询参数,每次调用是会带上这个参数,可自定义                         
+               queryParams : function(params) {
+               	var searchParam = $("#searchForm").serializeJSON();
+               	searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
+               	searchParam.pageSize = params.limit === undefined? -1 : params.limit;
+               	searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+  params.order;
+                   return searchParam;
+               },
+               //分页方式:client客户端分页,server服务端分页(*)
+               sidePagination: "server",
+               contextMenuTrigger:"right",//pc端 按右键弹出菜单
+               contextMenuTriggerMobile:"press",//手机端 弹出菜单,click:单击, press:长按。
+               contextMenu: '#context-menu',
+               onContextMenuItem: function(row, $el){
+                   if($el.data("item") == "edit"){
+                   		edit(row.id);
+                   }else if($el.data("item") == "view"){
+                       view(row.id);
+                   } else if($el.data("item") == "delete"){
+                        jp.confirm('确认要删除该数据记录吗?', function(){
+                       	jp.loading();
+                       	jp.get("${ctx}/managementcenter/materialinfo/delete?id="+row.id, function(data){
+                   	  		if(data.success){
+                   	  			$('#dataTable').bootstrapTable('refresh');
+                   	  			jp.success(data.msg);
+                   	  		}else{
+                   	  			jp.error(data.msg);
+                   	  		}
+                   	  	})
+                   	   
+                   	});
+                      
+                   } 
+               },
+              
+               onClickRow: function(row, $el){
+               },
+               	onShowSearch: function () {
+			$("#search-collapse").slideToggle();
+		},
+               columns: [
+			{
+		              field: 'projectName',
+		              title: '项目名称'
+		    }
+			,{
+		              field: 'materialCode',
+		              title: '物料编码'
+		    }
+		    ,{
+					   field: 'materialName',
+					   title: '物料名称'
+               }
+             ,{
+					   field: 'extendDescription',
+					   title: '扩展描述'
+               }
+             ,{
+					   field: 'unit',
+					   title: '单位'
+               }
+             ,{
+					   field: 'totalCount',
+					   title: '总量'
+               }
+              ,{
+                       field: 'weightKg',
+                       title: '单重/kg'
+                   }
+               ,{
+                       field: 'weightTon',
+                       title: '总重/吨'
+                   }
+             ,{
+                       field: 'supplyType',
+                       title: '甲乙供'
+                   }
+              ,{
+                       field: 'note',
+                       title: '备注'
+                   }
+		     ]
+		
+		});
+		
+		  
+	  if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
+
+		 
+		  $('#dataTable').bootstrapTable("toggleView");
+		}
+	  
+	  $('#dataTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
+                'check-all.bs.table uncheck-all.bs.table', function () {
+            $('#remove').prop('disabled', ! $('#dataTable').bootstrapTable('getSelections').length);
+            $('#view,#edit').prop('disabled', $('#dataTable').bootstrapTable('getSelections').length!=1);
+        });
+
+    $("#btnImport").click(function(){
+             jp.open({
+                       type: 2,
+                       area: [500, 200],
+                       auto: true,
+                       title:"导入数据",
+                       content: "${ctx}/managementcenter/materialinfo/importExcel" ,
+                       btn: ['确定', '关闭'],
+              btn1: function(index, layero){
+                     var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+                     iframeWin.contentWindow.importExcel('${ctx}/managementcenter/materialinfo/import', function (data) {
+                     if(data.success){
+                         jp.success(data.msg);
+                           refresh();
+                     }else{
+                        jp.error(data.msg);
+                      }
+                    jp.close(index);
+                    });//调用保存事件
+                   return false;
+                    },
+
+              btn2: function(index){
+                        jp.close(index);
+                      }
+                   });
+             });
+		
+		
+	 $("#export").click(function(){//导出Excel文件
+			jp.downloadFile('${ctx}/managementcenter/materialinfo/export');
+	  });
+
+		    
+	  $("#search").click("click", function() {// 绑定查询按扭
+		  $('#dataTable').bootstrapTable('refresh');
+		});
+
+
+	 
+	 $("#reset").click("click", function() {// 绑定查询按扭
+		  $("#searchForm  input").val("");
+		  $("#searchForm  select").val("");
+		  $("#searchForm  .select-item").html("");
+		  $('#dataTable').bootstrapTable('refresh');
+		});
+		
+		
+	});
+		
+  function getIdSelections() {
+        return $.map($("#dataTable").bootstrapTable('getSelections'), function (row) {
+            return row.id
+        });
+    }
+  
+  function deleteAll(){
+
+		jp.confirm('确认要删除该数据记录吗?', function(){
+			jp.loading();  	
+			jp.get("${ctx}/managementcenter/materialinfo/deleteAll?ids=" + getIdSelections(), function(data){
+         	  		if(data.success){
+         	  			$('#dataTable').bootstrapTable('refresh');
+         	  			jp.success(data.msg);
+         	  		}else{
+         	  			jp.error(data.msg);
+         	  		}
+         	  	})
+          	   
+		})
+  }
+
+    //刷新列表
+  function refresh(){
+  	$('#dataTable').bootstrapTable('refresh');
+  }
+  
+   function add(){
+	  jp.openSaveDialog('新增', "${ctx}/managementcenter/materialinfo/form",'800px', '500px');
+  }
+
+
+  
+   function edit(id){//没有权限时,不显示确定按钮
+       if(id == undefined){
+	      id = getIdSelections();
+	}
+	jp.openSaveDialog('编辑', "${ctx}/managementcenter/materialinfo/form?id=" + id, '800px', '500px');
+  }
+  
+ function view(id){//没有权限时,不显示确定按钮
+      if(id == undefined){
+             id = getIdSelections();
+      }
+        jp.openViewDialog('查看', "${ctx}/managementcenter/materialinfo/form?id=" + id, '800px', '500px');
+ }
+
+
+
+</script>

+ 118 - 0
src/main/webapp/webpage/modules/sg/managementcenter/materialinfo/materialInfoList.jsp

@@ -0,0 +1,118 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>物料列表</title>
+	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
+	<meta name="decorator" content="ani"/>
+	<%@ include file="/webpage/include/bootstraptable.jsp"%>
+	<%@include file="/webpage/include/treeview.jsp" %>
+	<%@include file="materialInfoList.js" %>
+</head>
+<body>
+	<div class="wrapper wrapper-content">
+	<div class="panel panel-primary">
+	<div class="panel-heading">
+		<h3 class="panel-title">物料列表</h3>
+	</div>
+	<div class="panel-body">
+	
+	<!-- 搜索 -->
+	<div id="search-collapse" class="collapse">
+		<div class="accordion-inner">
+			<form:form id="searchForm" modelAttribute="materialInfo" class="form form-horizontal well clearfix">
+			    <%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+				   <%--<label class="label-item single-overflow pull-left" title="储备项目暂定名称:">储备项目暂定名称:</label>--%>
+				   <%--<form:input path="reserveProjectName" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
+			    <%--</div>--%>
+				<div class="col-xs-12 col-sm-6 col-md-4">
+					<label class="label-item single-overflow pull-left" title="项目名称:">项目名称:</label>
+					<form:input path="projectName" htmlEscape="false" maxlength="64"  class=" form-control"/>
+				</div>
+				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+					<%--<label class="label-item single-overflow pull-left" title="储备编码:">储备编码:</label>--%>
+					<%--<form:input path="reserveCode" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
+				<%--</div>--%>
+				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+					<%--<label class="label-item single-overflow pull-left" title="项目编码:">项目编码:</label>--%>
+					<%--<form:input path="projectCode" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
+				<%--</div>--%>
+				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+					<%--<label class="label-item single-overflow pull-left" title="项目定义:">项目定义:</label>--%>
+					<%--<form:input path="projectDefine" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
+				<%--</div>--%>
+				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+					<%--<label class="label-item single-overflow pull-left" title="项目属性:">项目属性:</label>--%>
+					<%--<form:input path="projectAttribute" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
+				<%--</div>--%>
+				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+					<%--<label class="label-item single-overflow pull-left" title="项目批次:">项目批次:</label>--%>
+					<%--<form:input path="projectBatch" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
+				<%--</div>--%>
+				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+					<%--<label class="label-item single-overflow pull-left" title="项目批次:">物料批次:</label>--%>
+					<%--<form:input path="suppliesBatch" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
+				<%--</div>--%>
+		 <div class="col-xs-12 col-sm-6 col-md-4">
+			<div style="margin-top:26px">
+			  <a  id="search" class="btn btn-primary btn-rounded  btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
+			  <a  id="reset" class="btn btn-primary btn-rounded  btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>
+			 </div>
+	    </div>	
+	</form:form>
+	</div>
+	</div>
+	
+	<!-- 工具栏 -->
+	<div id="toolbar">
+			<%--<shiro:hasPermission name="managementcenter:materialinfo:add">--%>
+				<%--<button id="add" class="btn btn-primary" onclick="add()">--%>
+					<%--<i class="glyphicon glyphicon-plus"></i> 新建--%>
+				<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="managementcenter:materialinfo:edit">--%>
+			    <%--<button id="edit" class="btn btn-success" disabled onclick="edit()">--%>
+	            	<%--<i class="glyphicon glyphicon-edit"></i> 修改--%>
+	        	<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="managementcenter:materialinfo:del">--%>
+				<%--<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">--%>
+	            	<%--<i class="glyphicon glyphicon-remove"></i> 删除--%>
+	        	<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+		<shiro:hasPermission name="managementcenter:materialinfo:import">
+			<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
+		</shiro:hasPermission>
+			<shiro:hasPermission name="managementcenter:materialinfo:export">
+	        		<button id="export" class="btn btn-warning">
+					<i class="fa fa-file-excel-o"></i> 导出
+				</button>
+			 </shiro:hasPermission>
+	                 <%--<shiro:hasPermission name="managementcenter:materialinfo:view">--%>
+				<%--<button id="view" class="btn btn-default" disabled onclick="view()">--%>
+					<%--<i class="fa fa-search-plus"></i> 查看--%>
+				<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+		    </div>
+		
+	<!-- 表格 -->
+	<table id="dataTable"   data-toolbar="#toolbar"></table>
+
+    <!-- context menu -->
+    <ul id="context-menu" class="dropdown-menu">
+    	<shiro:hasPermission name="managementcenter:materialinfo:add">
+        <li data-item="view"><a>查看</a></li>
+        </shiro:hasPermission>
+    	<shiro:hasPermission name="managementcenter:materialinfo:edit">
+        <li data-item="edit"><a>编辑</a></li>
+        </shiro:hasPermission>
+        <shiro:hasPermission name="managementcenter:materialinfo:del">
+        <li data-item="delete"><a>删除</a></li>
+        </shiro:hasPermission>
+        <li data-item="action1"><a>取消</a></li>
+    </ul>  
+	</div>
+	</div>
+	</div>
+</body>
+</html>

+ 3 - 2
src/main/webapp/webpage/modules/sg/managementcenter/materialproject/materialProjectList.js

@@ -129,7 +129,7 @@ $(document).ready(function() {
                }
               ,{
                        field: 'suppliesBatch',
-                       title: '物批次'
+                       title: '物批次'
                    }
 		     ]
 		
@@ -152,7 +152,8 @@ $(document).ready(function() {
 		
 		
 	 $("#export").click(function(){//导出Excel文件
-			jp.downloadFile('${ctx}/managementcenter/materialproject/export');
+            var batch = $("#bat").val();
+			jp.downloadFile('${ctx}/managementcenter/materialproject/export?projectBatch='+batch);
 	  });
 
 		    

+ 1 - 1
src/main/webapp/webpage/modules/sg/managementcenter/materialproject/materialProjectList.jsp

@@ -47,7 +47,7 @@
 				</div>
 				<div class="col-xs-12 col-sm-6 col-md-4">
 					<label class="label-item single-overflow pull-left" title="项目批次:">项目批次:</label>
-					<form:input path="projectBatch" htmlEscape="false" maxlength="64"  class=" form-control"/>
+					<form:input path="projectBatch" htmlEscape="false" maxlength="64"  class=" form-control" id="bat"/>
 				</div>
 				<div class="col-xs-12 col-sm-6 col-md-4">
 					<label class="label-item single-overflow pull-left" title="项目批次:">物料批次:</label>