commit
9daa3e1277
10 changed files with 398 additions and 2 deletions
@ -0,0 +1,50 @@ |
||||
package org.springblade.desk.logistics.pojo.entity; |
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
@Schema(description = "箱绑定接收") |
||||
public class AGVCallBack { |
||||
/** |
||||
* 请求编号,每个请求都要一个唯一 |
||||
* 编号, 同一个请求重复提交, 使 |
||||
* 用同一编号 |
||||
*/ |
||||
private String reqCode; |
||||
/** |
||||
* 请求时间戳,格式: “yyyy-MM-dd |
||||
* HH:mm:ss” |
||||
*/ |
||||
private String reqTime; |
||||
/** |
||||
当前位置编号 |
||||
任务开始:该位置为任务起点 |
||||
走出储位:该位置为任务起点 |
||||
任务单取消:该位置为工作位编号 |
||||
任务结束:该位置为任务终点 |
||||
取放申请:取放料箱的点 |
||||
*/ |
||||
private String currentPositionCode; |
||||
/** |
||||
方法名, 可使用任务类型做为方法 |
||||
名 |
||||
由 RCS-2000 任务模板配置后并告 |
||||
知上层系统 |
||||
默认使用方式: |
||||
start : 任务开始 |
||||
outbin : 走出储位 |
||||
end : 任务结束 |
||||
cancel : 任务单取消 |
||||
apply:CTU 料箱取放申请 |
||||
*/ |
||||
private String method; |
||||
/** |
||||
AGV 编号(同 agvCode ) |
||||
*/ |
||||
private String robotCode; |
||||
/** |
||||
当前任务单号 |
||||
*/ |
||||
private String taskCode; |
||||
} |
||||
@ -0,0 +1,109 @@ |
||||
package org.springblade.desk.logistics.pojo.entity; |
||||
|
||||
/** |
||||
* @author: liweidong |
||||
* @create: 2026-03-03 |
||||
*/ |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
|
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* 物流库位实体类 |
||||
* |
||||
* @author |
||||
* @since |
||||
*/ |
||||
@Data |
||||
@TableName("LM_TASK_EXECUTE_RECORD") |
||||
@Schema(description = "AGV小车对接表") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class TaskExecuteRecord extends BaseEntity { |
||||
|
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
|
||||
/** |
||||
* 状态常量:任务开始 |
||||
*/ |
||||
public static final String STATUS_START = "start"; |
||||
|
||||
/** |
||||
* 状态常量:走出储位 |
||||
*/ |
||||
public static final String STATUS_END = "end"; |
||||
|
||||
/** |
||||
* 状态常量:任务单取消 |
||||
*/ |
||||
public static final String STATUS_CANCEL = "cancel"; |
||||
|
||||
/** |
||||
* 状态常量:走出储位 |
||||
*/ |
||||
public static final String STATUS_OUTBIN = "outbin"; |
||||
|
||||
/** |
||||
* 状态常量:CTU料箱取放申请 |
||||
*/ |
||||
public static final String STATUS_APPLY = "apply"; |
||||
|
||||
/** |
||||
* 状态常量:送料申请 |
||||
*/ |
||||
public static final String STATUS_FROMAGV = "fromAgv"; |
||||
|
||||
/** |
||||
* 状态常量:对接结束释放 |
||||
*/ |
||||
public static final String STATUS_RELEASE = "release"; |
||||
|
||||
/** |
||||
* 状态常量:放料申请 |
||||
*/ |
||||
public static final String STATUS_TOAGV = "toAgv"; |
||||
|
||||
/** |
||||
* 任务的ID |
||||
*/ |
||||
@Schema(description = "任务的ID") |
||||
private Long taskId; |
||||
|
||||
/** |
||||
* 默认使用方式: start:任务开始 outbin:走出储位 end:任务结束 cancel:任务单取消 apply:CTU料箱取放申请 |
||||
*/ |
||||
@Schema(description = "默认使用方式: start:任务开始 outbin:走出储位 end:任务结束 cancel:任务单取消 apply:CTU料箱取放申请") |
||||
private String method; |
||||
|
||||
/** |
||||
* 开始位置 |
||||
*/ |
||||
@Schema(description = "开始位置") |
||||
private String startPos; |
||||
|
||||
/** |
||||
* 结束位置 |
||||
*/ |
||||
@Schema(description = "结束位置") |
||||
private String endPos; |
||||
|
||||
/** |
||||
* AGV编号 |
||||
*/ |
||||
@Schema(description = "AGV编号") |
||||
private String robotCode; |
||||
|
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
@Schema(description = "备注") |
||||
private String remark; |
||||
|
||||
} |
||||
@ -0,0 +1,48 @@ |
||||
package org.springblade.desk.logistics.controller; |
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.desk.logistics.pojo.entity.AGVCallBack; |
||||
import org.springblade.desk.logistics.service.IOrderBoxService; |
||||
import org.springblade.desk.logistics.service.ITaskExecuteRecordService; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* agv小车 控制器 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-03-03 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/agv") |
||||
@Tag(name = "agv小车接口", description = "agv小车对接接口") |
||||
public class AGVDockingController { |
||||
|
||||
private final ITaskExecuteRecordService iTaskExecuteRecordService; |
||||
|
||||
|
||||
@PostMapping("/agvCallbackService/agvCallback") |
||||
@ApiOperationSupport(order = 1) |
||||
@Operation( |
||||
summary = "agv小车回调接口", |
||||
description = "AGV小车回调接口" |
||||
) |
||||
public R agvCallback(@RequestBody AGVCallBack agvCallBack ){ |
||||
// 1.参数合法性校验
|
||||
if (agvCallBack == null || agvCallBack.getTaskCode().trim().isEmpty()) { |
||||
return R.fail("任务单号不能为空"); |
||||
} |
||||
if (agvCallBack == null || agvCallBack.getMethod() .trim().isEmpty()) { |
||||
return R.fail("AGV小车当前状态不能为空"); |
||||
} |
||||
return iTaskExecuteRecordService.agvCallback(agvCallBack); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,10 @@ |
||||
package org.springblade.desk.logistics.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.desk.logistics.pojo.entity.TaskExecuteRecord; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface TaskExecuteRecordMapper extends BaseMapper<TaskExecuteRecord> { |
||||
|
||||
} |
||||
@ -0,0 +1,7 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper |
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace = "org.springblade.desk.logistics.mapper.TaskExecuteRecordMapper"> |
||||
|
||||
</mapper> |
||||
@ -0,0 +1,6 @@ |
||||
package org.springblade.desk.logistics.service; |
||||
|
||||
public interface IStorageMonitoringService { |
||||
void monitoringStation(); |
||||
|
||||
} |
||||
@ -0,0 +1,43 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.logistics.service; |
||||
|
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.desk.logistics.pojo.entity.AGVCallBack; |
||||
import org.springblade.desk.logistics.pojo.entity.OrderBind; |
||||
import org.springblade.desk.logistics.pojo.entity.TaskExecuteRecord; |
||||
|
||||
/** |
||||
* 物流小车对接实体类 服务类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2025-11-12 |
||||
*/ |
||||
public interface ITaskExecuteRecordService extends BaseService<TaskExecuteRecord> { |
||||
|
||||
R agvCallback(AGVCallBack agvCallBack); |
||||
} |
||||
@ -0,0 +1,50 @@ |
||||
package org.springblade.desk.logistics.service.impl; |
||||
|
||||
import org.springblade.desk.logistics.pojo.entity.Task; |
||||
import org.springblade.desk.logistics.service.ILocationService; |
||||
import org.springblade.desk.logistics.service.IStationService; |
||||
import org.springblade.desk.logistics.service.IStorageMonitoringService; |
||||
import org.springblade.desk.logistics.service.ITaskService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
|
||||
@Service |
||||
public class StorageMonitoringServiceImpl implements IStorageMonitoringService { |
||||
private static final Set<Integer> RUNNING_STATUSES = new HashSet<>(); |
||||
|
||||
static { |
||||
// 初始化运行中任务状态
|
||||
RUNNING_STATUSES.add(Task.STATUS_START); // 任务启动
|
||||
RUNNING_STATUSES.add(Task.STATUS_CONVEYOR_START); // 输送机启动
|
||||
RUNNING_STATUSES.add(Task.STATUS_CONVEYOR_END); // 输送机结束
|
||||
RUNNING_STATUSES.add(Task.STATUS_STATION); // 站点状态
|
||||
RUNNING_STATUSES.add(Task.STATUS_LOCATION); // 库位状态
|
||||
RUNNING_STATUSES.add(Task.STATUS_WAITING); // 等待状态
|
||||
RUNNING_STATUSES.add(Task.STATUS_STATION_RECEIVE);// 站点接收
|
||||
RUNNING_STATUSES.add(Task.STATUS_BACK_TO_STORAGE);// 返库状态
|
||||
} |
||||
/** |
||||
* 任务服务:处理箱绑定任务的创建、状态更新、删除等 |
||||
*/ |
||||
private final ITaskService iTaskService; |
||||
/** |
||||
* 站点服务:处理站点状态(占用/空闲)管理 |
||||
*/ |
||||
private final IStationService iStationService; |
||||
/** |
||||
* 库位服务:处理库位状态(占用/空闲)管理 |
||||
*/ |
||||
private final ILocationService iLocationService; |
||||
public StorageMonitoringServiceImpl(ITaskService iTaskService, IStationService iStationService, ILocationService iLocationService) { |
||||
this.iTaskService = iTaskService; |
||||
this.iStationService = iStationService; |
||||
this.iLocationService = iLocationService; |
||||
} |
||||
|
||||
@Override |
||||
public void monitoringStation() { |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,72 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.logistics.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.desk.logistics.mapper.OrderBindMapper; |
||||
import org.springblade.desk.logistics.mapper.TaskExecuteRecordMapper; |
||||
import org.springblade.desk.logistics.pojo.entity.AGVCallBack; |
||||
import org.springblade.desk.logistics.pojo.entity.OrderBind; |
||||
import org.springblade.desk.logistics.pojo.entity.TaskExecuteRecord; |
||||
import org.springblade.desk.logistics.service.IOrderBindService; |
||||
import org.springblade.desk.logistics.service.ITaskExecuteRecordService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 物流小车对接实体类 服务实现类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2025-11-12 |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRecordMapper, TaskExecuteRecord> implements ITaskExecuteRecordService { |
||||
|
||||
|
||||
@Override |
||||
public R agvCallback(AGVCallBack agvCallBack) { |
||||
log.info("agv小车接口调用参数入参:{}",agvCallBack); |
||||
List<TaskExecuteRecord> list = list(new LambdaQueryWrapper<TaskExecuteRecord>().eq(TaskExecuteRecord::getId, agvCallBack.getTaskCode()).orderByDesc(TaskExecuteRecord::getCreateTime)); |
||||
if (list==null||list.size()==0) { |
||||
return R.fail("未查询到该任务单号"); |
||||
} |
||||
TaskExecuteRecord taskExecuteRecord = list.get(0); |
||||
String method = agvCallBack.getMethod().replaceAll(" ", ""); |
||||
taskExecuteRecord.setMethod(method); |
||||
if (!updateById(taskExecuteRecord)) { |
||||
return R.fail("保存该任务单号失败"); |
||||
} |
||||
if (method.equals(TaskExecuteRecord.STATUS_END)) { |
||||
//todo: 调用东哥接口
|
||||
} |
||||
return R.success(); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue