Browse Source

导出完成,操作物料情况完成

yue 5 years atrás
parent
commit
a5d774e990

+ 1 - 0
src/main/java/com/jeeplus/modules/sg/information/entity/Information.java

@@ -14,6 +14,7 @@ import com.jeeplus.core.persistence.DataEntity;
  * @version 2019-09-04
  */
 public class Information extends DataEntity<Information>  {
+
 	//项目定义号
 	private String projectId;
 	//项目名称

+ 28 - 0
src/main/java/com/jeeplus/modules/sg/material/entity/Material.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.modules.sg.material.entity;
 
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
 import com.jeeplus.core.persistence.DataEntity;
 
 /**
@@ -11,6 +12,18 @@ import com.jeeplus.core.persistence.DataEntity;
  * @version 2019-09-04
  */
 public class Material extends DataEntity<Material>  {
+    private String id;
+
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(String id) {
+        this.id = id;
+    }
+
     //项目编号
     private String projectId;
     //物料编号
@@ -44,6 +57,7 @@ public class Material extends DataEntity<Material>  {
     //备注说明
     private String info;
 
+    @ExcelField(title="是否完成领退料", align=2, sort=13)
     public String getIsBack() {
         return isBack;
     }
@@ -60,6 +74,7 @@ public class Material extends DataEntity<Material>  {
         this.projectId = projectId;
     }
 
+    @ExcelField(title="物料编号", align=2, sort=1)
     public String getInforId() {
         return inforId;
     }
@@ -68,6 +83,7 @@ public class Material extends DataEntity<Material>  {
         this.inforId = inforId;
     }
 
+    @ExcelField(title="物料描述", align=2, sort=2)
     public String getMaterialName() {
         return materialName;
     }
@@ -76,6 +92,7 @@ public class Material extends DataEntity<Material>  {
         this.materialName = materialName;
     }
 
+    @ExcelField(title="出库金额", align=2, sort=3)
     public Double getOutboundAmount() {
         return outboundAmount;
     }
@@ -84,6 +101,7 @@ public class Material extends DataEntity<Material>  {
         this.outboundAmount = outboundAmount;
     }
 
+    @ExcelField(title="审定金额", align=2, sort=4)
     public Double getAuthorizedAmount() {
         return authorizedAmount;
     }
@@ -92,6 +110,7 @@ public class Material extends DataEntity<Material>  {
         this.authorizedAmount = authorizedAmount;
     }
 
+    @ExcelField(title="差额", align=2, sort=5)
     public Double getDifference() {
         return difference;
     }
@@ -100,6 +119,7 @@ public class Material extends DataEntity<Material>  {
         this.difference = difference;
     }
 
+    @ExcelField(title="出库数量", align=2, sort=6)
     public Double getOutboundNumber() {
         return outboundNumber;
     }
@@ -108,6 +128,7 @@ public class Material extends DataEntity<Material>  {
         this.outboundNumber = outboundNumber;
     }
 
+    @ExcelField(title="审定数量", align=2, sort=7)
     public Double getAuthorizedNumber() {
         return authorizedNumber;
     }
@@ -116,6 +137,7 @@ public class Material extends DataEntity<Material>  {
         this.authorizedNumber = authorizedNumber;
     }
 
+    @ExcelField(title="平均价单价", align=2, sort=8)
     public Double getPrice() {
         return price;
     }
@@ -124,6 +146,7 @@ public class Material extends DataEntity<Material>  {
         this.price = price;
     }
 
+    @ExcelField(title="单位", align=2, sort=9)
     public String getUnit() {
         return unit;
     }
@@ -132,6 +155,7 @@ public class Material extends DataEntity<Material>  {
         this.unit = unit;
     }
 
+    @ExcelField(title="物料小类", align=2, sort=10)
     public String getMaterialSmall() {
         return materialSmall;
     }
@@ -140,6 +164,7 @@ public class Material extends DataEntity<Material>  {
         this.materialSmall = materialSmall;
     }
 
+    @ExcelField(title="物料中类", align=2, sort=11)
     public String getMaterialMid() {
         return materialMid;
     }
@@ -148,6 +173,7 @@ public class Material extends DataEntity<Material>  {
         this.materialMid = materialMid;
     }
 
+    @ExcelField(title="物料大类", align=2, sort=12)
     public String getMaterialBig() {
         return materialBig;
     }
@@ -156,6 +182,7 @@ public class Material extends DataEntity<Material>  {
         this.materialBig = materialBig;
     }
 
+    @ExcelField(title="原因类型", align=2, sort=14)
     public String getStatus() {
         return status;
     }
@@ -164,6 +191,7 @@ public class Material extends DataEntity<Material>  {
         this.status = status;
     }
 
+    @ExcelField(title="备注说明", align=2, sort=15)
     public String getInfo() {
         return info;
     }

+ 8 - 2
src/main/java/com/jeeplus/modules/sg/material/mapper/xml/MaterialMapper.xml

@@ -3,6 +3,7 @@
 <mapper namespace="com.jeeplus.modules.sg.material.mapper.MaterialMapper">
     
 	<sql id="materialColumns">
+		id,
 		project_id,
 		infor_id,
 		material_name,
@@ -29,7 +30,7 @@
 	</select>
 
 	<update id="updateInfo" parameterType="com.jeeplus.modules.sg.material.entity.Material">
-		update material_information set status = #{status},info = #{info} where id = #{id};
+		update material_information set status = #{status},info = #{info},isback = "是" where id = #{id};
 	</update>
 	<select id="findList" resultType="Material" >
 		SELECT 
@@ -40,6 +41,9 @@
 			<if test="projectId != null and projectId != ''">
 				AND project_id = #{projectId}
 			</if>
+			<if test="id != null and id!=''">
+				AND id=#{id}
+			</if>
 		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -64,7 +68,9 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+	<select id="get" resultType="Material">
+		select id,status,info from material_information where id = #{id}
+	</select>
 	<insert id="insert">
 		INSERT INTO material_information(
 			id,

+ 1 - 0
src/main/java/com/jeeplus/modules/sg/material/service/MaterialService.java

@@ -44,6 +44,7 @@ public class MaterialService extends CrudService<MaterialMapper, Material> {
 		super.save(entity);
 	}
 
+	@Transactional(readOnly = false)
 	public Integer updateInfo(Material material) {
 		return materialMapper.updateInfo(material);
 	}

+ 10 - 26
src/main/java/com/jeeplus/modules/sg/material/web/MaterialController.java

@@ -8,6 +8,9 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.modules.sg.information.entity.Information;
 import com.jeeplus.modules.sg.material.entity.Material;
 import com.jeeplus.modules.sg.material.service.MaterialService;
@@ -70,8 +73,8 @@ public class MaterialController extends BaseController {
 	}
 
 	@RequestMapping(value = "form")
-	public String form(Information information, Model model) {
-		model.addAttribute("Information", information);
+	public String form(Material material, Model model) {
+		model.addAttribute("Material", material);
 		return "modules/sg/material/materialForm";
 	}
 
@@ -89,7 +92,7 @@ public class MaterialController extends BaseController {
 	*/
 /**
 	 * 导出excel文件
-	 *//*
+	 */
 
 	@ResponseBody
 	//@RequiresPermissions("test:onetomany:dialog:testDataMain1:export")
@@ -97,42 +100,23 @@ public class MaterialController extends BaseController {
     public AjaxJson exportFile(Material material, HttpServletRequest request, HttpServletResponse response) {
 		AjaxJson j = new AjaxJson();
 		try {
-            String fileName = "票务代理"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            String fileName = "物料清单"+ DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
             Page<Material> page = materialService.findPage(new Page<Material>(request, response, -1), material);
-    		new ExportExcel("票务代理", TestDataMain1.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		new ExportExcel("物料清单", Material.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());
+			j.setMsg("导出物料清单记录失败!失败信息:"+e.getMessage());
 		}
 			return j;
     }
-*/
 
 	
 
 	
-/*	*//**
-	 * 下载导入物料详情数据模板
-	 *//*
-	@ResponseBody
-	@RequiresPermissions("test:onetomany:dialog:testDataMain1:import")
-    @RequestMapping(value = "import/template")
-     public AjaxJson importFileTemplate(HttpServletResponse response) {
-		AjaxJson j = new AjaxJson();
-		try {
-            String fileName = "票务代理数据导入模板.xlsx";
-    		List<TestDataMain1> list = Lists.newArrayList(); 
-    		new ExportExcel("票务代理数据", TestDataMain1.class, 1).setDataList(list).write(response, fileName).dispose();
-    		return null;
-		} catch (Exception e) {
-			j.setSuccess(false);
-			j.setMsg( "导入模板下载失败!失败信息:"+e.getMessage());
-		}
-		return j;
-    }*/
+
 	
 
 }

+ 1 - 1
src/main/webapp/webpage/modules/sg/information/informationForm.jsp

@@ -4,8 +4,8 @@
 <head>
 	<title>票务代理管理</title>
 	<meta name="decorator" content="ani"/>
-	<script type="text/javascript">
 
+	<script type="text/javascript">
 		$(document).ready(function() {
 	        $('#inDate').datetimepicker({
 				 format: "YYYY-MM-DD HH:mm:ss"

+ 2 - 1
src/main/webapp/webpage/modules/sg/information/informationList.js

@@ -5,7 +5,7 @@ $(document).ready(function() {
 
 	window.operateEvents = {
 		'click #TableView': function (e, value, row, index) {
-			jp.openViewDialog('查看', "${ctx}/sg/material?projectId="+row.projectId, '1000px', '800px');
+			jp.openTab("${ctx}/sg/material?projectId="+row.projectId,'查看《'+row.projectName+'》物料情况', true);
 		}
 	};
 
@@ -124,6 +124,7 @@ $(document).ready(function() {
 		  $('#informationTable').bootstrapTable("toggleView");
 		}
 
+
 	  $('#informationTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
                 'check-all.bs.table uncheck-all.bs.table', function () {
             $('#remove').prop('disabled', ! $('#informationTable').bootstrapTable('getSelections').length);

+ 18 - 15
src/main/webapp/webpage/modules/sg/material/materialForm.jsp

@@ -2,30 +2,33 @@
 <%@ include file="/webpage/include/taglib.jsp"%>
 <html>
 <head>
+	<script src="/${ctx}/act/rest/js/common/jquery-1.8.3.js"></script>
+
 	<title>物料详细</title>
 	<meta name="decorator" content="ani"/>
 	<script type="text/javascript">
-
 		$(document).ready(function() {
-	        $('#inDate').datetimepicker({
-				 format: "YYYY-MM-DD HH:mm:ss"
-		    });
 			$("#saveInfo").click(function () {
 				$.ajax({
-					url:"/${ctx}/sg/material/update",
-					type:"post",
+					url: "${ctx}/sg/material/update",
+					type: "post",
 					data: $("form").serialize(),
-					dataType:"json",
-					success:function (data) {
+					dataType: "json",
+					success: function (data) {
+						console.log(data);
 						if (data == "1") {
-							alert("修改成功!");
-							window.close();
+							jp.success("修改成功");
+							jp.getParent().refresh();
+							var index = parent.layer.getFrameIndex(window.name);
+							jp.close(index);
 						} else {
-							alert("修改失败!");
-							window.close();
+							jp.error("修改失败");
+							jp.getParent().refresh();
+							var index = parent.layer.getFrameIndex(window.name);
+							jp.close(index)
 						}
 					}
-				})
+				});
 			})
 		});
 	</script>
@@ -45,14 +48,14 @@
 						</form:select>
 					</td>
 				</tr>
-				<tr class="">
+				<tr>
 					<td class="width-35" style="text-align: center;margin: 0 auto">
 						<form:textarea cssStyle="width: 300px;margin: 0 auto" path="info" htmlEscape="false" cssClass="form-control"/>
 					</td>
 				</tr>
 				<tr>
 					<td class="width-35" style="text-align: center;margin: 0 auto">
-						<input type="button" id="saveInfo" value="保存" onclick="saveInfo()" class="btn btn-primary btn-block btn-lg btn-parsley"/>
+						<input type="button" id="saveInfo" value="保存"  class="btn btn-primary btn-block btn-lg btn-parsley"/>
 					</td>
 		  		</tr>
 		 	</tbody>

+ 26 - 27
src/main/webapp/webpage/modules/sg/material/materialList.js

@@ -3,12 +3,6 @@
 
 $(document).ready(function() {
 
-	window.operateEvents = {
-		'click #TableView': function (e, value, row, index) {
-			jp.openViewDialog('查看票务代理', "${ctx}/sg/material/form?projectId=" + row.projectId, '1000px', '800px');
-		}
-	};
-
 	$('#informationTable').bootstrapTable({
 
 		  //请求方法
@@ -66,13 +60,19 @@ $(document).ready(function() {
                	onShowSearch: function () {
 			$("#search-collapse").slideToggle();
 		},
-               columns: [{
-		        field: 'inforId',
-		        title: '物料编号',
-		        sortable: true,
-		        sortName: 'inforId'
-		    }
-			,{
+               columns: [ {
+				   field: 'projectId',
+				   title: '项目编号',
+					visible:false
+			   }
+				   ,
+				   {
+			   field: 'inforId',
+			   title: '物料编号',
+			   sortable: true,
+			   sortName: 'inforId'
+				   }
+				   ,{
 		        field: 'materialName',
 		        title: '物料描述',
 		        sortable: true,
@@ -145,7 +145,11 @@ $(document).ready(function() {
 			   field: 'operate',
 			   title: '调整物料情况',
 			   width: '80px',
-			   events: operateEvents,
+			   events: {
+				   'click #TableView': function (e, value, row, index) {
+					   jp.openViewDialog('物料情况操作页', "${ctx}/sg/material/form?id=" + row.id, '1000px', '800px');
+				   }
+			   },
 			   formatter: operateFormatter
 		   }
 		     ]
@@ -168,7 +172,6 @@ $(document).ready(function() {
         });
 
 
-
 	  $("#search").click("click", function() {// 绑定查询按扭
 		  $('#informationTable').bootstrapTable('refresh');
 		});
@@ -178,25 +181,21 @@ $(document).ready(function() {
 		  $("#searchForm  select").val("");
 		  $('#informationTable').bootstrapTable('refresh');
 		});
-	});
-
-  function getIdSelections() {
-        return $.map($("#informationTable").bootstrapTable('getSelections'), function (row) {
-            return row.id
-        });
-    }
-
 
+		//导出
+		$("#export").click(function(){//导出Excel文件
+			var url = location.search;
+			var inx = url.indexOf('=');
+			var id = url.substring(inx+1,url.length);
+			jp.downloadFile('${ctx}/sg/material/export?projectId='+id);
+		});
+	});
 
     //刷新列表
   function refresh() {
       $('#informationTable').bootstrapTable('refresh');
   }
 
-
-
-
-
 	function addRow(list, idx, tpl, row){
 		$(list).append(Mustache.render(tpl, {
 			idx: idx, delBtn: true, row: row

+ 6 - 33
src/main/webapp/webpage/modules/sg/material/materialList.jsp

@@ -25,28 +25,6 @@
 				<label class="label-item single-overflow pull-left" title="物料编号:">物料编号:</label>
 				 <form:input path="projectId" htmlEscape="false" maxlength="100"  class=" form-control"/>
 			</div>
-			<%-- <div class="col-xs-12 col-sm-6 col-md-4">
-				<label class="label-item single-overflow pull-left" title="物料描述:">物料描述:</label>
-				<form:input path="projectName" htmlEscape="false" maxlength="100"  class=" form-control"/>
-			</div>
-			 <div class="col-xs-12 col-sm-6 col-md-4">
-				<div class="form-group">
-					<label class="label-item single-overflow pull-left" title="送审部门:">&nbsp;送审部门:</label>
-					<form:input path="department" htmlEscape="false" maxlength="100"  class=" form-control"/>
-				</div>
-			</div>
-			 <div class="col-xs-12 col-sm-6 col-md-4">
-				 <div class="form-group">
-					<label class="label-item single-overflow pull-left" title="审定日期:">&nbsp;一级单位:</label>
-					 <form:input path="firstUnits" htmlEscape="false" maxlength="100"  class=" form-control"/>
-				</div>
-			</div>
-				<div class="col-xs-12 col-sm-6 col-md-4">
-					<div class="form-group">
-						<label class="label-item single-overflow pull-left" title="审定日期:">&nbsp;二级单位:</label>
-						<form:input path="secondUnits" htmlEscape="false" maxlength="100"  class=" form-control"/>
-					</div>
-				</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>
@@ -58,17 +36,12 @@
 	</div>
 	
 	<!-- 工具栏 -->
-	<div id="toolbar">
-			<shiro:hasPermission name="test:onetomany:dialog:materialList:add">
-				<button id="btnInformation" class="btn btn-info">
-					<i class="fa fa-folder-open-o"></i> 清单导出
-				</button>
-			</shiro:hasPermission>
-			<shiro:hasPermission name="test:onetomany:dialog:materialList:add">
-			    <button id="" class="btn btn-info">
-	            	<i class="fa fa-folder-open-o"></i> 导出说明word
-	        	</button>
-			</shiro:hasPermission>
+			<div id="toolbar">
+<%--			<shiro:hasPermission name="test:onetomany:dialog:materialList:add">--%>
+			<button id="export" class="btn btn-warning">
+				<i class="fa fa-file-excel-o"></i> 导出
+			</button>
+<%--			</shiro:hasPermission>--%>
 		    </div>
 		
 	<!-- 表格 -->