Browse Source

保养编码01926,保养标准中显示执行人是厂家,但是在保养任务中显示为“检测”

01782/01783/01792/02165/02166/这些也有问题,执行人方式是维修人,但是最终保养的任务触发给了22万生产线,检测  这两个
hfxc226 3 months ago
parent
commit
9c9fe00b27

+ 4 - 1
platform-dao/src/main/java/com/platform/dao/dto/check/CheckJobDTO.java

@@ -41,7 +41,10 @@ public class CheckJobDTO extends BaseDTO implements Serializable {
      * 实际执行人姓名
      */
     private String actualUser;
-
+    /**
+     * 设备类型id
+     */
+    private String typeId;
     /**
      * 查询类别
      */

+ 3 - 1
platform-dao/src/main/resources/mapper/check/CheckJobMapper.xml

@@ -214,7 +214,9 @@
         <if test="sbNotStatus!=null">
             and sbInfo.status !=#{sbNotStatus}
         </if>
-
+        <if test="typeId != null and typeId != ''">
+            and sbinfo.typeId = #{typeId}
+        </if>
     </sql>
     <select id="selectList" parameterType="com.platform.dao.dto.check.CheckJobDTO"
             resultType="com.platform.dao.vo.query.check.CheckJobVO">

+ 22 - 17
platform-service/src/main/java/com/platform/service/check/impl/CheckJobServiceImpl.java

@@ -885,22 +885,9 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
                         if (!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())) {
                             continue;
                         }
+                        setCheckUserId(standard, sbInfo, checkJob);
                         if (standard.getCheckUserType() == null) {
-                            if (standard.getPeriodType() < CheckPlanPeriodTypeEnum.WEEK.getValue()) {
-                                checkJob.setCheckUserId(sbInfo.getSaveUser());
-                                standard.setCheckUserType(CheckUserTypeEnum.USE_USER.getValue());
-                            } else {
-                                checkJob.setCheckUserId(sbInfo.getRepairUser());
-                                standard.setCheckUserType(CheckUserTypeEnum.REPAIR_USER.getValue());
-                            }
-                        } else {
-                            if (standard.getCheckUserType().equals(CheckUserTypeEnum.USE_USER.getValue())) {
-                                checkJob.setCheckUserId(sbInfo.getSaveUser());
-                            } else if (standard.getCheckUserType().equals(CheckUserTypeEnum.REPAIR_USER.getValue())) {
-                                checkJob.setCheckUserId(sbInfo.getRepairUser());
-                            } else if (standard.getCheckUserType().equals(CheckUserTypeEnum.ZHIDING.getValue())) {
-                                checkJob.setCheckUserId(sbInfo.getRepairUser());
-                            }
+                            standard.setCheckUserType(CheckUserTypeEnum.REPAIR_USER.getValue());
                         }
                         checkJob.setStandardHours(standard.getStandardHours());
                         checkJob.setStatus(CheckJobStatusEnum.NOT_EXECUTE.getValue());
@@ -932,6 +919,19 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
             }
     }
 
+    private void setCheckUserId(CheckStandard standard, SbInfo sbInfo, CheckJob checkJob){
+        if (standard.getCheckUserType() == null) {
+            checkJob.setCheckUserId(sbInfo.getRepairUser());
+        } else {
+            if (standard.getCheckUserType().equals(CheckUserTypeEnum.USE_USER.getValue())) {
+                checkJob.setCheckUserId(sbInfo.getSaveUser());
+            } else if (standard.getCheckUserType().equals(CheckUserTypeEnum.REPAIR_USER.getValue())) {
+                checkJob.setCheckUserId(sbInfo.getRepairUser());
+            } else if (standard.getCheckUserType().equals(CheckUserTypeEnum.ZHIDING.getValue())) {
+                checkJob.setCheckUserId(sbInfo.getRepairUser());
+            }
+        }
+    }
     /**
      * 判断某个计划,某个设备,某个标准,是否要生成任务
      *
@@ -1361,6 +1361,8 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
     public void finishJob(CheckJobDTO dto) {
         LocalDateTime now = LocalDateTime.now();
         CheckJob checkJob = mapper.selectByPrimaryKey(dto.getId());
+        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(dto.getSbId());
+
         /*if(!CheckJobStatusEnum.EXECUTING.getValue().equals(checkJob.getStatus()) && !CheckJobStatusEnum.OUT_OF_DATE.getValue().equals(checkJob.getStatus())){
             return;
         }*/
@@ -1420,7 +1422,9 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
             nextCheckJob.setCreatedTime(LocalDateTime.now());
             nextCheckJob.setSbId(checkStandard.getSbId());
             nextCheckJob.setReceiveOvertime(false);
-            nextCheckJob.setCheckUserId(checkJob.getCheckUserId());
+
+            setCheckUserId(checkStandard, sbInfo, nextCheckJob);
+            // nextCheckJob.setCheckUserId(checkJob.getCheckUserId());
             nextCheckJob.setPartId(checkStandard.getPart());
             nextCheckJob.setStandardId(checkStandard.getId());
             nextCheckJob.setType(checkStandard.getType());
@@ -1474,6 +1478,7 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
     public void finishJobIgnore(CheckJobDTO dto) {
         LocalDateTime now = LocalDateTime.now();
         CheckJob checkJob = mapper.selectByPrimaryKey(dto.getId());
+        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(checkJob.getSbId());
         checkJob.setStatus(CheckJobStatusEnum.FINISHED.getValue());
         checkJob.setActualEndTime(now);
         if(checkJob.getActualStartTime() == null){
@@ -1517,7 +1522,7 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
             calcNextJobTime(nextCheckJob, checkJob.getActualEndTime(), checkStandard);
             nextCheckJob.setCreatedTime(LocalDateTime.now());
             nextCheckJob.setSbId(checkStandard.getSbId());
-            nextCheckJob.setCheckUserId(checkJob.getCheckUserId());
+            setCheckUserId(checkStandard, sbInfo, nextCheckJob);
             nextCheckJob.setPartId(checkStandard.getPart());
             nextCheckJob.setStandardId(checkStandard.getId());
             nextCheckJob.setType(checkStandard.getType());