Browse Source

Merge remote-tracking branch 'origin/demo_' into demo_

hfxc226 2 years ago
parent
commit
b804052672

+ 6 - 0
platform-dao/src/main/java/com/platform/dao/dto/store/OutStoreDetailDTO.java

@@ -148,4 +148,10 @@ public class OutStoreDetailDTO extends BaseDTO implements Serializable {
      * 是否出库:0退库,1出库
      */
     private Boolean isOut;
+    /**
+     * 打印新增字段
+     */
+    private String remark;  // 备注
+
+    private String unit;  // 单位
 }

+ 1 - 1
platform-dao/src/main/java/com/platform/dao/entity/sb/SbMeasureLog.java

@@ -42,7 +42,7 @@ public class SbMeasureLog implements Serializable {
      */
     private String no;
     /**
-     * 检查类型: 1-点检 2-巡检
+     * 检查类型: 1-点检 2-特种设备检定
      */
     private Integer type;
     /**

+ 7 - 0
platform-dao/src/main/java/com/platform/dao/entity/store/OutStoreDetail.java

@@ -103,4 +103,11 @@ public class OutStoreDetail implements Serializable{
      * 是否出库:0退库,1出库
      */
     private Boolean isOut;
+
+    /**
+     * 打印新增字段
+     */
+    private String remark;  // 备注
+
+    private String unit;  // 单位
 }

+ 27 - 0
platform-dao/src/main/java/com/platform/dao/enums/SbMeasureLogTypeEnum.java

@@ -0,0 +1,27 @@
+package com.platform.dao.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @Description 检定日志类型
+ * @Author chenyuehu
+ * @Date 2020/2/17
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Getter
+@AllArgsConstructor
+public enum SbMeasureLogTypeEnum {
+
+    /**
+     * 计量设备检定
+     */
+    BGCL(1),
+    /**
+     * 特种设备检定
+     */
+    TZSB(2);
+
+    private Integer value;
+
+}

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/store/OutStoreDetailVO.java

@@ -131,4 +131,8 @@ public class OutStoreDetailVO extends BaseVO implements Serializable {
      * 是否出库:0退库,1出库
      */
     private Boolean isOut;
+
+    private String remark;  // 备注
+
+    private String unit;  // 单位
 }

+ 6 - 0
platform-service/src/main/java/com/platform/service/sb/SbMeasureLogService.java

@@ -51,4 +51,10 @@ public interface SbMeasureLogService extends IBaseService<SbMeasureLog, SbMeasur
      * @param batchSbMeasureLog
      */
     void saveBatchMeasureLog(BatchSbMeasureLog batchSbMeasureLog);
+
+    /**
+     * 录入
+     * @param model
+     */
+    //void saveTZSBByDTTO(SbMeasureLogDTO model);
 }

+ 118 - 2
platform-service/src/main/java/com/platform/service/sb/impl/SbMeasureLogServiceImpl.java

@@ -159,8 +159,6 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
                 model.setType(1);
             }else if(sbInfo.getUseType().equals(SbUseType.BGCL.getValue())){
                 model.setType(2);
-            }else{
-                throw new BusinessException("非计量和非特种的设备, 无需填报检定记录");
             }
             sbInfo.setCheckDate(model.getLastDate());
             Integer checkPeriod = 0;// 默认12个月
@@ -462,4 +460,122 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
             });
         }
     }
