| | |
| | | package com.ruoyi.productionPlan.controller; |
| | | |
| | | 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.AjaxResult; |
| | | import com.ruoyi.productionPlan.dto.ProductionPlanDto; |
| | | import com.ruoyi.productionPlan.dto.ProductionPlanImportDto; |
| | | import com.ruoyi.productionPlan.dto.ProductionPlanSummaryDto; |
| | | import com.ruoyi.productionPlan.service.ProductionPlanService; |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @GetMapping("/loadProdData") |
| | | @ApiOperation("拉取销售生产计划") |
| | | @Log(title = "拉取销售生产计划", businessType = BusinessType.INSERT) |
| | | public AjaxResult loadProdData() { |
| | | productionPlanService.loadProdData(); |
| | |
| | | |
| | | @PostMapping("/combine") |
| | | @Log(title = "合并生产计划", businessType = BusinessType.INSERT) |
| | | @ApiOperation("合并生产计划") |
| | | public AjaxResult combine(@RequestBody ProductionPlanDto productionPlanDto) { |
| | | if (productionPlanDto.getIds() == null || productionPlanDto.getIds().isEmpty()) { |
| | | return AjaxResult.error("请选择要下发的生产计划"); |
| | | } |
| | | return AjaxResult.success(productionPlanService.combine(productionPlanDto)); |
| | | } |
| | | |
| | | @PostMapping("") |
| | | @Log(title = "创建生产计划", businessType = BusinessType.INSERT) |
| | | @ApiOperation("创建生产计划") |
| | | public AjaxResult add(@RequestBody ProductionPlanDto productionPlanDto) { |
| | | return AjaxResult.success(productionPlanService.add(productionPlanDto)); |
| | | } |
| | | |
| | | @PutMapping("") |
| | | @Log(title = "更新生产计划", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("更新生产计划") |
| | | public AjaxResult update(@RequestBody ProductionPlanDto productionPlanDto) { |
| | | return AjaxResult.success(productionPlanService.update(productionPlanDto)); |
| | | } |
| | | |
| | | @DeleteMapping("") |
| | | @Log(title = "删除生产计划", businessType = BusinessType.DELETE) |
| | | @ApiOperation("删除生产计划") |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | return AjaxResult.success(productionPlanService.removeByIds(ids)); |
| | | } |
| | | |
| | | @GetMapping("/summaryByProductType") |
| | | @ApiOperation("按照产品类别汇总统计需求量") |
| | | @Log(title = "按照产品类别汇总统计需求量", businessType = BusinessType.OTHER) |
| | | public AjaxResult summaryByProductType(ProductionPlanSummaryDto query) { |
| | | List<ProductionPlanSummaryDto> list = productionPlanService.summaryByProductType(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @PostMapping("/downloadTemplate") |
| | | @Log(title = "下载主生产计划导入模板", businessType = BusinessType.EXPORT) |
| | | @ApiOperation("下载主生产计划导入模板") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtil<ProductionPlanImportDto> excelUtil = new ExcelUtil<>(ProductionPlanImportDto.class); |
| | | excelUtil.importTemplateExcel(response, "主生产计划导入模板"); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @ApiOperation("主生产计划数据导入") |
| | | @Log(title = "主生产计划数据导入", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importProdData(@RequestParam("file") MultipartFile file) { |
| | | productionPlanService.importProdData(file); |
| | | return AjaxResult.success("导入成功"); |
| | | } |
| | | |
| | | @PostMapping("/export") |
| | | @ApiOperation("主生产计划数据导出") |
| | | @Log(title = "主生产计划数据导出", businessType = BusinessType.EXPORT) |
| | | public void exportProdData(HttpServletResponse response, @RequestBody(required = false) List<Long> ids) { |
| | | productionPlanService.exportProdData(response, ids); |
| | | } |
| | | |
| | | } |