| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProductBom; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.service.ProcessRouteService; |
| | | import com.ruoyi.production.service.ProductBomService; |
| | | import com.ruoyi.production.service.ProductProcessService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * BOM主表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 09:59:27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/productBom") |
| | | public class ProductBomController { |
| | | |
| | | @Autowired |
| | | private ProductBomService productBomService; |
| | | |
| | | @Autowired |
| | | private ProcessRouteService processRouteService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "BOM-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation("BOM-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, ProductBomDto productBomDto) { |
| | | IPage<ProductBomDto> listPage = productBomService.listPage(page, productBomDto); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @ApiModelProperty("æ°å¢BOM") |
| | | @PostMapping("/add") |
| | | @Log(title = "æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add( @RequestBody ProductBom productBom) { |
| | | return productBomService.add(productBom); |
| | | } |
| | | |
| | | @ApiOperation("æ´æ°BOM") |
| | | @Log(title = "ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/update") |
| | | public AjaxResult update(@RequestBody ProductBom productBom) { |
| | | return AjaxResult.success(productBomService.updateById(productBom)); |
| | | } |
| | | |
| | | @ApiOperation("å é¤BOM") |
| | | @DeleteMapping("/batchDelete") |
| | | @Log(title = "å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult batchDelete(@RequestBody List<Integer> ids) { |
| | | List<ProcessRoute> list = processRouteService.list(Wrappers.<ProcessRoute>lambdaQuery().in(ProcessRoute::getBomId, ids)); |
| | | if (list.size()>0){ |
| | | return AjaxResult.error("该BOMå·²ç»åå¨å¯¹åºçå·¥èºè·¯çº¿,æ æ³è¿è¡å é¤"); |
| | | } |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(productBomService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @GetMapping("/getByModel") |
| | | @Log(title = "BOM-æ ¹æ®éæ©çè§æ ¼åå·idæ¥è¯¢åå¨çbom", businessType = BusinessType.OTHER) |
| | | @ApiOperation("BOM-æ ¹æ®éæ©çè§æ ¼åå·idæ¥è¯¢åå¨çbom") |
| | | public AjaxResult getByModel(Long productModelId) { |
| | | List<ProductBom> productBoms = productBomService.list(Wrappers.<ProductBom>lambdaQuery().eq(ProductBom::getProductModelId, productModelId)); |
| | | return AjaxResult.success(productBoms); |
| | | } |
| | | |
| | | } |