shi'sen'yuan 3 yıl önce
ebeveyn
işleme
21fccfb305

+ 134 - 19
master/src/main/java/com/ruoyi/project/ehs/controller/TMsdsController.java

@@ -9,6 +9,8 @@ import java.util.List;
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.file.ExcelUtils;
+import com.ruoyi.project.plant.domain.TStaffmgr;
+import com.ruoyi.project.plant.service.ITStaffmgrService;
 import com.ruoyi.project.system.domain.SysDept;
 import com.ruoyi.project.system.domain.SysDictData;
 import com.ruoyi.project.system.service.ISysDeptService;
@@ -46,6 +48,9 @@ public class TMsdsController extends BaseController
     @Autowired
     private ISysDeptService iSysDeptService;
 
+    @Autowired
+    private ITStaffmgrService tStaffmgrService;
+
     /**
      * 查询MSDS管理列表
      */
@@ -135,8 +140,16 @@ public class TMsdsController extends BaseController
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         //字典查询
         List<SysDictData> plant = iSysDictTypeService.selectDictDataByType("PLANT_DIVIDE");
+        List<SysDictData> productCategory = iSysDictTypeService.selectDictDataByType("PRODUCT_CATEGORY");
+        List<SysDictData> hazardPhrases = iSysDictTypeService.selectDictDataByType("HAZARD_PHRASES");
+        List<SysDictData> cmr = iSysDictTypeService.selectDictDataByType("CMR");
+        List<SysDictData> ghsPictogram = iSysDictTypeService.selectDictDataByType("GHS_PICTOGRAM");
+        List<SysDictData> workArea = iSysDictTypeService.selectDictDataByType("WORK_AREA");
+        List<SysDictData> reviewState = iSysDictTypeService.selectDictDataByType("REVIEW_STATE");
         //部门查询
         List<SysDept> dept = iSysDeptService.selectDeptList(new SysDept());
