|
@@ -1,8 +1,9 @@
|
|
|
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.bscommon.sys.service.ApsBlankOrderService;
|
|
|
+import com.rongwei.bsentity.domain.ApsBlankOrderDo;
|
|
|
import com.rongwei.commonservice.service.RedisService;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.base.exception.CustomException;
|
|
@@ -42,6 +43,8 @@ public class ApsUtils {
|
|
|
private ApsProcessOperationProcessEquBackupDao autoApsProcessOperationProcessEquBackupDao;
|
|
|
@Autowired
|
|
|
private RedissonClient autoredissonClient;
|
|
|
+ @Autowired
|
|
|
+ private static ApsBlankOrderService apsBlankOrderService;
|
|
|
|
|
|
@PostConstruct
|
|
|
public void info() {
|
|
@@ -115,6 +118,38 @@ public class ApsUtils {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询坯料计划是否正在被排程或者已排程
|
|
|
+ * 正在排程的情况下抛出异常
|
|
|
+ */
|
|
|
+ public static void checkSchedulByBlankId(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("该坯料计划正在排程,不可以修改");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //是否已排程
|
|
|
+ ApsBlankOrderDo apsBlankOrderDo = apsBlankOrderService.getById(blankId);
|
|
|
+ if (Integer.parseInt(apsBlankOrderDo.getProductstatus()) > 10) {
|
|
|
+ throw new CustomException("该坯料计划生产状态已被其他人修改,请刷新页面后重新进入");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 增加 新的冲突
|
|
|
*
|