自动化立体仓库 - WMS系统
#
luxiaotao1123
2020-07-07 497660fe835e6eee3a11558c280133c405a8ec2c
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -1,11 +1,26 @@
package com.zy.asrs.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.param.CombParam;
import com.zy.asrs.service.LocDetlService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.MobileService;
import com.zy.common.model.MobileLocDetlVo;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * 移动端接口控制器
@@ -13,7 +28,14 @@
 */
@RestController
@RequestMapping("mobile")
public class MobileController {
public class MobileController extends BaseController  {
    @Autowired
    private MobileService mobileService;
    @Autowired
    private LocMastService locMastService;
    @Autowired
    private LocDetlService locDetlService;
    /**
     * 组托
@@ -21,8 +43,49 @@
    @RequestMapping("/comb/auth")
    @ManagerAuth(memo = "组托")
    public R comb(@RequestBody CombParam combParam){
        mobileService.comb(combParam, getUserId());
        return R.ok();
    }
    /**
     *  根据库位号查找库存明细
     */
    @RequestMapping("/locDetl")
    @ManagerAuth
    public R getLocDetl(@RequestParam(required = false)String locNo,
                        @RequestParam(required = false)String matNo){
        if (!Cools.isEmpty(locNo)) {
            LocMast locMast = locMastService.selectById(locNo);
            if (null == locMast || !"F".equals(locMast.getLocType())) {
                return R.parse(BaseRes.EMPTY);
            }
            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                    .eq("loc_no", locNo).orderBy("appe_time", false));
            List<MobileLocDetlVo> res = new ArrayList<>();
            locDetls.forEach(locDetl -> {
                MobileLocDetlVo vo = new MobileLocDetlVo();
                vo.setLocNo(locDetl.getLocNo());
                vo.setMatnr(locDetl.getMatnr());
                vo.setMaktx(locDetl.getMaktx());
                vo.setCount(locDetl.getAnfme());
                res.add(vo);
            });
            return R.ok().add(res);
        }
        if (!Cools.isEmpty(matNo)) {
            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                    .eq("matnr", matNo).orderBy("appe_time", false));
            List<MobileLocDetlVo> res = new ArrayList<>();
            locDetls.forEach(locDetl -> {
                MobileLocDetlVo vo = new MobileLocDetlVo();
                vo.setLocNo(locDetl.getLocNo());
                vo.setMatnr(locDetl.getMatnr());
                vo.setMaktx(locDetl.getMaktx());
                vo.setCount(locDetl.getAnfme());
                res.add(vo);
            });
            return R.ok().add(res);
        }
        return R.parse(BaseRes.PARAM);
    }
}