+        //人员查询
+        List<TStaffmgr> staffmgrs = tStaffmgrService.selectTStaffmgrList(new TStaffmgr());
         int rowNum = sheet.getPhysicalNumberOfRows();
         int failNumber = 0;
         for (int i = 1; i < rowNum; i++) {
@@ -150,45 +163,147 @@ public class TMsdsController extends BaseController
                     cell.setCellType(CellType.STRING);
                     String cellValue = ExcelUtils.getCellValue(cell);
                     logger.info("cellValue:" + cellValue);
-                    /*if (j == 0) {
-                        for (SysDictData p : plant) {
+                    if (j == 0) {
+                        entity.setItem(Long.parseLong(cellValue));//ITEM
+                    } else if (j == 1) {
+                        for (SysDictData p : productCategory) {
                             if (p.getDictLabel().equals(cellValue.trim())) {
-                                entity.setPlantCode(p.getDictValue());//装置名称
+                                entity.setProductcategory(p.getDictValue());//产品类别
                             }
                         }
-                    } else if (j == 1) {
-                        entity.setItem(cellValue);//ITEM
                     } else if (j == 2) {
-                        entity.setProductcategory(cellValue);//产品类别
-                    } else if (j == 3) {
                         entity.setEnName(cellValue);//英文名称
-                    } else if (j == 4) {
+                    } else if (j == 3) {
                         entity.setCnName(cellValue);//中文名称
-                    } else if (j == 5) {
+                    } else if (j == 4) {
                         entity.setCasNo(cellValue);//CAS号
+                    } else if (j == 5) {
+                        if (!cellValue.equals("")) {
+                            String[] hazard = cellValue.split(",");
+                            String hazardNo = "";
+                            int m = 0;
+                            for (String h : hazard) {
+                                for (SysDictData p : hazardPhrases) {
+                                    if (p.getDictLabel().equals(h)) {
+                                        if (m == 0) {
+                                            hazardNo = p.getDictValue();
+                                        }else {
+                                            hazardNo = hazardNo + "," + p.getDictValue();
+                                        }
+                                    }
+                                }
+                                m++;
+                            }
+                            entity.setHazardPhrases(hazardNo);//危险警句
+                        }
                     } else if (j == 6) {
-                        entity.setCnVersion(cellValue);//中文版次
+                        if (!cellValue.equals("")) {
+                            String[] cmrSplit = cellValue.split(",");
+                            String cmrdNo = "";
+                            int m = 0;
+                            for (String choose : cmrSplit) {
+                                for (SysDictData c : cmr) {
+                                    if (c.getDictLabel().equals(choose)) {
+                                        if (m == 0) {
+                                            cmrdNo = c.getDictValue();
+                                        }else {
+                                            cmrdNo = cmrdNo + "," + c.getDictValue();
+                                        }
+                                    }
+                                }
+                                m++;
+                            }
+                            entity.setCmr(cmrdNo);//是否三致物
+                        }
                     } else if (j == 7) {
-                        entity.setEnVersion(cellValue);//英文版次
+                        if (!cellValue.equals("")) {
+                            String[] ghs = cellValue.split(",");
+                            String ghsNo = "";
+                            int m = 0;
+                            for (String choose : ghs) {
+                                for (SysDictData p : ghsPictogram) {
+                                    if (p.getDictLabel().equals(choose)) {
+                                        if (m == 0) {
+                                            ghsNo = p.getDictValue();
+                                        }else {
+                                            ghsNo = ghsNo + "," + p.getDictValue();
+                                        }
+                                    }
+                                }
+                                m++;
+                            }
+                            entity.setGhsPictogram(ghsNo);//GHS符号
+                        }
                     } else if (j == 8) {
-                        entity.setSupplier(cellValue);//供应商
+                        entity.setHoldup(cellValue);//保存量
                     } else if (j == 9) {
-                        if (cellValue.length() > 3) {
-                            entity.setThisupdatetime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//本次更新时间
+                        if (!cellValue.equals("")) {
+                            String[] area = cellValue.split(",");
+                            String areaNo = "";
+                            int m = 0;
+                            for (String choose : area) {
+                                for (SysDictData w : workArea) {
+                                    if (w.getDictLabel().equals(choose)) {
+                                        if (m == 0) {
+                                            areaNo = w.getDictValue();
+                                        }else {
+                                            areaNo = areaNo + "," + w.getDictValue();
+                                        }
+                                    }
+                                }
+                                m++;
+                            }
+                            entity.setWorkArea(areaNo);//工作区域
                         }
                     } else if (j == 10) {
+                        entity.setForm(cellValue);//形态
+                    } else if (j == 11) {
+                        entity.setExplosionLimit(cellValue);//爆炸极限
+                    } else if (j == 12) {
+                        entity.setMeltingPoint(cellValue);//熔点
+                    } else if (j == 13) {
+                        entity.setBoilingPoint(cellValue);//沸点
+                    } else if (j == 14) {
+                        entity.setDensity(cellValue);//密度/分子量
+                    } else if (j == 15) {
+                        entity.setPurity(cellValue);//组成及纯度
+                    } else if (j == 16) {
+                        entity.setResponsibleCompany(cellValue);//归属单位
+                    } else if (j == 17) {
                         if (cellValue.length() > 3) {
-                            entity.setNextupdatetime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//下次更新时间
+                            entity.setIssueTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//出版日期
                         }
-                    } else if (j == 11) {
+                    } else if (j == 18) {
+                        entity.setVersion(cellValue);//版次
+                    } else if (j == 20) {
+                        for (TStaffmgr s : staffmgrs) {
+                            if (s.getStaffid().equals(cellValue.trim())) {
+                                entity.setReviewer(s.getStaffid());//回顾人
+                            }
+                        }
+                    } else if (j == 21) {
+                        if (cellValue.length() > 3) {
+                            entity.setReviewdate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//回顾日期
+                        }
+                    } else if (j == 22) {
+                        for (SysDictData r : reviewState) {
+                            if (r.getDictLabel().equals(cellValue.trim())) {
+                                entity.setReviewState(r.getDictValue());//回顾状态
+                            }
+                        }
+                    } else if (j == 23) {
+                        if (cellValue.length() > 3) {
+                            entity.setNextReviewdate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//下次回顾日期
+                        }
+                    } else if (j == 24) {
+                        entity.setRemarks(cellValue);//备注
+                    } else if (j == 25) {
                         for (SysDept d : dept) {
                             if (d.getDeptName().equals(cellValue.trim())) {
                                 entity.setDeptId(d.getDeptId());//部门编号
                             }
                         }
-                    } else if (j == 12) {
-                        entity.setRemarks(cellValue);//备注
-                    }*/
+                    }
                 }
                 entity.setCreaterCode(userId.toString());
                 logger.info("entity:" + entity);

+ 58 - 56
master/src/main/java/com/ruoyi/project/ehs/domain/TMsds.java

