#
luxiaotao1123
2021-02-27 b27e6efa9bb5ec164c7331eb49891438f4dbd020
#
1个文件已修改
35 ■■■■■ 已修改文件
src/main/java/zy/cloud/wms/manager/controller/PriorController.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/zy/cloud/wms/manager/controller/PriorController.java
@@ -13,7 +13,11 @@
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.Mat;
import zy.cloud.wms.manager.entity.Node;
import zy.cloud.wms.manager.entity.Prior;
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 +27,11 @@
    @Autowired
    private PriorService priorService;
    @Autowired
    private MatService matService;
    @Autowired
    private NodeService nodeService;
    @RequestMapping(value = "/prior/{id}/auth")
    @ManagerAuth
@@ -60,6 +69,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 +97,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);