|
|
|
|
@ -19,6 +19,7 @@ import com.shkj.wcs.third.rcs.dto.RcsCancelTaskDto; |
|
|
|
|
import com.shkj.wcs.third.rcs.dto.RcsCreateTaskDto; |
|
|
|
|
import com.shkj.wcs.third.rcs.dto.RcsIdList; |
|
|
|
|
import com.shkj.wcs.third.rcs.dto.RcsThirdResult; |
|
|
|
|
import com.shkj.wcs.third.workbinWcs.dto.WcsIncomingCheckDto; |
|
|
|
|
import com.shkj.wms.bo.AGVMoveBo; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
@ -89,41 +90,20 @@ public class WCSUtil { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 创建任务 |
|
|
|
|
* wcs系统通过此接口向rcs系统下发创建任务指令 |
|
|
|
|
* |
|
|
|
|
* @param dto dto |
|
|
|
|
* @return {@code Result} |
|
|
|
|
*/ |
|
|
|
|
public Result rcsCreateTask(RcsCreateTaskDto dto) { |
|
|
|
|
String json = JSONObject.toJSONString(dto); |
|
|
|
|
try { |
|
|
|
|
Map<String, String> headerMap = getHeaderMap(); |
|
|
|
|
String res = HttpRequest.post(agvCreateTaskUrl) |
|
|
|
|
.addHeaders(headerMap) |
|
|
|
|
.body(json) |
|
|
|
|
.execute().body(); |
|
|
|
|
Result result = parseThirdRcsResult(res); |
|
|
|
|
return result; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("createTask 方法出错了 = {}", e.getMessage()); |
|
|
|
|
return Result.err().msg(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 创建任务 |
|
|
|
|
* 生产区入库校验 |
|
|
|
|
* wcs系统通过此接口向rcs系统下发创建任务指令 |
|
|
|
|
* |
|
|
|
|
* @param dto dto |
|
|
|
|
* @return {@code Result} |
|
|
|
|
*/ |
|
|
|
|
public Result wcsIncomingTrayCheck(Wcs dto) { |
|
|
|
|
String json = JSONObject.toJSONString(dto); |
|
|
|
|
public Result wcsIncomingTrayCheck(WcsIncomingCheckDto dto) { |
|
|
|
|
String json = JSONObject.toJSONString(dto.getBody()); |
|
|
|
|
try { |
|
|
|
|
Map<String, String> headerMap = getHeaderMap(); |
|
|
|
|
String res = HttpRequest.post(agvCreateTaskUrl) |
|
|
|
|
headerMap.put("businessType","trayCheck"); |
|
|
|
|
String res = HttpRequest.post(wcsIncomingTrayCheckUrl) |
|
|
|
|
.addHeaders(headerMap) |
|
|
|
|
.body(json) |
|
|
|
|
.execute().body(); |
|
|
|
|
@ -131,7 +111,7 @@ public class WCSUtil { |
|
|
|
|
return result; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("createTask 方法出错了 = {}", e.getMessage()); |
|
|
|
|
log.error("wcsIncomingTrayCheck 方法出错了 = {}", e.getMessage()); |
|
|
|
|
return Result.err().msg(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -204,30 +184,7 @@ public class WCSUtil { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* AGV搬运 |
|
|
|
|
* |
|
|
|
|
* @param bo |
|
|
|
|
* @return {@link Result}<{@link Boolean}> |
|
|
|
|
*/ |
|
|
|
|
public Result<Boolean> moveByAGV(AGVMoveBo bo) { |
|
|
|
|
RcsCreateTaskDto dto = new RcsCreateTaskDto(); |
|
|
|
|
dto.setMapId(1); |
|
|
|
|
dto.setTaskType(bo.getTaskType()); |
|
|
|
|
dto.setTaskId(bo.getTaskId().toString()); |
|
|
|
|
//库位编号
|
|
|
|
|
List<RcsIdList> idList = new ArrayList<>(); |
|
|
|
|
List<String> points = bo.getPoints(); |
|
|
|
|
for (String point : points) { |
|
|
|
|
RcsIdList rcsIdList = new RcsIdList(); |
|
|
|
|
rcsIdList.setId(point); |
|
|
|
|
log.error(point); |
|
|
|
|
idList.add(rcsIdList); |
|
|
|
|
} |
|
|
|
|
dto.setTargets(idList); |
|
|
|
|
return rcsCreateTask(dto); |
|
|
|
|
// return Result.ok();
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取AGV实时状态信息 |
|
|
|
|
|