接口封装提交

main
Comair 7 months ago
parent c495e13601
commit 9f3102f0bc
  1. 6
      shkj-admin/src/main/resources/application-yun.yml
  2. 2
      shkj-admin/src/main/resources/application.yml
  3. 52
      shkj-wms/src/main/java/com/shkj/wcs/controller/busin/WcsTaskController.java
  4. 6
      shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java
  5. 6
      shkj-wms/src/main/java/com/shkj/wcs/third/rcs/RCSUtil.java

@ -12,7 +12,7 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://120.77.94.227:3306/sc-wcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://120.77.94.227:3306/sc_wcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: CTlTwKgIrRVTsEHqxxx password: CTlTwKgIrRVTsEHqxxx
# 从库数据源 # 从库数据源
@ -71,7 +71,7 @@ spring:
# 数据库索引 # 数据库索引
database: 3 database: 3
# 密码 # 密码
password: rvGUoUFAIg4nESp9 password:
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:
@ -93,7 +93,7 @@ third:
uploadWCSTaskStatusUrl: http://127.0.0.1:8081/api/toWzWcs/uploadWCSTaskStatus uploadWCSTaskStatusUrl: http://127.0.0.1:8081/api/toWzWcs/uploadWCSTaskStatus
# agv接口 # agv接口
agvCreateTaskUrl: http://127.0.0.1:8081/rest/common/createTask agvCreateTaskUrl: http://127.0.0.1:8081/rest/common/createTask
agvStatesUrl: http://127.0.0.1:8081/rest/robots/states agvStatesUrl: http://127.0.0.1:8081/api/robot/controller/robot/query
agvCancelTaskUrl: http://127.0.0.1:8081/rest/common/cancelTask agvCancelTaskUrl: http://127.0.0.1:8081/rest/common/cancelTask
queryAckByTaskUrl: http://127.0.0.1:8081/rest/common/queryAckByTaskId queryAckByTaskUrl: http://127.0.0.1:8081/rest/common/queryAckByTaskId
# ess接口 # ess接口

@ -45,7 +45,7 @@ spring:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
profiles: profiles:
active: pro146 active: yun
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:

@ -91,52 +91,18 @@ public class WcsTaskController {
} }
@Log(title = "wz-wcs任务下发", businessType = BusinessType.UPDATE) @Log(title = "查询库区状态", businessType = BusinessType.UPDATE)
@PostMapping("/toWzWcs/wcsIncomingTrayCheck") @PostMapping("/toWzWcs/queryAreaStatus")
@RepeatSubmit @RepeatSubmit
public WcsResponseVo wcsIncomingTrayCheck(WcsCreateTaskDto bo) { public WcsResponseVo queryAreaStatus(WcsCreateTaskDto dto) {
if (bo != null) { if (dto != null) {
List<WcsCreateTaskBody> body = bo.getBody(); String businessType = dto.getHeader().getBusinessType();
if (!body.isEmpty()) { if(businessType.equals("queryAreaStatus")){
for (WcsCreateTaskBody by : body) {
String taskId = by.getTaskId();
String trayCode = by.getTrayCode();
String taskType = by.getTaskType();
String fromBinCode = by.getFromBinCode();
String toBinCode = by.getToBinCode();
String dataChange = by.getDataChange();
String priority = by.getPriority();
LambdaQueryWrapper<BusinDataTask> lqwDataTask = new LambdaQueryWrapper<BusinDataTask>()
.eq(BusinDataTask::getContainerId, trayCode)
.in(BusinDataTask::getTaskStatus, "1", "2");
BusinDataTask one = iBusinDataTaskService.getOne(lqwDataTask);
if (dataChange.equals("1")) {
if (one != null) {
return WcsResponseVo.error(500, "该托盘" + trayCode + "存在未完成的任务");
}
BusinDataTask businDataTask = new BusinDataTask();
businDataTask.setTaskCode(taskId);
businDataTask.setTaskType(taskType);
businDataTask.setContainerId(Long.valueOf(trayCode));
businDataTask.setFromSide(fromBinCode);
businDataTask.setToSide(toBinCode);
businDataTask.setCreateTime(DateUtils.getNowDate());
businDataTask.setPriority(priority);
boolean save = iBusinDataTaskService.save(businDataTask);
if (save) {
//调用下游接口下任务
} }
} else if (dataChange.equals("2")) { List<WcsCreateTaskBody> body = dto.getBody();
if (one == null) { if (!body.isEmpty()) {
return WcsResponseVo.error(500, "未查询到该托盘" + trayCode + "存在未完成的任务");
}
one.setTaskStatus("6");
iBusinDataTaskService.updateById(one);
//推送给下游
}
}
} }
} }

@ -85,7 +85,7 @@ public class PlcEventTask {
@Autowired @Autowired
IBusinDataTaskService iBusinDataTaskService; IBusinDataTaskService iBusinDataTaskService;
@Scheduled(fixedDelay = 5000) //@Scheduled(fixedDelay = 5000)
public void init() { public void init() {
//查询需要连接的PLC,初始化连接对象 //查询需要连接的PLC,初始化连接对象
List<WcsPlcConnectVo> plcList =(List<WcsPlcConnectVo>) redisTemplate.opsForValue().get(RedisConstant.redisPlcListConnect); List<WcsPlcConnectVo> plcList =(List<WcsPlcConnectVo>) redisTemplate.opsForValue().get(RedisConstant.redisPlcListConnect);
@ -107,7 +107,7 @@ public class PlcEventTask {
//输送线心跳 //输送线心跳
@Scheduled(fixedDelay = 4000) //@Scheduled(fixedDelay = 4000)
public void writePlcheartbeatDps() { public void writePlcheartbeatDps() {
//根据连接的plcId获取属性 //根据连接的plcId获取属性
PlcOperate plcOperate = plcInit.getPlcOperate_dps(); PlcOperate plcOperate = plcInit.getPlcOperate_dps();
@ -136,7 +136,7 @@ public class PlcEventTask {
} }
//堆垛机心跳 //堆垛机心跳
@Scheduled(fixedDelay = 4000) //@Scheduled(fixedDelay = 4000)
public void writePlcheartbeatStk() { public void writePlcheartbeatStk() {
//根据连接的plcId获取属性 //根据连接的plcId获取属性
PlcOperate plcOperate = plcInit.getPlcOperate_stk(); PlcOperate plcOperate = plcInit.getPlcOperate_stk();

@ -206,11 +206,11 @@ public class RCSUtil {
/** /**
* 获取AGV实时状态信息 * 获取AGV实时状态信息
* *
* @param mapId bo * @param singleRobotCode bo
* @return {@code Result} * @return {@code Result}
*/ */
public Result rcsRobotsStates(String mapId) { public Result rcsRobotsStates(String singleRobotCode) {
String json = JSONObject.toJSONString(mapId); String json = JSONObject.toJSONString(singleRobotCode);
try { try {
Map<String, String> headerMap = getHeaderMap(); Map<String, String> headerMap = getHeaderMap();
String res = HttpRequest.post(agvStatesUrl) String res = HttpRequest.post(agvStatesUrl)

Loading…
Cancel
Save