接口封装提交

main
Comair 7 months ago
parent 3288adb818
commit d92318d763
  1. 103
      shkj-wms/src/main/java/com/shkj/wcs/controller/busin/WcsTaskController.java
  2. 47
      shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsCreateTaskDto.java
  3. 22
      shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsIdList.java
  4. 19
      shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSOperation.java
  5. 8
      shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSTaskTypeEnum.java
  6. 2
      shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/WCSUtil.java
  7. 17
      shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusBody.java
  8. 20
      shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusDto.java
  9. 19
      shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryTaskStatusBody.java
  10. 21
      shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WcsQueryTaskStatusDto.java

@ -5,11 +5,17 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shkj.common.annotation.Log;
import com.shkj.common.annotation.RepeatSubmit;
import com.shkj.common.core.domain.Result;
import com.shkj.common.enums.BusinessType;
import com.shkj.common.utils.DateUtils;
import com.shkj.wcs.service.IBusinDataTaskService;
import com.shkj.wcs.third.workbinWcs.dto.WcsCreateTaskBody;
import com.shkj.wcs.third.workbinWcs.dto.WcsCreateTaskDto;
import com.shkj.wcs.third.rcs.RCSUtil;
import com.shkj.wcs.third.rcs.dto.RcsCreateTaskDto;
import com.shkj.wcs.third.rcs.dto.RcsIdList;
import com.shkj.wcs.third.rcs.enums.RCSOperation;
import com.shkj.wcs.third.rcs.enums.RCSTaskTypeEnum;
import com.shkj.wcs.third.workbinWcs.WCSUtil;
import com.shkj.wcs.third.workbinWcs.dto.*;
import com.shkj.wcs.vo.WcsResponseVo;
import com.shkj.wcs.domain.BusinDataTask;
import lombok.RequiredArgsConstructor;
@ -19,6 +25,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -32,6 +39,12 @@ public class WcsTaskController {
@Autowired
private IBusinDataTaskService iBusinDataTaskService;
@Autowired
private RCSUtil rcsUtil;
@Autowired
private WCSUtil wcsUtil;
/**
* wz-wcs任务下发
@ -66,10 +79,34 @@ public class WcsTaskController {
businDataTask.setFromSide(fromBinCode);
businDataTask.setToSide(toBinCode);
businDataTask.setCreateTime(DateUtils.getNowDate());
businDataTask.setPriority(priority);
if (!priority.isEmpty()){
businDataTask.setPriority(priority);
}
boolean save = iBusinDataTaskService.save(businDataTask);
if (save) {
//调用下游接口下任务
log.info("任务储存成功!");
RcsCreateTaskDto rcsCreateTaskDto = new RcsCreateTaskDto();
rcsCreateTaskDto.setTaskType(RCSTaskTypeEnum.PF_LMR_COMMON.getValue());
rcsCreateTaskDto.setRobotTaskCode(businDataTask.getTaskCode());
if(!businDataTask.getPriority().isEmpty()){
rcsCreateTaskDto.setInitPriority(Integer.parseInt(businDataTask.getPriority()));
}
List<RcsIdList> rcsIdLists =new ArrayList<>();
for (int i = 1;i<=2;i++){
RcsIdList rcsIdList =new RcsIdList();
if(i==1){
rcsIdList.setType("ZONE");
rcsIdList.setCode(businDataTask.getFromSide());
rcsIdList.setOperation(RCSOperation.OT_COLLECT.getValue());
}
rcsIdList.setType("ZONE");
rcsIdList.setCode(businDataTask.getToSide());
rcsIdList.setOperation(RCSOperation.OT_DELIVERY.getValue());
rcsIdLists.add(rcsIdList);
}
//Result result = rcsUtil.rcsCreateTask(rcsCreateTaskDto);
}
} else if (dataChange.equals("2")) {
@ -89,23 +126,59 @@ public class WcsTaskController {
}
@Log(title = "查询库区状态", businessType = BusinessType.UPDATE)
@PostMapping("/toWzWcs/queryAreaStatus")
@Log(title = "查询是否存在出库任务测试接口", businessType = BusinessType.UPDATE)
@PostMapping("/toWzWcs/queryTaskStatus")
@RepeatSubmit
public WcsResponseVo queryAreaStatus(WcsCreateTaskDto dto) {
if (dto != null) {
String businessType = dto.getHeader().getBusinessType();
if(businessType.equals("queryAreaStatus")){
}
List<WcsCreateTaskBody> body = dto.getBody();
if (!body.isEmpty()) {
public WcsResponseVo queryTaskStatus(WCSQueryTaskStatusBody body) {
WcsResponseVo vo = wcsUtil.queryTaskStatus(body);
return vo;
}
}
@Log(title = "查询每个库区状态测试接口", businessType = BusinessType.UPDATE)
@PostMapping("/toKjWcs/queryAreaStatus")
@RepeatSubmit
public WcsResponseVo queryAreaStatus(WCSQueryAreaStatusDto dto) {
//调用plc接口 暂时不用
WCSQueryAreaStatusDto wcsQueryAreaStatusDto = new WCSQueryAreaStatusDto();
List<WCSQueryAreaStatusBody> areaStatusBodyList = new ArrayList<>();
String[] areaCodes = {"SC-A2", "SC-B2", "SC-C2", "SC-D2"};
int[] statusValues = {0, 1, 1, 1};
for (int i = 0; i < 4; i++) {
WCSQueryAreaStatusBody queryAreaStatusBody = new WCSQueryAreaStatusBody();
queryAreaStatusBody.setAreaInLocation(areaCodes[i]);
queryAreaStatusBody.setStatus(statusValues[i]);
areaStatusBodyList.add(queryAreaStatusBody);
}
return WcsResponseVo.success();
wcsQueryAreaStatusDto.setBody(areaStatusBodyList);
return WcsResponseVo.success(wcsQueryAreaStatusDto);
}
@Log(title = "任务状态上报测试接口", businessType = BusinessType.UPDATE)
@PostMapping("/toWzWcs/uploadWCSTaskStatus")
@RepeatSubmit
public WcsResponseVo uploadWCSTaskStatus(UploadWCSTaskStatusDto dto) {
//调用plc接口 暂时不用
WcsResponseVo vo = wcsUtil.uploadWCSTaskStatus(dto);
return vo;
}
@Log(title = "扫码处入库申请", businessType = BusinessType.UPDATE)
@PostMapping("/toWzWcs/wcsIncomingTaskRequest")
@RepeatSubmit
public WcsResponseVo wcsIncomingTaskRequest(WcsIncomingTaskRequestDto dto) {
//调用plc接口 暂时不用
WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(dto);
return vo;
}
}

@ -1,5 +1,6 @@
package com.shkj.wcs.third.rcs.dto;
import cn.hutool.core.date.DateTime;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@ -41,29 +42,55 @@ import java.util.List;
public class RcsCreateTaskDto implements Serializable {
/**
* 地图 id
*/
private Integer mapId;
/**
* 任务类型23 含义 A 点顶起托盘搬运至 B 点放下
* 任务类型24 含义 A 点顶起托盘搬运至 B 点不放下
* 任务类型25 含义在负载情况下将 AGV 移动至目标点并放下
*/
private Integer taskType;
private String taskType;
/**
* 优先级
*/
private Integer initPriority;
/**
* 任务截止时间
*/
private DateTime deadline;
/**
* 指定机器人
*/
private String robotType;
/**
*
*/
private String[] robotCode;
/**
* 任务id 任务 id,唯一标识(不能重复)
* 能否打断
*/
private String taskId;
private Integer interrupt;
/**
* 不提供该字段或者为 0 时将由 RCS 自动分配
* 任务编号
*/
private String robotId;
private String robotTaskCode;
/**
* 任务组编号
*/
private String groupCode;
/**
* 目标点集合如从 A 点搬运到 B 点需要提供两个目标点 注意 只有2个 第一个是 起点信息 第二个是目标点
*/
private List<RcsIdList> targets;
private List<RcsIdList> targetRoute;
}

