自动化立体仓库 - WMS系统
zwl
2 天以前 757f103f37d83dfb55bb49b3df0b805cb520d4f7
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -168,22 +168,25 @@
    /**
     * 出库确认 - 扫托盘码
     * 1.全板 返回 101
     * 2.拣料 返回 103
     * 31.全板出库等待下架 -->32.等待AGV搬运空板回库
     */
    @RequestMapping("/pakout/confirm/barcode/auth")
    @ManagerAuth
    public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode){
        if (Cools.isEmpty(barcode)) {
            return R.ok();
    public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode,
                                  @RequestParam(required = false) String staNo){
        if (Cools.isEmpty(barcode)||Cools.isEmpty(staNo)) {
            return R.error("托盘码或者AGV站点不能为空");
        }
        WrkMast wrkMast = wrkMastService.selectByBarcode(barcode);
        if (wrkMast != null) {
            List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
            // 去除已出库确认的明细
            wrkDetls.removeIf(wrkDetl -> wrkDetl.getInspect() != null && wrkDetl.getInspect() != 0);
            return R.ok().add(Cools.add("wrkNo", wrkMast.getWrkNo()).add("ioType", wrkMast.getIoType()).add("list", wrkDetls));
        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", barcode).eq("io_type", 101));
        if (Cools.isEmpty(wrkMast)) {
            return R.error("没有找到该托盘="+barcode+"对应的出库任务");
        }
        wrkMast.setWrkSts(32L);//32.等待AGV搬运空板回库
        wrkMast.setMemo(staNo);//AGV取空托盘站点
        wrkMast.setOveMk("Y");
        wrkMast.setModiTime(new Date());
        wrkMastService.updateById(wrkMast);
        return R.ok();
    }
@@ -464,51 +467,54 @@
     */
    @RequestMapping("/AGVMove")
    public R AGVMove(@RequestParam(required = false) String sourceStaNo
            ,@RequestParam(required = false) String staNo){
        RCSParam rcsParam = new RCSParam();
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        String formattedDate = now.format(formatter); // 格式化日期时间
        //网络流水号
        rcsParam.setReqId(now.toString());
        //应用标识
        rcsParam.setClientId("WMS");
        //通知时间
        rcsParam.setReqTime(formattedDate);
        RCSParam.DataBody dataBody=new RCSParam.DataBody();
        //任务号
        dataBody.setId(formattedDate);
            ,@RequestParam(required = false) String staNo
            ,Integer priority){
        String noww="aa" + new Date().getTime();
        List<RCSParam.TaskBody> taskBodyList=new ArrayList<>();
        RCSParam.TaskBody taskBody=new RCSParam.TaskBody();
        //取货类型
        taskBody.setType("load");
        taskBody.setStation(sourceStaNo);
        taskBodyList.add(taskBody);
        LinkedHashMap<String,Object> rcsParam=new LinkedHashMap<>();
        rcsParam.put("task_id",noww);
        rcsParam.put("start_location",sourceStaNo);
        rcsParam.put("start_command",1);
        rcsParam.put("target_location",staNo);
        rcsParam.put("target_command",2);
        rcsParam.put("priority",1);//优先级越小先执行
        rcsParam.put("robot_type",1);//车 辆 类 型 0:XC 1:XCD 2:XP_T 3:XP_L
        rcsParam.put("MoverID","XCD");
        String wait_location = "";
        if(staNo.equals("5001") || staNo.equals("5002") ){
            wait_location = "4";
        }else if(staNo.equals("6001") ){
            wait_location = "122";
        }else if(staNo.equals("6002") ){
            wait_location = "120";
        }else if(staNo.equals("7001") ){
            wait_location = "120";
        }else if(staNo.equals("7002") ){
            wait_location = "120";
        }
        rcsParam.put("wait_location",wait_location);//任务完成休息站点名称
        RCSParam.TaskBody taskBody1=new RCSParam.TaskBody();
        //放货类型
        taskBody1.setType("unload");
        taskBody1.setStation(staNo);
        taskBodyList.add(taskBody1);
        dataBody.setTasks(taskBodyList);
        rcsParam.setData(dataBody);
        LinkedHashMap<String,Object> map=new LinkedHashMap<>();
        map.put("data",rcsParam);
        String response ="";
        Boolean bool =false;
        String msg = "";
        try {
            log.info("wms派发搬运任务给AGV搬运={}", rcsParam);
            response = new HttpHandler.Builder()
                    // .setHeaders(headParam)
                    .setUri(url)
                    .setPath(attrcs)
                    .setJson(JSON.toJSONString(rcsParam))
                    .setJson(JSON.toJSONString(map))
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            if(jsonObject.getBoolean("IsSuccess")){
            JSONObject data = jsonObject.getJSONObject("data");
            JSONObject errInfo = jsonObject.getJSONObject("err_info");
            if(data.getInteger("result")==0){
                bool = true;
            }else{
                msg=errInfo.getString("err_msg");
            }
        } catch (Exception e) {
            log.error("wms派发搬运任务给AGV搬运失败返回值={}", response);
@@ -517,15 +523,16 @@
                    , url + attrcs
                    , null
                    , "127.0.0.1"
                    , JSON.toJSONString(rcsParam)
                    , JSON.toJSONString(map)
                    , response
                    , bool
            );
        }
        if(bool){
            return R.ok();
            return R.ok(noww);
        }else {
            return R.error("下发任务失败");
            return R.error(msg);
        }
    }