From 8e7e1f00d59df88f2f5ee120891cad692be4eafe Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期日, 24 十二月 2023 14:12:45 +0800
Subject: [PATCH] 点检标准导入

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/DailyInspectionStandardController.java |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/DailyInspectionStandardController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/DailyInspectionStandardController.java
index b93032f..26e2a1d 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/DailyInspectionStandardController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/DailyInspectionStandardController.java
@@ -293,18 +293,23 @@
                         Sheet sheet = workbook.getSheetAt(i);
                         for (Row row : sheet) {
                             // 閬嶅巻姣忎竴涓崟鍏冩牸
-                            for (Cell cell : row) {
+//                            for (Cell cell : row) {
+                            for(int j = 0;j < 5;j++){
                                 // 澶勭悊鍗曞厓鏍兼暟鎹紝渚嬪杈撳嚭鍗曞厓鏍肩殑鍊�
+                                Cell cell = row.getCell(j);
+//                                if("STRING".equals(cell.getCellType().toString())|| "BLANK".equals(cell.getCellType().toString())){
                                 if("STRING".equals(cell.getCellType().toString())|| "BLANK".equals(cell.getCellType().toString())){
                                     //鐐规鍛ㄦ湡瀛樺湪锛屽垽鏂澶囩粺涓�缂栫爜鏄惁瀛樺湪
-                                    if(cell.getStringCellValue().contains("璁惧鍚嶇О锛�")){
-                                        String[] tybh1  = cell.getStringCellValue().split("缁熶竴缂栧彿锛�");
+                                    String strCell = cell.getStringCellValue();
+                                    if(strCell.contains("璁惧鍚嶇О锛�")){
+                                        String[] tybh1  = strCell.split("缁熶竴缂栧彿锛�");
                                         String[] tybh2 = tybh1[1].split("骞�");
-                                        equipmentNum = tybh2[0].trim().substring(0,tybh2[0].trim().length()-4).trim();
+//                                        equipmentNum = tybh2[0].trim().substring(0,tybh2[0].trim().length()-4).trim();
+                                        equipmentNum = tybh2[0].trim();
                                         /*String year =  tybh2[0].trim().substring(tybh2[0].trim().length()-4,tybh2[0].trim().length()).trim();
                                         String[] month1 = tybh2[1].split("鏈�");
                                         String month = month1[0].trim();
-                                        String[] unit1 = cell.getStringCellValue().split("鍗曚綅锛�");
+                                        String[] unit1 = strCell.split("鍗曚綅锛�");
                                         String unit = unit1[1].trim();*/
                                         Equipment equipment = equipmentService.lambdaQuery().eq(Equipment::getNum,equipmentNum).eq(Equipment::getDelFlag, CommonConstant.DEL_FLAG_0).one();
                                         if(equipment == null){
@@ -325,7 +330,7 @@
                                                 dailyInspectionStandard.setVersion("1.0");
                                                 dailyInspectionStandard.setAssignMode("1");
                                                 dailyInspectionStandard.setEquipmentId(equipment.getId());
-                                                dailyInspectionStandard.setApprovalStatus("1");
+                                                dailyInspectionStandard.setApprovalStatus("5");
                                                 //dailyInspectionStandardService.save(dailyInspectionStandard);
                                                 //dailyInspectionStandardId = dailyInspectionStandard.getId();
                                             }
@@ -334,20 +339,20 @@
                                     }
                                     //璁惧缁熶竴缂栫爜瀛樺湪锛屽垽鏂偣妫�椤圭洰鏄惁瀛樺湪
                                     if(c == 0){
-                                        System.out.print(cell.getStringCellValue() + "\t");
-                                        if(cell.getStringCellValue().contains("鐐规椤圭洰")){
+                                        System.out.print(strCell + "\t");
+                                        if(strCell.contains("鐐规椤圭洰")){
                                             a = 1;
                                             projectColumnIndex = cell.getColumnIndex();
                                             break;
                                         }
-                                        if(cell.getStringCellValue().contains("缁存姢璐d换浜虹瀛�")){
+                                        if(strCell.contains("缁存姢璐d换浜虹瀛�")){
                                             a = 0;
                                         }
                                         if(projectColumnIndex == cell.getColumnIndex() && a == 1){
                                             DailyInspectionStandardDetail dailyInspectionStandardDetail = new DailyInspectionStandardDetail();
                                             dailyInspectionStandardDetail.setDailyInspectionStandardId(dailyInspectionStandardId);
                                             String dayInspectionProjectName = row.getCell(projectColumnIndex).toString();
-                                            String standard = row.getCell(projectColumnIndex+1).toString();
+                                            String standard = row.getCell(projectColumnIndex+3).toString();
                                             //鏌ヨ鐐瑰嚮椤圭洰锛屽鏋滄病鏈夋柊澧炵偣妫�椤圭洰
                                             if(StringUtils.isNotBlank(dayInspectionProjectName)){
                                                 List<InspectionProject> inspectionProjectList = inspectionProjectService.lambdaQuery().eq(InspectionProject::getName,dayInspectionProjectName).eq(InspectionProject::getDelFlag,CommonConstant.DEL_FLAG_0).list();
@@ -372,12 +377,13 @@
                                             }
                                             break;
                                         }
-                                        if(cell.getStringCellValue().contains("鍛ㄤ繚鍏婚」鐩�")){
+
+                                        if(strCell.contains("鍛ㄤ繚鍏婚」鐩�")){
                                             b = 1;
                                             maintenanceColumnIndex = cell.getColumnIndex();
                                             break;
                                         }
-                                        if(cell.getStringCellValue().contains("鍛ㄤ繚鍏绘搷浣滆�呮墽琛�")){
+                                        if(strCell.contains("鍛ㄤ繚鍏绘搷浣滆�呮墽琛�")){
                                             b = 0;
                                             dailyInspectionStandardService.save(dailyInspectionStandard);
                                             for(DailyInspectionStandardDetail dailyInspectionStandardDetail : dailyInspectionStandardDetailList){
@@ -392,7 +398,7 @@
                                             DailyInspectionStandardDetail dailyInspectionStandardDetail = new DailyInspectionStandardDetail();
                                             dailyInspectionStandardDetail.setDailyInspectionStandardId(dailyInspectionStandardId);
                                             String weekInspectionProjectName = row.getCell(maintenanceColumnIndex).toString();
-                                            String inspectionStandardName = row.getCell(maintenanceColumnIndex+1).toString();
+                                            String inspectionStandardName = row.getCell(maintenanceColumnIndex+3).toString();
                                             if(StringUtils.isNotBlank(weekInspectionProjectName)){
                                                 List<InspectionProject> inspectionProjectList = inspectionProjectService.lambdaQuery().eq(InspectionProject::getName,weekInspectionProjectName).eq(InspectionProject::getDelFlag,CommonConstant.DEL_FLAG_0).list();
                                                 if(CollectionUtils.isEmpty(inspectionProjectList)){

--
Gitblit v1.9.3