add:增加固化室前置与后置任务
This commit is contained in:
@@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.dynamictp.common.util.StringUtil;
|
||||
@@ -38,6 +39,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -139,7 +143,7 @@ public class GHCMLTask extends AbstractTask {
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("暂存区域[" + task.getPoint_code1() + "]未找到所需点位!");
|
||||
}
|
||||
log.info("当前任务{}找到预计终点{}",task.getTask_id(),point.getPoint_code());
|
||||
log.info("当前任务{}找到预计终点{}", task.getTask_id(), point.getPoint_code());
|
||||
// 设置组盘 - 需要的话由子类自行实现
|
||||
task.setGroup_id(setGroupPlate(jsonObject));
|
||||
// 设置等待点并修改创建成功状态
|
||||
@@ -148,9 +152,26 @@ public class GHCMLTask extends AbstractTask {
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
task.setRequest_param(JSONObject.toJSONString(jsonObject));
|
||||
List<SchBaseTask> qlTask = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getPoint_code2, task.getPoint_code1())
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())
|
||||
.eq(SchBaseTask::getIs_delete,false)
|
||||
.ge(SchBaseTask::getCreate_time,
|
||||
LocalDateTime.now().toLocalDate().atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
|
||||
)
|
||||
.eq(SchBaseTask::getVehicle_code, startPoint.getVehicle_code())
|
||||
.orderByDesc(SchBaseTask::getCreate_time)
|
||||
.last("limit 1"));
|
||||
if (ObjectUtil.isEmpty(qlTask)) {
|
||||
throw new BadRequestException("创建失败,找不到[" + task.getPoint_code1() + "]完成的前置GHCQLTask任务!");
|
||||
}
|
||||
//更新绑定前置任务固化室点位 -> 固化室出口标识
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, qlTask.get(0).getTask_id())
|
||||
.set(SchBaseTask::getTask_group_id, task.getTask_id());
|
||||
taskService.update(updateWrapper);
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.save(task);
|
||||
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -94,24 +97,13 @@ public class GHCQLTask extends AbstractTask {
|
||||
if (ObjectUtils.isEmpty(ghsExitList)) {
|
||||
return;
|
||||
}
|
||||
//过滤未完成的固化室出库任务的点位
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.in(SchBaseTask::getPoint_code1, ghsExitList)
|
||||
.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())
|
||||
);
|
||||
if (ObjectUtils.isNotEmpty(taskList)) {
|
||||
taskList.stream().map(SchBaseTask::getPoint_code1).forEach(ghsExitList::remove);
|
||||
}
|
||||
if (ObjectUtils.isEmpty(ghsExitList)) {
|
||||
return;
|
||||
}
|
||||
AbstractTask task = taskFactory.getTask(TASK_CONFIG_CODE);
|
||||
ghsExitList.forEach(point -> {
|
||||
ghsExitList.forEach(r -> {
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("config_code", TASK_CONFIG_CODE);
|
||||
param.put("requestNo", "LMS" + IdUtil.simpleUUID());
|
||||
param.put("device_code", point);
|
||||
param.put("device_code", r);
|
||||
param.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
task.apply(param);
|
||||
} catch (Exception e) {
|
||||
@@ -130,6 +122,17 @@ public class GHCQLTask extends AbstractTask {
|
||||
|
||||
@Override
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
List<SchBaseTask> qlTask = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getPoint_code2, task.getPoint_code2())
|
||||
.eq(SchBaseTask::getConfig_code,"GHCQLTask")
|
||||
.eq(SchBaseTask::getIs_delete,false)
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())
|
||||
.orderByDesc(SchBaseTask::getCreate_time).last("limit 1"));
|
||||
if (ObjectUtil.isNotEmpty(qlTask)) {
|
||||
if (qlTask.get(0).getTask_group_id() == null) {
|
||||
throw new BadRequestException("创建失败,任务号[" + qlTask.get(0).getTask_code() + "]找不到相关的后置任务GHCMLTask任务!");
|
||||
}
|
||||
}
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
@@ -160,7 +163,6 @@ public class GHCQLTask extends AbstractTask {
|
||||
task.setGroup_id(point.getGroup_id());
|
||||
task.setRemark("");
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
|
||||
@@ -6,7 +6,7 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:xftn_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lms_xftn}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:stand_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
|
||||
Reference in New Issue
Block a user