自动化立体仓库 - WMS系统
zyx
2023-07-14 2c3fddeac17fb2edf05325faacee71fa97f7cc2f
src/main/java/com/zy/asrs/controller/AgvMobileController.java
@@ -1,13 +1,22 @@
package com.zy.asrs.controller;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.entity.AgvBasDevp;
import com.zy.asrs.entity.param.CombParam;
import com.zy.asrs.service.AgvBasDevpService;
import com.zy.asrs.service.AgvMobileService;
import com.zy.asrs.service.AgvWorkService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * 移动端接口控制器
@@ -19,11 +28,16 @@
    @Autowired
    private AgvMobileService agvMobileService;
    @Autowired
    private AgvBasDevpService agvBasDevpService;
    @Autowired
    private AgvWorkService workService;
    @PostMapping("/comb/auth")
    public R comb(@RequestBody CombParam combParam){
        agvMobileService.comb(combParam, 1l);
        return R.ok("组托成功");
        String message = agvMobileService.comb(combParam, 1l);
        return R.ok(message);
    }
    @PostMapping("/combBinging/auth")
@@ -34,9 +48,31 @@
        return R.ok("托盘绑定站点成功");
    }
    @PostMapping("/getBasDevp/auth")
    public R getBasDevpByFloor(@RequestBody Map<String,Object> map){
        String floor = map.get("floor").toString();
        if("1".equals(floor) || "3".equals(floor)){
            return R.ok(agvMobileService.getAgvBasDevpByFloor(Integer.parseInt(floor)));
        }
        return R.error("参数错误");
    }
    @PostMapping("/pakin/auth")
    public R pakin(@RequestBody Map<String,Object> map){
        List<String> devNos = (List<String>) map.get("devNo");
        List<AgvBasDevp> agvBasDevpList = devNos.stream().map(devNo -> {
            AgvBasDevp agvBasDevp = agvBasDevpService.selectById(devNo);
            if (!"F".equals(agvBasDevp.getLocSts())) {
                throw new CoolException("当前站点货位状态不为F.在库,请重新选择");
            }
            return agvBasDevp;
        }).collect(Collectors.toList());
        workService.createWaitPainWrkMastStart(agvBasDevpList, getUserId());
        return R.ok("生成工作档成功");
    }
}