add:新增分切暂存维护功能
This commit is contained in:
@@ -248,4 +248,12 @@ public class SlitterPdaController {
|
||||
public ResponseEntity<Object> returnShaft(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(slitterService.returnShaft(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/cutCacheInventory")
|
||||
@Log("分切暂存维护")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> cutCacheInventory(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(slitterService.cutCacheInventory(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -362,4 +362,11 @@ public interface SlitterService {
|
||||
* @return
|
||||
*/
|
||||
JSONObject returnShaft(JSONObject param);
|
||||
|
||||
/**
|
||||
* 分切暂存维护
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
JSONObject cutCacheInventory(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -1585,7 +1585,8 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
data.put("status", "1".equals(point.getPoint_status())
|
||||
? "空位" : "2".equals(point.getPoint_status())
|
||||
? "有气胀轴" : "3".equals(point.getPoint_status())
|
||||
? "有子卷" : "-");
|
||||
? "有子卷" : "4".equals(point.getPoint_status())
|
||||
? "有气胀轴(不带管芯)" : "-");
|
||||
if (SlitterConstant.SLITTER_NO.equals(point.getIs_used())) {
|
||||
data.put("status", "已禁用");
|
||||
}
|
||||
@@ -2402,11 +2403,15 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的行架任务!");
|
||||
}
|
||||
// 校验是否存在agv任务
|
||||
List<SchBaseTask> taskList = taskService.checkHaveStartTask(pointCode);
|
||||
List<SchBaseTask> taskList = taskService.checkHaveTask(pointCode);
|
||||
if (taskList.size() > 0) {
|
||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的agv任务!");
|
||||
}
|
||||
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "1")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "未检测有气胀轴,请先设置点位信息再触发!!");
|
||||
}
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "2")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测空气胀轴,请先清空点位信息再触发!!");
|
||||
@@ -2417,46 +2422,46 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
if (ObjectUtil.isNotEmpty(point.getQzz_no1()) || ObjectUtil.isNotEmpty(point.getQzz_no2())) {
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + " 的气胀轴编码不为空,请先清空点位信息再触发!!");
|
||||
}
|
||||
if (Objects.equals(point.getPoint_status(), "1") && ObjectUtil.isEmpty(point.getQzz_no1()) && ObjectUtil.isEmpty(point.getQzz_no2())) {
|
||||
// 如果是没货 绑定为空轴状态
|
||||
point.setPoint_status("4");
|
||||
bcutpointivtService.updateById(point);
|
||||
}
|
||||
JSONObject taskParam = new JSONObject();
|
||||
if (Objects.equals(point.getPoint_status(), "4") && ObjectUtil.isEmpty(point.getQzz_no1()) && ObjectUtil.isEmpty(point.getQzz_no2())) {
|
||||
|
||||
// 获取内包间缓存位
|
||||
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());
|
||||
if (ObjectUtil.isNotEmpty(size1)) {
|
||||
taskParam.put("vehicle_code1", IdUtil.getSnowflake(1, 1).nextIdStr() + size1);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(size2)) {
|
||||
taskParam.put("vehicle_code2", IdUtil.getSnowflake(1, 1).nextIdStr() + size2);
|
||||
}
|
||||
taskParam.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV到内包间"));
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
returnShaftAgvTask.createTask(taskParam);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试!!");
|
||||
JSONObject taskParam = new JSONObject();
|
||||
|
||||
// 获取内包间缓存位
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getNBJCanUsePoint("1", "1", "0", "2");
|
||||
if (areaEmptyNotTaskPoint.size() <= 1) {
|
||||
throw new BadRequestException("请求搬运失败,内包间没有可存放位置!");
|
||||
}
|
||||
} finally {
|
||||
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||
lock.unlock();
|
||||
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());
|
||||
if (ObjectUtil.isNotEmpty(size1)) {
|
||||
taskParam.put("vehicle_code1", IdUtil.getSnowflake(1, 1).nextIdStr() + size1);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(size2)) {
|
||||
taskParam.put("vehicle_code2", IdUtil.getSnowflake(1, 1).nextIdStr() + size2);
|
||||
}
|
||||
taskParam.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV到内包间"));
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
returnShaftAgvTask.createTask(taskParam);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试!!");
|
||||
}
|
||||
} finally {
|
||||
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "点位状态不对,请先设置点位信息再触发!!");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -2667,4 +2672,34 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
res.put("message", "饵料下卷成功!");
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject cutCacheInventory(JSONObject param) {
|
||||
log.info("手持维护分切暂存库存:{}", param);
|
||||
// param : point_code, type
|
||||
String pointCode = param.getString("point_code");
|
||||
BstIvtCutpointivt bstIvtCutpointivt = bcutpointivtService.getPintByTrussCode(pointCode, false);
|
||||
if (bstIvtCutpointivt.getTruss_point_code1().equals(pointCode)) {
|
||||
bstIvtCutpointivt.setQzz_no1("");
|
||||
}
|
||||
if (bstIvtCutpointivt.getTruss_point_code2().equals(pointCode)) {
|
||||
bstIvtCutpointivt.setQzz_no2("");
|
||||
}
|
||||
if (SlitterConstant.SLITTER_YES.equals(param.getString("type"))) {
|
||||
if (ObjectUtil.isEmpty(bstIvtCutpointivt.getQzz_no1()) && ObjectUtil.isEmpty(bstIvtCutpointivt.getQzz_no2())) {
|
||||
bstIvtCutpointivt.setPoint_status("4");
|
||||
}
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(bstIvtCutpointivt.getQzz_no1()) && ObjectUtil.isEmpty(bstIvtCutpointivt.getQzz_no2())) {
|
||||
bstIvtCutpointivt.setPoint_status("1");
|
||||
}
|
||||
}
|
||||
TaskUtils.updateOptMessageByBCutPoint(bstIvtCutpointivt);
|
||||
bcutpointivtService.updateById(bstIvtCutpointivt);
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("message", "分切暂存设置成功!");
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user