#
luxiaotao1123
2021-04-02 6ee1f81722e1ab6d18e19952e64a9e5377ffa3ef
src/main/java/zy/cloud/wms/manager/controller/PriorController.java
@@ -13,7 +13,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import zy.cloud.wms.common.web.BaseController;
import zy.cloud.wms.manager.entity.Prior;
import zy.cloud.wms.manager.entity.*;
import zy.cloud.wms.manager.service.MatService;
import zy.cloud.wms.manager.service.NodeService;
import zy.cloud.wms.manager.service.PriorService;
import java.util.*;
@@ -23,6 +25,27 @@
    @Autowired
    private PriorService priorService;
    @Autowired
    private MatService matService;
    @Autowired
    private NodeService nodeService;
    /**
     * 安全库存警告分页
     * @param curr
     * @param limit
     * @param param
     * @return
     */
    @RequestMapping(value = "/safeSto/list/auth")
    @ManagerAuth
    public R safeStoList(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam Map<String, Object> param){
        return R.ok(priorService.getSafeQtyPage(toPage(curr, limit, param, SafeStoDo.class)));
    }
    /***************************************************/
    @RequestMapping(value = "/prior/{id}/auth")
    @ManagerAuth
@@ -60,6 +83,19 @@
    @RequestMapping(value = "/prior/add/auth")
    @ManagerAuth
    public R add(Prior prior) {
        if (prior.getMatId() != null) {
            Mat mat = matService.selectById(prior.getMatId());
            if (mat != null) {
                prior.setMatnr(mat.getMatnr());
                prior.setMaktx(mat.getMaktx());
            }
        }
        if (prior.getNodeId() != null) {
            Node node = nodeService.selectById(prior.getNodeId());
            if (node != null) {
                prior.setNodeName(node.getName());
            }
        }
        prior.setCreateBy(getUserId());
        prior.setCreateTime(new Date());
        prior.setUpdateBy(getUserId());
@@ -75,6 +111,19 @@
        if (Cools.isEmpty(prior) || null==prior.getId()){
            return R.error();
        }
        if (prior.getMatId() != null) {
            Mat mat = matService.selectById(prior.getMatId());
            if (mat != null) {
                prior.setMatnr(mat.getMatnr());
                prior.setMaktx(mat.getMaktx());
            }
        }
        if (prior.getNodeId() != null) {
            Node node = nodeService.selectById(prior.getNodeId());
            if (node != null) {
                prior.setNodeName(node.getName());
            }
        }
        prior.setUpdateBy(getUserId());
        prior.setUpdateTime(new Date());
        priorService.updateById(prior);