| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.bean.dto.ProductionPlanDto; |
| | | import com.ruoyi.production.bean.dto.ProductionPlanImportDto; |
| | | import com.ruoyi.production.bean.vo.ProductionPlanVo; |
| | | import com.ruoyi.production.service.ProductionPlanService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * ç产计å表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-21 02:11:10 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/productionPlan") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "主ç产计å") |
| | | public class ProductionPlanController { |
| | | |
| | | private final ProductionPlanService productionPlanService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "è·åç产计åå表") |
| | | public R<IPage<ProductionPlanVo>> productionPlanListPage(Page<ProductionPlanDto> page, ProductionPlanDto productionPlanDto) { |
| | | return R.ok(productionPlanService.listPage(page, productionPlanDto)); |
| | | } |
| | | |
| | | @PostMapping("/combine") |
| | | @Log(title = "åå¹¶ç产计å", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "åå¹¶ç产计å") |
| | | public R combine(@RequestBody ProductionPlanDto productionPlanDto) { |
| | | if (productionPlanDto.getIds() == null || productionPlanDto.getIds().isEmpty()) { |
| | | return R.fail("è¯·éæ©è¦ä¸åçç产计å"); |
| | | } |
| | | |
| | | if (productionPlanDto.getTotalAssignedQuantity() == null || productionPlanDto.getTotalAssignedQuantity().compareTo(BigDecimal.ZERO) <= 0) { |
| | | return R.fail("请è¾å
¥ä¸åæ°é"); |
| | | } |
| | | return R.ok(productionPlanService.combine(productionPlanDto)); |
| | | } |
| | | |
| | | @PostMapping("addProductionPlan") |
| | | @Log(title = "å建ç产计å", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "å建ç产计å") |
| | | public R add(@RequestBody ProductionPlanDto productionPlanDto) { |
| | | return R.ok(productionPlanService.add(productionPlanDto)); |
| | | } |
| | | |
| | | @PutMapping("updateProductionPlan") |
| | | @Log(title = "æ´æ°ç产计å", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "æ´æ°ç产计å") |
| | | public R update(@RequestBody ProductionPlanDto productionPlanDto) { |
| | | return R.ok(productionPlanService.update(productionPlanDto)); |
| | | } |
| | | |
| | | @DeleteMapping("deleteProductionPlan") |
| | | @Log(title = "å é¤ç产计å", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤ç产计å") |
| | | public R delete(@RequestBody List<Long> ids) { |
| | | return R.ok(productionPlanService.delete(ids)); |
| | | } |
| | | |
| | | @PostMapping("/downloadTemplate") |
| | | @Log(title = "ä¸è½½ä¸»ç产计å导å
¥æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | @Operation(summary = "ä¸è½½ä¸»ç产计å导å
¥æ¨¡æ¿") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtil<ProductionPlanImportDto> excelUtil = new ExcelUtil<>(ProductionPlanImportDto.class); |
| | | excelUtil.importTemplateExcel(response, "主ç产计å导å
¥æ¨¡æ¿"); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "主çäº§è®¡åæ°æ®å¯¼å
¥") |
| | | @Log(title = "主çäº§è®¡åæ°æ®å¯¼å
¥", businessType = BusinessType.IMPORT) |
| | | public R importProdData(@RequestParam("file") MultipartFile file) { |
| | | productionPlanService.importProdData(file); |
| | | return R.ok("导å
¥æå"); |
| | | } |
| | | |
| | | @PostMapping("/export") |
| | | @Operation(summary = "主çäº§è®¡åæ°æ®å¯¼åº") |
| | | @Log(title = "主çäº§è®¡åæ°æ®å¯¼åº", businessType = BusinessType.EXPORT) |
| | | public void exportProdData(HttpServletResponse response, @RequestBody(required = false) List<Long> ids) { |
| | | productionPlanService.exportProdData(response, ids); |
| | | } |
| | | |
| | | } |