소스 검색

材料库代码

user5 3 년 전
부모
커밋
d12168548a

+ 14 - 13
src/main/java/com/jeeplus/modules/projectmaterialstorage/entity/ProjectMaterialStorage.java

@@ -1,23 +1,26 @@
 package com.jeeplus.modules.projectmaterialstorage.entity;
 
+import com.google.common.collect.Lists;
 import com.jeeplus.common.persistence.DataEntity;
 import com.jeeplus.common.utils.excel.annotation.ExcelField;
 import com.jeeplus.modules.project.entity.Project;
 import com.jeeplus.modules.sys.entity.Area;
-import org.bouncycastle.asn1.cms.PasswordRecipientInfo;
 
 import java.util.Date;
+import java.util.List;
 
 public class ProjectMaterialStorage extends DataEntity<ProjectMaterialStorage> {
 
     private static final long serialVersionUID = 1707305231298038352L;
 
-    private String id;
-
     private String projectNumber;  //报告号
 
     private Double price ; //材料价格
 
+    //材料信息数据表集合
+    private List<projectMaterialStorageImport> projectMaterialStorageList = Lists.newArrayList();
+
+
     public Date getBeginDate() {
         return beginDate;
     }
@@ -72,16 +75,6 @@ public class ProjectMaterialStorage extends DataEntity<ProjectMaterialStorage> {
         return projectName;
     }
 
-    @Override
-    public String getId() {
-        return id;
-    }
-
-    @Override
-    public void setId(String id) {
-        this.id = id;
-    }
-
     public void setProjectName(String projectName) {
         this.projectName = projectName;
     }
@@ -145,4 +138,12 @@ public class ProjectMaterialStorage extends DataEntity<ProjectMaterialStorage> {
     public void setUnit(String unit) {
         this.unit = unit;
     }
+
+    public List<projectMaterialStorageImport> getProjectMaterialStorageList() {
+        return projectMaterialStorageList;
+    }
+
+    public void setProjectMaterialStorageList(List<projectMaterialStorageImport> projectMaterialStorageList) {
+        this.projectMaterialStorageList = projectMaterialStorageList;
+    }
 }

+ 63 - 0
src/main/java/com/jeeplus/modules/projectmaterialstorage/entity/projectMaterialStorageImport.java

@@ -0,0 +1,63 @@
+package com.jeeplus.modules.projectmaterialstorage.entity;
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.modules.project.entity.Project;
+
+/**
+ * @author: 徐滕
+ * @version: 2022-07-04 17:16
+ */
+public class projectMaterialStorageImport extends DataEntity<projectMaterialStorageImport> {
+
+
+
+    private String projectNumber;  //报告号
+
+    private Double price ; //材料价格
+
+    private String materialName; //材料名称
+
+    private Project project;  //项目
+
+    private String unit; //单位
+
+    public String getProjectNumber() {
+        return projectNumber;
+    }
+
+    public void setProjectNumber(String projectNumber) {
+        this.projectNumber = projectNumber;
+    }
+
+    public Double getPrice() {
+        return price;
+    }
+
+    public void setPrice(Double price) {
+        this.price = price;
+    }
+
+    public String getMaterialName() {
+        return materialName;
+    }
+
+    public void setMaterialName(String materialName) {
+        this.materialName = materialName;
+    }
+
+    public Project getProject() {
+        return project;
+    }
+
+    public void setProject(Project project) {
+        this.project = project;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+}

+ 5 - 12
src/main/java/com/jeeplus/modules/projectmaterialstorage/service/ProjectMaterialStorageService.java

@@ -1,28 +1,16 @@
 package com.jeeplus.modules.projectmaterialstorage.service;
 
 
-import afu.org.checkerframework.checker.igj.qual.I;
-import afu.org.checkerframework.checker.igj.qual.ReadOnly;
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.service.CrudService;
-import com.jeeplus.common.utils.IdGen;
-import com.jeeplus.common.utils.MenuStatusEnum;
 import com.jeeplus.modules.projectmaterialstorage.dao.ProjectMaterialStorageDao;
 import com.jeeplus.modules.projectmaterialstorage.entity.ProjectMaterialStorage;
-import com.jeeplus.modules.projectmaterialstorage.entity.ProjectMaterialStorageExport;
 import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectRecordsDao;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
-import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecordsExport;
-import com.jeeplus.modules.sys.utils.UserUtils;
-import com.sun.org.apache.xpath.internal.operations.Bool;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.List;
-
 /**
  * 项目表Service
  * @author gx
@@ -76,6 +64,11 @@ public class ProjectMaterialStorageService extends CrudService<ProjectMaterialSt
      * 查询同项目名称、价格、材料名称的数量是否只有一个
      */
     public Boolean qureyCountAboutProjectMaterialStorage(ProjectMaterialStorage projectMaterialStorage){
+        //材料列表自身重复判断
+
+        //材料列表数据库重复判断
+
+        //如果重复,重复的材料名称以String形式抛出到前端
 
         if(projectMaterialStorageDao.selectCountAboutProjectMaterialStorage(projectMaterialStorage) != 1){
             return false;

+ 10 - 4
src/main/webapp/webpage/modules/projectMaterialStorage/projectMaterialStorageForm.jsp

@@ -138,6 +138,13 @@
 				addRow1('#projectMaterialStorageList', projectMaterialStorageListRowIdx, projectMaterialStorageListTpl, data[i])
 			}
 		}
+		function num(obj){
+			obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
+			obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
+			obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
+			obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
+			obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
+		}
 	</script>
 </head>
 <body>
@@ -168,18 +175,17 @@
 				<script type="text/template" id="projectMaterialStorageListTpl">//<!--
                     <tr id="projectMaterialStorageList{{idx}}">
                         <td class="hide">
-                            <input id="projectMaterialStorageList{{idx}}_invoiceId" name="projectMaterialStorageList[{{idx}}].invoiceId" type="hidden" value="{{row.invoiceId}}"/>
 							<input id="projectMaterialStorageList{{idx}}_projectId" name="projectMaterialStorageList[{{idx}}].projectId" type="hidden" value="{{row.projectId}}"/>
 							<input id="projectMaterialStorageList{{idx}}_delFlag" name="projectMaterialStorageList[{{idx}}].delFlag" type="hidden" value="0"/>
                         </td>
                         <td>
-							<input id="projectMaterialStorageList{{idx}}_materialName" name = "materialName"  type="text" value="{{row.materialName}}"  class="form-control"/>
+							<input id="projectMaterialStorageList{{idx}}_materialName" name = "projectMaterialStorageList[{{idx}}].materialName"  type="text" value="{{row.materialName}}"  class="form-control"/>
                         </td>
                         <td>
-							<input id="projectMaterialStorageList{{idx}}_price" name = "price"   type="text" value="{{row.price}}"  class="form-control"/>
+							<input id="projectMaterialStorageList{{idx}}_price" name = "projectMaterialStorageList[{{idx}}].price"   type="text" value="{{row.price}}"   onkeyup="num(this)" class="form-control"/>
                         </td>
                         <td>
-							<input id="projectMaterialStorageList{{idx}}_unit" name = "unit"  type="text" value="{{row.unit}}"  class="form-control"/>
+							<input id="projectMaterialStorageList{{idx}}_unit" name = "projectMaterialStorageList[{{idx}}].unit"  type="text" value="{{row.unit}}"  class="form-control"/>
                         </td>
                         <td class="text-center op-td" >
                             {{#delBtn}}<span class="op-btn op-btn-delete" onclick="delRow(this, '#projectMaterialStorageList{{idx}}')" title="删除"><i class="glyphicon glyphicon-remove"></i>&nbsp;删除</span>{{/delBtn}}

+ 2 - 2
src/main/webapp/webpage/modules/ruralprojectrecords/cost/ruralCostProjectMessageList.jsp

@@ -177,7 +177,7 @@
 			});
 		}
 
-		function openDialogre(title,url,width,height,target,buttons) {
+		function openDialogreMaterialStorage(title,url,width,height,target,buttons) {
 
 			if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {//如果是移动端,就使用自适应大小弹窗
 				width = 'auto';
@@ -1016,7 +1016,7 @@
 			<shiro:hasPermission name="ruralProject:ruralCostProjectMessage:projectMaterialStorage">
 				//材料库处理按钮
 				if (d.projectMaterialStorageStatus==1){
-					xml+="<a href=\"#\" onclick=\"openDialogre('添加项目材料信息', '${ctx}/project/projectMaterialStorage/form?id=" + d.id +"','95%', '95%','','提交,关闭')\" class=\"layui-btn layui-btn-xs layui-bg-blue\" style='height: 32px;margin-top: 5px;margin-bottom: 5px;' > 材料库处理</a>";
+					xml+="<a href=\"#\" onclick=\"openDialogreMaterialStorage('添加项目材料信息', '${ctx}/project/projectMaterialStorage/form?id=" + d.id +"','95%', '95%','','提交,关闭')\" class=\"layui-btn layui-btn-xs layui-bg-blue\" style='height: 32px;margin-top: 5px;margin-bottom: 5px;' > 材料库处理</a>";
 				}
 			</shiro:hasPermission>