@ -18,12 +18,26 @@ import java.io.Serializable;
public class RcsIdList implements Serializable {
/**
* 库位编号字符串,格式不限
* 目标路径序列从0开始
*/
private String id;
private Integer seq;
/**
* 目标货架角度 暂时用不到
* 目标类型
*/
private Integer angle;
private String type;
/**
* 目标编号
*/
private String code;
/**
* 到达后操作 COLLECT 取货DELIVERY 送货ROTATE 旋转
*/
private String operation;
private String robotType;
}

@ -0,0 +1,19 @@
package com.shkj.wcs.third.rcs.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 到达后的操作
*/
@Getter
@AllArgsConstructor
public enum RCSOperation {
OT_COLLECT("COLLECT","取货"),
OT_DELIVERY("DELIVERY","送货"),
OT_ROTATE("ROTATE","旋转");
private String value;
private String desc;
}

@ -17,11 +17,13 @@ public enum RCSTaskTypeEnum {
* 任务类型24 含义 A 点顶起托盘搬运至 B 点不放下
* #任务类型25 含义在负载情况下将 AGV 移动至目标点并放下
*/
A_TO_B_AND_PUT(23, "从 A 点顶起托盘搬运至 B 点放下"),
A_TO_B_NO_PUT(24, "从 A 点顶起托盘搬运至 B 点不放下"),
/* A_TO_B_AND_PUT(23, "从 A 点顶起托盘搬运至 B 点放下"),
A_TO_B_NO_PUT(24, "从 A 点顶起托盘搬运至 B 点不放下"),*/
PF_LMR_COMMON("PF-LMR-COMMON","搬运,一至数个执行步骤");
// A_TO_B_GOODS_MOVE(25, "在负载情况下将 AGV 移动至目标点并放下"),
;
private Integer value;
private String value;
private String desc;
}

@ -63,7 +63,7 @@ public class WCSUtil {
* @param dto
* @return
*/
public WcsResponseVo queryTaskStatus(WcsIncomingTrayCheckBody dto) {
public WcsResponseVo queryTaskStatus(WCSQueryTaskStatusBody dto) {
Map<String, String> headerMap = new HashMap<>(1);
headerMap.put("businessType", "trayCheck");
String json = JSONObject.toJSONString(dto);

@ -0,0 +1,17 @@
package com.shkj.wcs.third.workbinWcs.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class WCSQueryAreaStatusBody implements Serializable {
private String areaInLocation;
private Integer status;
}

@ -0,0 +1,20 @@
package com.shkj.wcs.third.workbinWcs.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
*查询库区状态实体
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class WCSQueryAreaStatusDto implements Serializable {
private WcsCreateTaskHeader header;
private List<WCSQueryAreaStatusBody> body;
}

@ -0,0 +1,19 @@
package com.shkj.wcs.third.workbinWcs.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class WCSQueryTaskStatusBody implements Serializable {
private String taskType;
private String trayType;
private String destination;
}

@ -0,0 +1,21 @@
package com.shkj.wcs.third.workbinWcs.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
*生产区入库校验实体
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class WcsQueryTaskStatusDto implements Serializable {
private WcsCreateTaskHeader header;
private List<WCSQueryTaskStatusBody> body;
}
Loading…
Cancel
Save