|
@@ -3,6 +3,7 @@ package com.rongwei.bscommon.sys.utils;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import com.rongwei.bscommon.sys.dao.ApsProcessOperationBackupDao;
|
|
|
import com.rongwei.bscommon.sys.dao.ApsProcessOperationProcessEquBackupDao;
|
|
|
+import com.rongwei.commonservice.service.RedisService;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
@@ -32,18 +33,24 @@ public class ApsUtils {
|
|
|
private static ApsProcessOperationBackupDao apsProcessOperationBackupDao;
|
|
|
private static ApsProcessOperationProcessEquBackupDao apsProcessOperationProcessEquBackupDao;
|
|
|
private static RedissonClient redissonClient;
|
|
|
+ private static RedisService redisService;
|
|
|
+ @Autowired
|
|
|
+ private RedisService autoRedisService;
|
|
|
@Autowired
|
|
|
private ApsProcessOperationBackupDao autoApsProcessOperationBackupDao;
|
|
|
@Autowired
|
|
|
private ApsProcessOperationProcessEquBackupDao autoApsProcessOperationProcessEquBackupDao;
|
|
|
@Autowired
|
|
|
private RedissonClient autoredissonClient;
|
|
|
+
|
|
|
@PostConstruct
|
|
|
public void info() {
|
|
|
apsProcessOperationBackupDao = autoApsProcessOperationBackupDao;
|
|
|
apsProcessOperationProcessEquBackupDao = autoApsProcessOperationProcessEquBackupDao;
|
|
|
redissonClient = autoredissonClient;
|
|
|
+ redisService = autoRedisService;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 删除当前员工所属工厂的排程备份信息
|
|
|
*
|
|
@@ -64,9 +71,9 @@ public class ApsUtils {
|
|
|
* 校验当前是否正在排程中
|
|
|
* 正在排程的情况下抛出异常
|
|
|
*/
|
|
|
- public static void checkScheduling(SysUserVo currentUser ) {
|
|
|
+ public static void checkScheduling(SysUserVo currentUser) {
|
|
|
// 当前等路人所属工厂
|
|
|
- if(currentUser==null){
|
|
|
+ if (currentUser == null) {
|
|
|
currentUser = CXCommonUtils.getCurrentUser();
|
|
|
}
|
|
|
String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
|
|
@@ -82,6 +89,31 @@ public class ApsUtils {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验坯料计划是否正在排程中
|
|
|
+ * 正在排程的情况下抛出异常
|
|
|
+ */
|
|
|
+ public static void checkSchedulingByBlankId(SysUserVo currentUser, String blankId) {
|
|
|
+ // 当前等路人所属工厂
|
|
|
+ if (currentUser == null) {
|
|
|
+ currentUser = CXCommonUtils.getCurrentUser();
|
|
|
+ }
|
|
|
+ String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
|
|
|
+ if (StringUtils.isBlank(tenantId)) {
|
|
|
+ throw new CustomException("当前用户所属工厂信息为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(blankId)) {
|
|
|
+ throw new CustomException("坯料计划ID不能为空");
|
|
|
+ }
|
|
|
+ String key = "aps-blankids-" + tenantId;
|
|
|
+ boolean hasKey = redisService.hasKey(key);
|
|
|
+ if (hasKey) {
|
|
|
+ String blankIds = redisService.getRedisCatchObj(key).toString();
|
|
|
+ if (Arrays.asList(blankIds.split(",")).contains(blankId)) {
|
|
|
+ throw new CustomException("正在排程,请稍后操作");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 增加 新的冲突
|
|
@@ -100,6 +132,7 @@ public class ApsUtils {
|
|
|
}
|
|
|
return conflictdeList.stream().distinct().filter(StringUtils::isNotBlank).collect(Collectors.joining(","));
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 删除旧冲突
|
|
|
*
|