| | |
| | | import cn.iocoder.yudao.module.srm.api.supplier.dto.SrmSupplierRespDTO; |
| | | 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.math.BigDecimal; |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得生产工单") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-work-order:query')") |
| | | public CommonResult<MesProWorkOrderRespVO> getWorkOrder(@RequestParam("id") Long id) { |
| | | MesProWorkOrderDO workOrder = workOrderService.getWorkOrder(id); |
| | | if (workOrder == null) { |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得生产工单分页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-work-order:query')") |
| | | public CommonResult<PageResult<MesProWorkOrderRespVO>> getWorkOrderPage(@Valid MesProWorkOrderPageReqVO pageReqVO) { |
| | | PageResult<MesProWorkOrderDO> pageResult = workOrderService.getWorkOrderPage(pageReqVO); |
| | | return success(new PageResult<>(buildWorkOrderRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | |
| | | |
| | | @GetMapping("/schedule-page") |
| | | @Operation(summary = "获得生产工单调度状态分页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-work-order:query')") |
| | | public CommonResult<PageResult<MesProWorkOrderRespVO>> getWorkOrderSchedulePage(@Valid MesProWorkOrderPageReqVO pageReqVO) { |
| | | PageResult<MesProWorkOrderDO> pageResult = workOrderService.getWorkOrderSchedulePage(pageReqVO); |
| | | return success(new PageResult<>(buildWorkOrderRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | |
| | | List<MesProWorkOrderDO> list = workOrderService.getWorkOrderPage(pageReqVO).getList(); |
| | | List<MesProWorkOrderRespVO> voList = buildWorkOrderRespVOList(list); |
| | | ExcelUtils.write(response, "生产工单.xls", "数据", MesProWorkOrderRespVO.class, voList); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得生产工单导入模板") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | // 手动创建导出 demo |
| | | List<MesProWorkOrderImportExcelVO> list = Collections.singletonList( |
| | | MesProWorkOrderImportExcelVO.builder() |
| | | .code("WO-001").name("示例生产工单").type(1).orderSourceType(1) |
| | | .orderSourceCode("").productCode("").quantity(new BigDecimal("100")) |
| | | .clientName("").saleOrderNo("").batchCode("") |
| | | .requestDate(java.time.LocalDateTime.of(2026, 10, 16, 9, 0, 0)) |
| | | .remark("").build() |
| | | ); |
| | | // 输出 |
| | | ExcelUtils.write(response, "生产工单导入模板.xls", "生产工单列表", MesProWorkOrderImportExcelVO.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-work-order:import')") |
| | | public CommonResult<MesProWorkOrderImportRespVO> importExcel(@RequestParam("file") MultipartFile file, |
| | | @RequestParam(value = "updateSupport", required = false, |
| | | defaultValue = "false") Boolean updateSupport) throws Exception { |
| | | List<MesProWorkOrderImportExcelVO> list = ExcelUtils.read(file, MesProWorkOrderImportExcelVO.class); |
| | | return success(workOrderService.importWorkOrderList(list, updateSupport)); |
| | | } |
| | | |
| | | @PutMapping("/confirm") |
| | |
| | | @GetMapping("/progress/{id}") |
| | | @Operation(summary = "获取工单进度详情") |
| | | @Parameter(name = "id", description = "编号", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-work-order:query')") |
| | | public CommonResult<MesProWorkOrderProgressRespVO> getWorkOrderProgress(@PathVariable("id") Long id) { |
| | | return success(workOrderService.getWorkOrderProgress(id)); |
| | | } |