浏览代码

Merge remote-tracking branch 'origin/master'

yue 5 年之前
父节点
当前提交
a2c0790b33
共有 21 个文件被更改,包括 1855 次插入68 次删除
  1. 3 3
      src/main/java/com/jeeplus/modules/act/service/ActTaskService.java
  2. 76 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/entity/MaterialInventory.java
  3. 32 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/entity/MaterialRequisition.java
  4. 20 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/mapper/MaterialInventoryMapper.java
  5. 185 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/mapper/xml/MaterialInventoryMapper.xml
  6. 56 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/service/MaterialInventoryService.java
  7. 172 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/util/ImportPro.java
  8. 394 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/util/ImportUtil.java
  9. 221 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/web/MaterialInventoryController.java
  10. 13 1
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialProvided/util/ImportPro.java
  11. 6 1
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialProvided/web/MaterialProvidedController.java
  12. 41 5
      src/main/java/com/jeeplus/modules/sg/managementcenter/project/entity/Project.java
  13. 36 15
      src/main/java/com/jeeplus/modules/sg/managementcenter/project/mapper/xml/ProjectMapper.xml
  14. 8 1
      src/main/java/com/jeeplus/modules/sg/managementcenter/project/service/ProjectService.java
  15. 58 35
      src/main/java/com/jeeplus/modules/sg/managementcenter/project/util/ProExcelInfo.java
  16. 5 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/project/web/ProjectController.java
  17. 306 0
      src/main/webapp/webpage/modules/sg/managementcenter/materialInventory/materialInventory.js
  18. 93 0
      src/main/webapp/webpage/modules/sg/managementcenter/materialInventory/materialInventory.jsp
  19. 84 0
      src/main/webapp/webpage/modules/sg/managementcenter/materialInventory/materialInventoryForm.jsp
  20. 22 2
      src/main/webapp/webpage/modules/sg/managementcenter/project/projectForm.jsp
  21. 24 5
      src/main/webapp/webpage/modules/sg/managementcenter/project/projectList.js

+ 3 - 3
src/main/java/com/jeeplus/modules/act/service/ActTaskService.java

