Jelajahi Sumber

aps-排程备份检查

sucheng 1 tahun lalu
induk
melakukan
9783898260

+ 7 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProcessOperationBackupDao.java

@@ -2,7 +2,9 @@ package com.rongwei.bscommon.sys.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.rongwei.bsentity.domain.ApsProcessOperationBackupDo;
+import com.rongwei.bsentity.vo.CheckScheduleVo;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 
@@ -18,6 +20,11 @@ public interface ApsProcessOperationBackupDao extends BaseMapper<ApsProcessOpera
 
     void processOperationCopy(@Param("userId") String userId,
                               @Param("userName") String userName);
+
+    @Select("select count(ID) as count,BACKUPUSERID as backUpUserId,BACKUPUSER as backUpUserName from aps_process_operation_backup where DELETED = 0 AND BLANKID in (select ID from aps_blank_order where DELETED ='0' and  PRODUCTIONORDERID = #{orderId} ) GROUP BY BACKUPUSERID,BACKUPUSER limit 1")
+    CheckScheduleVo selectBackByOrderId(@Param("orderId") String orderId);
+
+    CheckScheduleVo selectBackByBlankIdList(@Param("blankIdList") List<String> blankIdList);
 }
 
 

+ 1 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsBlankOrderService.java

@@ -51,6 +51,6 @@ public interface ApsBlankOrderService extends IService<ApsBlankOrderDo> {
     R checkAndUpdateBlankAndOutput(ApsProductionTechnicalRequirementDo req);
     void updateBlankSplicingColumn(String blankId);
 
-    R checkSchedule(List<String> blankIdList);
+    R checkSchedule(CheckScheduleReq req);
 
 }

+ 31 - 4
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java

@@ -2314,13 +2314,40 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     }
 
     @Override
-    public R checkSchedule(List<String> blankIdList) {
+    public R checkSchedule(CheckScheduleReq req) {
         //是否正在排程
         ApsUtils.checkScheduling(null);
+        CheckScheduleVo checkScheduleVo = null;
+        //根据订单ID查询
+        if (ObjectUtil.isNotEmpty(req.getOrderId())) {
+            checkScheduleVo = apsProcessOperationBackupDao.selectBackByOrderId(req.getOrderId());
+        }
+        if (ObjectUtil.isNotEmpty(req.getBlankIdList())) {
+            checkScheduleVo = apsProcessOperationBackupDao.selectBackByBlankIdList(req.getBlankIdList());
+        }
+        CheckScheduleResponse checkScheduleResponse = new CheckScheduleResponse();
+        if (ObjectUtil.isEmpty(checkScheduleVo)) {
+            checkScheduleResponse.setNeedWarning(true);
+            checkScheduleResponse.setWarningMessage("修改坯料计划后需要重新排程,确认修改吗?");
+            return R.ok(checkScheduleResponse);
+        }
+        //获取当前用户
+        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
 
-        //判断当前坯料计划是否存在排程备份
-
+        if (ObjectUtil.isNotEmpty(checkScheduleVo.getCount()) && checkScheduleVo.getCount().equals(0)) {
+            checkScheduleResponse.setNeedWarning(true);
+            checkScheduleResponse.setWarningMessage("修改坯料计划后需要重新排程,确认修改吗?");
+            return R.ok(checkScheduleResponse);
+        }
+        if (ObjectUtil.isNotEmpty(checkScheduleVo.getBackUpUserId()) && checkScheduleVo.getBackUpUserId().equals(currentUser.getId())) {
+            checkScheduleResponse.setNeedWarning(true);
+            checkScheduleResponse.setWarningMessage("该操作会导致您的排程结果备份不可恢复,确认继续吗?");
+            return R.ok(checkScheduleResponse);
+        } else {
+            checkScheduleResponse.setNeedWarning(true);
+            checkScheduleResponse.setWarningMessage(checkScheduleVo.getBackUpUserName() + "正在排程,该操作会导致其排程结果备份不可恢复,确认继续吗?");
+            return R.ok(checkScheduleResponse);
+        }
 
-        return null;
     }
 }

+ 12 - 0
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProcessOperationBackupDao.xml

@@ -194,6 +194,18 @@
                 </if>
             </where>
     </delete>
+    <select id="selectBackByBlankIdList" resultType="com.rongwei.bsentity.vo.CheckScheduleVo">
+        select count(ID) as count,
+            BACKUPUSERID as backUpUserId,
+            BACKUPUSER as backUpUserName
+        from aps_process_operation_backup
+        where DELETED = 0
+            AND BLANKID in
+            <foreach collection="blankIdList" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        GROUP BY BACKUPUSERID,BACKUPUSER limit 1
+    </select>
     <insert id="processOperationCopy">
         INSERT INTO aps_process_operation_backup (<include refid="Base_Column_List"/>)
         SELECT

+ 18 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/CheckScheduleReq.java

@@ -0,0 +1,18 @@
+package com.rongwei.bsentity.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author :sc
+ * @since :2024/7/9
+ */
+@Data
+public class CheckScheduleReq {
+    //坯料计划ID集合
+    private List<String> blankIdList;
+
+    //订单ID
+    private String orderId;
+}

+ 20 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/CheckScheduleResponse.java

@@ -0,0 +1,20 @@
+package com.rongwei.bsentity.vo;
+
+import lombok.Data;
+
+/**
+ * @author :sc
+ * @since :2024/7/10
+ */
+@Data
+public class CheckScheduleResponse {
+    /**
+     * 是否需要弱提示
+     */
+    private Boolean needWarning = false;
+
+    /**
+     * 提示内容
+     */
+    private String warningMessage;
+}

+ 25 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/CheckScheduleVo.java

@@ -0,0 +1,25 @@
+package com.rongwei.bsentity.vo;
+
+import lombok.Data;
+
+/**
+ * @author :sc
+ * @since :2024/7/9
+ */
+@Data
+public class CheckScheduleVo {
+    /**
+     * 备份的数量
+     */
+    private Integer count;
+
+    /**
+     * 备份人ID
+     */
+    private String backUpUserId;
+
+    /**
+     * 备份人名称
+     */
+    private String backUpUserName;
+}

+ 4 - 3
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsBlankOrderController.java

@@ -6,6 +6,7 @@ import com.rongwei.bsentity.domain.ApsBlankOrderDo;
 import com.rongwei.bsentity.domain.ApsProductionTechnicalRequirementDo;
 import com.rongwei.bsentity.vo.ApsPlanVo;
 import com.rongwei.bsentity.vo.CheckAndSaveOrUpdateBlankReq;
+import com.rongwei.bsentity.vo.CheckScheduleReq;
 import com.rongwei.bsentity.vo.OrderLockVo;
 import com.rongwei.rwcommon.base.R;
 import lombok.extern.slf4j.Slf4j;
@@ -172,9 +173,9 @@ public class ApsBlankOrderController {
      * 根据坯料计划ID查询排程相关提醒
      */
     @PostMapping("/checkSchedule")
-    public R checkSchedule(@RequestBody List<String> blankIdList) {
-        log.info("checkSchedule 检查排程相关提醒,入参为:{}", blankIdList);
-        return apsBlankOrderService.checkSchedule(blankIdList);
+    public R checkSchedule(@RequestBody CheckScheduleReq req) {
+        log.info("checkSchedule 检查排程相关提醒,入参为:{}", req);
+        return apsBlankOrderService.checkSchedule(req);
     }
 }