| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam; |
| | | import com.zy.asrs.entity.param.taskCreateParam; |
| | | import com.zy.asrs.service.*; |
| | | 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.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | private TaskWrkController taskWrkController; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | |
| | | private static final boolean auth = true; |
| | | |
| | |
| | | @PostMapping("/targetWharfApply") |
| | | public R targetWharfApply(@RequestHeader String appkey, |
| | | @RequestBody WMSAndAGVInterfaceParam param, |
| | | HttpServletRequest request) { |
| | | HttpServletRequest request) throws IOException { |
| | | if (Cools.isEmpty(param)){ |
| | | return R.error("参数为空!"); |
| | | } else if (Cools.isEmpty(param.getTaskNo())){ |
| | |
| | | } else if (Cools.isEmpty(param.getFreeWharfs()) || param.getFreeWharfs().size()==0){ |
| | | return R.error("空闲的入库码头(AGV)为空!"); |
| | | } |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); |
| | | ToWmsDTO toWmsDTO = new ToWmsDTO(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("x-api-key","7a15b5db-29b6-552c-8cff-0cfec3756da2"); |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(1); |
| | | list.add(4); |
| | | //TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); |
| | | toWmsDTO.setWarehouseId("1688469798893297665"); |
| | | toWmsDTO.setContainerCode(param.getContainerCode()); |
| | | toWmsDTO.setApplyType("TUNNEL"); |
| | | toWmsDTO.setCanInboundTunnels(list); |
| | | String response = new HttpHandler.Builder() |
| | | .setHeaders(map) |
| | | .setUri(wmsUrl) |
| | | .setPath("wcsManager/wcsInterface/inboundTaskApply") |
| | | .setJson(JSON.toJSONString(toWmsDTO)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | if (Cools.isEmpty(taskWrk)){ |
| | | return R.error("未查询到任务,任务号:"+param.getTaskNo()); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | //解析 |
| | | return R.ok(jsonObject.get("data")); |
| | | }else { |
| | | return R.error((String) jsonObject.get("msg")); |
| | | } |
| | | return R.ok(taskWrk.getStartPoint()); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | //AGV请求动作接口 |
| | |
| | | public R agvTaskRequest(@RequestHeader String appkey, |
| | | @RequestBody WMSAndAGVInterfaceParam param, |
| | | HttpServletRequest request) { |
| | | auth(appkey, param, request); |
| | | if (Cools.isEmpty(param)){ |
| | | return R.error("参数为空!"); |
| | | } else if (Cools.isEmpty(param.getRequestType())){ |