|
|
|
|
@ -6,6 +6,7 @@ import cn.hutool.http.HttpUtil; |
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import groovy.lang.Lazy; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.redisson.executor.TasksService; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
@ -13,10 +14,7 @@ import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.desk.logistics.constant.AgvConstant; |
|
|
|
|
import org.springblade.desk.logistics.mapper.TaskExecuteRecordMapper; |
|
|
|
|
import org.springblade.desk.logistics.pojo.dto.AGVCallBackDto; |
|
|
|
|
import org.springblade.desk.logistics.pojo.entity.Location; |
|
|
|
|
import org.springblade.desk.logistics.pojo.entity.Station; |
|
|
|
|
import org.springblade.desk.logistics.pojo.entity.Task; |
|
|
|
|
import org.springblade.desk.logistics.pojo.entity.TaskExecuteRecord; |
|
|
|
|
import org.springblade.desk.logistics.pojo.entity.*; |
|
|
|
|
import org.springblade.desk.logistics.pojo.vo.AgvSchedulingTaskVO; |
|
|
|
|
import org.springblade.desk.logistics.service.*; |
|
|
|
|
import org.springblade.desk.logistics.utils.AgvTaskTypeUtil; |
|
|
|
|
@ -44,7 +42,7 @@ import static org.springblade.desk.logistics.pojo.entity.Station.DROPOFF_CONVEYO |
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@Slf4j |
|
|
|
|
public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRecordMapper, TaskExecuteRecord> implements ITaskExecuteRecordService { |
|
|
|
|
public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRecordMapper, TaskExecuteRecord> implements ITaskExecuteRecordService { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
TaskExecuteRecordMapper taskExecuteRecordMapper; |
|
|
|
|
@ -55,17 +53,15 @@ public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRec |
|
|
|
|
@Autowired |
|
|
|
|
ILocationService locationService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
ITaskExecuteRecordService taskExecuteRecordService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
IStationService stationService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
IPipelineService iPipelineService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
AgvTaskTypeUtil agvTaskTypeUtil; |
|
|
|
|
@Autowired |
|
|
|
|
IVirtualShelvesService virtualShelvesService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* AGV小车任务状态回调接口 |
|
|
|
|
@ -314,7 +310,7 @@ public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRec |
|
|
|
|
log.error("Task状态修改失败"); |
|
|
|
|
} |
|
|
|
|
// 添加任务
|
|
|
|
|
boolean record = taskExecuteRecordService.inboundRecord(ctuSchedulingTask, task); |
|
|
|
|
boolean record = inboundRecord(ctuSchedulingTask, task); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
@ -427,7 +423,7 @@ public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRec |
|
|
|
|
// 调用AGV
|
|
|
|
|
String taskType = agvTaskTypeUtil.getTaskType(Integer.valueOf(station.getStationPosition())); |
|
|
|
|
|
|
|
|
|
boolean agvResult = iPipelineService.genAgvSchedulingTask( |
|
|
|
|
boolean agvResult = genAgvSchedulingTask( |
|
|
|
|
taskType, location.getLocationCode(),station.getStationCode() , EQUIPMENT_TYPE_AGV, task |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
@ -438,6 +434,7 @@ public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRec |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 生成请求唯一标识 |
|
|
|
|
* @param prefix 前缀 |
|
|
|
|
@ -448,6 +445,51 @@ public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRec |
|
|
|
|
return prefix + IdUtil.fastSimpleUUID(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean genAgvSchedulingTask(String taskType, String startPos, String endPos, String type, Task task) { |
|
|
|
|
|
|
|
|
|
// 获取虚拟货架
|
|
|
|
|
VirtualShelves virtualShelves = virtualShelvesService.getVirtualShelvesCode(); |
|
|
|
|
if (null == virtualShelves) { |
|
|
|
|
log.error("获取虚拟货架失败"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 站点绑定虚拟货架
|
|
|
|
|
boolean shelves = boundVirtualShelves( |
|
|
|
|
virtualShelves.getVirtualShelvesCode(), |
|
|
|
|
startPos |
|
|
|
|
); |
|
|
|
|
if (!shelves) { |
|
|
|
|
log.error("站点绑定虚拟货架失败"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 调用AGV
|
|
|
|
|
AgvSchedulingTaskVO agvSchedulingTaskVO = genAgvSchedulingTask( |
|
|
|
|
taskType, |
|
|
|
|
startPos, |
|
|
|
|
endPos, |
|
|
|
|
type, |
|
|
|
|
virtualShelves.getVirtualShelvesCode() |
|
|
|
|
); |
|
|
|
|
if (null == agvSchedulingTaskVO || !"0".equals(agvSchedulingTaskVO.getCode())) { |
|
|
|
|
log.error("调用AGV调度失败"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 入库记录
|
|
|
|
|
if (null == task) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boolean record = inboundRecord(agvSchedulingTaskVO, task); |
|
|
|
|
if (!record) { |
|
|
|
|
log.error("入库记录保存失败"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|