| | |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Autowired |
| | | private BasCrnErrorService basCrnErrorService; |
| | | |
| | | @Value("${agv.url}") |
| | | private String agvUrl; |
| | | @Value("${agv.bindPodAndBerth}") |
| | | private String bindPodAndBerth; |
| | | |
| | | private static final boolean auth = true; |
| | | |
| | | public static final ArrayList<String> APP_KEY_LIST = new ArrayList<String>() {{ |
| | |
| | | return R.error("任务不存在"); |
| | | } |
| | | |
| | | if (taskWrk.getTargetPoint().equals("0900601")) { |
| | | HashMap<String, Object> requestParam = new HashMap<>(); |
| | | |
| | | int nextInt = new Random().nextInt(100); |
| | | requestParam.put("reqCode", taskWrk.getTaskNo() + "-" + nextInt); |
| | | requestParam.put("podCode", param.get("podCode")); |
| | | requestParam.put("positionCode", taskWrk.getTargetPoint()); |
| | | requestParam.put("indBind", 0); |
| | | |
| | | String response = null; |
| | | boolean requestStatus = false; |
| | | try { |
| | | log.info("WCS解绑AGV货架={}", taskWrk); |
| | | response = new HttpHandler.Builder() |
| | | .setUri(agvUrl) |
| | | .setPath(bindPodAndBerth) |
| | | .setJson(JSON.toJSONString(requestParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.get("code").equals("0")) { |
| | | requestStatus = true; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("WCS派发任务给AGV失败{},返回值={}", taskWrk, response); |
| | | } finally { |
| | | apiLogService.save("WCS派发任务给AGV" |
| | | , agvUrl + bindPodAndBerth |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(requestParam) |
| | | , response |
| | | , requestStatus |
| | | ); |
| | | } |
| | | } |
| | | |
| | | taskWrk.setStatus(TaskStatusType.COMPLETE.id); |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrk.setBarcode(param.get("podCode").toString()); |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |