xs 5 anos atrás
pai
commit
f4b429eccb
14 arquivos alterados com 1845 adições e 3 exclusões
  1. 53 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/entity/InventoryTable.java
  2. 174 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/entity/MaterialPlan.java
  3. 25 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/mapper/MaterialPlanMapper.java
  4. 227 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/mapper/xml/MaterialPlanMapper.xml
  5. 63 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/service/MaterialPlanService.java
  6. 394 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/util/ImportUtil.java
  7. 137 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/util/MaterialPlanInfo.java
  8. 217 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/web/MeterialPlanController.java
  9. 1 1
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/mapper/xml/MaterialProjectMapper.xml
  10. 1 1
      src/main/java/com/jeeplus/modules/sg/managementcenter/project/mapper/xml/ProjectMapper.xml
  11. 1 1
      src/main/webapp/webpage/modules/sg/managementcenter/activiti/constructionForm.jsp
  12. 131 0
      src/main/webapp/webpage/modules/sg/managementcenter/materialplan/materialplanForm.jsp
  13. 322 0
      src/main/webapp/webpage/modules/sg/managementcenter/materialplan/materialplanList.js
  14. 99 0
      src/main/webapp/webpage/modules/sg/managementcenter/materialplan/materialplanList.jsp

+ 53 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/entity/InventoryTable.java

@@ -0,0 +1,53 @@
+package com.jeeplus.modules.sg.managementcenter.materialplan.entity;
+
+/**
+ * 基础数据 -- 库存导入表
+ */
+public class InventoryTable {
+    private String uniqueCode;//物资唯一码(批次编码)
+    private String inventoryQuantity;//非限制库存数量
+    private String numberFrozen;//冻结数量
+    private String supplierName;//供应商名称
+
+    public String getUniqueCode() {
+        return uniqueCode;
+    }
+
+    public void setUniqueCode(String uniqueCode) {
+        this.uniqueCode = uniqueCode;
+    }
+
+    public String getInventoryQuantity() {
+        return inventoryQuantity;
+    }
+
+    public void setInventoryQuantity(String inventoryQuantity) {
+        this.inventoryQuantity = inventoryQuantity;
+    }
+
+    public String getNumberFrozen() {
+        return numberFrozen;
+    }
+
+    public void setNumberFrozen(String numberFrozen) {
+        this.numberFrozen = numberFrozen;
+    }
+
+    public String getSupplierName() {
+        return supplierName;
+    }
+
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
+
+    @Override
+    public String toString() {
+        return "InventoryTable{" +
+                "uniqueCode='" + uniqueCode + '\'' +
+                ", inventoryQuantity='" + inventoryQuantity + '\'' +
+                ", numberFrozen='" + numberFrozen + '\'' +
+                ", supplierName='" + supplierName + '\'' +
+                '}';
+    }
+}

+ 174 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/entity/MaterialPlan.java

