Browse Source

拆旧材料清单

[user3] 3 years ago
parent
commit
5a04bf6242

+ 9 - 0
src/main/java/com/jeeplus/modules/sg/raiseCapitalDesign/entity/InventoryData.java

@@ -6,8 +6,17 @@ import java.util.List;
  * @author enford
  */
 public class InventoryData {
+    private String uuid;
     private List<InventoryInfo> inventoryList;
 
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
     public List<InventoryInfo> getInventoryList() {
         return inventoryList;
     }

+ 248 - 22
src/main/java/com/jeeplus/modules/sg/raiseCapitalDesign/service/RaiseCapitalDesignService.java

@@ -398,7 +398,7 @@ public class RaiseCapitalDesignService extends CrudService<RaiseCapitalDesignMap
 		if(null != bytes){
 			list = JSON.parseArray(new String(bytes),InventoryInfo.class);
 		}else{
-
+			list=inventoryListData();
 		}
 		return list;
 	}
@@ -482,22 +482,44 @@ public class RaiseCapitalDesignService extends CrudService<RaiseCapitalDesignMap
 		String cableSeventyListJson = JSON.toJSONString(cableSeventyList);
 		CacheChannel channel = J2Cache.getChannel();
 		RedisClient client = ((RedisCacheProvider)channel.getL2Provider()).getRedisClient();
-		BinaryJedisCommands binaryJedisCommands = client.get();
-		binaryJedisCommands.set((cableSectionData.getUuid()+"cableDisposeData").getBytes(),cableDisposeDataJson.getBytes());
-		binaryJedisCommands.set((cableSectionData.getUuid()+"cableFourHundred").getBytes(),cableFourHundredListJson.getBytes());
-		binaryJedisCommands.set((cableSectionData.getUuid()+"cableHundredAndTwenty").getBytes(),cableHundredAndTwentyListJson.getBytes());
-		binaryJedisCommands.set((cableSectionData.getUuid()+"cableThreeHundred").getBytes(),cableThreeHundredListJson.getBytes());
-		binaryJedisCommands.set((cableSectionData.getUuid()+"cableTwoHundredForty").getBytes(),cableTwoHundredFortyListJson.getBytes());
-		binaryJedisCommands.set((cableSectionData.getUuid()+"cableSeventy").getBytes(),cableSeventyListJson.getBytes());
-		binaryJedisCommands.expire((cableSectionData.getUuid()+"cableDisposeData").getBytes(),86400);
-		binaryJedisCommands.expire((cableSectionData.getUuid()+"cableFourHundred").getBytes(),86400);
-		binaryJedisCommands.expire((cableSectionData.getUuid()+"cableHundredAndTwenty").getBytes(),86400);
-		binaryJedisCommands.expire((cableSectionData.getUuid()+"cableThreeHundred").getBytes(),86400);
-		binaryJedisCommands.expire((cableSectionData.getUuid()+"cableTwoHundredForty").getBytes(),86400);
-		binaryJedisCommands.expire((cableSectionData.getUuid()+"cableSeventy").getBytes(),86400);
+		try {
+			BinaryJedisCommands binaryJedisCommands = client.get();
+			binaryJedisCommands.set((cableSectionData.getUuid()+"cableDisposeData").getBytes(),cableDisposeDataJson.getBytes());
+			binaryJedisCommands.set((cableSectionData.getUuid()+"cableFourHundred").getBytes(),cableFourHundredListJson.getBytes());
+			binaryJedisCommands.set((cableSectionData.getUuid()+"cableHundredAndTwenty").getBytes(),cableHundredAndTwentyListJson.getBytes());
+			binaryJedisCommands.set((cableSectionData.getUuid()+"cableThreeHundred").getBytes(),cableThreeHundredListJson.getBytes());
+			binaryJedisCommands.set((cableSectionData.getUuid()+"cableTwoHundredForty").getBytes(),cableTwoHundredFortyListJson.getBytes());
+			binaryJedisCommands.set((cableSectionData.getUuid()+"cableSeventy").getBytes(),cableSeventyListJson.getBytes());
+			binaryJedisCommands.expire((cableSectionData.getUuid()+"cableDisposeData").getBytes(),86400);
+			binaryJedisCommands.expire((cableSectionData.getUuid()+"cableFourHundred").getBytes(),86400);
+			binaryJedisCommands.expire((cableSectionData.getUuid()+"cableHundredAndTwenty").getBytes(),86400);
+			binaryJedisCommands.expire((cableSectionData.getUuid()+"cableThreeHundred").getBytes(),86400);
+			binaryJedisCommands.expire((cableSectionData.getUuid()+"cableTwoHundredForty").getBytes(),86400);
+			binaryJedisCommands.expire((cableSectionData.getUuid()+"cableSeventy").getBytes(),86400);
+		}finally {
+			client.release();
+		}
 
