diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/WCSUtil.java b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/WCSUtil.java index 1083516..fd78f1a 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/WCSUtil.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/WCSUtil.java @@ -4,7 +4,8 @@ import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONObject; import com.shkj.common.constant.RedisConstant; import com.shkj.common.core.domain.Result; - +import com.shkj.plc.sdk.device.PLCReadAndWrite; +import com.shkj.plc.sdk.device.PlcOperate; import com.shkj.system.service.ISysParameterService; import com.shkj.wcs.bo.AGVStatesBo; import com.shkj.wcs.bo.AGVUploadStatusBo; @@ -19,8 +20,6 @@ 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.wcs.third.workbinWcs.dto.WcsIncomingTrayCheckBody; -import com.shkj.wcs.vo.WcsResponseVo; import com.shkj.wms.bo.AGVMoveBo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -73,6 +72,34 @@ public class WCSUtil { e.printStackTrace(); log.error("KJ向WZ请求生产区入库托盘码校验 方法出错了 = {}", e.getMessage()); return WcsResponseVo.error(500,e.getMessage()); + headerMap.put("authorization", "mrbase64 mrrest:YWRtaW4mYWRtaW4="); + return headerMap; + } + + + + /** + * 生产区入库校验 + * wcs系统通过此接口向rcs系统下发创建任务指令 + * + * @param dto dto + * @return {@code Result} + */ + public Result wcsIncomingTrayCheck(WcsIncomingCheckDto dto) { + String json = JSONObject.toJSONString(dto.getBody()); + try { + Map headerMap = getHeaderMap(); + headerMap.put("businessType","trayCheck"); + String res = HttpRequest.post(wcsIncomingTrayCheckUrl) + .addHeaders(headerMap) + .body(json) + .execute().body(); + Result result = parseThirdRcsResult(res); + return result; + } catch (Exception e) { + e.printStackTrace(); + log.error("wcsIncomingTrayCheck 方法出错了 = {}", e.getMessage()); + return Result.err().msg(e.getMessage()); } } @@ -93,5 +120,36 @@ public class WCSUtil { return WcsResponseVo.error(500,res); } } + return Result.err().msg(res); + } + } + + /** + * 任务取消 + * 上游系统调⽤此接⼝,将已下发待处理的任务取消 + * + * @param /rest/tasks/del + * @return {@code Result} + */ + public Result rcsTaskCancel(RcsCancelTaskDto dto) { + String json = JSONObject.toJSONString(dto); + + try { + Map headerMap = getHeaderMap(); + String res = HttpRequest.post(agvCancelTaskUrl) + .addHeaders(headerMap) + .body(json) + .execute().body(); + + return parseThirdRcsResult(res); + } catch (Exception e) { + e.printStackTrace(); + log.error("rcs taskCancel 方法出错了 = {}", e.getMessage()); + return Result.err().msg(e.getMessage()); + } + } + + + }