| | |
| | | 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.*; |
| | |
| | | |
| | | @Autowired |
| | | private PriorService priorService; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private NodeService nodeService; |
| | | |
| | | |
| | | @RequestMapping(value = "/prior/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @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()); |
| | |
| | | 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); |