| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import com.yuanchu.mom.pojo.dto.MaterialTreeDto; |
| | | import com.yuanchu.mom.service.MaterialService; |
| | | import com.yuanchu.mom.pojo.dto.MaterialDto; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.annotation.Resource; |
| | | |
| | | @Api(tags = "技术管理-->标准MOM-->物料模块") |
| | | @Api(tags = "技术管理-->标准BOM") |
| | | @RestController |
| | | @RequestMapping("/material") |
| | | public class MaterialController { |
| | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @ApiOperation(value = "查询物料的树") |
| | | @Resource |
| | | TechnologyService technologyService; |
| | | |
| | | @Resource |
| | | ProductService productService; |
| | | |
| | | @Resource |
| | | MbomService mbomService; |
| | | |
| | | @Resource |
| | | TechniqueService techniqueService; |
| | | |
| | | @ApiOperation(value = "左侧五级树展示") |
| | | @GetMapping("/selectTreeByMaterial") |
| | | public Result<List<MaterialTreeDto>> selectTreeByMaterial(){ |
| | | public Result selectTreeByMaterial() { |
| | | return Result.success(materialService.selectTreeByMaterial()); |
| | | } |
| | | |
| | | @ApiOperation("(1,2级)新增-->物料,标准,型号") |
| | | @PostMapping("/add") |
| | | public Result<?> addMaterial(@Validated @RequestBody MaterialDto materialDto) { |
| | | materialService.addMaterial(materialDto); |
| | | return Result.success("添加物料【" + materialDto.getName() + "】成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "右侧数据展示-->选择版本") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "type", value = "类型(0:工艺路线;1:技术指标;2:物料清单;3:生产工艺)", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/selectVersion") |
| | | public Result selectVersion(Integer type, Integer specificationsId) { |
| | | switch (type) { |
| | | case 0: |
| | | //工艺路线 |
| | | return Result.success(technologyService.selectVerByTec(specificationsId)); |
| | | case 1: |
| | | //技术指标 |
| | | return Result.success(productService.selectVerByPro(specificationsId)); |
| | | case 2: |
| | | //物料清单 |
| | | return Result.success(mbomService.selectVerByMbom(specificationsId)); |
| | | case 3: |
| | | //生产工艺 |
| | | return Result.success(techniqueService.selectVerByTeq(specificationsId)); |
| | | } |
| | | return Result.fail("没有该类型!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "右侧数据展示") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "type", value = "类型(0:工艺路线;1:技术指标;2:物料清单;3:生产工艺)", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "版本(默认最新)", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "message", value = "搜索内容", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/selectAll") |
| | | public Result selectAll(Integer specificationsId, Integer type, Integer version,String message) { |
| | | switch (type) { |
| | | case 0: |
| | | //工艺路线 |
| | | return Result.success(technologyService.selectAllTec(specificationsId, version,message)); |
| | | case 1: |
| | | //技术指标 |
| | | return Result.success(productService.selectAllPro(specificationsId, version,message)); |
| | | case 2: |
| | | //物料清单 |
| | | return Result.success(mbomService.selectAllMbom(specificationsId, version,message)); |
| | | case 3: |
| | | //生产工艺 |
| | | return Result.success(techniqueService.selectAllTeq(specificationsId, version,message)); |
| | | } |
| | | return Result.fail("没有该类型!"); |
| | | } |
| | | } |