fix: 手持申请送子卷到暂存区

This commit is contained in:
2024-08-15 13:59:33 +08:00
parent 2b816302ba
commit 39399e2dd9
4 changed files with 67 additions and 3 deletions

View File

@@ -73,6 +73,12 @@ public class SlitterPdaController {
public ResponseEntity<Object> sendSubVolumeToNBJ(@RequestBody JSONObject param) {
return new ResponseEntity<>(slitterDevices.pdaSendSubVolumeToNBJ(param), HttpStatus.OK);
}
@PostMapping("/markingFoilSlittingToCache")
@Log("标箔分切下料AGV任务")
@SaIgnore
public ResponseEntity<Object> markingFoilSlittingToCache(@RequestBody JSONObject param) {
return new ResponseEntity<>(slitterDevices.markingFoilSlittingToCache(param), HttpStatus.OK);
}
@PostMapping("/getCutCacheAgvPoints")
@Log("获取分切暂存位AGV点位下拉框数据")
@SaIgnore

View File

@@ -59,6 +59,7 @@ public class AutoSendAirShaftAgvTask {
// todo: 可以把区域校验去掉就能够包括B1,B2,B3,B4
List<BstIvtCutpointivt> cutPoints = bcutpointivtService.getAreaNotTaskPointByStatus("1", "2", "0", "0");
for (BstIvtCutpointivt cutPoint : cutPoints) {
log.info("此时执行的点位:{}", cutPoint.getPoint_code());
// 获取分切计划
List<String> collect = Stream.of(cutPoint.getQzz_no1(), cutPoint.getQzz_no2())
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());

View File

@@ -242,4 +242,11 @@ public interface SlitterService {
* @return /
*/
JSONObject doStockAreaUnbinding(JSONObject param);
/**
* 标箔分切下料AGV任务
* @param param /
* @return /
*/
JSONObject markingFoilSlittingToCache(JSONObject param);
}

View File

@@ -52,19 +52,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.util.ArrayList;
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;
import static org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil.getNumberByResourceCode;
import static org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil.getPointLocationInCutDevice;
import static org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil.getPaperLength;
/**
* @author lyd
@@ -1513,4 +1510,57 @@ public class SlitterServiceImpl implements SlitterService {
res.put("message", "备货区解绑成功!");
return res;
}
@Override
public JSONObject markingFoilSlittingToCache(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");
// 校验是否存在任务
List<SchBaseTask> taskList = taskService.checkHaveTask(pointCode);
if (taskList.size() > 0) {
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的任务!");
}
BstIvtCutpointivt cut = bcutpointivtService.getPintByAgvCode(pointCode, false);
// todo: 考虑B4
if (!"B2".equals(cut.getProduct_area())) {
throw new BadRequestException("操作失败只有B2才能去暂存位!");
}
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getAreaNotTaskPointByStatus("2",
"1", "0","0");
if (areaEmptyNotTaskPoint.size() == 0) {
throw new BadRequestException(cut.getProduct_area() + "该区域暂存位暂无位置存放满轴");
}
// 生成任务
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 RuntimeException(e);
}
try {
if (tryLock) {
JSONObject taskParam = new JSONObject();
taskParam.put("point_code1", cut.getPoint_code());
taskParam.put("point_code2", endPoint.getPoint_code());
taskParam.put("vehicle_code1", cut.getQzz_no1());
taskParam.put("vehicle_code2", cut.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();
}
}
return res;
}
}