@@ -0,0 +1,174 @@
+package com.jeeplus.modules.sg.managementcenter.materialplan.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.core.persistence.DataEntity;
+
+import java.util.Date;
+
+public class MaterialPlan extends DataEntity<MaterialPlan> {
+    private String uniqueCode;//物资唯一码(批次编码)
+    private String requireCoding;//需求物资编码
+    private String description;//物料描述
+    private String expansionCode;//物料扩展编码
+    private String expansionDescription;//物料扩展描述
+    private String bigDescribe;//大类描述
+    private String moderateDescribe;//中类描述
+    private String smallDescribe;//小类描述
+    private String requireNumber;//需求数量
+    private String util;//单位
+    private String planToBatch;//计划批次
+    private Date deliverySchedule;//供货计划到日
+    private String flagStorage;//是否入库
+    private String inventoryQuantity;//库存数量
+    private String numberFrozen;//冻结数量
+    private String supplierName;//供应商名称
+
+    public String getUniqueCode() {
+        return uniqueCode;
+    }
+
+    public void setUniqueCode(String uniqueCode) {
+        this.uniqueCode = uniqueCode;
+    }
+
+    public String getRequireCoding() {
+        return requireCoding;
+    }
+
+    public void setRequireCoding(String requireCoding) {
+        this.requireCoding = requireCoding;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getExpansionCode() {
+        return expansionCode;
+    }
+
+    public void setExpansionCode(String expansionCode) {
+        this.expansionCode = expansionCode;
+    }
+
+    public String getExpansionDescription() {
+        return expansionDescription;
+    }
+
+    public void setExpansionDescription(String expansionDescription) {
+        this.expansionDescription = expansionDescription;
+    }
+
+    public String getBigDescribe() {
+        return bigDescribe;
+    }
+
+    public void setBigDescribe(String bigDescribe) {
+        this.bigDescribe = bigDescribe;
+    }
+
+    public String getModerateDescribe() {
+        return moderateDescribe;
+    }
+
+    public void setModerateDescribe(String moderateDescribe) {
+        this.moderateDescribe = moderateDescribe;
+    }
+
+    public String getSmallDescribe() {
+        return smallDescribe;
+    }
+
+    public void setSmallDescribe(String smallDescribe) {
+        this.smallDescribe = smallDescribe;
+    }
+
+    public String getRequireNumber() {
+        return requireNumber;
+    }
+
+    public void setRequireNumber(String requireNumber) {
+        this.requireNumber = requireNumber;
+    }
+
+    public String getUtil() {
+        return util;
+    }
+
+    public void setUtil(String util) {
+        this.util = util;
+    }
+
+    public String getPlanToBatch() {
+        return planToBatch;
+    }
+
+    public void setPlanToBatch(String planToBatch) {
+        this.planToBatch = planToBatch;
+    }
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    public Date getDeliverySchedule() {
+        return deliverySchedule;
+    }
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    public void setDeliverySchedule(Date deliverySchedule) {
+        this.deliverySchedule = deliverySchedule;
+    }
+
+    public String getFlagStorage() {
+        return flagStorage;
+    }
+
+    public void setFlagStorage(String flagStorage) {
+        this.flagStorage = flagStorage;
+    }
+    public String getInventoryQuantity() {
+        return inventoryQuantity;
+    }
+    public void setInventoryQuantity(String inventoryQuantity) {
+        this.inventoryQuantity = inventoryQuantity;
+    }
+
+    public String getNumberFrozen() {
+        return numberFrozen;
+    }
+
+    public void setNumberFrozen(String numberFrozen) {
+        this.numberFrozen = numberFrozen;
+    }
+
+    public String getSupplierName() {
+        return supplierName;
+    }
+
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
+
+
+    @Override
+    public String toString() {
+        return "MaterialPlan{" +
+                "uniqueCode='" + uniqueCode + '\'' +
+                ", requireCoding='" + requireCoding + '\'' +
+                ", description='" + description + '\'' +
+                ", expansionCode='" + expansionCode + '\'' +
+                ", expansionDescription='" + expansionDescription + '\'' +
+                ", bigDescribe='" + bigDescribe + '\'' +
+                ", moderateDescribe='" + moderateDescribe + '\'' +
+                ", smallDescribe='" + smallDescribe + '\'' +
+                ", requireNumber='" + requireNumber + '\'' +
+                ", util='" + util + '\'' +
+                ", planToBatch='" + planToBatch + '\'' +
+                ", deliverySchedule=" + deliverySchedule +
+                ", flagStorage='" + flagStorage + '\'' +
+                ", inventoryQuantity='" + inventoryQuantity + '\'' +
+                ", numberFrozen='" + numberFrozen + '\'' +
+                ", supplierName='" + supplierName + '\'' +
+                '}';
+    }
+}

+ 25 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/mapper/MaterialPlanMapper.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialplan.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.materialplan.entity.MaterialPlan;
+import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
+import io.swagger.models.auth.In;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 请假表单MAPPER接口
+ * @author lgf
+ * @version 2018-06-12
+ */
+@MyBatisMapper
+public interface MaterialPlanMapper extends BaseMapper<MaterialPlan> {
+    public Integer insertList(@Param("list") List<MaterialPlan> list);
+    void deleteData(String uniqueCode);
+}

+ 227 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/mapper/xml/MaterialPlanMapper.xml

@@ -0,0 +1,227 @@
+<?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.materialplan.mapper.MaterialPlanMapper">
+    
+	<sql id="planColumns">
+		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.unique_code As "uniqueCode",
+		a.require_coding As "requireCoding",
+		a.material_description As "description",
+		a.expansion_code As "expansionCode",
+		a.expansion_description As "expansionDescription",
+		a.big_describe As "bigDescribe",
+		a.moderate_describe As "moderateDescribe",
+		a.small_describe As "smallDescribe",
+		a.require_number As "requireNumber",
+		a.material_unit As "util",
+		a.plan_to_batch As "planToBatch",
+		a.delivery_schedule As "deliverySchedule",
+		a.flag_storage As "flagStorage",
+		a.inventory_quantity As "inventoryQuantity",
+		a.number_frozen As "numberFrozen",
+		a.supplier_name As "supplierName"
+	</sql>
+    
+	<select id="get" resultType="MaterialPlan" >
+		SELECT 
+			<include refid="planColumns"/>
+		FROM sm_material_plan a
+		WHERE a.unique_code = #{id}
+	</select>
+	
+	<select id="findList" resultType="MaterialPlan" >
+		SELECT
+			<include refid="planColumns"/>
+		FROM sm_material_plan a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+			<if test="uniqueCode != null and  uniqueCode != ''">
+				AND a.unique_code = LIKE CONCAT(CONCAT('%',#{uniqueCode},'%'))
+			</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="MaterialPlan" >
+		SELECT
+		<include refid="planColumns"/>
+		FROM sm_material_plan 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 sm_material_plan(
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			unique_code,
+			require_coding,
+			material_description,
+			expansion_code,
+			expansion_description,
+			big_describe,
+			moderate_describe,
+			small_describe,
+			require_number,
+			material_unit,
+			plan_to_batch,
+			delivery_schedule,
+			flag_storage,
+			inventory_quantity,
+			number_frozen,
+			supplier_name
+		) VALUES
+		(
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{uniqueCode},
+			#{requireCoding},
+			#{description},
+			#{expansionCode},
+    		#{expansionDescription},
+    		#{bigDescribe},
+    		#{moderateDescribe},
+    		#{smallDescribe},
+    		#{requireNumber},
+    		#{util},
+    		#{planToBatch},
+    		#{deliverySchedule},
+    		#{flagStorage},
+    		#{inventoryQuantity},
+    		#{numberFrozen},
+    		#{supplierName}
+		)
+	</insert>
+
+	<insert id="insertList">
+		replace INTO sm_material_plan(
+		create_by,
+		create_date,
+		update_by,
+		update_date,
+		remarks,
+		del_flag,
+		unique_code,
+		require_coding,
+		material_description,
+		expansion_code,
+		expansion_description,
+		big_describe,
+		moderate_describe,
+		small_describe,
+		require_number,
+		material_unit,
+		plan_to_batch,
+		delivery_schedule,
+		flag_storage,
+		inventory_quantity,
+		number_frozen,
+		supplier_name
+		) VALUES
+		<foreach collection="list" item="item" index="index" separator="," >
+			(
+			#{item.createBy.id},
+			#{item.createDate},
+			#{item.updateBy.id},
+			#{item.updateDate},
+			#{item.remarks},
+			#{item.delFlag},
+			#{item.uniqueCode},
+			#{item.requireCoding},
+			#{item.description},
+			#{item.expansionCode},
+			#{item.expansionDescription},
+			#{item.bigDescribe},
+			#{item.moderateDescribe},
+			#{item.smallDescribe},
+			#{item.requireNumber},
+			#{item.util},
+			#{item.planToBatch},
+			#{item.deliverySchedule},
+			#{item.flagStorage},
+			#{item.inventoryQuantity},
+			#{item.numberFrozen},
+			#{item.supplierName}
+			)
+		</foreach>
+	</insert>
+
+	<update id="update">
+		UPDATE sm_material_plan SET
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			require_coding = #{requireCoding},
+			material_description = #{description},
+			expansion_code = #{expansionCode},
+			expansion_description = #{expansionDescription},
+			big_describe = #{bigDescribe},
+			moderate_describe = #{moderateDescribe},
+			small_describe = #{smallDescribe},
+			require_number = #{requireNumber},
+			material_unit = #{util},
+			plan_to_batch = #{planToBatch},
+			delivery_schedule =#{deliverySchedule},
+			flag_storage = #{flagStorage},
+			inventory_quantity = #{inventoryQuantity},
+			number_frozen = #{numberFrozen},
+			supplier_name = #{supplierName}
+		WHERE unique_code = #{uniqueCode}
+	</update>
+	
+	
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM sm_material_plan
+		WHERE unique_code = #{id}
+	</update>
+
+	<update id="deleteData">
+		DELETE FROM sm_material_plan
+		WHERE unique_code= #{unique_code}
+	</update>
+
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE sm_material_plan SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE unique_code = #{id}
+	</update>
+	
+	
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="Project" statementType="STATEMENT">
+		select * FROM sm_material_plan  where ${unique_code} = '${value}'
+	</select>
+
+</mapper>

+ 63 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/service/MaterialPlanService.java

@@ -0,0 +1,63 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialplan.service;
+
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.core.service.CrudService;
+import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
+import com.jeeplus.modules.sg.managementcenter.materialplan.entity.MaterialPlan;
+import com.jeeplus.modules.sg.managementcenter.materialplan.mapper.MaterialPlanMapper;
+import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
+import com.jeeplus.modules.sg.managementcenter.project.mapper.ProjectMapper;
+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 MaterialPlanService extends CrudService<MaterialPlanMapper, MaterialPlan> {
+    @Autowired
+	private MaterialPlanMapper materialPlanMapper;
+
+	public MaterialPlan get(String uniqueCode) {
+		return super.get(uniqueCode);
+	}
+	
+	public List<MaterialPlan> findList(MaterialPlan materialPlan) {
+		return super.findList(materialPlan);
+	}
+	
+	public Page<MaterialPlan> findPage(Page<MaterialPlan> page, MaterialPlan materialPlan) {
+		return super.findPage(page, materialPlan);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(MaterialPlan materialPlan) {
+		super.save(materialPlan);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(MaterialPlan materialPlan) {
+		super.delete(materialPlan);
+	}
+
+	@Transactional(readOnly = false)
+	public void update(MaterialPlan materialPlan){
+		materialPlan.preUpdate();
+		materialPlanMapper.update(materialPlan);
+	}
+	@Transactional(readOnly = false)
+	public void saveList(List<MaterialPlan> list) {
+		for(MaterialPlan materialPlan : list){
+			materialPlan.preInsert();
+		}
+		materialPlanMapper.insertList(list);
+	}
+
+	@Transactional(readOnly = false)
+	public void deleteData(String uniqueCode){materialPlanMapper.deleteData(uniqueCode);
+	}
+}

+ 394 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/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.materialplan.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");
+//		}
+//		
+//	}
+}

+ 137 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/util/MaterialPlanInfo.java

@@ -0,0 +1,137 @@
+package com.jeeplus.modules.sg.managementcenter.materialplan.util;
+import com.jeeplus.modules.sg.managementcenter.materialplan.entity.InventoryTable;
+import com.jeeplus.modules.sg.managementcenter.materialplan.entity.MaterialPlan;
+import groovy.util.IFileNameFinder;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
+import org.apache.poi.ss.usermodel.Row;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+public class MaterialPlanInfo {
+    public static final Integer MATER_ONE = 1;
+    public static final Integer MATER_TWO = 2;
+    public static final Integer MATER_THREE = 3;
+    public static final Integer MATER_FOUR = 4;
+    public static final String MATER_CODE = "物资唯一编码";
+    public static final String MATER_CODETWO = "批次编码";
+    public static final String MATER_NUMBER = "序号";
+//    public static final String MATER_STORAGE = "是否入库";
+//    public static final String MATER_COUNT = "库存数量";
+//    public static final String MATER_DONGCOUNT = "冻结数量";
+//    public static final String MATER_ITEMNAME = "供应商名称";
+    /**
+     * 获取表格数据
+     * @param importUtil
+     * @return List<ErpAccount> 导入表格数据
+     */
+    public static List<MaterialPlan> getMaterPlanUtil(ImportUtil importUtil)  {
+        int lastRow = importUtil.getLastDataRowNum();
+        List<MaterialPlan> list = new ArrayList<MaterialPlan>();
+        MaterialPlan materialPlan = null;
+        String uniqueCode="";//费用估算
+        for(int i=1; i<lastRow;i++){
+            materialPlan = new MaterialPlan();
+            Row row = importUtil.getRow(i);
+            uniqueCode = (String)importUtil.getCellValue(row,0);
+            if (StringUtils.isNotBlank(uniqueCode)){
+                materialPlan.setUniqueCode(uniqueCode);
+                materialPlan.setRequireCoding((String)importUtil.getCellValue(row,1));
+                materialPlan.setDescription((String)importUtil.getCellValue(row,2));
+                materialPlan.setExpansionCode((String)importUtil.getCellValue(row,3));
+                materialPlan.setExpansionDescription((String)importUtil.getCellValue(row,4));
+                materialPlan.setBigDescribe((String)importUtil.getCellValue(row,5));
+                materialPlan.setModerateDescribe((String)importUtil.getCellValue(row,6));
+                materialPlan.setSmallDescribe((String)importUtil.getCellValue(row,7));
+                materialPlan.setRequireNumber((String)importUtil.getCellValue(row,8));
+                materialPlan.setUtil((String)importUtil.getCellValue(row,9));
+                materialPlan.setPlanToBatch((String)importUtil.getCellValue(row,10));
+                materialPlan.setFlagStorage((String)importUtil.getCellValue(row,12));
+                materialPlan.setInventoryQuantity((String)importUtil.getCellValue(row,13));
+                materialPlan.setNumberFrozen((String)importUtil.getCellValue(row,14));
+                materialPlan.setSupplierName((String)importUtil.getCellValue(row,15));
+                list.add(materialPlan);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 导入基础数据 -  库存 数据 list集合
+     * @param importUtil
+     * @return
+     */
+    public static List<InventoryTable> getInventoryTableUtil(ImportUtil importUtil)  {
+        int lastRow = importUtil.getLastDataRowNum();
+        List<InventoryTable> list = new ArrayList<InventoryTable>();
+        InventoryTable inventoryTable = null;
+        String uniqueCode="";//费用估算
+        for(int i=1; i<lastRow;i++){
+            inventoryTable = new InventoryTable();
+            Row row = importUtil.getRow(i);
+            uniqueCode = (String)importUtil.getCellValue(row,3);
+            if (StringUtils.isNotBlank(uniqueCode)){
+                inventoryTable.setUniqueCode(uniqueCode);
+                inventoryTable.setInventoryQuantity((String)importUtil.getCellValue(row,7));
+                inventoryTable.setNumberFrozen((String)importUtil.getCellValue(row,9));
+                inventoryTable.setSupplierName((String)importUtil.getCellValue(row,15));
+                list.add(inventoryTable);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 判断excel是哪张表
+     * @return
+     */
+    public static Integer getJudgeExcel(ImportUtil importUtil){
+        Row row = importUtil.getRow(0);
+        String firstName = (String) importUtil.getCellValue(row,0);
+        if (firstName.contains(MATER_CODE)||firstName.contains(MATER_CODETWO)){
+            return MATER_ONE;
+        }
+        if (firstName.contains(MATER_NUMBER)){
+            return MATER_TWO;
+        }
+        return MATER_FOUR;
+    }
+
+    /**
+     * 获取新的数据系列
+     * @return
+     */
+    public static List<MaterialPlan> getUpdateMaterPlan(List<MaterialPlan> materialPlanList,ImportUtil importUtil){
+        List<InventoryTable> inventoryTableList = MaterialPlanInfo.getInventoryTableUtil(importUtil);
+        for (InventoryTable inventoryTable:inventoryTableList){
+            System.out.println(inventoryTable);
+        }
+        for (MaterialPlan materialPlan:materialPlanList){
+            for (InventoryTable inventoryTable:inventoryTableList){
+                if (materialPlan.getUniqueCode().equals(inventoryTable.getUniqueCode())){
+                    materialPlan.setInventoryQuantity(inventoryTable.getInventoryQuantity());
+                    materialPlan.setNumberFrozen(inventoryTable.getNumberFrozen());
+                    materialPlan.setSupplierName(inventoryTable.getSupplierName());
+                }
+            }
+            System.out.println("qweqweqw====="+materialPlan);
+        }
+        return materialPlanList;
+    }
+
+    /**
+     * 生成随机数
+     * @return
+     */
+    public static String getStatus(){
+        int machineId = 1;
+        int hashCodeV = UUID.randomUUID().toString().hashCode();
+        if (hashCodeV<0){
+            hashCodeV=-hashCodeV;
+        }
+        return  (machineId+String.format("%015d",hashCodeV));
+    }
+
+}

+ 217 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialplan/web/MeterialPlanController.java

@@ -0,0 +1,217 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialplan.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.materialplan.entity.InventoryTable;
+import com.jeeplus.modules.sg.managementcenter.materialplan.entity.MaterialPlan;
+import com.jeeplus.modules.sg.managementcenter.materialplan.service.MaterialPlanService;
+import com.jeeplus.modules.sg.managementcenter.materialplan.util.ImportUtil;
+import com.jeeplus.modules.sg.managementcenter.materialplan.util.MaterialPlanInfo;
+import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
+import com.jeeplus.modules.sg.managementcenter.project.service.ProjectService;
+import com.jeeplus.modules.sg.managementcenter.project.util.ProExcelInfo;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+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.validation.ConstraintViolationException;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 表单Controller
+ * @author lgf
+ * @version 2018-06-12
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/sg/managementcenter/materialplan")
+public class MeterialPlanController extends BaseController {
+
+	@Autowired
+	private MaterialPlanService materialPlanService;
+	
+	@ModelAttribute
+	public MaterialPlan get(@RequestParam(required=false) String id) {
+		MaterialPlan entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = materialPlanService.get(id);
+		}
+		if (entity == null){
+			entity = new MaterialPlan();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 工程管理表单列表页面
+	 */
+//	@RequiresPermissions("test:one:dialog:leave1:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(MaterialPlan materialPlan, Model model) {
+		model.addAttribute("materialPlan", materialPlan);
+		return "modules/sg/managementcenter/materialplan/materialplanList";
+	}
+	
+		/**
+	 * 表单列表数据
+	 */
+	@ResponseBody
+//	@RequiresPermissions("test:one:dialog:leave1:list")
+	@RequestMapping(value = "data")
+	public Map<String, Object> data(MaterialPlan materialPlan, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<MaterialPlan> page = materialPlanService.findPage(new Page<MaterialPlan>(request, response), materialPlan);
+		return getBootstrapData(page);
+	}
+
+	/**
+	 * 查看,增加,编辑表单表单页面
+	 */
+//	@RequiresPermissions(value={"test:one:dialog:leave1:view","test:one:dialog:leave1:add","test:one:dialog:leave1:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(MaterialPlan materialPlan, Model model) {
+		model.addAttribute("materialPlan", materialPlan);
+		return "modules/sg/managementcenter/materialplan/materialplanForm";
+	}
+
+	/**
+	 * 保存表单
+	 */
+	@ResponseBody
+//	@RequiresPermissions(value={"test:one:dialog:leave1:add","test:one:dialog:leave1:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public AjaxJson save(MaterialPlan materialPlan, Model model) throws Exception{
+		AjaxJson j = new AjaxJson();
+		/**
+		 * 后台hibernate-validation插件校验
+		 */
+		String errMsg = beanValidator(materialPlan);
+		if (StringUtils.isNotBlank(errMsg)){
+			j.setSuccess(false);
+			j.setMsg(errMsg);
+			return j;
+		}
+		//新增或编辑表单保存
+		materialPlanService.save(materialPlan);//保存
+		j.setSuccess(true);
+		j.setMsg("保存项目明细数据成功");
+		return j;
+	}
+	
+	/**
+	 * 删除表单
+	 */
+	@ResponseBody
+//	@RequiresPermissions("test:one:dialog:leave1:del")
+	@RequestMapping(value = "delete")
+	public AjaxJson delete(MaterialPlan materialPlan) {
+		AjaxJson j = new AjaxJson();
+		materialPlanService.delete(materialPlan);
+		j.setMsg("删除项目明细数据成功");
+		return j;
+	}
+	
+	/**
+	 * 批量表单
+	 */
+	@ResponseBody
+//	@RequiresPermissions("test:one:dialog:leave1:del")
+	@RequestMapping(value = "deleteAll")
+	public AjaxJson deleteAll(String ids) {
+		AjaxJson j = new AjaxJson();
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			materialPlanService.deleteData(id);
+		}
+		j.setMsg("删除成功");
+		return j;
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@ResponseBody
+//	@RequiresPermissions("test:one:dialog:leave1:export")
+    @RequestMapping(value = "export")
+    public AjaxJson exportFile(MaterialPlan materialPlan, HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		try {
+            String fileName = "项目明细表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<MaterialPlan> page = materialPlanService.findPage(new Page<MaterialPlan>(request, response, -1), materialPlan);
+    		new ExportExcel("项目明细表", MaterialPlan.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("test:one:dialog:leave1:import")
+    @RequestMapping(value = "import")
+   	public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) throws IOException, InvalidFormatException {
+		AjaxJson j = new AjaxJson();
+//		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportUtil importUtil = new ImportUtil(file,0,0);
+			Integer integer = MaterialPlanInfo.getJudgeExcel(importUtil);//验证表
+
+			System.out.println(integer);
+			if (integer==1){
+				List<MaterialPlan> materialPlans = MaterialPlanInfo.getMaterPlanUtil(importUtil);
+				materialPlanService.saveList(materialPlans);
+			}
+			if (integer==2){
+				MaterialPlan material = new MaterialPlan();
+				List<MaterialPlan> materialPlanList = materialPlanService.findAllList(material);
+				if (null==materialPlanList&&materialPlanList.size()<=0){
+					j.setMsg( "还没有导入基础数据表");
+					return j;
+				}
+				List<MaterialPlan> updateMaterPlans = MaterialPlanInfo.getUpdateMaterPlan(materialPlanList, importUtil);
+				for (MaterialPlan updateMaterPlan:updateMaterPlans){
+					try{
+						materialPlanService.update(updateMaterPlan);
+						successNum++;
+					}catch(ConstraintViolationException ex){
+						failureNum++;
+					}catch (Exception ex) {
+						failureNum++;
+					}
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条项目表单记录。");
+			}
+			j.setMsg( "已成功导入 "+successNum+" 条项目表单记录"+failureMsg);
+//		} catch (Exception e) {
+//			j.setSuccess(false);
+//			j.setMsg("导入失败!失败信息:"+e.getMessage());
+//		}
+		return j;
+    }
+}

+ 1 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/mapper/xml/MaterialProjectMapper.xml

@@ -141,7 +141,7 @@
 			#{suppliesBatch}
 		)
 	</insert>
-	
+
 	<update id="update">
 		UPDATE xm_material_project SET
 			update_by = #{updateBy.id},

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

@@ -48,7 +48,7 @@
 				AND a.id = #{id}
 			</if>
 			<if test="requireName != null and  requireName != ''">
-				AND a.require_name = #{requireName}
+				AND a.require_name LIKE CONCAT(CONCAT('%',#{requireName},'%'))
 			</if>
 		</where>
 		<choose>

+ 1 - 1
src/main/webapp/webpage/modules/sg/managementcenter/activiti/constructionForm.jsp

@@ -142,7 +142,7 @@
 								<td class="width-35">
 									<%--<input type='text'  name="projectName" class="form-control required"  value="${construction.projectName}"/>--%>
 									<sys:itemselect url="${ctx}/sg/managementcenter/project/dataSys" id="project" name="project.id" value="${project.id}" labelName="project.requireName" labelValue="${project.requireName}"
-													title="选择项目号" cssClass="form-control " fieldLabels="${fns:urlEncode('需求编号|项目需求名称|需求提出单位|变电站名称|线路名称|设备基本情况|运行班')}" fieldKeys="id|requireName|demandUnit|bdzName|lineName|asicEquipment|runTheClass" searchLabels="${fns:urlEncode('需求编号|项目需求名称')}" searchKeys="id|requireName" ></sys:itemselect>
+													title="选择项目号" cssClass="form-control " fieldLabels="${fns:urlEncode('项目需求名称|需求提出单位|变电站名称|线路名称|设备基本情况|运行班')}" fieldKeys="requireName|demandUnit|bdzName|lineName|asicEquipment|runTheClass" searchLabels="${fns:urlEncode('项目需求名称')}" searchKeys="requireName" ></sys:itemselect>
 								</td>
 								<td class="width-15 active"><label class="pull-right">接收图纸时间:</label></td>
 								<td class="width-35">

+ 131 - 0
src/main/webapp/webpage/modules/sg/managementcenter/materialplan/materialplanForm.jsp

@@ -0,0 +1,131 @@
+<%@ 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() {
+
+	        $('#deliverySchedule').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/materialplan/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="materialPlan" class="form-horizontal">
+		<form:hidden path="id"/>	
+		<table class="table table-bordered">
+			<tbody>
+				<tr>
+					<td class="width-15 active"><label class="pull-right" style="float: left">物资编码:</label></td>
+					<td class="width-35">
+						<form:input path="uniqueCode" htmlEscape="false" class="form-control required"/>
+					</td>
+					<td class="width-15 active"><label class="pull-right">需求物资编码:</label></td>
+					<td class="width-35">
+						<form:input path="requireCoding" htmlEscape="false"   class="form-control required"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">物料描述:</label></td>
+					<td class="width-35">
+						<form:input path="description" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">物料扩展编码:</label></td>
+					<td class="width-35">
+						<form:input path="expansionCode" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">物料扩展描述:</label></td>
+					<td class="width-35">
+						<form:input path="expansionDescription" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">大类描述:</label></td>
+					<td class="width-35">
+						<form:input path="bigDescribe" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">中类描述:</label></td>
+					<td class="width-35">
+						<form:input path="moderateDescribe" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">小类描述:</label></td>
+					<td class="width-35">
+						<form:input path="smallDescribe" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">需求数量:</label></td>
+					<td class="width-35">
+						<form:input path="requireNumber" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">单位:</label></td>
+					<td class="width-35">
+						<form:input path="util" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">计划批次:</label></td>
+					<td class="width-35">
+						<form:input path="planToBatch" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">供货计划到日:</label></td>
+					<td class="width-35">
+						<div class='input-group form_datetime' id='deliverySchedule'>
+							<input type='text'  name="deliverySchedule" class="form-control required"  value="<fmt:formatDate value="${materialPlan.deliverySchedule}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
+								<span class="input-group-addon">
+			                        <span class="glyphicon glyphicon-calendar"></span>
+			                    </span>
+						</div>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">是否入库:</label></td>
+					<td class="width-35">
+						<form:input path="flagStorage" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">库存数量:</label></td>
+					<td class="width-35">
+						<form:input path="inventoryQuantity" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">冻结数量:</label></td>
+					<td class="width-35">
+						<form:input path="numberFrozen" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">供应商名称:</label></td>
+					<td class="width-35">
+						<form:input path="supplierName" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+			</tbody>
+		</table>
+	</form:form>
+</body>
+</html>

+ 322 - 0
src/main/webapp/webpage/modules/sg/managementcenter/materialplan/materialplanList.js

@@ -0,0 +1,322 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<script>
+$(document).ready(function() {
+	$('#materialPlanTable').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: 5,
+               //可供选择的每页的行数(*)    
+               pageList: [5,10, 25, 50, 100],
+               //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据  
+               url: "${ctx}/sg/managementcenter/materialplan/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.uniqueCode);
+                   }else if($el.data("item") == "view"){
+                       view(row.uniqueCode);
+                   } else if($el.data("item") == "delete"){
+                        jp.confirm('确认要删除该请假表单记录吗?', function(){
+                       	jp.loading();
+                       	jp.get("${ctx}/sg/managementcenter/materialplan/delete?id="+row.uniqueCode, function(data){
+                   	  		if(data.success){
+                   	  			$('#materialPlanTable').bootstrapTable('refresh');
+                   	  			jp.success(data.msg);
+                   	  		}else{
+                   	  			jp.error(data.msg);
+                   	  		}
+                   	  	})
+                   	   
+                   	});
+                      
+                   } 
+               },
+              
+               onClickRow: function(row, $el){
+               },
+               	onShowSearch: function () {
+			$("#search-collapse").slideToggle();
+		},
+               columns: [{
+		        checkbox: true
+		       
+		    }
+			,{
+		        field: 'uniqueCode',
+		        title: '物资唯一码(批次编码)',
+		        sortName: 'uniqueCode'
+		        ,formatter:function(value, row , index){
+
+			   if(value == null || value ==""){
+				   value = "-";
+			   }
+			   <c:choose>
+				   <c:when test="${fns:hasPermission('sg:managementcenter:materialplan:edit')}">
+				      return "<a href='javascript:edit(\""+row.uniqueCode+"\")'>"+value+"</a>";
+			      </c:when>
+				  <c:when test="${fns:hasPermission('sg:managementcenter:materialplan:view')}">
+				      return "<a href='javascript:view(\""+row.uniqueCode+"\")'>"+value+"</a>";
+			      </c:when>
+				  <c:otherwise>
+				      return value;
+			      </c:otherwise>
+			   </c:choose>
+
+		        }
+		       
+		    }
+			,{
+		        field: 'requireCoding',
+		        title: '需求物资编码',
+		        sortName: 'requireCoding'
+		       
+		    }
+			,{
+		        field: 'description',
+		        title: '物料描述',
+		        sortName: 'description'
+		       
+		    }
+			,{
+		        field: 'expansionCode',
+		        title: '物料扩展编码',
+		        sortName: 'expansionCode'
+		       
+		    }
+			,{
+		        field: 'expansionDescription',
+		        title: '物料扩展描述',
+		        sortName: 'expansionDescription'
+		       
+		    }
+                   ,{
+                       field: 'bigDescribe',
+                       title: '大类描述',
+                       sortName: 'bigDescribe'
+
+                   }
+                   ,{
+                       field: 'moderateDescribe',
+                       title: '中类描述',
+                       sortName: 'moderateDescribe'
+
+                   }
+                   ,{
+                       field: 'smallDescribe',
+                       title: '小类描述',
+                       sortName: 'smallDescribe'
+
+                   }
+                   ,{
+                       field: 'requireNumber',
+                       title: '需求数量',
+                       sortName: 'requireNumber'
+
+                   }
+                   ,{
+                       field: 'util',
+                       title: '单位',
+                       sortName: 'util'
+
+                   }
+                   ,{
+                       field: 'planToBatch',
+                       title: '计划批次',
+                       sortName: 'planToBatch'
+
+                   }
+                   ,{
+                       field: 'deliverySchedule',
+                       title: '供货计划到日',
+                       sortName: 'deliverySchedule',
+                       // formatter: getTime
+                   }
+                   ,{
+                       field: 'flagStorage',
+                       title: '是否入库',
+                       sortName: 'flagStorage'
+                   }
+                   ,{
+                       field: 'inventoryQuantity',
+                       title: '库存数量',
+                       sortName: 'inventoryQuantity'
+                   }
+                   ,{
+                       field: 'numberFrozen',
+                       title: '冻结数量',
+                       sortName: 'numberFrozen'
+                   }
+                   ,{
+                       field: 'supplierName',
+                       title: '供应商名称',
+                       sortName: 'supplierName'
+                   }
+		     ]
+		
+		});
+		function getTime(value, row, index) {
+			return [
+				"<div class='input-group form_datetime' id='deliverySchedule'> <input type='text'  name='deliverySchedule' class='form-control required'  value=''/> <span class='input-group-addon'> <span class='glyphicon glyphicon-calendar'></span> </span></div>" ,
+			].join('');
+		}
+
+	  if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
+
+		 
+		  $('#materialPlanTable').bootstrapTable("toggleView");
+		}
+	  
+	  $('#materialPlanTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
+                'check-all.bs.table uncheck-all.bs.table', function () {
+            $('#remove').prop('disabled', ! $('#materialPlanTable').bootstrapTable('getSelections').length);
+            $('#view,#edit').prop('disabled', $('#materialPlanTable').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/materialplan/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}/sg/managementcenter/materialplan/export');
+	  });
+
+		    
+	  $("#search").click("click", function() {// 绑定查询按扭
+		  $('#materialPlanTable').bootstrapTable('refresh');
+		});
+	 
+	 $("#reset").click("click", function() {// 绑定查询按扭
+		  $("#searchForm  input").val("");
+		  $("#searchForm  select").val("");
+		  $("#searchForm  .select-item").html("");
+		  $('#materialPlanTable').bootstrapTable('refresh');
+		});
+		
+		$('#beginDate').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($("#materialPlanTable").bootstrapTable('getSelections'), function (row) {
+            return row.uniqueCode
+        });
+    }
+  
+  function deleteAll(){
+		jp.confirm('确认要删除该项目管理表单记录吗?', function(){
+			jp.loading();  	
+			jp.get("${ctx}/sg/managementcenter/materialplan/deleteAll?ids=" + getIdSelections(), function(data){
+         	  		if(data.success){
+         	  			$('#materialPlanTable').bootstrapTable('refresh');
+         	  			jp.success(data.msg);
+         	  		}else{
+         	  			jp.error(data.msg);
+         	  		}
+         	  	})
+          	   
+		})
+  }
+
+    //刷新列表
+  function refresh(){
+  	$('#materialPlanTable').bootstrapTable('refresh');
+  }
+  
+   function add(){
+	  jp.openSaveDialog('新增项目管理表单', "${ctx}/sg/managementcenter/materialplan/form",'800px', '500px');
+  }
+
+
+  
+   function edit(id){//没有权限时,不显示确定按钮
+       if(id == undefined){
+	      id = getIdSelections();
+	}
+	jp.openSaveDialog('编辑项目管理表单', "${ctx}/sg/managementcenter/materialplan/form?id=" + id, '800px', '500px');
+  }
+  
+ function view(id){//没有权限时,不显示确定按钮
+      if(id == undefined){
+             id = getIdSelections();
+      }
+        jp.openViewDialog('查看项目管理表单', "${ctx}/sg/managementcenter/materialplan/form?id=" + id, '800px', '500px');
+ }
+
+
+
+</script>

+ 99 - 0
src/main/webapp/webpage/modules/sg/managementcenter/materialplan/materialplanList.jsp

@@ -0,0 +1,99 @@
+<%@ 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="materialplanList.js" %>
+</head>
+<script>
+    $(document).ready(function() {
+        $('#beginDate').datetimepicker({
+            format: "YYYY-MM-DD HH:mm:ss"
+        });
+        $('#endDate').datetimepicker({
+            format: "YYYY-MM-DD HH:mm:ss"
+        });
+    });
+</script>
+<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="materialPlan" 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="uniqueCode" htmlEscape="false" maxlength="100"  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="test:one:dialog:leave1:add">--%>
+				<button id="add" class="btn btn-primary" onclick="add()">
+					<i class="glyphicon glyphicon-plus"></i> 新建
+				</button>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:one:dialog:leave1:edit">--%>
+			    <button id="edit" class="btn btn-success" disabled onclick="edit()">
+	            	<i class="glyphicon glyphicon-edit"></i> 修改
+	        	</button>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:one:dialog:leave1:del">--%>
+				<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
+	            	<i class="glyphicon glyphicon-remove"></i> 删除
+	        	</button>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:one:dialog:leave1:import">--%>
+				<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:one:dialog:leave1:export">--%>
+	        		<button id="export" class="btn btn-warning">
+					<i class="fa fa-file-excel-o"></i> 导出
+				</button>
+			 <%--</shiro:hasPermission>--%>
+	                 <%--<shiro:hasPermission name="test:one:dialog:leave1:view">--%>
+				<button id="view" class="btn btn-default" disabled onclick="view()">
+					<i class="fa fa-search-plus"></i> 查看
+				</button>
+			<%--</shiro:hasPermission>--%>
+		    </div>
+		
+	<!-- 表格 -->
+	<table id="materialPlanTable"   data-toolbar="#toolbar"></table>
+
+    <!-- context menu -->
+    <ul id="context-menu" class="dropdown-menu">
+    	<%--<shiro:hasPermission name="test:one:dialog:leave1:view">--%>
+        <li data-item="view"><a>查看</a></li>
+        <%--</shiro:hasPermission>--%>
+    	<%--<shiro:hasPermission name="test:one:dialog:leave1:edit">--%>
+        <li data-item="edit"><a>编辑</a></li>
+        <%--</shiro:hasPermission>--%>
+        <%--<shiro:hasPermission name="test:one:dialog:leave1:del">--%>
+        <li data-item="delete"><a>删除</a></li>
+        <%--</shiro:hasPermission>--%>
+        <li data-item="action1"><a>取消</a></li>
+    </ul>  
+	</div>
+	</div>
+	</div>
+</body>
+</html>