+
+    /*@Override
+    public void saveTZSBByDTTO(SbMeasureLogDTO model) {
+        // 更新设备下次检定日期
+        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(model.getSbId());
+        SbInfo tempInfo = new SbInfo();
+        tempInfo.setId(sbInfo.getId());
+        // 判断设备状态,如果是在库,直接修改设备状态即可
+        if(model.getSbStatus()){
+            sbInfo.setStatus(SbInfoStatusEnum.IN_STORE.getValue());
+            String remark = "设备状态由【"+SbInfoStatusEnum.getNameByValue(sbInfo.getStatus())+"】 ---> 【";
+            remark += "在库】";
+            handleSbChangeRecord(remark,model,tempInfo,CommonConstants.CHANGE_TYPE_SB_STATUS);
+        }else{
+            model.setCheckUserId(SecurityUtils.getUserInfo().getUserId()); // 谁操作即是检定记录人
+            SbMeasureLog sbMeasureLog = super.saveModelByDTO(model);
+            model.setId(sbMeasureLog.getId());
+            tempInfo.setParentId(sbInfo.getParentId());
+            tempInfo.setPositionId(sbInfo.getPositionId());
+            if(sbInfo.getUseType().equals(SbUseType.BGCL.getValue())){
+                model.setType(1);
+            }else if(sbInfo.getUseType().equals(SbUseType.BGCL.getValue())){
+                model.setType(2);
+            }else{
+                throw new BusinessException("非计量和非特种的设备, 无需填报检定记录");
+            }
+            sbInfo.setCheckDate(model.getLastDate());
+            Integer checkPeriod = 0;// 默认12个月
+            if(model.getCheckPeriod() != null){
+                checkPeriod = model.getCheckPeriod();
+            }else{
+                throw new BusinessException("检定设备的检定周期未设置,无法计算下次检定日期,请先设置");
+            }
+            sbInfo.setNextCheckDate(model.getLastDate().minusMonths(-checkPeriod).minusDays(1));
+            sbInfo.setZaiz(model.getName());// 检定单位
+            sbInfo.setSbdh(model.getNo());// 检定编号
+            sbInfo.setRemark(model.getRemark());// 备注
+            sbInfo.setDph(model.getRequirement());// 检定人
+            sbInfo.setMeasureStatus(YesNoEnum.NO.getValue());// 每次检定后, 检定状态改为正常
+            sbInfo.setCheckPeriod(model.getCheckPeriod()); // 检定周期
+            // 设备位置变动
+            boolean insertAllocate = Boolean.FALSE; // 设备位置
+            boolean insertParent = Boolean.FALSE; // 父设备
+            boolean insertNo = Boolean.FALSE; // 设备位号
+            boolean insertZzh = Boolean.FALSE; // 出厂编码
+            String oldPositionId = getPureString(sbInfo.getPositionId());
+            String oldParentId = getPureString(sbInfo.getParentId());
+            String positionId = getPureString(model.getSbPositionId());
+            String parentId = getPureString(model.getSbParentId());
+            String oldSbPositionNo = getPureString(sbInfo.getPositionNo()); // 设备位号
+            String positionNo = getPureString(model.getSbPositionNo());
+            String oldZzh = getPureString(sbInfo.getZzh()); // 原出厂编码
+            String zzh = getPureString(model.getZzh()); // 出厂编码
+            StringBuilder remark1 = new StringBuilder();
+            StringBuilder remark2 = new StringBuilder();
+            StringBuilder remark3 = new StringBuilder();
+            if(!oldPositionId.equals(positionId)){
+                insertAllocate = Boolean.TRUE;
+                sbInfo.setPositionId(positionId);
+                String before = oldPositionId == "" ? oldPositionId : sbPositionMapper.selectNameById(oldPositionId);
+                remark1.append("设备位置变动【" + before).append("】 ---> ");
+                String after = positionId == "" ? positionId : sbPositionMapper.selectNameById(positionId);
+                remark1.append("【" + after + "】");
+            }
+            if(!oldParentId.equals(parentId)){
+                insertParent = Boolean.TRUE;
+                sbInfo.setParentId(parentId);
+                remark2.append("父设备变动【" + sbInfo.getName()).append("】 ---> ");
+                String after = parentId == "" ? parentId : sbInfoMapper.selectNameById(parentId);
+                remark2.append("【" + after + "】");
+            }
+            if(!oldSbPositionNo.equals(positionNo)){
+                if(StringUtils.isNotBlank(sbInfo.getParentId())){
+                    // 子设备判断,传输过来的位号,是否存在于sb_location
+                    SbLocation location = new SbLocation();
+                    location.setNo(positionNo);
+                    if(sbLocationMapper.selectCount(location) == 0){
+                        insertLocation(model.getSbPositionNo(),sbInfo);
+                    }
+                }
+                insertNo = Boolean.TRUE;
+                remark3.append("设备位号变动【"+sbInfo.getPositionNo()).append("】 ---> ");
+                remark3.append("【"+positionNo+"】");
+                // 位号变动,父设备也有可能变动
+                SbLocation location = new SbLocation();
+                location.setNo(positionNo);
+                List<SbLocation> locations = sbLocationMapper.select(location);
+                if(locations != null && locations.size() > 0){
+                    sbInfo.setParentId(locations.get(0).getSbId());
+                }
+                sbInfo.setPositionNo(model.getSbPositionNo()); // 设备位号
+            }
+            StringBuilder remark4 = new StringBuilder();
+            if(!oldZzh.equals(zzh)){
+                insertZzh = Boolean.TRUE;
+                remark4.append("设备原号变动【"+oldZzh).append("】 ---> ");
+                remark4.append("【"+zzh+"】");
+                sbInfo.setZzh(zzh);
+            }
+            // 保存文件
+            sysFileService.saveFile(model.getId(), SysFileTypeEnum.Sb_MEASURE_IMGS.getValue(), model.getCheckImgList());
+            sysFileService.saveFile(model.getId(), SysFileTypeEnum.Sb_MEASURE_FILES.getValue(), model.getCheckFileList());
+            // 写入调拨记录
+            if(insertAllocate){
+                handleSbChangeRecord(remark1.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_POSITION);
+            }
+            if(insertParent){
+                handleSbChangeRecord(remark2.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_PARENT);
+            }
+            if(insertNo){
+                handleSbChangeRecord(remark3.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_NO);
+            }
+            if(insertZzh){
+                handleSbChangeRecord(remark4.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_ZZH);
+            }
+            sbInfoMapper.updateByPrimaryKey(sbInfo);
+        }
+    }*/
 }