opt: 锁更改
This commit is contained in:
@@ -66,7 +66,6 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -81,11 +80,17 @@ import static org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil.getPointLocati
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class SlitterServiceImpl implements SlitterService {
|
public class SlitterServiceImpl implements SlitterService {
|
||||||
/** 是否使用虚拟卷 */
|
/**
|
||||||
|
* 是否使用虚拟卷
|
||||||
|
*/
|
||||||
public final static String USE_XN = "USE_XN";
|
public final static String USE_XN = "USE_XN";
|
||||||
/** 套轴期限 */
|
/**
|
||||||
|
* 套轴期限
|
||||||
|
*/
|
||||||
public final static String TZ_DAY = "TZ_DAY";
|
public final static String TZ_DAY = "TZ_DAY";
|
||||||
/** 套轴区域 */
|
/**
|
||||||
|
* 套轴区域
|
||||||
|
*/
|
||||||
public final static String PARAM_CODE_PLAN_AREA = "PARAM_CODE_PLAN_AREA";
|
public final static String PARAM_CODE_PLAN_AREA = "PARAM_CODE_PLAN_AREA";
|
||||||
@Autowired
|
@Autowired
|
||||||
private BstIvtStockingivtMapper bstIvtStockingivtMapper;
|
private BstIvtStockingivtMapper bstIvtStockingivtMapper;
|
||||||
@@ -302,7 +307,7 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
List<String> stepTipLogs = getRedisListValue("ERROR" + deviceCode);
|
List<String> stepTipLogs = getRedisListValue("ERROR" + deviceCode);
|
||||||
// 枷锁
|
// 枷锁
|
||||||
RLock lock = redissonClient.getLock("doAcsFinishLoadShaft");
|
RLock lock = redissonClient.getLock("doAcsFinishLoadShaft");
|
||||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS);
|
||||||
try {
|
try {
|
||||||
if (tryLock) {
|
if (tryLock) {
|
||||||
log.info("ACS申请套管完成参数: {}", param);
|
log.info("ACS申请套管完成参数: {}", param);
|
||||||
@@ -1201,12 +1206,18 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
public JSONObject pdaSendSubVolumeToNBJ(JSONObject param) {
|
public JSONObject pdaSendSubVolumeToNBJ(JSONObject param) {
|
||||||
log.info("手持申请送子卷到内包间参数:{}", param);
|
log.info("手持申请送子卷到内包间参数:{}", param);
|
||||||
JSONObject res = new JSONObject();
|
JSONObject res = new JSONObject();
|
||||||
res.put("status", HttpStatus.HTTP_OK);
|
res.put("status", HttpStatus.HTTP_OK);
|
||||||
res.put("message", "创建AGV任务成功!");
|
res.put("message", "创建AGV任务成功!");
|
||||||
|
RLock lock = redissonClient.getLock("doAcsFinishLoadShaft");
|
||||||
|
boolean tryLock;
|
||||||
|
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||||
|
try {
|
||||||
|
if (tryLock) {
|
||||||
// param: point_code
|
// param: point_code
|
||||||
String pointCode = param.getString("point_code");
|
String pointCode = param.getString("point_code");
|
||||||
// 校验是否存在任务
|
// 校验是否存在任务
|
||||||
@@ -1239,22 +1250,11 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
} else {
|
} else {
|
||||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]无气胀轴信息,请先绑定子卷库存!");
|
throw new BadRequestException("操作失败,点位[" + pointCode + "]无气胀轴信息,请先绑定子卷库存!");
|
||||||
}
|
}
|
||||||
// List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1",
|
|
||||||
// "1", "0", "2");
|
|
||||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getNBJCanUsePoint("1", "1", "0", "2");
|
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getNBJCanUsePoint("1", "1", "0", "2");
|
||||||
if (areaEmptyNotTaskPoint.size() <= 1) {
|
if (areaEmptyNotTaskPoint.size() <= 1) {
|
||||||
throw new BadRequestException("请求搬运失败,内包间没有可存放位置!");
|
throw new BadRequestException("请求搬运失败,内包间没有可存放位置!");
|
||||||
}
|
}
|
||||||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0);
|
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0);
|
||||||
RLock lock = redissonClient.getLock(endPoint.getPoint_code());
|
|
||||||
boolean tryLock;
|
|
||||||
try {
|
|
||||||
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new BadRequestException("获取锁异常");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (tryLock) {
|
|
||||||
taskParam.put("point_code1", point.getPoint_code());
|
taskParam.put("point_code1", point.getPoint_code());
|
||||||
taskParam.put("point_code2", endPoint.getPoint_code());
|
taskParam.put("point_code2", endPoint.getPoint_code());
|
||||||
taskParam.put("vehicle_code1", point.getQzz_no1());
|
taskParam.put("vehicle_code1", point.getQzz_no1());
|
||||||
|
|||||||
Reference in New Issue
Block a user