-	}
 
+	}
+	/**
+	 * 拆旧材料清单计算处理
+	 * @param inventoryData
+	 */
+	@Transactional(readOnly = false)
+	public void saveInventory(InventoryData inventoryData) {
+		List<InventoryInfo> inventoryListData = inventoryData.getInventoryList();
+		String inventoryJson = JSON.toJSONString(inventoryListData);
+		CacheChannel channel = J2Cache.getChannel();
+		RedisClient client = ((RedisCacheProvider)channel.getL2Provider()).getRedisClient();
+		try {
+			BinaryJedisCommands binaryJedisCommands = client.get();
+			binaryJedisCommands.set((inventoryData.getUuid()+"inventory").getBytes(),inventoryJson.getBytes());
+			binaryJedisCommands.expire((inventoryData.getUuid()+"inventory").getBytes(),86400);
+		} finally {
+			client.release();
+		}
+	}
 	/**
 	 * 页面需要的数据
 	 * @param cableSectionData
@@ -538,14 +560,218 @@ public class RaiseCapitalDesignService extends CrudService<RaiseCapitalDesignMap
 		return dataList;
 	}
 
-	public List<InventoryInfo> InventoryData(){
+	public List<InventoryInfo> inventoryListData(){
 		List<InventoryInfo> list = Lists.newArrayList();
-		InventoryInfo inventory1=new InventoryInfo();
-		inventory1.setNum("1");
-		inventory1.setName("10kV电力电缆");
-		inventory1.setNum("YJV22-8.7/15-3×400");
-		inventory1.setNum("1");
-
+		InventoryInfo inventoryYi=new InventoryInfo();
+		inventoryYi.setNum("1");
+		inventoryYi.setName("10kV电力电缆");
+		inventoryYi.setSpecifications("YJV22-8.7/15-3×400");
+		inventoryYi.setCompany("米");
+		list.add(inventoryYi);
+
+		InventoryInfo inventoryEr=new InventoryInfo();
+		inventoryEr.setNum("1");
+		inventoryEr.setName("10kV电力电缆");
+		inventoryEr.setSpecifications("YJV22-8.7/15-3×300");
+		inventoryEr.setCompany("米");
+		list.add(inventoryEr);
+
+		InventoryInfo inventorySan=new InventoryInfo();
+		inventorySan.setNum("1");
+		inventorySan.setName("10kV电力电缆");
+		inventorySan.setSpecifications("YJV22-8.7/15-3×95");
+		inventorySan.setCompany("米");
+		list.add(inventorySan);
+
+		InventoryInfo inventorySi=new InventoryInfo();
+		inventorySi.setNum("1");
+		inventorySi.setName("10kV电力电缆");
+		inventorySi.setSpecifications("YJV22-8.7/15-3×35");
+		inventorySi.setCompany("米");
+		list.add(inventorySi);
+
+		InventoryInfo inventoryWu=new InventoryInfo();
+		inventoryWu.setNum("2");
+		inventoryWu.setName("10kV架空导线");
+		inventoryWu.setSpecifications("JKLYJ-240");
+		inventoryWu.setCompany("米");
+		inventoryWu.setRemarks("折单长度(单回路径)");
+		list.add(inventoryWu);
+
+		InventoryInfo inventoryLiu=new InventoryInfo();
+		inventoryLiu.setNum("2");
+		inventoryLiu.setName("10kV架空导线");
+		inventoryLiu.setSpecifications("JKLYJ-185");
+		inventoryLiu.setCompany("米");
+		list.add(inventoryLiu);
+
+		InventoryInfo inventoryQi=new InventoryInfo();
+		inventoryQi.setNum("2");
+		inventoryQi.setName("10kV架空导线");
+		inventoryQi.setSpecifications("JKLYJ-150");
+		inventoryQi.setCompany("米");
+		list.add(inventoryQi);
+
+		InventoryInfo inventoryBa=new InventoryInfo();
+		inventoryBa.setNum("2");
+		inventoryBa.setName("10kV架空导线");
+		inventoryBa.setSpecifications("LGJ-240");
+		inventoryBa.setCompany("米");
+		list.add(inventoryBa);
+
+		InventoryInfo inventoryJiu=new InventoryInfo();
+		inventoryJiu.setNum("2");
+		inventoryJiu.setName("10kV架空导线");
+		inventoryJiu.setSpecifications("LGJ-185");
+		inventoryJiu.setCompany("米");
+		list.add(inventoryJiu);
+
+		InventoryInfo inventoryShi=new InventoryInfo();
+		inventoryShi.setNum("2");
+		inventoryShi.setName("10kV架空导线");
+		inventoryShi.setSpecifications("LGJ-150");
+		inventoryShi.setCompany("米");
+		list.add(inventoryShi);
+
+		InventoryInfo inventoryShiYi=new InventoryInfo();
+		inventoryShiYi.setNum("3");
+		inventoryShiYi.setName("10kV电杆");
+		inventoryShiYi.setSpecifications("钢管杆");
+		inventoryShiYi.setCompany("基");
+		list.add(inventoryShiYi);
+
+		InventoryInfo inventoryShiEr=new InventoryInfo();
+		inventoryShiEr.setNum("3");
+		inventoryShiEr.setName("10kV电杆");
+		inventoryShiEr.setSpecifications("宅基塔");
+		inventoryShiEr.setCompany("基");
+		list.add(inventoryShiEr);
+
+		InventoryInfo inventoryShiSan=new InventoryInfo();
+		inventoryShiSan.setNum("3");
+		inventoryShiSan.setName("10kV电杆");
+		inventoryShiSan.setSpecifications("Φ190×15");
+		inventoryShiSan.setCompany("基");
+		list.add(inventoryShiSan);
+
+		InventoryInfo inventoryShiSi=new InventoryInfo();
+		inventoryShiSi.setNum("3");
+		inventoryShiSi.setName("10kV电杆");
+		inventoryShiSi.setSpecifications("Φ190×12");
+		inventoryShiSi.setCompany("基");
+		list.add(inventoryShiSi);
+
+		InventoryInfo inventoryShiWu=new InventoryInfo();
+		inventoryShiWu.setNum("4");
+		inventoryShiWu.setName("10kV电缆分支箱");
+		inventoryShiWu.setSpecifications("1进1出");
+		inventoryShiWu.setCompany("台");
+		list.add(inventoryShiWu);
+
+		InventoryInfo inventoryShiLiu=new InventoryInfo();
+		inventoryShiLiu.setNum("4");
+		inventoryShiLiu.setName("10kV电缆分支箱");
+		inventoryShiLiu.setSpecifications("1进2出");
+		inventoryShiLiu.setCompany("台");
+		list.add(inventoryShiLiu);
+
+		InventoryInfo inventoryShiQi=new InventoryInfo();
+		inventoryShiQi.setNum("4");
+		inventoryShiQi.setName("10kV电缆分支箱");
+		inventoryShiQi.setSpecifications("1进3出");
+		inventoryShiQi.setCompany("台");
+		list.add(inventoryShiQi);
+
+		InventoryInfo inventoryShiBa=new InventoryInfo();
+		inventoryShiBa.setNum("5");
+		inventoryShiBa.setName("10kV电缆环网柜");
+		inventoryShiBa.setSpecifications("2进2出");
+		inventoryShiBa.setCompany("台");
+		list.add(inventoryShiBa);
+
+		InventoryInfo inventoryShiJiu=new InventoryInfo();
+		inventoryShiJiu.setNum("5");
+		inventoryShiJiu.setName("10kV电缆环网柜");
+		inventoryShiJiu.setSpecifications("2进3出");
+		inventoryShiJiu.setCompany("台");
+		list.add(inventoryShiJiu);
+
+		InventoryInfo inventoryErYi=new InventoryInfo();
+		inventoryErYi.setNum("6");
+		inventoryErYi.setName("10kV变压器");
+		inventoryErYi.setSpecifications("50kVA");
+		inventoryErYi.setCompany("台");
+		list.add(inventoryErYi);
+
+		InventoryInfo inventoryErEr=new InventoryInfo();
+		inventoryErEr.setNum("6");
+		inventoryErEr.setName("10kV变压器");
+		inventoryErEr.setSpecifications("315kVA");
+		inventoryErEr.setCompany("台");
+		list.add(inventoryErEr);
+
+		InventoryInfo inventoryErSan=new InventoryInfo();
+		inventoryErSan.setNum("7");
+		inventoryErSan.setName("10kV柱上设备");
+		inventoryErSan.setSpecifications("断路器开关");
+		inventoryErSan.setCompany("台");
+		list.add(inventoryErSan);
+
+		InventoryInfo inventoryErSi=new InventoryInfo();
+		inventoryErSi.setNum("7");
+		inventoryErSi.setName("10kV柱上设备");
+		inventoryErSi.setSpecifications("SF6开关");
+		inventoryErSi.setCompany("台");
+		list.add(inventoryErSi);
+
+		InventoryInfo inventoryErWu=new InventoryInfo();
+		inventoryErWu.setNum("7");
+		inventoryErWu.setName("10kV柱上设备");
+		inventoryErWu.setSpecifications("熔断器");
+		inventoryErWu.setCompany("只");
+		list.add(inventoryErWu);
+
+		InventoryInfo inventoryErLiu=new InventoryInfo();
+		inventoryErLiu.setNum("8");
+		inventoryErLiu.setName("0.4kV电气设备");
+		inventoryErLiu.setSpecifications("低压综合配电箱");
+		inventoryErLiu.setCompany("套");
+		list.add(inventoryErLiu);
+
+		InventoryInfo inventoryErQi=new InventoryInfo();
+		inventoryErQi.setNum("8");
+		inventoryErQi.setName("0.4kV电气设备");
+		inventoryErQi.setSpecifications("低压综合配电箱");
+		inventoryErQi.setCompany("面");
+		list.add(inventoryErQi);
+
+		InventoryInfo inventoryErBa=new InventoryInfo();
+		inventoryErBa.setNum("9");
+		inventoryErBa.setName("0.4kV电缆");
+		inventoryErBa.setSpecifications("");
+		inventoryErBa.setCompany("米");
+		list.add(inventoryErBa);
+
+		InventoryInfo inventoryErJiu=new InventoryInfo();
+		inventoryErJiu.setNum("10");
+		inventoryErJiu.setName("铁附件");
+		inventoryErJiu.setSpecifications("变压器全套框架等");
+		inventoryErJiu.setCompany("吨");
+		list.add(inventoryErJiu);
+
+		InventoryInfo inventorySanYi=new InventoryInfo();
+		inventorySanYi.setNum("11");
+		inventorySanYi.setName("10kV箱变");
+		inventorySanYi.setSpecifications("");
+		inventorySanYi.setCompany("台");
+		list.add(inventorySanYi);
+
+		InventoryInfo inventorySanEr=new InventoryInfo();
+		inventorySanEr.setNum("12");
+		inventorySanEr.setName("10kV箱变");
+		inventorySanEr.setSpecifications("");
+		inventorySanEr.setCompany("台");
+		list.add(inventorySanEr);
 		return list;
 	}
 }

+ 22 - 0
src/main/java/com/jeeplus/modules/sg/raiseCapitalDesign/web/RaiseCapitalDesignController.java

@@ -241,6 +241,28 @@ public class RaiseCapitalDesignController extends BaseController {
 		j.setMsg("处理完成");
 		return j;
 	}
+	/**
+	 * 电缆分段计算处理
+	 */
+	@ResponseBody
+	@RequestMapping(value = "saveInventory")
+	public AjaxJson saveInventory(InventoryData inventoryData, Model model) throws Exception{
+		AjaxJson j = new AjaxJson();
+		/**
+		 * 后台hibernate-validation插件校验
+		 */
+		String errMsg = beanValidator(inventoryData);
+		if (StringUtils.isNotBlank(errMsg)){
+			j.setSuccess(false);
+			j.setMsg(errMsg);
+			return j;
+		}
+		//新增或编辑表单保存
+		raiseCapitalDesignService.saveInventory(inventoryData);//处理
+		j.setSuccess(true);
+		j.setMsg("处理完成");
+		return j;
+	}
 
 	/**
 	 * 保存提资表单

+ 135 - 0
src/main/webapp/webpage/modules/sg/raiseCapitalDesign/inventoryForm.jsp

@@ -0,0 +1,135 @@
+<%@ 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() {
+	        $('#inDate').datetimepicker({
+				 format: "YYYY-MM-DD HH:mm:ss"
+		    });
+		});
+
+		function save() {
+            var isValidate = jp.validateForm('#inputForm');//校验表单
+            if(!isValidate){
+                return false;
+			}else{
+            	var uuid = $("#uuid").val();
+                jp.loading();
+                jp.post("${ctx}/raiseCapitalDesign/saveInventory",$('#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);
+                    }
+                })
+			}
+
+        }
+		function addRow(list, idx, tpl, row){
+			$(list).append(Mustache.render(tpl, {
+				idx: idx, delBtn: true, row: row
+			}));
+			$(list+idx).find("select").each(function(){
+				$(this).val($(this).attr("data-value"));
+			});
+			$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+				var ss = $(this).attr("data-value").split(',');
+				for (var i=0; i<ss.length; i++){
+					if($(this).val() == ss[i]){
+						$(this).attr("checked","checked");
+					}
+				}
+			});
+			$(list+idx).find(".form_datetime").each(function(){
+				 $(this).datetimepicker({
+					 format: "YYYY-MM-DD HH:mm:ss"
+			    });
+			});
+		}
+		function delRow(obj, prefix){
+			var id = $(prefix+"_id");
+			var delFlag = $(prefix+"_delFlag");
+			if (id.val() == ""){
+				$(obj).parent().parent().remove();
+			}else if(delFlag.val() == "0"){
+				delFlag.val("1");
+				$(obj).html("&divide;").attr("title", "撤销删除");
+				$(obj).parent().parent().addClass("error");
+			}else if(delFlag.val() == "1"){
+				delFlag.val("0");
+				$(obj).html("&times;").attr("title", "删除");
+				$(obj).parent().parent().removeClass("error");
+			}
+		}
+	</script>
+</head>
+<body class="bg-white">
+		<form:form id="inputForm" modelAttribute="inventoryData" action="${ctx}/filing/basicInformation/save" method="post" class="form-horizontal">
+			<input type="hidden" id="uuid" name="uuid" value="${uuid}">
+			<div class="tabs-container">
+				<div class="tab-content">
+					<div id="tab-1" class="tab-pane fade in  active">
+				<table class="table table-striped table-bordered table-condensed">
+					<thead>
+						<tr>
+							<th class="hide"></th>
+							<th>序号</th>
+							<th>名称</th>
+							<th>规格</th>
+							<th>单位</th>
+							<th>数量</th>
+							<th>备注</th>
+						</tr>
+					</thead>
+					<tbody id="inventoryList">
+					</tbody>
+				</table>
+				<script type="text/template" id="basicInformationTpl">//<!--
+					<tr id="inventoryList{{idx}}">
+						<td class="hide">
+						</td>
+						<td  class="max-width-250">
+						<input type='text' id="inventoryList[{{idx}}]_num"  name="inventoryList[{{idx}}].num" readonly= "true" class="form-control"  value="{{row.num}}"/>
+						</td>
+						<td  class="max-width-250">
+						<input type='text' id="inventoryList[{{idx}}]_name"  name="inventoryList[{{idx}}].name" readonly= "true" class="form-control"  value="{{row.name}}"/>
+						</td>
+						<td  class="max-width-250">
+						<input type='text' id="inventoryList[{{idx}}]_specifications"  name="inventoryList[{{idx}}].specifications" readonly= "true" class="form-control"  value="{{row.specifications}}"/>
+						</td>
+						<td  class="max-width-250">
+						<input type='text' id="inventoryList[{{idx}}]_company"  name="inventoryList[{{idx}}].company" readonly= "true" class="form-control"  value="{{row.company}}"/>
+						</td>
+
+						<td  class="max-width-250">
+							<input type='text' id="inventoryList[{{idx}}]_quantity" name="inventoryList[{{idx}}].quantity" placeholder="请输入数字"  class="form-control number"  value="{{row.quantity}}"/>
+						</td>
+						<td class="max-width-250">
+							<input type='text' id="inventoryList[{{idx}}]_remarks" name="inventoryList[{{idx}}].remarks" class="form-control"  value="{{row.remarks}}"/>
+						</td>
+					</tr>//-->
+				</script>
+				<script type="text/javascript">
+					var basicInformationRowIdx = 0, basicInformationTpl = $("#basicInformationTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+					$(document).ready(function() {
+						var data = ${fns:toJson(inventoryList)};
+						for (var i=0; i<data.length; i++){
+							console.log(data[i])
+							addRow('#inventoryList', basicInformationRowIdx, basicInformationTpl, data[i]);
+							basicInformationRowIdx = basicInformationRowIdx + 1;
+						}
+					});
+				</script>
+				</div>
+			</div>
+		</div>
+		</form:form>
+</body>
+</html>

+ 3 - 0
src/main/webapp/webpage/modules/sg/raiseCapitalDesign/raiseCapitalDesign.jsp

@@ -106,6 +106,9 @@
 						<button id="cableSection" class="btn btn-primary" onclick="cableSection()">
 							电缆分段
 						</button>
+						<button id="cableSection" class="btn btn-primary" onclick="inventory()">
+							拆旧材料清册
+						</button>
 					<%--</shiro:hasPermission>--%>
 				</div>
 				<table class="table table-view">