From 1eeae82f74cbb3469ad8931e45b6fc77a945b912 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: 星期一, 23 十月 2023 16:10:08 +0800
Subject: [PATCH] 姑苏实验室去除价格确认过程

---
 src/main/java/com/nanometer/smartlab/controller/LaboratoryMngController.java |   50 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/controller/LaboratoryMngController.java b/src/main/java/com/nanometer/smartlab/controller/LaboratoryMngController.java
index 86ff06f..aa97f57 100644
--- a/src/main/java/com/nanometer/smartlab/controller/LaboratoryMngController.java
+++ b/src/main/java/com/nanometer/smartlab/controller/LaboratoryMngController.java
@@ -9,6 +9,7 @@
 import com.nanometer.smartlab.entity.BaseMeta;
 import com.nanometer.smartlab.entity.SysReagent;
 import com.nanometer.smartlab.service.BaseMetaService;
+import com.nanometer.smartlab.service.SysLaboratoryContainerService;
 import com.nanometer.smartlab.service.SysProjectService;
 import org.apache.log4j.Logger;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -43,6 +44,8 @@
 	@Resource
 	private SysLaboratoryService sysLaboratoryService;
 	@Resource
+	private SysLaboratoryContainerService sysLaboratoryContainerService;
+	@Resource
 	private BaseMetaService baseMetaService;
 	@Resource
 	private SysProjectService sysProjectService;
@@ -60,6 +63,7 @@
 	private List<SysLaboratory> selectedList;
 	private String type;
 	private String name;
+	private String project;
 
 	private int action;
 
@@ -84,7 +88,7 @@
 
 	public void exportLab2Excel(){
 		try {
-			List<Map> list = sysLaboratoryService.exportLabList(type, name);
+			List<Map> list = sysLaboratoryService.exportLabList(type, name,project);
 			sysLaboratoryService.exportLab2Excel(list);
 			FacesUtils.info("导出成功");
 		}catch (Exception e){
@@ -94,7 +98,6 @@
 	}
 
 	public void uploadFile(FileUploadEvent event) {
-		System.out.println("=========导入开始=====");
 		List<BaseMeta> typeList=baseMetaService.getBaseMetaList("laboratory_type");
 		List<BaseMeta> departList=baseMetaService.getBaseMetaList("user_department");
 		try{
@@ -150,10 +153,10 @@
 
 					}
 					valuesList.add(cellInfo);
-
-
 				}
-				System.out.println("value :     "+valuesList);
+				if (valuesList.size() != 8){
+					break;
+				}
 				SysLaboratory laboratory=new SysLaboratory();
 				laboratory.setType(returnTypeId(typeList,valuesList.get(0)));
 				laboratory.setName(valuesList.get(1));
@@ -179,7 +182,6 @@
 				sysLaboratories.add(laboratory);
 			}
 			sysLaboratoryService.insertSysReagentList(sysLaboratories);
-			System.out.println("=========导入结束=====");
 			FacesUtils.info("导入成功。");
 		}catch (Exception ex) {
 			ex.printStackTrace();
@@ -262,6 +264,7 @@
 			}
 
 			this.sysLaboratoryService.deleteSysLaboratory(this.selectedList);
+			this.sysLaboratoryContainerService.delBySlcIds(this.selectedList);
 
 			FacesUtils.info("删除成功。");
 		} catch (Exception e) {
@@ -279,11 +282,12 @@
 						Map<String, Object> filters) {
 					List<SysLaboratory> list = null;
 					try {
-						int count = sysLaboratoryService.getSysLaboratoryTotalCount(type, name);
+						int count = sysLaboratoryService.getSysLaboratoryTotalCount(type, name,project);
 						this.setRowCount(count);
 						if (count > 0) {
-							list = sysLaboratoryService.getSysLaboratoryList(type, name, first, pageSize);
+							list = sysLaboratoryService.getSysLaboratoryList(type, name,project, first, pageSize);
 						}
+						selectedList = new ArrayList<> ();
 					} catch (Exception e) {
 						logger.error(e);
 					}
@@ -292,17 +296,17 @@
 
 				@Override
 				public SysLaboratory getRowData(String rowKey) {
-					Iterator<SysLaboratory> iterator = this.iterator();
-					if (iterator != null) {
-						SysLaboratory su = null;
-						while (iterator.hasNext()) {
-							su = iterator.next();
-							if (rowKey.equals(su.getId())) {
-								return su;
-							}
-						}
-					}
-					return null;
+//					Iterator<SysLaboratory> iterator = this.iterator();
+//					if (iterator != null) {
+//						SysLaboratory su = null;
+//						while (iterator.hasNext()) {
+//							su = iterator.next();
+//							if (rowKey.equals(su.getId())) {
+//								return su;
+//							}
+//						}
+//					}
+					return sysLaboratoryService.getSysLaboratory(rowKey);
 				}
 			};
 		}
@@ -344,4 +348,12 @@
 	public void setType(String type) {
 		this.type = type;
 	}
+
+	public String getProject() {
+		return project;
+	}
+
+	public void setProject(String project) {
+		this.project = project;
+	}
 }

--
Gitblit v1.9.2