opt:增加点位库存表启用状态过滤查询
This commit is contained in:
@@ -2,7 +2,6 @@ package org.nl.b_lms.pdm.subpackagerelation.dao;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
package org.nl.b_lms.pdm.subpackagerelation.dto;
|
package org.nl.b_lms.pdm.subpackagerelation.dto;
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||||
import org.nl.common.domain.query.BaseQuery;
|
import org.nl.common.domain.query.BaseQuery;
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
package org.nl.b_lms.sch.tasks.packingArea;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||||
|
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||||
|
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
|
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||||
|
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.wms.sch.AcsTaskDto;
|
||||||
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||||
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满轴缓存位到待检区agv搬运任务
|
||||||
|
*
|
||||||
|
* @author gbx
|
||||||
|
* @since 2024-01-24
|
||||||
|
*/
|
||||||
|
@Service()
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class DjqTask extends AbstractAcsTask {
|
||||||
|
@Resource
|
||||||
|
private IschBaseTaskService taskService;
|
||||||
|
@Resource
|
||||||
|
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ZxqTask zxqTask;
|
||||||
|
|
||||||
|
private final String THIS_CLASS = DjqTask.class.getName();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AcsTaskDto> addTask() {
|
||||||
|
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||||
|
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getHandle_class, THIS_CLASS)
|
||||||
|
.eq(SchBaseTask::getTask_status, TaskStatusEnum.START_AND_POINT.getCode())
|
||||||
|
.eq(SchBaseTask::getIs_delete, 0)
|
||||||
|
);
|
||||||
|
taskList.forEach(r -> {
|
||||||
|
AcsTaskDto dto = AcsTaskDto.builder()
|
||||||
|
.ext_task_id(r.getTask_id().toString())
|
||||||
|
.task_code(r.getTask_code())
|
||||||
|
.task_type(r.getAcs_task_type())
|
||||||
|
.start_device_code(r.getPoint_code1())
|
||||||
|
.next_device_code(r.getPoint_code2())
|
||||||
|
.start_device_code2(r.getPoint_code3())
|
||||||
|
.next_device_code2(r.getPoint_code4())
|
||||||
|
.vehicle_code(r.getVehicle_code())
|
||||||
|
.priority(r.getPriority())
|
||||||
|
.remark(r.getRemark())
|
||||||
|
.product_area(r.getProduct_area())
|
||||||
|
.agv_system_type("2")
|
||||||
|
.build();
|
||||||
|
resultList.add(dto);
|
||||||
|
});
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||||
|
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
||||||
|
.eq(StringUtils.isNotBlank(taskObj.getString("task_code1")), SchBaseTask::getTask_code, taskObj.getString("task_code1")), false);
|
||||||
|
if (schBaseTask == null) {
|
||||||
|
throw new BadRequestException("待检区到空载具缓存位搬运空载具桁架任务更新接口任务号为空!");
|
||||||
|
}
|
||||||
|
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||||
|
// 更新任务状态为执行中
|
||||||
|
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
}
|
||||||
|
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
//1.更改任务状态为完成
|
||||||
|
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
//2.改变起点点位状态
|
||||||
|
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status",PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name",null).eq("point_code",schBaseTask.getPoint_code1()));
|
||||||
|
//更新库存记录
|
||||||
|
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status",PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name",schBaseTask.getVehicle_code()).eq("point_code",schBaseTask.getPoint_code2()));
|
||||||
|
//todo 3.手持确认包装关系,生产包装关系表数据
|
||||||
|
//todo 4.根据子卷包装关系查询木箱号,调刘先源的空木箱出库服务创建出库任务
|
||||||
|
//5.创建子卷搬运到装箱区任务
|
||||||
|
List<BstIvtPackageinfoivt> zxqPointList = packageinfoivtService
|
||||||
|
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||||
|
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("装箱区"))
|
||||||
|
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||||
|
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空"))
|
||||||
|
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||||
|
if(CollectionUtils.isNotEmpty(zxqPointList))
|
||||||
|
{
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
|
||||||
|
jo.put("point_code1", schBaseTask.getPoint_code2());
|
||||||
|
jo.put("point_code2", zxqPointList.get(0).getPoint_code());
|
||||||
|
jo.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||||
|
zxqTask.createTask(jo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String createTask(JSONObject form) {
|
||||||
|
Assert.notNull(form, "请求参数不能为空");
|
||||||
|
String task_type = form.getString("task_type");
|
||||||
|
if (StrUtil.isBlank(task_type)) {
|
||||||
|
throw new BadRequestException("业务类型不能为空");
|
||||||
|
}
|
||||||
|
String point_code1 = form.getString("point_code1");
|
||||||
|
if (StrUtil.isBlank(point_code1)) {
|
||||||
|
throw new BadRequestException("起点不能为空");
|
||||||
|
}
|
||||||
|
String point_code2 = form.getString("point_code2");
|
||||||
|
if (StrUtil.isBlank(point_code2)) {
|
||||||
|
throw new BadRequestException("下一点不能为空");
|
||||||
|
}
|
||||||
|
String point_code3 = form.getString("point_code3");
|
||||||
|
|
||||||
|
String point_code4 = form.getString("point_code4");
|
||||||
|
|
||||||
|
String vehicle_code = form.getString("vehicle_code");
|
||||||
|
if (StrUtil.isBlank(vehicle_code)) {
|
||||||
|
throw new BadRequestException("载具号不能为空");
|
||||||
|
}
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
json.put("task_type", form.getString("task_type"));
|
||||||
|
json.put("vehicle_code", form.getString("vehicle_code"));
|
||||||
|
String task_status = form.getString("task_status");
|
||||||
|
if (StrUtil.isEmpty(task_status)) {
|
||||||
|
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||||
|
} else {
|
||||||
|
json.put("task_status", task_status);
|
||||||
|
}
|
||||||
|
json.put("point_code1", point_code1);
|
||||||
|
json.put("point_code2", point_code2);
|
||||||
|
json.put("point_code3", point_code3);
|
||||||
|
json.put("point_code4", point_code4);
|
||||||
|
json.put("handle_class", this.getClass().getName());
|
||||||
|
json.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
json.put("create_name", SecurityUtils.getCurrentUsername());
|
||||||
|
json.put("create_time", DateUtil.now());
|
||||||
|
json.put("priority", "1");
|
||||||
|
json.put("acs_task_type", "9");
|
||||||
|
json.put("response_param", form.getString("truss_type"));
|
||||||
|
json.put("request_param", form.getString("request_param"));
|
||||||
|
taskService.save(json.toJavaObject(SchBaseTask.class));
|
||||||
|
//如果目标点位没有空位先创建不下发
|
||||||
|
if (form.getBoolean("isSend")) {
|
||||||
|
this.immediateNotifyAcs(json.getString("task_id"));
|
||||||
|
}
|
||||||
|
return json.getString("task_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,6 @@ import org.nl.wms.sch.AcsTaskDto;
|
|||||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -0,0 +1,194 @@
|
|||||||
|
package org.nl.b_lms.sch.tasks.packingArea;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||||
|
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||||
|
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
|
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||||
|
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.wms.sch.AcsTaskDto;
|
||||||
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||||
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 空载具缓存位到待检区或管制区补空载具桁架任务
|
||||||
|
*
|
||||||
|
* @author gbx
|
||||||
|
* @since 2024-01-24
|
||||||
|
*/
|
||||||
|
@Service()
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class KzjhcwTask extends AbstractAcsTask {
|
||||||
|
|
||||||
|
|
||||||
|
private final String THIS_CLASS = KzjhcwTask.class.getName();
|
||||||
|
@Resource
|
||||||
|
private IschBaseTaskService taskService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KzjhcwTask kzjhcwTask;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AcsTaskDto> addTask() {
|
||||||
|
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||||
|
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getHandle_class, THIS_CLASS)
|
||||||
|
.eq(SchBaseTask::getTask_status, TaskStatusEnum.START_AND_POINT.getCode())
|
||||||
|
.eq(SchBaseTask::getIs_delete, 0)
|
||||||
|
);
|
||||||
|
taskList.forEach(r -> {
|
||||||
|
AcsTaskDto dto = AcsTaskDto.builder()
|
||||||
|
.ext_task_id(r.getTask_id().toString())
|
||||||
|
.task_code(r.getTask_code())
|
||||||
|
.task_type(r.getAcs_task_type())
|
||||||
|
.start_device_code(r.getPoint_code1())
|
||||||
|
.next_device_code(r.getPoint_code2())
|
||||||
|
.start_device_code2(r.getPoint_code3())
|
||||||
|
.next_device_code2(r.getPoint_code4())
|
||||||
|
.vehicle_code(r.getVehicle_code())
|
||||||
|
.priority(r.getPriority())
|
||||||
|
.remark(r.getRemark())
|
||||||
|
.product_area(r.getProduct_area())
|
||||||
|
.agv_system_type("2")
|
||||||
|
.build();
|
||||||
|
resultList.add(dto);
|
||||||
|
});
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||||
|
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
||||||
|
.eq(StringUtils.isNotBlank(taskObj.getString("task_code1")), SchBaseTask::getTask_code, taskObj.getString("task_code1")), false);
|
||||||
|
if (schBaseTask == null) {
|
||||||
|
throw new BadRequestException("待检区到空载具缓存位搬运空载具桁架任务更新接口任务号为空!");
|
||||||
|
}
|
||||||
|
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||||
|
// 更新任务状态为执行中
|
||||||
|
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
}
|
||||||
|
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
//1.更改任务状态为完成
|
||||||
|
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
//2.改变起点点位状态
|
||||||
|
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||||
|
//更新库存记录
|
||||||
|
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||||
|
//3.待检区搬运空载具到空载具缓存位完毕,判断是否有未下发的空载具送输送线任务,有就下发
|
||||||
|
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService
|
||||||
|
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||||
|
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||||
|
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空"))
|
||||||
|
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||||
|
//待检区和管控区点位
|
||||||
|
List<BstIvtPackageinfoivt> djqPointList = bstIvtPackageinfoivtList.stream().filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("待检区").equals(r.getPoint_status())
|
||||||
|
|| PackageInfoIvtEnum.POINT_STATUS.code("管制区").equals(r.getPoint_status())).collect(Collectors.toList());
|
||||||
|
//空载具缓冲区点位
|
||||||
|
List<BstIvtPackageinfoivt> kzjhcqPointList = bstIvtPackageinfoivtList.stream().filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位").equals(r.getPoint_status())).collect(Collectors.toList());
|
||||||
|
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||||
|
//确定起点和终点未下发
|
||||||
|
.eq(SchBaseTask::getTask_status, TaskStatusEnum.START_AND_POINT.getCode())
|
||||||
|
.and(r ->
|
||||||
|
r.in(SchBaseTask::getPoint_code1, djqPointList)
|
||||||
|
)
|
||||||
|
.and(r ->
|
||||||
|
r.in(SchBaseTask::getPoint_code2, kzjhcqPointList)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
taskList.forEach(r -> {
|
||||||
|
//任务下发
|
||||||
|
kzjhcwTask.immediateNotifyAcs(r.getTask_id().toString());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createTask(JSONObject form) {
|
||||||
|
Assert.notNull(form, "请求参数不能为空");
|
||||||
|
String task_type = form.getString("task_type");
|
||||||
|
if (StrUtil.isBlank(task_type)) {
|
||||||
|
throw new BadRequestException("业务类型不能为空");
|
||||||
|
}
|
||||||
|
String point_code1 = form.getString("point_code1");
|
||||||
|
if (StrUtil.isBlank(point_code1)) {
|
||||||
|
throw new BadRequestException("起点不能为空");
|
||||||
|
}
|
||||||
|
String point_code2 = form.getString("point_code2");
|
||||||
|
if (StrUtil.isBlank(point_code2)) {
|
||||||
|
throw new BadRequestException("下一点不能为空");
|
||||||
|
}
|
||||||
|
String point_code3 = form.getString("point_code3");
|
||||||
|
|
||||||
|
String point_code4 = form.getString("point_code4");
|
||||||
|
|
||||||
|
String vehicle_code = form.getString("vehicle_code");
|
||||||
|
if (StrUtil.isBlank(vehicle_code)) {
|
||||||
|
throw new BadRequestException("载具号不能为空");
|
||||||
|
}
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
json.put("task_type", form.getString("task_type"));
|
||||||
|
json.put("vehicle_code", form.getString("vehicle_code"));
|
||||||
|
String task_status = form.getString("task_status");
|
||||||
|
if (StrUtil.isEmpty(task_status)) {
|
||||||
|
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||||
|
} else {
|
||||||
|
json.put("task_status", task_status);
|
||||||
|
}
|
||||||
|
json.put("point_code1", point_code1);
|
||||||
|
json.put("point_code2", point_code2);
|
||||||
|
json.put("point_code3", point_code3);
|
||||||
|
json.put("point_code4", point_code4);
|
||||||
|
json.put("handle_class", this.getClass().getName());
|
||||||
|
json.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
json.put("create_name", SecurityUtils.getCurrentUsername());
|
||||||
|
json.put("create_time", DateUtil.now());
|
||||||
|
json.put("priority", "1");
|
||||||
|
json.put("acs_task_type", "9");
|
||||||
|
json.put("response_param", form.getString("truss_type"));
|
||||||
|
json.put("request_param", form.getString("request_param"));
|
||||||
|
taskService.save(json.toJavaObject(SchBaseTask.class));
|
||||||
|
//如果目标点位没有空位先创建不下发
|
||||||
|
if (form.getBoolean("isSend")) {
|
||||||
|
this.immediateNotifyAcs(json.getString("task_id"));
|
||||||
|
}
|
||||||
|
return json.getString("task_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,282 @@
|
|||||||
|
package org.nl.b_lms.sch.tasks.packingArea;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.b_lms.pdm.productionplan.dao.PdmBiSlittingproductionplan;
|
||||||
|
import org.nl.b_lms.pdm.productionplan.service.IpdmBiSlittingproductionplanService;
|
||||||
|
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||||
|
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||||
|
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
|
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||||
|
import org.nl.common.enums.ContainerLevelEnum;
|
||||||
|
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.wms.sch.AcsTaskDto;
|
||||||
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||||
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 输送线到满轴缓存位桁架任务
|
||||||
|
*
|
||||||
|
* @author gbx
|
||||||
|
* @since 2024-01-24
|
||||||
|
*/
|
||||||
|
@Service()
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class MzhcwTask extends AbstractAcsTask {
|
||||||
|
|
||||||
|
private final String THIS_CLASS = MzhcwTask.class.getName();
|
||||||
|
@Resource
|
||||||
|
private IschBaseTaskService taskService;
|
||||||
|
@Resource
|
||||||
|
private IpdmBiSlittingproductionplanService productionPlanService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DjqTask djqTask;
|
||||||
|
@Resource
|
||||||
|
private GzqTask gzqTask;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KzjhcwTask kzjhcwTask;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SsxDjwTask ssxDjwTask;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AcsTaskDto> addTask() {
|
||||||
|
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||||
|
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getHandle_class, THIS_CLASS)
|
||||||
|
.eq(SchBaseTask::getTask_status, TaskStatusEnum.START_AND_POINT.getCode())
|
||||||
|
.eq(SchBaseTask::getIs_delete, 0)
|
||||||
|
);
|
||||||
|
taskList.forEach(r -> {
|
||||||
|
AcsTaskDto dto = AcsTaskDto.builder()
|
||||||
|
.ext_task_id(r.getTask_id().toString())
|
||||||
|
.task_code(r.getTask_code())
|
||||||
|
.task_type(r.getAcs_task_type())
|
||||||
|
.start_device_code(r.getPoint_code1())
|
||||||
|
.next_device_code(r.getPoint_code2())
|
||||||
|
.start_device_code2(r.getPoint_code3())
|
||||||
|
.next_device_code2(r.getPoint_code4())
|
||||||
|
.vehicle_code(r.getVehicle_code())
|
||||||
|
.priority(r.getPriority())
|
||||||
|
.remark(r.getRemark())
|
||||||
|
.product_area(r.getProduct_area())
|
||||||
|
.agv_system_type("2")
|
||||||
|
.build();
|
||||||
|
resultList.add(dto);
|
||||||
|
});
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||||
|
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
||||||
|
.eq(StringUtils.isNotBlank(taskObj.getString("task_code1")), SchBaseTask::getTask_code, taskObj.getString("task_code1")), false);
|
||||||
|
if (schBaseTask == null) {
|
||||||
|
throw new BadRequestException("接口sendProductToFirstFloor,任务号为空!");
|
||||||
|
}
|
||||||
|
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||||
|
// 更新任务状态为执行中
|
||||||
|
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
}
|
||||||
|
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
//1.更改任务状态为完成
|
||||||
|
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
//2.改变起点点位状态
|
||||||
|
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||||
|
//更新库存记录
|
||||||
|
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||||
|
//3.acs传子卷信息,去分切计划表查找定级数据,桁架任务完成根据子卷定级创建AGV任务将满轴搬运至质检区或管制区
|
||||||
|
if (StringUtils.isBlank(taskObj.getString("container_name"))) {
|
||||||
|
throw new BadRequestException("子卷号不能为空!");
|
||||||
|
}
|
||||||
|
PdmBiSlittingproductionplan containerInfo = productionPlanService.getOne(new LambdaUpdateWrapper<PdmBiSlittingproductionplan>()
|
||||||
|
.eq(PdmBiSlittingproductionplan::getContainer_name, taskObj.getString("container_name")));
|
||||||
|
if (containerInfo == null) {
|
||||||
|
throw new BadRequestException("找不到子卷信息!");
|
||||||
|
}
|
||||||
|
//子卷等级
|
||||||
|
String level = containerInfo.getLevel();
|
||||||
|
if (Arrays.stream(ContainerLevelEnum.values()).noneMatch(enumItem -> enumItem.getCode().equals(level))) {
|
||||||
|
throw new BadRequestException("非法的子卷等级!");
|
||||||
|
}
|
||||||
|
//查询待检区和管制区库位情况
|
||||||
|
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService
|
||||||
|
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||||
|
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||||
|
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||||
|
JSONObject toDjqTask = new JSONObject();
|
||||||
|
//获取子卷号
|
||||||
|
toDjqTask.put("vehicle_code", containerInfo.getContainer_name());
|
||||||
|
// 判断子卷等级属于待检区还是管制区,创建满轴缓存位到待检区或管制区的agv任务
|
||||||
|
if (Stream.of(ContainerLevelEnum.BEST, ContainerLevelEnum.WELL, ContainerLevelEnum.COMMON).anyMatch(enumItem -> enumItem.getCode().equals(level))) {
|
||||||
|
List<BstIvtPackageinfoivt> djqPointList = bstIvtPackageinfoivtList.stream()
|
||||||
|
.filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("待检区").equals(r.getPoint_status())
|
||||||
|
&& PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status())).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(djqPointList)) {
|
||||||
|
throw new BadRequestException("待检区暂无空余库位!");
|
||||||
|
}
|
||||||
|
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
|
||||||
|
toDjqTask.put("point_code1", schBaseTask.getPoint_code2());
|
||||||
|
toDjqTask.put("point_code2", djqPointList.get(0).getPoint_code());
|
||||||
|
djqTask.createTask(toDjqTask);
|
||||||
|
} else if (Stream.of(ContainerLevelEnum.REWORK, ContainerLevelEnum.CONTROL).anyMatch(enumItem -> enumItem.getCode().equals(level))) {
|
||||||
|
List<BstIvtPackageinfoivt> gkqPointList = bstIvtPackageinfoivtList.stream()
|
||||||
|
.filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("管制区").equals(r.getPoint_status())
|
||||||
|
&& PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status())).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(gkqPointList)) {
|
||||||
|
throw new BadRequestException("管控区暂无空余库位!");
|
||||||
|
}
|
||||||
|
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->管制区"));
|
||||||
|
toDjqTask.put("point_code1", schBaseTask.getPoint_code2());
|
||||||
|
toDjqTask.put("point_code2", gkqPointList.get(0).getPoint_code());
|
||||||
|
gzqTask.createTask(toDjqTask);
|
||||||
|
}
|
||||||
|
//4.创建空载具到输送线任务
|
||||||
|
List<BstIvtPackageinfoivt> kzjPointList = bstIvtPackageinfoivtList.stream()
|
||||||
|
.filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位").equals(r.getPoint_status())
|
||||||
|
&& PackageInfoIvtEnum.IVT_STATUS.code("空载具").equals(r.getIvt_status())).collect(Collectors.toList());
|
||||||
|
JSONObject toSsxTask = new JSONObject();
|
||||||
|
toSsxTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("放空(空载具缓存位->输送线)"));
|
||||||
|
toSsxTask.put("vehicle_code", containerInfo.getContainer_name());
|
||||||
|
//判断是否有空载具
|
||||||
|
if (CollectionUtils.isNotEmpty(kzjPointList)) {
|
||||||
|
//直接创建搬运空载具任务
|
||||||
|
toSsxTask.put("point_code1", kzjPointList.get(0).getPoint_code());
|
||||||
|
//终点为输送线点位
|
||||||
|
toSsxTask.put("point_code2", schBaseTask.getPoint_code1());
|
||||||
|
ssxDjwTask.createTask(toSsxTask);
|
||||||
|
} else {
|
||||||
|
//空载具位没有可用的库存:判断是否有正在搬运空载具过来的任务,有的话不创建
|
||||||
|
//没有的话创建搬运空载具任务, 当任务完成的时候,补发桁架任务。
|
||||||
|
List<BstIvtPackageinfoivt> packageinfoivtList = packageinfoivtService.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||||
|
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"))
|
||||||
|
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用")));
|
||||||
|
//todo 查找正在搬运到待检区的任务,假设只有一个,如果有多个车则更改
|
||||||
|
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
|
||||||
|
//执行中
|
||||||
|
.eq(SchBaseTask::getTask_status, TaskStatusEnum.EXECUTING.getCode())
|
||||||
|
.and(
|
||||||
|
r -> r.in(SchBaseTask::getPoint_code2, packageinfoivtList)
|
||||||
|
));
|
||||||
|
//没有正在搬运空载具过来的任务,创建搬运空载具任务
|
||||||
|
if (CollectionUtils.isEmpty(taskList)) {
|
||||||
|
//查询待检区库位有空载具的
|
||||||
|
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
||||||
|
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||||
|
.in(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.POINT_STATUS.code("管制区"))
|
||||||
|
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具")).orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||||
|
//待检区库位有空载具
|
||||||
|
if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||||
|
List<BstIvtPackageinfoivt> kzjPoint = packageinfoivtList.stream()
|
||||||
|
.filter(r -> PackageInfoIvtEnum.IVT_STATUS.code("空载具").equals(r.getIvt_status()))
|
||||||
|
.sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
//创建搬运空载具任务
|
||||||
|
JSONObject toKzjhcwTask = new JSONObject();
|
||||||
|
toKzjhcwTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区->空载具缓存位)"));
|
||||||
|
toKzjhcwTask.put("point_code1", djqPointList.get(0).getPoint_code());
|
||||||
|
toKzjhcwTask.put("point_code2", kzjPoint.get(0).getPoint_code());
|
||||||
|
toKzjhcwTask.put("vehicle_code", containerInfo.getContainer_name());
|
||||||
|
kzjhcwTask.createTask(toKzjhcwTask);
|
||||||
|
}
|
||||||
|
//todo 待检区和管制区都无空载具情况
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createTask(JSONObject form) {
|
||||||
|
Assert.notNull(form, "请求参数不能为空");
|
||||||
|
String task_type = form.getString("task_type");
|
||||||
|
if (StrUtil.isBlank(task_type)) {
|
||||||
|
throw new BadRequestException("业务类型不能为空");
|
||||||
|
}
|
||||||
|
String point_code1 = form.getString("point_code1");
|
||||||
|
if (StrUtil.isBlank(point_code1)) {
|
||||||
|
throw new BadRequestException("起点不能为空");
|
||||||
|
}
|
||||||
|
String point_code2 = form.getString("point_code2");
|
||||||
|
if (StrUtil.isBlank(point_code2)) {
|
||||||
|
throw new BadRequestException("下一点不能为空");
|
||||||
|
}
|
||||||
|
String point_code3 = form.getString("point_code3");
|
||||||
|
|
||||||
|
String point_code4 = form.getString("point_code4");
|
||||||
|
|
||||||
|
String vehicle_code = form.getString("vehicle_code");
|
||||||
|
if (StrUtil.isBlank(vehicle_code)) {
|
||||||
|
throw new BadRequestException("载具号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
json.put("task_type", form.getString("task_type"));
|
||||||
|
json.put("vehicle_code", form.getString("vehicle_code"));
|
||||||
|
json.put("product_area", form.getString("product_area"));
|
||||||
|
String task_status = form.getString("task_status");
|
||||||
|
if (StrUtil.isEmpty(task_status)) {
|
||||||
|
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||||
|
} else {
|
||||||
|
json.put("task_status", task_status);
|
||||||
|
}
|
||||||
|
json.put("point_code1", point_code1);
|
||||||
|
json.put("point_code2", point_code2);
|
||||||
|
json.put("point_code3", point_code3);
|
||||||
|
json.put("point_code4", point_code4);
|
||||||
|
json.put("handle_class", this.getClass().getName());
|
||||||
|
json.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
json.put("create_name", SecurityUtils.getCurrentUsername());
|
||||||
|
json.put("create_time", DateUtil.now());
|
||||||
|
json.put("priority", "1");
|
||||||
|
json.put("acs_task_type", "9");
|
||||||
|
json.put("response_param", form.getString("truss_type"));
|
||||||
|
json.put("request_param", form.getString("request_param"));
|
||||||
|
taskService.save(json.toJavaObject(SchBaseTask.class));
|
||||||
|
//如果目标点位没有空位先创建不下发
|
||||||
|
if (form.getBoolean("isSend")) {
|
||||||
|
this.immediateNotifyAcs(json.getString("task_id"));
|
||||||
|
}
|
||||||
|
return json.getString("task_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
package org.nl.b_lms.sch.tasks.packingArea;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||||
|
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||||
|
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
|
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||||
|
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.wms.sch.AcsTaskDto;
|
||||||
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||||
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 空载具缓存位到输送线桁架任务
|
||||||
|
*
|
||||||
|
* @author gbx
|
||||||
|
* @since 2024-01-24
|
||||||
|
*/
|
||||||
|
@Service()
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class SsxDjwTask extends AbstractAcsTask {
|
||||||
|
|
||||||
|
private final String THIS_CLASS = SsxDjwTask.class.getName();
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IschBaseTaskService taskService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KzjhcwTask kzjhcwTask;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AcsTaskDto> addTask() {
|
||||||
|
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||||
|
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getHandle_class, THIS_CLASS)
|
||||||
|
.eq(SchBaseTask::getTask_status, TaskStatusEnum.START_AND_POINT.getCode())
|
||||||
|
.eq(SchBaseTask::getIs_delete, 0)
|
||||||
|
);
|
||||||
|
taskList.forEach(r -> {
|
||||||
|
AcsTaskDto dto = AcsTaskDto.builder()
|
||||||
|
.ext_task_id(r.getTask_id().toString())
|
||||||
|
.task_code(r.getTask_code())
|
||||||
|
.task_type(r.getAcs_task_type())
|
||||||
|
.start_device_code(r.getPoint_code1())
|
||||||
|
.next_device_code(r.getPoint_code2())
|
||||||
|
.start_device_code2(r.getPoint_code3())
|
||||||
|
.next_device_code2(r.getPoint_code4())
|
||||||
|
.vehicle_code(r.getVehicle_code())
|
||||||
|
.priority(r.getPriority())
|
||||||
|
.remark(r.getRemark())
|
||||||
|
.product_area(r.getProduct_area())
|
||||||
|
.agv_system_type("2")
|
||||||
|
.build();
|
||||||
|
resultList.add(dto);
|
||||||
|
});
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||||
|
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(StringUtils.isNotBlank(taskObj.getString("task_code1")), SchBaseTask::getTask_code, taskObj.getString("task_code1")), false);
|
||||||
|
if (schBaseTask == null) {
|
||||||
|
throw new BadRequestException("空载具缓存位到输送线桁架任务任务更新接口任务号为空!");
|
||||||
|
}
|
||||||
|
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||||
|
// 更新任务状态为执行中
|
||||||
|
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
}
|
||||||
|
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
//1.更改任务状态为完成
|
||||||
|
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
//2.改变起点点位状态
|
||||||
|
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||||
|
//更新库存记录
|
||||||
|
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||||
|
//3.空载具缓存位到输送线送空任务完成,去待检区或管制区补空载具
|
||||||
|
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
||||||
|
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||||
|
.in(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.POINT_STATUS.code("管制区"))
|
||||||
|
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具"))
|
||||||
|
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||||
|
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||||
|
//有空载具
|
||||||
|
if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||||
|
//创建搬运空载具任务
|
||||||
|
JSONObject toKzjhcwTask = new JSONObject();
|
||||||
|
toKzjhcwTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区->空载具缓存位)"));
|
||||||
|
toKzjhcwTask.put("point_code1", djqPointList.get(0).getPoint_code());
|
||||||
|
//任务起点为补空载具终点
|
||||||
|
toKzjhcwTask.put("point_code2", schBaseTask.getPoint_code1());
|
||||||
|
kzjhcwTask.createTask(toKzjhcwTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createTask(JSONObject form) {
|
||||||
|
Assert.notNull(form, "请求参数不能为空");
|
||||||
|
|
||||||
|
String task_type = form.getString("task_type");
|
||||||
|
if (StrUtil.isBlank(task_type)) {
|
||||||
|
throw new BadRequestException("业务类型不能为空");
|
||||||
|
}
|
||||||
|
String point_code1 = form.getString("point_code1");
|
||||||
|
if (StrUtil.isBlank(point_code1)) {
|
||||||
|
throw new BadRequestException("起点不能为空");
|
||||||
|
}
|
||||||
|
String point_code2 = form.getString("point_code2");
|
||||||
|
if (StrUtil.isBlank(point_code2)) {
|
||||||
|
throw new BadRequestException("下一点不能为空");
|
||||||
|
}
|
||||||
|
String point_code3 = form.getString("point_code3");
|
||||||
|
|
||||||
|
String point_code4 = form.getString("point_code4");
|
||||||
|
|
||||||
|
String vehicle_code = form.getString("vehicle_code");
|
||||||
|
if (StrUtil.isBlank(vehicle_code)) {
|
||||||
|
throw new BadRequestException("载具号不能为空");
|
||||||
|
}
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
json.put("task_type", form.getString("task_type"));
|
||||||
|
json.put("vehicle_code", form.getString("vehicle_code"));
|
||||||
|
String task_status = form.getString("task_status");
|
||||||
|
if (StrUtil.isEmpty(task_status)) {
|
||||||
|
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||||
|
} else {
|
||||||
|
json.put("task_status", task_status);
|
||||||
|
}
|
||||||
|
json.put("point_code1", point_code1);
|
||||||
|
json.put("point_code2", point_code2);
|
||||||
|
json.put("point_code3", point_code3);
|
||||||
|
json.put("point_code4", point_code4);
|
||||||
|
json.put("handle_class", this.getClass().getName());
|
||||||
|
json.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
json.put("create_name", SecurityUtils.getCurrentUsername());
|
||||||
|
json.put("create_time", DateUtil.now());
|
||||||
|
json.put("priority", "1");
|
||||||
|
json.put("acs_task_type", "9");
|
||||||
|
json.put("response_param", form.getString("truss_type"));
|
||||||
|
json.put("request_param", form.getString("request_param"));
|
||||||
|
taskService.save(json.toJavaObject(SchBaseTask.class));
|
||||||
|
//如果目标点位没有空位先创建不下发
|
||||||
|
if (form.getBoolean("isSend")) {
|
||||||
|
this.immediateNotifyAcs(json.getString("task_id"));
|
||||||
|
}
|
||||||
|
return json.getString("task_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,13 +5,11 @@ import cn.hutool.core.lang.Assert;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.b_lms.pdm.productionplan.service.IpdmBiSlittingproductionplanService;
|
|
||||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||||
|
|||||||
Reference in New Issue
Block a user