@@ -1482,7 +1482,7 @@ public class ActTaskService extends BaseService {
 				vars.put("design",user.getThroughResearchRole());
 				vars.put("jys", true);
 			} else {
-				vars.put("design", user.getDesignUnitRole());
+				vars.put("design", user.getDesignUnitManage());
 				vars.put("des", true);
 			}
 		} else {
@@ -1551,7 +1551,7 @@ public class ActTaskService extends BaseService {
 		if ("yes".equals(flag)) {
 			vars.put("design", user.getProjectManageRole());
 		} else {
-			vars.put("design", user.getDesignUnitRole());
+			vars.put("design", user.getDesignUnitManage());
 		}
 		//根据登陆查询所属的角色
 		vars.put("pass", "yes".equals(flag)? true : false);
@@ -2577,7 +2577,7 @@ public class ActTaskService extends BaseService {
 		Map<String, Object> vars = Maps.newHashMap();
 		vars.put("pass", "yes".equals(flag)? true : false);
 		Project user = MyActiviUtils.findUser(act.getProcInsId());
-		String designUnitRole = user.getDesignUnitRole();
+		String designUnitRole = user.getDesignUnitManage();
 		if ("yes".equals(flag)) {
 			vars.put("design",designUnitRole);
 		} else {

+ 76 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/entity/MaterialInventory.java

@@ -0,0 +1,76 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialInventory.entity;
+
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.core.persistence.DataEntity;
+
+public class MaterialInventory extends DataEntity<MaterialInventory> {
+	private static final long serialVersionUID = 1L;
+	private String materialCode;   //物料编码
+	private String materialDetail;   //物料描述
+	private Double stockQuantity;   //非限制库存数量
+	private Double frozenQuantity;   //已冻结库存数量
+	private Double availableStockQuantity;   //可用库存数量
+	private Double requireCount;//需求数量
+	private Double outCount;//已经出库数量
+	@ExcelField(title="需求数量", align=2, sort=5)
+	public Double getRequireCount() {
+		return requireCount;
+	}
+
+	public void setRequireCount(Double requireCount) {
+		this.requireCount = requireCount;
+	}
+	@ExcelField(title="已出库数量", align=2, sort=6)
+	public Double getOutCount() {
+		return outCount;
+	}
+
+	public void setOutCount(Double outCount) {
+		this.outCount = outCount;
+	}
+
+	@ExcelField(title="物料编码", align=2, sort=1)
+	public String getMaterialCode() {
+		return materialCode;
+	}
+
+	public void setMaterialCode(String materialCode) {
+		this.materialCode = materialCode;
+	}
+	@ExcelField(title="物料描述", align=2, sort=2)
+	public String getMaterialDetail() {
+		return materialDetail;
+	}
+
+	public void setMaterialDetail(String materialDetail) {
+		this.materialDetail = materialDetail;
+	}
+	@ExcelField(title="非限制库存数量", align=2, sort=3)
+	public Double getStockQuantity() {
+		return stockQuantity;
+	}
+
+	public void setStockQuantity(Double stockQuantity) {
+		this.stockQuantity = stockQuantity;
+	}
+	@ExcelField(title="已冻结库存数量", align=2, sort=4)
+	public Double getFrozenQuantity() {
+		return frozenQuantity;
+	}
+
+	public void setFrozenQuantity(Double frozenQuantity) {
+		this.frozenQuantity = frozenQuantity;
+	}
+	@ExcelField(title="可用库存数量", align=2, sort=7)
+	public Double getAvailableStockQuantity() {
+		return availableStockQuantity;
+	}
+
+	public void setAvailableStockQuantity(Double availableStockQuantity) {
+		this.availableStockQuantity = availableStockQuantity;
+	}
+}
+

+ 32 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/entity/MaterialRequisition.java

@@ -0,0 +1,32 @@
+package com.jeeplus.modules.sg.managementcenter.materialInventory.entity;
+
+public class MaterialRequisition {
+    private String materialCode;//物料编码
+    private Double requireCount;//需求数量
+    private Double outCount;//已经出库数量
+
+    public String getMaterialCode() {
+        return materialCode;
+    }
+
+    public void setMaterialCode(String materialCode) {
+        this.materialCode = materialCode;
+    }
+
+    public Double getRequireCount() {
+        return requireCount;
+    }
+
+    public void setRequireCount(Double requireCount) {
+        this.requireCount = requireCount;
+    }
+
+    public Double getOutCount() {
+        return outCount;
+    }
+
+    public void setOutCount(Double outCount) {
+        this.outCount = outCount;
+    }
+
+}

+ 20 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/mapper/MaterialInventoryMapper.java

@@ -0,0 +1,20 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialInventory.mapper;
+
+import com.jeeplus.core.persistence.BaseMapper;
+import com.jeeplus.core.persistence.annotation.MyBatisMapper;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialInventory;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialRequisition;
+import com.jeeplus.modules.sg.managementcenter.materialProvided.entity.MaterialProvided;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@MyBatisMapper
+public interface MaterialInventoryMapper extends BaseMapper<MaterialInventory> {
+    public Integer insertList(@Param("list") List<MaterialInventory> list);
+
+    List<MaterialInventory> findByList(@Param("list") List<MaterialRequisition> list);
+}

+ 185 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/mapper/xml/MaterialInventoryMapper.xml

@@ -0,0 +1,185 @@
+<?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.materialInventory.mapper.MaterialInventoryMapper">
+    
+	<sql id="materialColumns">
+		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.materialCode	AS  "materialCode",
+		a.materialDetail	AS  "materialDetail",
+		a.stockQuantity	AS  "stockQuantity",
+		a.frozenQuantity	AS  "frozenQuantity",
+		a.requireCount AS "requireCount",
+		a.outCount AS "outCount",
+	    a.availableStockQuantity AS "availableStockQuantity"
+	</sql>
+	<select id="get" resultType="MaterialInventory" >
+		SELECT 
+			<include refid="materialColumns"/>
+		FROM xm_material_inventory a
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="MaterialInventory" >
+		SELECT
+			<include refid="materialColumns"/>
+		FROM xm_material_inventory a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+			<if test="materialCode != null and materialCode != '' ">
+				AND materialCode LIKE CONCAT(CONCAT('%',#{materialCode},'%'))
+			</if>
+		</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>
+	
+	<select id="findAllList" resultType="MaterialInventory" >
+		SELECT
+			<include refid="materialColumns"/>
+		FROM xm_material_inventory a
+			<include refid="materialColumns"/>
+		<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">
+		replace INTO xm_material_inventory(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			materialCode,
+			materialDetail,
+			stockQuantity,
+			frozenQuantity,
+			requireCount,
+			outCount,
+			availableStockQuantity
+		) VALUES (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{materialCode},
+			#{materialDetail},
+			#{stockQuantity},
+			#{frozenQuantity},
+			#{requireCount},
+			#{outCount},
+		  	#{availableStockQuantity}
+		)
+	</insert>
+
+	<insert id="insertList">
+		replace INTO xm_material_inventory(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			materialCode,
+			materialDetail,
+			stockQuantity,
+			frozenQuantity,
+			requireCount,
+			outCount,
+			availableStockQuantity
+		) 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.materialCode},
+			#{item.materialDetail},
+			#{item.stockQuantity},
+			#{item.frozenQuantity},
+			#{item.requireCount},
+			#{item.outCount},
+			#{item.availableStockQuantity}
+			)
+		</foreach>
+	</insert>
+
+	<update id="update">
+		UPDATE xm_material_inventory SET
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			remarks = #{remarks},
+			materialCode = #{materialCode},
+			materialDetail = #{materialDetail},
+			stockQuantity =#{stockQuantity},
+			frozenQuantity =#{frozenQuantity},
+			requireCount = #{requireCount},
+			outCount = #{outCount},
+			availableStockQuantity =#{availableStockQuantity}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM xm_material_inventory
+		WHERE id = #{id}
+	</update>
+	
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE xm_material_inventory SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="MaterialInventory" statementType="STATEMENT">
+		select * FROM xm_material_inventory  where ${propertyName} = '${value}'
+	</select>
+
+	<select id="findByList" resultType="com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialInventory">
+		SELECT
+		<include refid="materialColumns"/>
+		FROM xm_material_inventory a
+		<where>
+			a.materialCode in
+			<foreach collection="list" item="item" open="(" close=")" separator=",">
+				#{item.materialCode}
+			</foreach>
+		</where>
+	</select>
+</mapper>

+ 56 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/service/MaterialInventoryService.java

@@ -0,0 +1,56 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialInventory.service;
+
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.core.service.CrudService;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialInventory;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialRequisition;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.mapper.MaterialInventoryMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+@Service
+@Transactional(readOnly = true)
+public class MaterialInventoryService extends CrudService<MaterialInventoryMapper, MaterialInventory> {
+	@Autowired
+	private MaterialInventoryMapper materialInventoryMapper;
+
+	public MaterialInventory get(String id) {
+		return super.get(id);
+	}
+	
+	public List<MaterialInventory> findList(MaterialInventory materialInventory) {
+		return super.findList(materialInventory);
+	}
+	
+	public Page<MaterialInventory> findPage(Page<MaterialInventory> page, MaterialInventory materialInventory) {
+		return super.findPage(page, materialInventory);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(MaterialInventory materialInventory) {
+		super.save(materialInventory);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(MaterialInventory materialInventory) {
+		super.delete(materialInventory);
+	}
+
+	@Transactional(readOnly = false)
+	public void saveList(List<MaterialInventory> list) {
+		for(MaterialInventory materialInventory : list){
+			materialInventory.preInsert();
+		}
+		materialInventoryMapper.insertList(list);
+	}
+
+	public List<MaterialInventory> findByList(List<MaterialRequisition> list){
+		return materialInventoryMapper.findByList(list);
+	}
+}

+ 172 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/util/ImportPro.java

@@ -0,0 +1,172 @@
+package com.jeeplus.modules.sg.managementcenter.materialInventory.util;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialInventory;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialRequisition;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.Row;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+public class ImportPro {
+    /**
+     * 获取库存表格数据
+     * @param importUtil
+     * @return List<ErpAccount> 导入表格数据
+     */
+    public static List<MaterialInventory> getMaterialInventoryUtil(ImportUtil importUtil)  {
+        int lastRow = importUtil.getLastDataRowNum();
+        List<MaterialInventory> list = new ArrayList<MaterialInventory>();
+        MaterialInventory materialInventory = null;
+        String materialCode="";//物料编码
+        for(int i=1; i<lastRow;i++){
+            materialInventory = new MaterialInventory();
+            Row row = importUtil.getRow(i);
+            materialCode = (String)importUtil.getCellValue(row,3);
+            if (StringUtils.isNotBlank(materialCode)){
+                materialInventory.setMaterialCode(materialCode);
+                materialInventory.setMaterialDetail((String)importUtil.getCellValue(row,4));//物料描述
+                materialInventory.setStockQuantity(new Double((String)importUtil.getCellValue(row,6)));//非限制库存数量
+                materialInventory.setFrozenQuantity(new Double((String)importUtil.getCellValue(row,8)));//已冻结库存数量
+                list.add(materialInventory);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 获取领料单表格数据
+     * @param importUtil
+     * @return List<ErpAccount> 导入表格数据
+     */
+    public static List<MaterialRequisition> getMaterialRequisitionUtil(ImportUtil importUtil)  {
+        int lastRow = importUtil.getLastDataRowNum();
+        List<MaterialRequisition> list = new ArrayList<MaterialRequisition>();
+        MaterialRequisition materialRequisition = null;
+        String materialCode="";//物料编码
+        for(int i=1; i<lastRow;i++){
+            materialRequisition = new MaterialRequisition();
+            Row row = importUtil.getRow(i);
+            materialCode = (String)importUtil.getCellValue(row,12);
+            if (StringUtils.isNotBlank(materialCode)){
+               if (!materialCode.contains("物料")){
+                   materialRequisition.setMaterialCode(materialCode);//物料编码
+                   materialRequisition.setRequireCount(new Double((String)importUtil.getCellValue(row,15)));//需求数量
+                   materialRequisition.setOutCount(new Double((String)importUtil.getCellValue(row,16)));//已出库数量
+                   list.add(materialRequisition);
+               }
+            }
+        }
+        return list;
+    }
+    /*
+        得到可使用库存数量
+     */
+    public static List<MaterialInventory> getMaterial(List<MaterialInventory> materialInventories,List<MaterialRequisition> materialRequisitions){
+        Double availableStockQuantity = 0.0;
+        Double requireCount =0.0;
+        Double outCount = 0.0;
+        for (MaterialInventory materialInventory:materialInventories){
+            for (MaterialRequisition materialRequisition:materialRequisitions){
+                if (materialInventory.getMaterialCode().equals(materialRequisition.getMaterialCode())){
+                    availableStockQuantity = materialRequisition.getRequireCount()-materialRequisition.getOutCount();
+                    requireCount = materialRequisition.getRequireCount();
+                    outCount = materialRequisition.getOutCount();
+                    break;
+                }
+            }
+            materialInventory.setRequireCount(requireCount);
+            materialInventory.setOutCount(outCount);
+            availableStockQuantity = materialInventory.getStockQuantity() - availableStockQuantity;
+            materialInventory.setAvailableStockQuantity(availableStockQuantity);
+        }
+        return materialInventories;
+    }
+
+    /*
+     * 去重库存表
+     */
+    public static List<MaterialInventory> getSetMaterialInvenntory(List<MaterialInventory> materialInventories){
+        List<MaterialInventory> materialInventoryList = new ArrayList<MaterialInventory>();
+        boolean flag = true;
+        MaterialInventory material = null;
+        double count = 0.0;
+        for (MaterialInventory materialInventory:materialInventories){
+            flag = true;
+            for (MaterialInventory materialInventory1:materialInventoryList){
+                if (materialInventory1.getMaterialCode().equals(materialInventory.getMaterialCode())){
+                    count = materialInventory.getStockQuantity()+materialInventory1.getStockQuantity();
+                    materialInventory1.setStockQuantity(count);//非限制库存数量
+                    count = materialInventory.getFrozenQuantity()+materialInventory1.getFrozenQuantity();
+                    materialInventory1.setFrozenQuantity(count);//已冻结库存数量
+                    flag = false;
+                    break;
+                }
+            }
+            if (flag){
+                material = new MaterialInventory();
+                material.setMaterialCode(materialInventory.getMaterialCode());//物料编码
+                material.setMaterialDetail(materialInventory.getMaterialDetail());//物料描述
+                material.setStockQuantity(materialInventory.getStockQuantity());//非限制库存数量
+                material.setFrozenQuantity(materialInventory.getFrozenQuantity());//已冻结库存数量
+                materialInventoryList.add(material);
+            }
+        }
+        for (MaterialInventory materialInventory:materialInventoryList){
+            System.out.println(materialInventory);
+        }
+        return materialInventoryList;
+    }
+
+    /*
+     * 去重 附件5
+     */
+    public static List<MaterialRequisition> getSetMaterialRequisition(List<MaterialRequisition> requisitions){
+        List<MaterialRequisition> requisitionList = new ArrayList<MaterialRequisition>();
+        boolean flag = true;
+        MaterialRequisition requisition = null;
+        double count = 0.0;
+        for (MaterialRequisition materialRequisition:requisitions){
+            flag = true;
+            for (MaterialRequisition materialRequisition1:requisitionList){
+                if (materialRequisition.getMaterialCode().equals(materialRequisition1.getMaterialCode())){
+                    count = materialRequisition.getRequireCount()+materialRequisition1.getRequireCount();
+                    materialRequisition1.setRequireCount(count);
+                    count = materialRequisition.getOutCount()+materialRequisition1.getOutCount();
+                    materialRequisition1.setOutCount(count);
+                    flag = false;
+                }
+            }
+            if (flag){
+                requisition = new MaterialRequisition();
+                requisition.setMaterialCode(materialRequisition.getMaterialCode());
+                requisition.setRequireCount(materialRequisition.getRequireCount());
+                requisition.setOutCount(materialRequisition.getOutCount());
+                requisitionList.add(requisition);
+            }
+        }
+        return requisitionList;
+    }
+    //验证库存表
+    public static boolean getJudgeInventory(ImportUtil importUtil){
+        boolean flag = false;
+        Row row = importUtil.getRow(0);
+        String materialCode = (String) importUtil.getCellValue(row,3);//物理编码
+        String materialDetails = (String) importUtil.getCellValue(row,4);//物料描述
+        if (!materialCode.contains("编码")||!materialDetails.contains("描述")){
+            return true;
+        }
+        return false;
+    }
+    //验证库存表
+    public static boolean getJudgeRequisition(ImportUtil importUtil){
+        boolean flag = false;
+        Row row = importUtil.getRow(3);
+        String requireCount = (String) importUtil.getCellValue(row,15);//物理编码
+        String outCount = (String) importUtil.getCellValue(row,16);//物料描述
+        if (!requireCount.contains("需求")||!outCount.contains("出库")){
+            return true;
+        }
+        return false;
+    }
+}

+ 394 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/util/ImportUtil.java

@@ -0,0 +1,394 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialInventory.util;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.Reflections;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.DictUtils;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.text.NumberFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 导入Excel文件(支持“XLS”和“XLSX”格式)
+ * @author jeeplus
+ * @version 2016-03-10
+ */
+public class ImportUtil {
+
+	private static Logger log = LoggerFactory.getLogger(ImportUtil.class);
+
+	/**
+	 * 工作薄对象
+	 */
+	private Workbook wb;
+
+	/**
+	 * 工作表对象
+	 */
+	private Sheet sheet;
+
+	/**
+	 * 标题行号
+	 */
+	private int headerNum;
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件,读取第一个工作表
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(String fileName, int headerNum)
+			throws InvalidFormatException, IOException {
+		this(new File(fileName), headerNum);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件对象,读取第一个工作表
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(File file, int headerNum)
+			throws InvalidFormatException, IOException {
+		this(file, headerNum, 0);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(String fileName, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		this(new File(fileName), headerNum, sheetIndex);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件对象
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(File file, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		this(file.getName(), new FileInputStream(file), headerNum, sheetIndex);
+	}
+
+	/**
+	 * 构造函数
+	 * @param file 导入文件对象
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(MultipartFile multipartFile, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件对象
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(String fileName, InputStream is, int headerNum, int sheetIndex)
+			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.getNumberOfSheets()<sheetIndex){
+			throw new RuntimeException("文档中没有工作表!");
+		}
+		this.sheet = this.wb.getSheetAt(sheetIndex);
+		this.headerNum = headerNum;
+		log.debug("Initialize success.");
+	}
+	
+	/**
+	 * 获取行对象
+	 * @param rownum
+	 * @return
+	 */
+	public Row getRow(int rownum){
+		return this.sheet.getRow(rownum);
+	}
+
+	/**
+	 * 获取数据行号
+	 * @return
+	 */
+	public int getDataRowNum(){
+		return headerNum+1;
+	}
+	
+	/**
+	 * 获取最后一个数据行号
+	 * @return
+	 */
+	public int getLastDataRowNum(){
+		return this.sheet.getLastRowNum()+headerNum;
+	}
+	
+	/**
+	 * 获取最后一个列号
+	 * @return
+	 */
+	public int getLastCellNum(){
+		return this.getRow(headerNum).getLastCellNum();
+	}
+	
+	/**
+	 * 获取单元格值
+	 * @param row 获取的行
+	 * @param column 获取单元格列号
+	 * @return 单元格值
+	 */
+	public Object getCellValue(Row row, int column) {
+		Object val = "";
+		try {
+			Cell cell = row.getCell(column);
+			if (cell != null) {
+				if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
+					// val = cell.getNumericCellValue();
+					// 当excel 中的数据为数值或日期是需要特殊处理
+					if (HSSFDateUtil.isCellDateFormatted(cell)) {
+						double d = cell.getNumericCellValue();
+						Date date = HSSFDateUtil.getJavaDate(d);
+						SimpleDateFormat dformat = new SimpleDateFormat(
+								"yyyy-MM-dd");
+						val = dformat.format(date);
+					} else {
+						NumberFormat nf = NumberFormat.getInstance();
+						nf.setGroupingUsed(false);// true时的格式:1,234,567,890
+						val = nf.format(cell.getNumericCellValue());// 数值类型的数据为double,所以需要转换一下
+					}
+				} else if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
+					val = cell.getStringCellValue();
+				} else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
+					val = cell.getCellFormula();
+				} else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
+					val = cell.getBooleanCellValue();
+				} else if (cell.getCellType() == Cell.CELL_TYPE_ERROR) {
+					val = cell.getErrorCellValue();
+				}
+			}
+		} catch (Exception e) {
+			return val;
+		}
+		return val;
+	}
+	
+	/**
+	 * 获取导入数据列表
+	 * @param cls 导入对象类型
+	 * @param groups 导入分组
+	 */
+	public <E> List<E> getDataList(Class<E> cls, int... groups) throws InstantiationException, IllegalAccessException{
+		List<Object[]> annotationList = Lists.newArrayList();
+		// Get annotation field 
+		Field[] fs = cls.getDeclaredFields();
+		for (Field f : fs){
+			ExcelField ef = f.getAnnotation(ExcelField.class);
+			if (ef != null && (ef.type()==0 || ef.type()==2)){
+				if (groups!=null && groups.length>0){
+					boolean inGroup = false;
+					for (int g : groups){
+						if (inGroup){
+							break;
+						}
+						for (int efg : ef.groups()){
+							if (g == efg){
+								inGroup = true;
+								annotationList.add(new Object[]{ef, f});
+								break;
+							}
+						}
+					}
+				}else{
+					annotationList.add(new Object[]{ef, f});
+				}
+			}
+		}
+		// Get annotation method
+		Method[] ms = cls.getDeclaredMethods();
+		for (Method m : ms){
+			ExcelField ef = m.getAnnotation(ExcelField.class);
+			if (ef != null && (ef.type()==0 || ef.type()==2)){
+				if (groups!=null && groups.length>0){
+					boolean inGroup = false;
+					for (int g : groups){
+						if (inGroup){
+							break;
+						}
+						for (int efg : ef.groups()){
+							if (g == efg){
+								inGroup = true;
+								annotationList.add(new Object[]{ef, m});
+								break;
+							}
+						}
+					}
+				}else{
+					annotationList.add(new Object[]{ef, m});
+				}
+			}
+		}
+		// Field sorting
+		Collections.sort(annotationList, new Comparator<Object[]>() {
+			public int compare(Object[] o1, Object[] o2) {
+				return new Integer(((ExcelField)o1[0]).sort()).compareTo(
+						new Integer(((ExcelField)o2[0]).sort()));
+			};
+		});
+		//log.debug("Import column count:"+annotationList.size());
+		// Get excel data
+		List<E> dataList = Lists.newArrayList();
+		for (int i = this.getDataRowNum(); i < this.getLastDataRowNum(); i++) {
+			E e = (E)cls.newInstance();
+			int column = 0;
+			Row row = this.getRow(i);
+			StringBuilder sb = new StringBuilder();
+			for (Object[] os : annotationList){
+				Object val = this.getCellValue(row, column++);
+				if (val != null){
+					ExcelField ef = (ExcelField)os[0];
+					// If is dict type, get dict value
+					if (StringUtils.isNotBlank(ef.dictType())){
+						val = DictUtils.getDictValue(val.toString(), ef.dictType(), "");
+						//log.debug("Dictionary type value: ["+i+","+colunm+"] " + val);
+					}
+					// Get param type and type cast
+					Class<?> valType = Class.class;
+					if (os[1] instanceof Field){
+						valType = ((Field)os[1]).getType();
+					}else if (os[1] instanceof Method){
+						Method method = ((Method)os[1]);
+						if ("get".equals(method.getName().substring(0, 3))){
+							valType = method.getReturnType();
+						}else if("set".equals(method.getName().substring(0, 3))){
+							valType = ((Method)os[1]).getParameterTypes()[0];
+						}
+					}
+					//log.debug("Import value type: ["+i+","+column+"] " + valType);
+					try {
+						//如果导入的java对象,需要在这里自己进行变换。
+						if (valType == String.class){
+							String s = String.valueOf(val.toString());
+							if(StringUtils.endsWith(s, ".0")){
+								val = StringUtils.substringBefore(s, ".0");
+							}else{
+								val = String.valueOf(val.toString());
+							}
+						}else if (valType == Integer.class){
+							val = Double.valueOf(val.toString()).intValue();
+						}else if (valType == Long.class){
+							val = Double.valueOf(val.toString()).longValue();
+						}else if (valType == Double.class){
+							val = Double.valueOf(val.toString());
+						}else if (valType == Float.class){
+							val = Float.valueOf(val.toString());
+						}else if (valType == Date.class){
+							SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
+							val=sdf.parse(val.toString()); 
+						}else if (valType == User.class){
+							val = UserUtils.getByUserName(val.toString());
+						}else if (valType == Office.class){
+							val = UserUtils.getByOfficeName(val.toString());
+						}else if (valType == Area.class){
+							val = UserUtils.getByAreaName(val.toString());
+						}else{
+							if (ef.fieldType() != Class.class){
+								val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
+							}else{
+								val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(), 
+										"fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
+							}
+						}
+					} catch (Exception ex) {
+						log.info("Get cell value ["+i+","+column+"] error: " + ex.toString());
+						val = null;
+					}
+					// set entity value
+					if (os[1] instanceof Field){
+						Reflections.invokeSetter(e, ((Field)os[1]).getName(), val);
+					}else if (os[1] instanceof Method){
+						String mthodName = ((Method)os[1]).getName();
+						if ("get".equals(mthodName.substring(0, 3))){
+							mthodName = "set"+StringUtils.substringAfter(mthodName, "get");
+						}
+						Reflections.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val});
+					}
+				}
+				sb.append(val+", ");
+			}
+			dataList.add(e);
+			log.debug("Read success: ["+i+"] "+sb.toString());
+		}
+		return dataList;
+	}
+
+//	/**
+//	 * 导入测试
+//	 */
+//	public static void main(String[] args) throws Throwable {
+//		
+//		ImportExcel ei = new ImportExcel("target/export.xlsx", 1);
+//		
+//		for (int i = ei.getDataRowNum(); i < ei.getLastDataRowNum(); i++) {
+//			Row row = ei.getRow(i);
+//			for (int j = 0; j < ei.getLastCellNum(); j++) {
+//				Object val = ei.getCellValue(row, j);
+//				System.out.print(val+", ");
+//			}
+//			System.out.print("\n");
+//		}
+//		
+//	}
+}

+ 221 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialInventory/web/MaterialInventoryController.java

@@ -0,0 +1,221 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialInventory.web;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.core.web.BaseController;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialInventory;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialRequisition;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.service.MaterialInventoryService;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.util.ImportPro;
+import com.jeeplus.modules.sg.managementcenter.materialInventory.util.ImportUtil;
+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 java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping(value = "${adminPath}/sg/managementcenter/materialInventory")
+public class MaterialInventoryController extends BaseController {
+
+	@Autowired
+	private MaterialInventoryService materialInventoryService;
+	
+	@ModelAttribute
+	public MaterialInventory get(@RequestParam(required=false) String id) {
+		MaterialInventory entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = materialInventoryService.get(id);
+		}
+		if (entity == null){
+			entity = new MaterialInventory();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 列表页面
+	 */
+	@RequiresPermissions("managementcenter:materialInventory:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(MaterialInventory materialInventory, Model model) {
+		model.addAttribute("materialInventory", materialInventory);
+		return "modules/sg/managementcenter/materialInventory/materialInventory";
+	}
+
+		/**
+	 * 列表数据
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialInventory:list")
+	@RequestMapping(value = "data")
+	public Map<String, Object> data(MaterialInventory materialInventory, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<MaterialInventory> page = materialInventoryService.findPage(new Page<MaterialInventory>(request, response), materialInventory);
+		return getBootstrapData(page);
+	}
+
+	/**
+	 * 查看,增加,编辑表单页面
+	 */
+	@RequiresPermissions(value={"managementcenter:materialInventory:view","managementcenter:materialInventory:add","managementcenter:materialInventory:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(MaterialInventory materialInventory, Model model) {
+		model.addAttribute("marterialInventory",materialInventory);
+		return "modules/sg/managementcenter/materialInventory/materialInventoryForm";
+	}
+
+	/**
+	 * 保存表单
+	 */
+	@ResponseBody
+	@RequiresPermissions(value={"managementcenter:materialInventory:add","managementcenter:materialInventory:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public AjaxJson save(MaterialInventory materialInventory, Model model) throws Exception{
+		AjaxJson j = new AjaxJson();
+		/**
+		 * 后台hibernate-validation插件校验
+		 */
+		String errMsg = beanValidator(materialInventory);
+		if (StringUtils.isNotBlank(errMsg)){
+			j.setSuccess(false);
+			j.setMsg(errMsg);
+			return j;
+		}
+		//新增或编辑表单保存
+		materialInventoryService.save(materialInventory);//保存
+		j.setSuccess(true);
+		j.setMsg("保存库存成功");
+		return j;
+	}
+	
+	/**
+	 * 删除表单
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialInventory:del")
+	@RequestMapping(value = "delete")
+	public AjaxJson delete(MaterialInventory materialInventory) {
+		AjaxJson j = new AjaxJson();
+		materialInventoryService.delete(materialInventory);
+		j.setMsg("删除库存成功");
+		return j;
+	}
+	
+	/**
+	 * 批量表单
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialInventory:del")
+	@RequestMapping(value = "deleteAll")
+	public AjaxJson deleteAll(String ids) {
+		AjaxJson j = new AjaxJson();
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			materialInventoryService.delete(materialInventoryService.get(id));
+		}
+		j.setMsg("删除请假表单成功");
+		return j;
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialInventory:export")
+    @RequestMapping(value = "export")
+    public AjaxJson exportFile(MaterialInventory materialInventory, HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		try {
+            String fileName = "库存"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<MaterialInventory> page = materialInventoryService.findPage(new Page<MaterialInventory>(request, response, -1), materialInventory);
+    		new ExportExcel("库存", MaterialInventory.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		j.setSuccess(true);
+    		j.setMsg("导出成功!");
+    		return j;
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg("导出失败!失败信息:"+e.getMessage());
+		}
+			return j;
+    }
+
+	/**
+	 * 导入Excel数据
+        导入库存表
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialInventory:import")
+    @RequestMapping(value = "import")
+   	public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request){
+		AjaxJson j = new AjaxJson();
+		try {
+			StringBuilder failureMsg = new StringBuilder();
+			ImportUtil importUtil = new ImportUtil(file,1,0);
+			boolean judgeInventory = ImportPro.getJudgeInventory(importUtil);
+			if (judgeInventory){
+				j.setSuccess(false);
+				j.setMsg("导入失败:表格不符合规范!");
+				return j;
+			}
+			List<MaterialInventory> materialInventoryUtil = ImportPro.getMaterialInventoryUtil(importUtil);
+			List<MaterialInventory> materialInventories = ImportPro.getSetMaterialInvenntory(materialInventoryUtil);//去重
+			materialInventoryService.saveList(materialInventories);
+			j.setMsg( "已成功导入"+materialInventories.size()+"条,"+"库存记录"+failureMsg);
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg("导入库存失败!失败信息:"+e.getMessage());
+		}
+		return j;
+    }
+    /**
+     * 导入Excel数据
+		导入附件五2
+     */
+    @ResponseBody
+    @RequiresPermissions("managementcenter:materialInventory:import")
+    @RequestMapping(value = "import1")
+    public AjaxJson importFile1(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request){
+        AjaxJson j = new AjaxJson();
+        try {
+            StringBuilder failureMsg = new StringBuilder();
+            ImportUtil importUtil = new ImportUtil(file,1,0);
+			boolean judgeRequisition = ImportPro.getJudgeRequisition(importUtil);
+			if (judgeRequisition){
+				j.setSuccess(false);
+				j.setMsg("导入失败:表格不符合规范!");
+				return j;
+			}
+			List<MaterialRequisition> materialRequisitionUtil = ImportPro.getMaterialRequisitionUtil(importUtil);//得到数据表格
+			List<MaterialRequisition> materialRequisitionList = ImportPro.getSetMaterialRequisition(materialRequisitionUtil);//去重
+			List<MaterialInventory> byList = materialInventoryService.findByList(materialRequisitionList);//得到数据库中匹配的物料编码
+			if (null==byList||byList.size()<=0){
+				j.setSuccess(false);
+				j.setMsg("导入领料单失败!失败信息:无基础数据");
+				return j;
+			}
+			List<MaterialInventory> materialInventories = ImportPro.getMaterial(byList, materialRequisitionList);//得到可使用库存数量
+			materialInventoryService.saveList(materialInventories);
+			j.setMsg( "已成功导入"+materialInventories.size()+"条,"+"领料单记录"+failureMsg);
+        } catch (Exception e) {
+            j.setSuccess(false);
+            j.setMsg("导入领料单失败!失败信息:"+e.getMessage());
+        }
+        return j;
+    }
+}

+ 13 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/materialProvided/util/ImportPro.java

@@ -50,7 +50,19 @@ public class ImportPro {
         }
         return list;
     }
-
+    /*
+        验证
+     */
+    public static Boolean getJudgeProvided(ImportUtil importUtil){
+        boolean flag = false;
+        Row row = importUtil.getRow(0);
+        String materialCode = (String) importUtil.getCellValue(row,5);//物理编码
+        String materialDetail = (String) importUtil.getCellValue(row,6);//物料描述
+        if (!materialCode.contains("编码")||!materialDetail.contains("描述")){
+            return true;
+        }
+        return false;
+    }
     /**
      * 生成随机数
      * @return

+ 6 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/materialProvided/web/MaterialProvidedController.java

@@ -159,7 +159,6 @@ public class MaterialProvidedController extends BaseController {
 
 	/**
 	 * 导入Excel数据
-
 	 */
 	@ResponseBody
 	@RequiresPermissions("managementcenter:materialProvided:import")
@@ -169,6 +168,12 @@ public class MaterialProvidedController extends BaseController {
 		try {
 			StringBuilder failureMsg = new StringBuilder();
 			ImportUtil importUtil = new ImportUtil(file,1,0);
+			Boolean judgeProvided = ImportPro.getJudgeProvided(importUtil);
+			if (judgeProvided){
+				j.setSuccess(false);
+				j.setMsg("导入失败:表格不符合规范!");
+				return j;
+			}
 			List<MaterialProvided> materProUtil = ImportPro.getMaterProUtil(importUtil);
 			Integer maxVersion = materialProvidedService.findMaxVersion();
 			materialProvidedService.saveList(materProUtil,maxVersion);

+ 41 - 5
src/main/java/com/jeeplus/modules/sg/managementcenter/project/entity/Project.java

@@ -24,8 +24,11 @@ public class Project extends DataEntity<Project> {
     private String throughResearchRole;//经研所角色
     private String constructionUnit;//施工单位
     private String constructionUnitRole;//施工单位角色
+    private String constructionUnitManage;//施工单位项目经理
+    private String constructionUnitLeader;//施工单位领导
     private String designUnit;//设计单位
-    private String designUnitRole;//设计单位角色
+    private String designUnitManage;//设计单位角色
+    private String designUnitLeader;//施工 单位领导
     private String clarificaitonType;//交底类型
     private String bulidClassificationResons;//建设理由分类
     private String bulbidResons;//建设理由
@@ -56,6 +59,7 @@ public class Project extends DataEntity<Project> {
     private String stayOpenArea;//柱开集中或就业地
     private String ringNetworkCabinet;//环网柜
     private String stationDtu;//站房dtu
+    private String itemType;//项目类型
     private String status;
     private String acquisitionStatus;//领料状态
     private String constructionStatus;//施工状态
@@ -267,12 +271,12 @@ public class Project extends DataEntity<Project> {
     }
 
     @ExcelField(title = "设计单位角色", align = 2, sort = 21)
-    public String getDesignUnitRole() {
-        return designUnitRole;
+    public String getDesignUnitManage() {
+        return designUnitManage;
     }
 
-    public void setDesignUnitRole(String designUnitRole) {
-        this.designUnitRole = designUnitRole;
+    public void setDesignUnitManage(String designUnitManage) {
+        this.designUnitManage = designUnitManage;
     }
 
     public void setConstructionUnitRole(String constructionUnitRole) {
@@ -564,4 +568,36 @@ public class Project extends DataEntity<Project> {
     public void setEarlyMaterial(Integer earlyMaterial) {
         this.earlyMaterial = earlyMaterial;
     }
+
+    public String getConstructionUnitManage() {
+        return constructionUnitManage;
+    }
+
+    public void setConstructionUnitManage(String constructionUnitManage) {
+        this.constructionUnitManage = constructionUnitManage;
+    }
+
+    public String getConstructionUnitLeader() {
+        return constructionUnitLeader;
+    }
+
+    public void setConstructionUnitLeader(String constructionUnitLeader) {
+        this.constructionUnitLeader = constructionUnitLeader;
+    }
+
+    public String getDesignUnitLeader() {
+        return designUnitLeader;
+    }
+
+    public void setDesignUnitLeader(String designUnitLeader) {
+        this.designUnitLeader = designUnitLeader;
+    }
+
+    public String getItemType() {
+        return itemType;
+    }
+
+    public void setItemType(String itemType) {
+        this.itemType = itemType;
+    }
 }

+ 36 - 15
src/main/java/com/jeeplus/modules/sg/managementcenter/project/mapper/xml/ProjectMapper.xml

@@ -19,7 +19,6 @@
 	  	a.project_name AS "projectName",
 	  	a.project_number AS "projectNumber",
 		a.project_manage_role AS "projectManageRole",
-
 		a.distribution_engineering AS "distributionEngineering",
 		a.distribution_materials AS "distributionMaterials",
 		a.distribution_system AS "distributionSystem",
@@ -28,13 +27,13 @@
 		a.run_unit AS "runUnit",
 		a.run_unit_role AS "runUnitRole",
 		a.through_research_role AS "throughResearchRole",
-
 		a.construction_unit AS "constructionUnit",
 		a.construction_unit_role AS "constructionUnitRole",
-
+		a.construction_unit_manage AS "constructionUnitManage",
+		a.construction_unit_leader AS "constructionUnitLeader",
     	a.design_unit AS "design_unit",
-		a.design_unit_role AS "designUnitRole",
-
+		a.design_unit_manage AS "designUnitManage",
+		a.design_unit_leader AS "designUnitLeader",
 		a.clarificaiton_type AS "clarificaitonType",
 		a.build_classification_resons As "bulidClassificationResons",
 		a.bulbid_resons As "bulbidResons",
@@ -65,10 +64,12 @@
     	a.stay_open_area AS "stayOpenArea",
     	a.ring_network_cabinet AS "ringNetworkCabinet",
     	a.station_dtu AS "stationDtu",
+    	a.item_type AS "itemType",
 		a.status As "status",
 		a.acquisition_status AS "acquisitionStatus",
 		a.construction_status AS "constructionStatus",
-		a.whether_close_status AS "whetherCloseStatus"
+		a.whether_close_status AS "whetherCloseStatus",
+		a.earlyMaterial AS "earlyMaterial"
 	</sql>
     
 	<select id="get" resultType="Project" >
@@ -160,8 +161,11 @@
 			through_research_role,
 			construction_unit,
 			construction_unit_role,
+			construction_unit_manage,
+			construction_unit_leader,
 			design_unit,
-			design_unit_role,
+			design_unit_manage,
+			design_unit_leader,
 			clarificaiton_type,
 			build_classification_resons,
 			bulbid_resons,
@@ -192,10 +196,12 @@
 			stay_open_area,
 			ring_network_cabinet,
 			station_dtu,
+			item_type,
 			status,
 			acquisition_status,
 			construction_status,
-			whether_close_status
+			whether_close_status,
+			earlyMaterial
 		) VALUES (
 			#{id},
 			#{createBy.id},
@@ -223,8 +229,11 @@
 			#{throughResearchRole},
 			#{constructionUnit},
 			#{constructionUnitRole},
-			#{design_unit},
-			#{design_unit_role},
+			#{constructionUnitManage},
+			#{constructionUnitLeader},
+			#{designUnit},
+			#{designUnitManage},
+			#{designUnitLeader},
 			#{clarificaitonType},
     		#{bulidClassificationResons},
     		#{bulbidResons},
@@ -255,10 +264,12 @@
     	 	#{stayOpenArea},
     	 	#{ringNetworkCabinet},
     	 	#{stationDtu},
+    	 	#{itemType},
     		#{status},
     		#{acquisitionStatus},
     		#{constructionStatus},
-    		#{whetherCloseStatus}
+    		#{whetherCloseStatus},
+    		#{earlyMaterial}
 		)
 	</insert>
 
@@ -290,8 +301,11 @@
 		through_research_role,
 		construction_unit,
 		construction_unit_role,
+		construction_unit_manage,
+		construction_unit_leader,
 		design_unit,
-		design_unit_role,
+		design_unit_manage,
+		design_unit_leader,
 		clarificaiton_type,
 		build_classification_resons,
 		bulbid_resons,
@@ -321,11 +335,13 @@
 		phone_style,
 		stay_open_area,
 		ring_network_cabinet,
+		item_type,
 		station_dtu,
 		status,
 		acquisition_status,
 		construction_status,
-		whether_close_status
+		whether_close_status,
+		earlyMaterial
 		) VALUES
 		<foreach collection="list" item="item" index="index" separator="," >
 			(
@@ -355,8 +371,11 @@
 			#{item.throughResearchRole},
 			#{item.constructionUnit},
 			#{item.constructionUnitRole},
+			#{item.constructionUnitManage},
+			#{item.constructionUnitLeader},
 			#{item.designUnit},
-			#{item.designUnitRole},
+			#{item.designUnitManage},
+			#{item.designUnitLeader},
 			#{item.clarificaitonType},
 			#{item.bulidClassificationResons},
 			#{item.bulbidResons},
@@ -386,11 +405,13 @@
 			#{item.phoneStyle},
 			#{item.stayOpenArea},
 			#{item.ringNetworkCabinet},
+			#{item.itemType},
 			#{item.stationDtu},
 			#{item.status},
 			#{item.acquisitionStatus},
 			#{item.constructionStatus},
-			#{item.whetherCloseStatus}
+			#{item.whetherCloseStatus},
+			#{item.earlyMaterial}
 		)
 		</foreach>
 	</insert>

+ 8 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/project/service/ProjectService.java

@@ -82,6 +82,7 @@ public class ProjectService extends CrudService<ProjectMapper, Project> {
 		String acquisitionStatus="0";//领料状态
 		String constructionStatus="0";//施工状态
 		String whetherCloseStatus = "0";//项目是否关闭
+		Integer earlyMaterial = 0;//是否可以提前领料
 		Project project1 = new Project();
 		List<Project> list = projectMapper.findList(project1);
 		for(Project project:projects){
@@ -89,12 +90,14 @@ public class ProjectService extends CrudService<ProjectMapper, Project> {
 			acquisitionStatus="0";//领料状态
 			constructionStatus="0";//施工状态
 			whetherCloseStatus = "0";//项目是否关闭
+			earlyMaterial = 0;//是否可以提前领料
 			for (Project project2:list){
 				if (project.getRequireName().equals(project2.getRequireName())){
 					status = project2.getStatus();
 					acquisitionStatus = project2.getAcquisitionStatus();
 					constructionStatus = project2.getConstructionStatus();
 					whetherCloseStatus = project2.getWhetherCloseStatus();
+					earlyMaterial = project2.getEarlyMaterial();
 					project.setId(project2.getId());//项目id
 					project.setCreateBy(project2.getCreateBy());
 					project.setCreateDate(project2.getCreateDate());
@@ -109,8 +112,11 @@ public class ProjectService extends CrudService<ProjectMapper, Project> {
 					project.setThroughResearchRole(project2.getThroughResearchRole());//经研所角色
 					project.setConstructionUnit(project2.getConstructionUnit());//施工单位
 					project.setConstructionUnitRole(project2.getConstructionUnitRole());//施工单位角色
+					project.setConstructionUnitManage(project2.getConstructionUnitManage());//施工单位项目经理
+					project.setConstructionUnitLeader(project2.getConstructionUnitLeader());//施工单位项目领导
 					project.setDesignUnit(project2.getDesignUnit());//设计单位
-					project.setDesignUnitRole(project2.getDesignUnitRole());//设计单位角色
+					project.setDesignUnitManage(project2.getDesignUnitManage());//设计单位角色
+					project.setDesignUnitLeader(project2.getDesignUnitLeader());//设计单位领导
 					project.setClarificaitonType(project2.getClarificaitonType());//交底类型
 					break;
 				}
@@ -125,6 +131,7 @@ public class ProjectService extends CrudService<ProjectMapper, Project> {
 			project.setAcquisitionStatus(acquisitionStatus);
 			project.setConstructionStatus(constructionStatus);
 			project.setWhetherCloseStatus(whetherCloseStatus);
+			project.setEarlyMaterial(earlyMaterial);
 		}
 		if (null!=projects&&projects.size()>0){
 			projectMapper.insertList(projects);

+ 58 - 35
src/main/java/com/jeeplus/modules/sg/managementcenter/project/util/ProExcelInfo.java

@@ -25,7 +25,7 @@ public  class ProExcelInfo {
     public static String[] PRO_PHONE_STYLE = {"光纤","公网","专网"};//通信方式
     public static String[] PRO_STAY_AREA={"集中","就地"};//柱开集中或就业地
     public static String[] PRO_RING_NETWORK = {"户内","户外"};//环网柜
-
+    public static String[] PRO_ITEM_TYPE = {"资本项目","成本项目"};//项目类型
     /**
      * 获取表格数据
      * @param importUtil
@@ -61,41 +61,45 @@ public  class ProExcelInfo {
                 project.setThroughResearchRole((String)importUtil.getCellValue(row,17));//经研所角色
                 project.setConstructionUnit((String)importUtil.getCellValue(row,18));//施工单位
                 project.setConstructionUnitRole((String)importUtil.getCellValue(row,19));//施工单位角色
-                project.setDesignUnit((String)importUtil.getCellValue(row,20));//设计单位
-                project.setDesignUnitRole((String)importUtil.getCellValue(row,21));//设计单位角色
-                project.setClarificaitonType((String)importUtil.getCellValue(row,22));//交底类型
-                project.setBulidClassificationResons((String)importUtil.getCellValue(row,23));//建设理由分类
-                project.setBulbidResons((String)importUtil.getCellValue(row,24));//建设理由
-                project.setAsicEquipment((String)importUtil.getCellValue(row,25));//设备基本状况
-                project.setRunTheClass((String)importUtil.getCellValue(row,26));//运行班
-                project.setProjectTeam((String)importUtil.getCellValue(row,27));//项目组
-                costEstimate = (String) importUtil.getCellValue(row,28);
+                project.setConstructionUnitManage((String)importUtil.getCellValue(row,20));//施工单位项目经理
+                project.setConstructionUnitLeader((String)importUtil.getCellValue(row,21));//施工单位领导
+                project.setDesignUnit((String)importUtil.getCellValue(row,22));//设计单位
+                project.setDesignUnitManage((String)importUtil.getCellValue(row,23));//设计单位项目领导
+                project.setDesignUnitLeader((String)importUtil.getCellValue(row,24));//设计单位领导
+                project.setClarificaitonType((String)importUtil.getCellValue(row,25));//交底类型
+                project.setBulidClassificationResons((String)importUtil.getCellValue(row,26));//建设理由分类
+                project.setBulbidResons((String)importUtil.getCellValue(row,27));//建设理由
+                project.setAsicEquipment((String)importUtil.getCellValue(row,28));//设备基本状况
+                project.setRunTheClass((String)importUtil.getCellValue(row,29));//运行班
+                project.setProjectTeam((String)importUtil.getCellValue(row,30));//项目组
+                costEstimate = (String) importUtil.getCellValue(row,31);
                 if (null!=costEstimate&&!costEstimate.equals("")){
                     project.setCostEstimate(Double.parseDouble(costEstimate));//费用估算
                 }
-                project.setWhetherRheUpwind((String)importUtil.getCellValue(row,29));//是否迎风期度夏项目
-                project.setSureDaDate((String)importUtil.getCellValue(row,30));//确定下达时间
-                project.setTextRemark((String)importUtil.getCellValue(row,31));//备注
-                project.setPowerLine((String)importUtil.getCellValue(row,32));//停电线路
-                project.setPowerScope((String)importUtil.getCellValue(row,33));//停电范围
-                project.setProjectType((String)importUtil.getCellValue(row,34));//项目类型
-                project.setPowerFlagPackage((String)importUtil.getCellValue(row,35));//是否为停电打包项目
-                project.setPreliminaryJudgment((String)importUtil.getCellValue(row,36));//证处初步判断
-                project.setFlagCivilEngineering((String)importUtil.getCellValue(row,37));//是否含土建
-                project.setSteelTubePole((String)importUtil.getCellValue(row,38));//钢管杆基础类型
-                project.setFlagApprovalPlanning((String)importUtil.getCellValue(row,39));//是否需要规划报批
-                project.setEquCreateType((String)importUtil.getCellValue(row,40));//设备改造类型
-                project.setEquCreateSize((String)importUtil.getCellValue(row,41));//间隔数
-                project.setFlagNewEquName((String)importUtil.getCellValue(row,42));//是否新设备命名
-                project.setIncludeBdzNews((String)importUtil.getCellValue(row,43));//是否含变电站新闻格投运
-                project.setFlagNoElectrical((String)importUtil.getCellValue(row,44));//是否非射电电气施工
-                project.setDrawingsWork((String)importUtil.getCellValue(row,45));//图纸标注的带点作业情况
-                project.setFlagAutomation((String)importUtil.getCellValue(row,46));//是否含自动化
-                project.setTwoAndThreeRemote((String)importUtil.getCellValue(row,47));//二遥或三
-                project.setPhoneStyle((String)importUtil.getCellValue(row,48));//通信方式
-                project.setStayOpenArea((String)importUtil.getCellValue(row,49));//柱开集中或就业地
-                project.setRingNetworkCabinet((String)importUtil.getCellValue(row,50));//环网柜
-                project.setStationDtu((String)importUtil.getCellValue(row,51));//站房dtu
+                project.setWhetherRheUpwind((String)importUtil.getCellValue(row,32));//是否迎风期度夏项目
+                project.setSureDaDate((String)importUtil.getCellValue(row,33));//确定下达时间
+                project.setTextRemark((String)importUtil.getCellValue(row,34));//备注
+                project.setPowerLine((String)importUtil.getCellValue(row,35));//停电线路
+                project.setPowerScope((String)importUtil.getCellValue(row,36));//停电范围
+                project.setProjectType((String)importUtil.getCellValue(row,37));//项目类型
+                project.setPowerFlagPackage((String)importUtil.getCellValue(row,38));//是否为停电打包项目
+                project.setPreliminaryJudgment((String)importUtil.getCellValue(row,39));//证处初步判断
+                project.setFlagCivilEngineering((String)importUtil.getCellValue(row,40));//是否含土建
+                project.setSteelTubePole((String)importUtil.getCellValue(row,41));//钢管杆基础类型
+                project.setFlagApprovalPlanning((String)importUtil.getCellValue(row,42));//是否需要规划报批
+                project.setEquCreateType((String)importUtil.getCellValue(row,43));//设备改造类型
+                project.setEquCreateSize((String)importUtil.getCellValue(row,44));//间隔数
+                project.setFlagNewEquName((String)importUtil.getCellValue(row,45));//是否新设备命名
+                project.setIncludeBdzNews((String)importUtil.getCellValue(row,46));//是否含变电站新闻格投运
+                project.setFlagNoElectrical((String)importUtil.getCellValue(row,47));//是否非射电电气施工
+                project.setDrawingsWork((String)importUtil.getCellValue(row,48));//图纸标注的带点作业情况
+                project.setFlagAutomation((String)importUtil.getCellValue(row,49));//是否含自动化
+                project.setTwoAndThreeRemote((String)importUtil.getCellValue(row,50));//二遥或三
+                project.setPhoneStyle((String)importUtil.getCellValue(row,51));//通信方式
+                project.setStayOpenArea((String)importUtil.getCellValue(row,52));//柱开集中或就业地
+                project.setRingNetworkCabinet((String)importUtil.getCellValue(row,53));//环网柜
+                project.setStationDtu((String)importUtil.getCellValue(row,54));//站房dtu
+                project.setItemType((String)importUtil.getCellValue(row,55));//项目类型
                 project.setStatus("0");
                 list.add(project);
             }
@@ -109,6 +113,7 @@ public  class ProExcelInfo {
         String indexFive =  (String)importUtil.getCellValue(row,5);
         String indexSix = (String)importUtil.getCellValue(row,6);
         String indexNine = (String)importUtil.getCellValue(row,9);
+        String indexFives= (String)importUtil.getCellValue(row,55);
         if (!indexFive.contains("项目")){
             flag = true;
         }
@@ -118,6 +123,9 @@ public  class ProExcelInfo {
         if (!indexNine.contains("角色")){
             flag = true;
         }
+        if (!indexFives.contains("类型")){
+            flag = true;
+        }
         return flag;
     }
 
@@ -158,11 +166,20 @@ public  class ProExcelInfo {
             if (null==project.getConstructionUnitRole()||"".equals(project.getConstructionUnitRole())){//施工单位:施工单位角色
                 str+="施工单位角色不能为空;";
             }
+            if (null==project.getConstructionUnitManage()||"".equals(project.getConstructionUnitManage())){//施工单位:施工单位角色
+                str+="施工单位项目经理不能为空;";
+            }
+            if (null==project.getConstructionUnitLeader()||"".equals(project.getConstructionUnitLeader())){//施工单位:施工单位角色
+                str+="施工单位领导不能为空;";
+            }
             if (null==project.getDesignUnit()||"".equals(project.getDesignUnit())){//设计单位
                 str+="设计单位不能为空;";
             }
-            if (null==project.getDesignUnitRole()||"".equals(project.getDesignUnitRole())){//设计单位角色
-                str+="设计单位角色不能为空;";
+            if (null==project.getDesignUnitManage()||"".equals(project.getDesignUnitManage())){//设计单位角色
+                str+="设计单位项目经理不能为空;";
+            }
+            if (null==project.getDesignUnitLeader()||"".equals(project.getDesignUnitLeader())){//设计单位
+                str+="设计单位领导不能为空;";
             }
             if (null!=project.getType()){//类型
                 flag = getJudge(project.getType(), PRO_TYPE);
@@ -284,6 +301,12 @@ public  class ProExcelInfo {
                     str+="环网柜填写有误;";
                 }
             }
+            if (null!=project.getItemType()){
+                flag = getJudge(project.getItemType(),PRO_ITEM_TYPE);
+                if (flag){
+                    str+="项目类型填写有误";
+                }
+            }
 
         }
         if (!"".equals(str)){

+ 5 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/project/web/ProjectController.java

@@ -281,6 +281,11 @@ public class ProjectController extends BaseController {
 				j.setMsg("导入失败:"+judgeValue+"数据不符合规范!");
 				return j;
 			}
+			if (null==projects||projects.size()<=0){
+				j.setSuccess(false);
+				j.setMsg("导入失败:无符合数据.");
+				return j;
+			}
 			projectService.saveList(projects);
 			j.setMsg( "已成功导入 "+projects.size()+" 条项目表单记录");
 		} catch (Exception e) {

+ 306 - 0
src/main/webapp/webpage/modules/sg/managementcenter/materialInventory/materialInventory.js

@@ -0,0 +1,306 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<script>
+$(document).ready(function() {
+	$('#materialInventoryTable').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}/sg/managementcenter/materialInventory/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}/sg/managementcenter/materialInventory/delete?id="+row.id, function(data){
+                   	  		if(data.success){
+                   	  			$('#materialInventoryTable').bootstrapTable('refresh');
+                   	  			jp.success(data.msg);
+                   	  		}else{
+                   	  			jp.error(data.msg);
+                   	  		}
+                   	  	})
+
+                   	});
+
+                   }
+               },
+              
+               onClickRow: function(row, $el){
+               },
+                onLoadSuccess:function(data){
+                    jQuery(function(){
+                        //使用id选择器;例如:tab对象->tr->td对象.
+                        $("#materialInventoryTable tr td").each(function(i){
+                            //获取td当前对象的文本,如果长度大于25;
+                            if($(this).text().length>20){
+                                //给td设置title属性,并且设置td的完整值.给title属性.
+                                $(this).attr("title",$(this).text());
+                                //获取td的值,进行截取。赋值给text变量保存.
+                                var text=$(this).text().substring(0,20)+"...";
+                                //重新为td赋值;
+                                $(this).text(text);
+                            }
+                        });
+                    });
+                },
+               	onShowSearch: function () {
+			$("#search-collapse").slideToggle();
+		},
+               columns: [
+                   {
+                       checkbox: true
+
+                   },
+                   {
+                       field: 'materialCode',
+                       width:130,
+                       title: '物料编码'
+                       ,formatter:function(value, row , index){
+
+                           if(value == null || value ==""){
+                               value = "-";
+                           }
+                       <c:choose>
+                           <c:when test="${fns:hasPermission('managementcenter:materialInventory:edit')}">
+                           return "<a href='javascript:edit(\""+row.id+"\")'>"+value+"</a>";
+                       </c:when>
+                           <c:when test="${fns:hasPermission('managementcenter:materialInventory:view')}">
+                           return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
+                       </c:when>
+                           <c:otherwise>
+                           return value;
+                       </c:otherwise>
+                           </c:choose>
+
+                       }
+                   }
+                   ,{
+                       field: 'materialDetail',
+                       width:220,
+                       title: '物料描述'
+                   }
+                   ,{
+                       field: 'stockQuantity',
+                       width:120,
+                       title: '非限制库存数量'
+                   }
+                   ,{
+                       field: 'frozenQuantity',
+                       width:120,
+                       title: '已冻结库存数量'
+                   }
+                   ,{
+                       field: 'requireCount',
+                       width:120,
+                       title: '需求数量'
+                   }
+                   ,{
+                       field: 'outCount',
+                       width:120,
+                       title: '已出库数量'
+                   }
+                   ,{
+                       field: 'availableStockQuantity',
+                       width:130,
+                       title: '可用库存数量'
+                   }
+		     ]
+		
+		});
+		
+		  
+	  if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
+
+		 
+		  $('#materialInventoryTable').bootstrapTable("toggleView");
+		}
+	  
+	  $('#materialInventoryTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
+                'check-all.bs.table uncheck-all.bs.table', function () {
+            $('#remove').prop('disabled', ! $('#materialInventoryTable').bootstrapTable('getSelections').length);
+            $('#view,#edit').prop('disabled', $('#materialInventoryTable').bootstrapTable('getSelections').length!=1);
+        });
+		  
+		$("#btnImport").click(function(){
+			jp.open({
+			    type: 2,
+                area: [500, 200],
+                auto: true,
+			    title:"导入数据",
+			    content: "${ctx}/tag/importExcel" ,
+			    btn: ['确定', '关闭'],
+			    btn1: function(index, layero){
+				        var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+						iframeWin.contentWindow.importExcel('${ctx}/sg/managementcenter/materialInventory/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);
+	    	       }
+			}); 
+		});
+    $("#btnImport1").click(function(){
+        jp.open({
+            type: 2,
+            area: [500, 200],
+            auto: true,
+            title:"导入数据",
+            content: "${ctx}/tag/importExcel" ,
+            btn: ['确定', '关闭'],
+            btn1: function(index, layero){
+                var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+                iframeWin.contentWindow.importExcel('${ctx}/sg/managementcenter/materialInventory/import1', 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}/sg/managementcenter/materialInventory/export');
+	  });
+
+		    
+	  $("#search").click("click", function() {// 绑定查询按扭
+		  $('#materialInventoryTable').bootstrapTable('refresh');
+		});
+	 
+	 $("#reset").click("click", function() {// 绑定查询按扭
+		  $("#searchForm  input").val("");
+		  $("#searchForm  select").val("");
+		  $("#searchForm  .select-item").html("");
+		  $('#materialInventoryTable').bootstrapTable('refresh');
+		});
+		
+		$('#beginBeginDate').datetimepicker({
+			 format: "YYYY-MM-DD HH:mm:ss"
+		});
+		$('#endBeginDate').datetimepicker({
+			 format: "YYYY-MM-DD HH:mm:ss"
+		});
+		$('#endDate').datetimepicker({
+			 format: "YYYY-MM-DD HH:mm:ss"
+		});
+		
+	});
+		
+  function getIdSelections() {
+        return $.map($("#materialInventoryTable").bootstrapTable('getSelections'), function (row) {
+            return row.id
+        });
+    }
+  
+  function deleteAll(){
+
+		jp.confirm('确认要删除库存物料管理表单记录吗?', function(){
+			jp.loading();  	
+			jp.get("${ctx}/sg/managementcenter/materialInventory/deleteAll?ids=" + getIdSelections(), function(data){
+         	  		if(data.success){
+         	  			$('#materialInventoryTable').bootstrapTable('refresh');
+         	  			jp.success(data.msg);
+         	  		}else{
+         	  			jp.error(data.msg);
+         	  		}
+         	  	})
+          	   
+		})
+  }
+
+    //刷新列表
+  function refresh(){
+  	$('#materialInventoryTable').bootstrapTable('refresh');
+  }
+  
+   function add(){
+	  jp.openSaveDialog('新增库存物料管理表单', "${ctx}/sg/managementcenter/materialInventory/form",'800px', '500px');
+  }
+
+
+  //
+   function edit(id){//没有权限时,不显示确定按钮
+       if(id == undefined){
+	      id = getIdSelections();
+	}
+	jp.openSaveDialog('编辑库存物料管理表单', "${ctx}/sg/managementcenter/materialInventory/form?id=" + id, '800px', '500px');
+  }
+  
+ function view(id){//没有权限时,不显示确定按钮
+      if(id == undefined){
+          id = getIdSelections();
+      }
+      jp.openViewDialog('查看库存物料管理表单', "${ctx}/sg/managementcenter/materialInventory/form?id=" + id, '800px', '500px');
+ }
+
+
+
+</script>

+ 93 - 0
src/main/webapp/webpage/modules/sg/managementcenter/materialInventory/materialInventory.jsp

@@ -0,0 +1,93 @@
+<%@ 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="materialInventory.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="materialInventory" 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="materialCode" 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:materialInventory:add">
+				<button id="add" class="btn btn-primary" onclick="add()">
+					<i class="glyphicon glyphicon-plus"></i> 新建
+				</button>
+			</shiro:hasPermission>
+			<%--<shiro:hasPermission name="managementcenter:materialInventory:edit">--%>
+			    <%--<button id="edit" class="btn btn-success" disabled onclick="edit()">--%>
+	            	<%--<i class="glyphicon glyphicon-edit"></i> 修改--%>
+	        	<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+			<shiro:hasPermission name="managementcenter:materialInventory:del">
+				<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
+	            	<i class="glyphicon glyphicon-remove"></i> 删除
+	        	</button>
+			</shiro:hasPermission>
+			<shiro:hasPermission name="managementcenter:materialInventory:import">
+				<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入库存表</button>
+			</shiro:hasPermission>
+            <shiro:hasPermission name="managementcenter:materialInventory:import">
+                <button id="btnImport1" class="btn btn-info"><i class="fa fa-folder-open-o"></i>导入领料单</button>
+            </shiro:hasPermission>
+			<shiro:hasPermission name="managementcenter:materialInventory:export">
+	        		<button id="export" class="btn btn-warning">
+					<i class="fa fa-file-excel-o"></i> 导出
+				</button>
+			 </shiro:hasPermission>
+			<%--<shiro:hasPermission name="managementcenter:materialInventory:view">--%>
+				<%--<button id="view" class="btn btn-default" disabled onclick="view()">--%>
+					<%--<i class="fa fa-search-plus"></i> 查看--%>
+				<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+		    </div>
+		
+	<!-- 表格 -->
+	<table id="materialInventoryTable"  style="table-layout:fixed"  data-toolbar="#toolbar"></table>
+
+    <!-- context menu -->
+    <ul id="context-menu" class="dropdown-menu">
+    	<shiro:hasPermission name="managementcenter:materialInventory:view">
+        <li data-item="view"><a>查看</a></li>
+        </shiro:hasPermission>
+    	<shiro:hasPermission name="managementcenter:materialInventory:edit">
+        <li data-item="edit"><a>编辑</a></li>
+        </shiro:hasPermission>
+        <shiro:hasPermission name="managementcenter:materialInventory:del">
+        <li data-item="delete"><a>删除</a></li>
+        </shiro:hasPermission>
+        <li data-item="action1"><a>取消</a></li>
+    </ul>  
+	</div>
+	</div>
+	</div>
+</body>
+</html>

+ 84 - 0
src/main/webapp/webpage/modules/sg/managementcenter/materialInventory/materialInventoryForm.jsp

@@ -0,0 +1,84 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>甲供标准物资</title>
+	<meta name="decorator" content="ani"/>
+	<script type="text/javascript">
+
+		$(document).ready(function() {
+
+	        $('#beginDate').datetimepicker({
+				 format: "YYYY-MM-DD HH:mm:ss"
+		    });
+	        $('#endDate').datetimepicker({
+				 format: "YYYY-MM-DD HH:mm:ss"
+		    });
+		});
+		function save() {
+            var isValidate = jp.validateForm('#inputForm');//校验表单
+            if(!isValidate){
+                return false;
+            }else{
+                jp.loading();
+                jp.post("${ctx}/sg/managementcenter/materialInventory/save",$('#inputForm').serialize(),function(data){
+                    if(data.success){
+                        jp.getParent().refresh();
+                        var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
+                        parent.layer.close(dialogIndex);
+                        jp.success(data.msg)
+
+                    }else{
+                        jp.error(data.msg);
+                    }
+                })
+            }
+        }
+	</script>
+</head>
+<body class="bg-white">
+		<form:form id="inputForm" modelAttribute="materialInventory" class="form-horizontal">
+		<form:hidden path="id"/>	
+		<table class="table table-bordered">
+		   	<tbody>
+                <tr>
+                    <td class="width-15 active"><label class=""><font color="red">*</font>物料编码:</label></td>
+                    <td class="width-35">
+                        <form:input path="materialCode" htmlEscape="false" class="form-control required "/>
+                    </td>
+                    <td class="width-15 active"><label class=""><font color="red">*</font>物料描述:</label></td>
+                    <td class="width-35">
+                        <form:input path="materialDetail" htmlEscape="false" class="form-control required"/>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="width-15 active"><label class=""><font color="red">*</font>非限制性库存数量:</label></td>
+                    <td class="width-35">
+                        <form:input path="stockQuantity" htmlEscape="false" class="form-control required number"/>
+                    </td>
+                    <td class="width-15 active"><label class=""><font color="red">*</font>已冻结库存数量:</label></td>
+                    <td class="width-35">
+                        <form:input path="frozenQuantity" htmlEscape="false" class="form-control required number"/>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="width-15 active"><label class=""><font color="red">*</font>需求数量:</label></td>
+                    <td class="width-35">
+                        <form:input path="requireCount" htmlEscape="false" class="form-control required number"/>
+                    </td>
+                    <td class="width-15 active"><label class=""><font color="red">*</font>已出库数量:</label></td>
+                    <td class="width-35">
+                        <form:input path="outCount" htmlEscape="false" class="form-control required number"/>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="width-15 active"><label class=""><font color="red">*</font>可用库存数量:</label></td>
+                    <td class="width-35">
+                        <form:input path="availableStockQuantity" htmlEscape="false" class="form-control required number"/>
+                    </td>
+                </tr>
+		 	</tbody>
+		</table>
+	</form:form>
+</body>
+</html>

+ 22 - 2
src/main/webapp/webpage/modules/sg/managementcenter/project/projectForm.jsp

@@ -137,15 +137,35 @@
 					<td class="width-35">
 						<form:input path="constructionUnitRole" htmlEscape="false" class="form-control required"/>
 					</td>
+					<td class="width-15 active"><label class=""><font color="red">*</font>施工单位项目经理:</label></td>
+					<td class="width-35">
+						<form:input path="designUnitManage" htmlEscape="false" class="form-control required"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class=""><font color="red">*</font>施工单位领导:</label></td>
+					<td class="width-35">
+						<form:input path="designUnitLeader" htmlEscape="false" class="form-control required"/>
+					</td>
 					<td class="width-15 active"><label class=""><font color="red">*</font>设计单位:</label></td>
 					<td class="width-35">
 						<form:input path="designUnit" htmlEscape="false" class="form-control required"/>
 					</td>
 				</tr>
 				<tr>
-					<td class="width-15 active"><label class=""><font color="red">*</font>设计单位角色:</label></td>
+					<td class="width-15 active"><label class=""><font color="red">*</font>设计单位项目经理:</label></td>
+					<td class="width-35">
+						<form:input path="designUnitManage" htmlEscape="false" class="form-control required"/>
+					</td>
+					<td class="width-15 active"><label class=""><font color="red">*</font>设计单位领导:</label></td>
+					<td class="width-35">
+						<form:input path="designUnitLeader" htmlEscape="false" class="form-control required"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class=""><font color="red">*</font>项目类型:</label></td>
 					<td class="width-35">
-						<form:input path="designUnitRole" htmlEscape="false" class="form-control required"/>
+						<form:input path="itemType" htmlEscape="false" class="form-control required"/>
 					</td>
 					<td class="width-15 active"><label class=""><font color="red">*</font>交底类型:</label></td>
 					<td class="width-35">

+ 24 - 5
src/main/webapp/webpage/modules/sg/managementcenter/project/projectList.js

@@ -202,17 +202,31 @@ $(document).ready(function() {
                        width:110
                    }
                    ,{
+                       field: 'constructionUnitManage',
+                       title: '施工单位项目经理',
+                       width:130
+                   }
+                   ,{
+                       field: 'constructionUnitLeader',
+                       title: '施工单位领导',
+                       width:110
+                   }
+                   ,{
                        field: 'designUnit',
                        title: '设计单位',
                        width:110
                    }
                    ,{
-                       field: 'designUnitRole',
-                       title: '设计单位角色',
+                       field: 'designUnitManage',
+                       title: '设计单位项目经理',
+                       width:130
+                   }
+                   ,{
+                       field: 'designUnitLeader',
+                       title: '设计单位领导',
                        width:110
                    }
                    ,{
-                       title: '设计单位角色',
                        field: 'clarificaitonType',
                        title: '交底类型',
                        width:100
@@ -257,7 +271,7 @@ $(document).ready(function() {
                    ,{
                        field: 'whetherRheUpwind',
                        title: '是否迎风期度夏项目',
-                       width:140
+                       width:150
 
                    }
                    ,{
@@ -290,7 +304,7 @@ $(document).ready(function() {
                    ,{
                        field: 'powerFlagPackage',
                        title: '是否为停电打包项目',
-                       width:140
+                       width:150
                    }
                    ,{
                        field: 'preliminaryJudgment',
@@ -372,6 +386,11 @@ $(document).ready(function() {
                        title: '站房DTU',
                        width:120
                    }
+                   ,{
+                       field: 'itemType',
+                       title: '项目类型',
+                       width:120
+                   }
 
 		     ]