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