| | |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsImportRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsSaveReqVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.service.pro.mps.MesProMpsService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | |
| | | ExcelUtils.write(response, "生产主计划.xls", "数据", MesProMpsRespVO.class, voList); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得生产主计划导入模板") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | List<MesProMpsImportExcelVO> list = Collections.singletonList( |
| | | MesProMpsImportExcelVO.builder() |
| | | .code("MPS-001").saleOrderNo("").productCode("").quantity(new java.math.BigDecimal("100")) |
| | | .clientName("").requestDate(java.time.LocalDateTime.of(2026, 10, 16, 9, 0, 0)) |
| | | .remark("").build() |
| | | ); |
| | | ExcelUtils.write(response, "生产主计划导入模板.xls", "生产主计划列表", MesProMpsImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入生产主计划") |
| | | @Parameters({ |
| | | @Parameter(name = "file", description = "Excel 文件", required = true), |
| | | @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") |
| | | }) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:import')") |
| | | public CommonResult<MesProMpsImportRespVO> importExcel(@RequestParam("file") MultipartFile file, |
| | | @RequestParam(value = "updateSupport", required = false, |
| | | defaultValue = "false") Boolean updateSupport) throws Exception { |
| | | List<MesProMpsImportExcelVO> list = ExcelUtils.read(file, MesProMpsImportExcelVO.class); |
| | | return success(mpsService.importMpsList(list, updateSupport)); |
| | | } |
| | | |
| | | @PostMapping("/issue") |
| | | @Operation(summary = "下发生产主计划") |
| | | @Parameter(name = "id", description = "MPS 编号", required = true) |