@@ -30,7 +30,7 @@ public class TMsds extends BaseEntity {
     /**
      * 产品类别
      */
-    @Excel(name = "产品类别")
+    @Excel(name = "产品类别", dictType = "PRODUCT_CATEGORY")
     private String productcategory;
 
     /**
@@ -51,71 +51,36 @@ public class TMsds extends BaseEntity {
     @Excel(name = "CAS号")
     private String casNo;
 
-    /**
-     * 部门编号
-     */
-    private Long deptId;
-
-    /**
-     * 删除标识
-     */
-    private Long delFlag;
-
     /**
      * 危险警句(详细内容)
      */
-    @Excel(name = "危险警句", readConverterExp = "详=细内容")
+    @Excel(name = "危险警句", dictType = "HAZARD_PHRASES")
     private String hazardPhrases;
 
-    /**
-     * 备注
-     */
-    private String remarks;
-
     /**
      * 是否三致物
      */
-    @Excel(name = "是否三致物")
+    @Excel(name = "是否三致物", dictType = "CMR")
     private String cmr;
 
     /**
      * GHS符号
      */
-    @Excel(name = "GHS符号")
+    @Excel(name = "GHS符号", dictType = "GHS_PICTOGRAM")
     private String ghsPictogram;
 
-    /**
-     * 创建人
-     */
-    private String createrCode;
-
     /**
      * 保存量
      */
     @Excel(name = "保存量")
     private String holdup;
 
-    /**
-     * 创建日期
-     */
-    private Date createdate;
-
-    /**
-     * 更新人
-     */
-    private String updaterCode;
-
     /**
      * 工作区域
      */
-    @Excel(name = "工作区域")
+    @Excel(name = "工作区域", dictType = "WORK_AREA")
     private String workArea;
 
-    /**
-     * 更新日期
-     */
-    private Date updatedate;
-
     /**
      * 形态
      */
@@ -125,19 +90,19 @@ public class TMsds extends BaseEntity {
     /**
      * 爆炸极限(v%)
      */
-    @Excel(name = "爆炸极限", readConverterExp = "v=%")
+    @Excel(name = "爆炸极限(v%)")
     private String explosionLimit;
 
     /**
      * 熔点(℃)
      */
-    @Excel(name = "熔点", readConverterExp = "℃=")
+    @Excel(name = "熔点(℃)")
     private String meltingPoint;
 
     /**
      * 沸点(℃)
      */
-    @Excel(name = "沸点", readConverterExp = "℃=")
+    @Excel(name = "沸点(℃)")
     private String boilingPoint;
 
     /**
@@ -149,7 +114,7 @@ public class TMsds extends BaseEntity {
     /**
      * 组成及纯度(w/w)
      */
-    @Excel(name = "组成及纯度", readConverterExp = "w=/w")
+    @Excel(name = "组成及纯度(w/w)")
     private String purity;
 
     /**
@@ -166,16 +131,6 @@ public class TMsds extends BaseEntity {
     private Date issueTime;
     private String issueTimeYear;
 
-    /** 出版日期2 */
-    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
-    @Excel(name = "出版日期", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date issuetimeTwo;
-
-    /** 出版日期3 */
-    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
-    @Excel(name = "出版日期", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date issuetimeThree;
-
     /**
      * 版次
      */
@@ -185,8 +140,9 @@ public class TMsds extends BaseEntity {
     /**
      * 回顾人
      */
-    @Excel(name = "回顾人")
     private String reviewer;
+    @Excel(name = "回顾人")
+    private String reviewerName;
 
     /**
      * 回顾日期
@@ -198,7 +154,7 @@ public class TMsds extends BaseEntity {
     /**
      * 回顾状态
      */
-    @Excel(name = "回顾状态")
+    @Excel(name = "回顾状态", dictType = "REVIEW_STATE")
     private String reviewState;
 
     /**
@@ -208,6 +164,50 @@ public class TMsds extends BaseEntity {
     @Excel(name = "下次回顾日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date nextReviewdate;
 
+    /**
+     * 部门编号
+     */
+    private Long deptId;
+
+    /**
+     * 删除标识
+     */
+    private Long delFlag;
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    private String remarks;
+
+    /**
+     * 创建人
+     */
+    private String createrCode;
+
+    /**
+     * 创建日期
+     */
+    private Date createdate;
+
+    /**
+     * 更新人
+     */
+    private String updaterCode;
+
+    /**
+     * 更新日期
+     */
+    private Date updatedate;
+
+    /** 出版日期2 */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
+    private Date issuetimeTwo;
+
+    /** 出版日期3 */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
+    private Date issuetimeThree;
+
     /** 部门名称 */
     @Excel(name = "部门名称")
     private String deptName;
@@ -452,7 +452,9 @@ public class TMsds extends BaseEntity {
     public String getReviewer() {
         return reviewer;
     }
+    public String getReviewerName() { return reviewerName; }
 
+    public void setReviewerName(String reviewerName) { this.reviewerName = reviewerName; }
     public void setReviewdate(Date reviewdate) {
         this.reviewdate = reviewdate;
     }

+ 4 - 2
master/src/main/resources/mybatis/ehs/TMsdsMapper.xml

@@ -35,6 +35,7 @@
         <result property="issuetimeThree"    column="issuetime_three"    />
         <result property="version"    column="version"    />
         <result property="reviewer"    column="reviewer"    />
+        <result property="reviewerName"    column="name"    />
         <result property="reviewdate"    column="reviewdate"    />
         <result property="reviewState"    column="review_state"    />
         <result property="nextReviewdate"    column="next_reviewdate"    />
@@ -42,8 +43,9 @@
     </resultMap>
 
     <sql id="selectTMsdsVo">
-        select d.id, d.item, d.productcategory, d.en_name, d.cn_name, d.cas_no, d.dept_id, d.del_flag, d.hazard_phrases, d.cmr, d.remarks, d.creater_code, d.ghs_pictogram, d.createdate, d.holdup, d.updater_code, d.work_area, d.form, d.updatedate, d.explosion_limit, d.melting_point, d.boiling_point, d.density, d.purity, d.responsible_company, d.issue_time, d.version, d.reviewer, d.reviewdate, d.review_state, d.next_reviewdate, d.issuetime_two, d.issuetime_three ,s.dept_name from t_msds d
+        select d.id, d.item, d.productcategory, d.en_name, d.cn_name, d.cas_no, d.dept_id, d.del_flag, d.hazard_phrases, d.cmr, d.remarks, d.creater_code, d.ghs_pictogram, d.createdate, d.holdup, d.updater_code, d.work_area, d.form, d.updatedate, d.explosion_limit, d.melting_point, d.boiling_point, d.density, d.purity, d.responsible_company, d.issue_time, d.version, d.reviewer, t.name, d.reviewdate, d.review_state, d.next_reviewdate, d.issuetime_two, d.issuetime_three ,s.dept_name from t_msds d
       left join sys_dept s on s.dept_id = d.dept_id
+      left join t_staffmgr t on t.staffid = d.reviewer
     </sql>
 
     <select id="selectTMsdsList" parameterType="TMsds" resultMap="TMsdsResult">
@@ -63,7 +65,7 @@
 
     <select id="selectTMsdsById" parameterType="Long" resultMap="TMsdsResult">
         <include refid="selectTMsdsVo"/>
-        where id = #{id}
+        where d.id = #{id}
     </select>
 
     <insert id="insertTMsds" parameterType="TMsds">

BIN
master/src/main/resources/static/template/ehs/msds.xlsx


+ 7 - 19
ui/src/views/ehs/msds/index.vue

@@ -177,7 +177,7 @@
         </template>
       </el-table-column>
       <el-table-column :label="$t('版次')" align="center" prop="version" :show-overflow-tooltip="true"/>
-      <el-table-column :label="$t('回顾人')" align="center" prop="reviewer" :show-overflow-tooltip="true"/>
+      <el-table-column :label="$t('回顾人')" align="center" prop="reviewerName" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('回顾日期')" align="center" prop="reviewdate" width="100">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.reviewdate, '{y}-{m}-{d}') }}</span>
@@ -486,7 +486,7 @@
           <em>{{ $t('点击上传') }}</em>
         </div>
         <div class="el-upload__tip" slot="tip">
-          <el-checkbox v-model="upload.updateSupport" />{{ $t('是否更新已经存在的用户数据') }}
+          <!--<el-checkbox v-model="upload.updateSupport" />{{ $t('是否更新已经存在的用户数据') }}-->
           <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
         </div>
         <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
@@ -853,22 +853,6 @@
             _this.msdsList[key].workArea = workAreaName;
             _this.msdsList[key].hazardPhrasesid = value.hazardPhrases;
             _this.msdsList[key].hazardPhrases = hazardPhrasesName;
-            /** 查询姓名 **/
-            if (value.reviewer != null) {
-              let staffId = value.reviewer.split(",");
-              staffId.forEach(function (id, index) {
-                _this.stffmgrOptions.forEach(function (item) {
-                  if (item.staffid === id) {
-                    if (index === 0) {
-                      parentName = item.name
-                    }else {
-                      parentName = parentName + "," + item.name
-                    }
-                  }
-                });
-              });
-            }
-            _this.msdsList[key].reviewer=parentName;
 
             /** GHS符号判断 **/
             var ghsPictogram = null;
@@ -1184,7 +1168,11 @@
         this.upload.open = false;
         this.upload.isUploading = false;
         this.$refs.upload.clearFiles();
-        this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+        if (response.data[0] != null) {
+          this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+        }else {
+          this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+        }
         this.getList();
       },
       // 提交上传文件