fix: 手持暂存下料修改
This commit is contained in:
@@ -965,73 +965,56 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
@Override
|
||||
public JSONObject pdaSendSubVolumeToNBJ(JSONObject param) {
|
||||
log.info("手持申请送子卷到内包间参数:{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("message", "创建AGV任务成功!");
|
||||
// param: point_code
|
||||
String pointCode = param.getString("point_code");
|
||||
RLock open = redissonClient.getLock(pointCode);
|
||||
boolean openLock;
|
||||
// 校验是否存在任务
|
||||
List<SchBaseTask> taskList = taskService.checkHaveTask(pointCode);
|
||||
if (taskList.size() > 0) {
|
||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的任务!");
|
||||
}
|
||||
BstIvtCutpointivt point = bcutpointivtService.getPintByAgvCode(pointCode, false);
|
||||
if (Objects.equals(point.getPoint_status(), "1")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测无货,请确保任务执行完毕后触发!");
|
||||
}
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "2")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测空气胀轴,请确保下卷任务是否完毕后触发!");
|
||||
}
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1",
|
||||
"1", "0", "2");
|
||||
if (areaEmptyNotTaskPoint.size() == 0) {
|
||||
throw new BadRequestException("请求搬运失败,内包间没有可存放位置!");
|
||||
}
|
||||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0);
|
||||
RLock lock = redissonClient.getLock(endPoint.getPoint_code());
|
||||
boolean tryLock;
|
||||
try {
|
||||
openLock = open.tryLock(0, TimeUnit.SECONDS);
|
||||
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new BadRequestException("获取锁异常");
|
||||
}
|
||||
try {
|
||||
if (openLock) {
|
||||
// 校验是否存在任务
|
||||
List<SchBaseTask> taskList = taskService.checkHaveTask(pointCode);
|
||||
if (taskList.size() > 0) {
|
||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的任务!");
|
||||
}
|
||||
BstIvtCutpointivt point = bcutpointivtService.getPintByAgvCode(pointCode, false);
|
||||
if (Objects.equals(point.getPoint_status(), "1")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测无货,请确保任务执行完毕后触发!");
|
||||
}
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "2")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测空气胀轴,请确保下卷任务是否完毕后触发!");
|
||||
}
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1",
|
||||
"1", "0", "2");
|
||||
if (areaEmptyNotTaskPoint.size() == 0) {
|
||||
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) {
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", point.getPoint_code());
|
||||
taskParam.put("point_code2", endPoint.getPoint_code());
|
||||
taskParam.put("vehicle_code1", point.getQzz_no1());
|
||||
taskParam.put("vehicle_code2", point.getQzz_no2());
|
||||
taskParam.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV到内包间"));
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
slitterDownAgvTask.createTask(taskParam);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试!!");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
if (tryLock) {
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", point.getPoint_code());
|
||||
taskParam.put("point_code2", endPoint.getPoint_code());
|
||||
taskParam.put("vehicle_code1", point.getQzz_no1());
|
||||
taskParam.put("vehicle_code2", point.getQzz_no2());
|
||||
taskParam.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV到内包间"));
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
slitterDownAgvTask.createTask(taskParam);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试!!");
|
||||
}
|
||||
} finally {
|
||||
if (openLock) {
|
||||
open.unlock();
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("message", "创建AGV任务请求成功!");
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user