| | |
| | | |
| | | package org.springblade.mdm.program.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineVO; |
| | | import org.springblade.mdm.program.service.DncSendBackService; |
| | | import org.springblade.mdm.program.service.NcProgramExchangeService; |
| | | import org.springblade.mdm.program.vo.DncSendBackData; |
| | | import org.springblade.mdm.program.vo.ProgramExchangeStatQueryVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | */ |
| | | @NonDS |
| | | @RestController |
| | | @RequestMapping("/program") |
| | | @RequestMapping("/program/dncsendback/") |
| | | @AllArgsConstructor |
| | | @Tag(name = "DNC回传程序接口", description = "DNC回传程序接口") |
| | | @Tag(name = "DNC导入", description = "DNC导入接口") |
| | | @Slf4j |
| | | public class DncSendBackController { |
| | | |
| | | private final DncSendBackService dncSendBackService; |
| | | |
| | | /** |
| | | * dnc回传文件导入 |
| | | * |
| | | * @param file 流程文件 |
| | | */ |
| | | /* |
| | | @PostMapping("dnc-sendback-upload") |
| | | @ApiOperationSupport(order = 4) |
| | | @Operation(summary = "dnc回传文件导入", description = "dnc回传文件导入") |
| | | public R dncSendBackUpload(@RequestParam MultipartFile file) { |
| | | boolean temp = Objects.requireNonNull(file.getOriginalFilename()).endsWith("pkg"); |
| | | temp = true;//临时放行 |
| | | return R.data(Kv.create().set("name", file.getOriginalFilename()).set("success", temp)); |
| | | } |
| | | */ |
| | | private final NcProgramExchangeService ncProgramExchangeService; |
| | | /** |
| | | * 上传DNC回传文件 |
| | | * |
| | | * @param file dnc程序打包文件 |
| | | */ |
| | | @PostMapping("dnc-sendback-upload") |
| | | @PostMapping("upload") |
| | | @ApiOperationSupport(order = 1) |
| | | @Operation(summary = "上传DNC回传文件", description = "传入文件") |
| | | public R<List<DncSendBackData>> dncSendBackUpload(@RequestParam MultipartFile file) { |
| | | return R.data(dncSendBackService.dncSendBackUpload(file)); |
| | | @Operation(summary = "上传文件", description = "上传DNC回传文件") |
| | | public R<Void> dncSendBackUpload(@RequestParam MultipartFile file) { |
| | | try { |
| | | ncProgramExchangeService.dncSendBackUpload(file); |
| | | }catch (Exception e){ |
| | | log.error("导入错误",e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return R.success(); |
| | | } |
| | | |
| | | @PostMapping("dnc-sendback-accept") |
| | | @Operation(summary = "dnc回传数据分页", description = "dnc回传数据分页") |
| | | @GetMapping("/page") |
| | | public R<IPage<DncSendBackData>> page(Query query) { |
| | | IPage<DncSendBackData> pages = ncProgramExchangeService.dncSendBackPageQuery(query); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | @PostMapping("accept") |
| | | @ApiOperationSupport(order = 2) |
| | | @Operation(summary = "DNC回传数据入库") |
| | | @Operation(summary = "DNC回传数据入库", description = "入库,同时启动固化流程") |
| | | public R<Void> dncSendBackAccept(@RequestParam String ids) { |
| | | try { |
| | | dncSendBackService.dncFileAccept(ids); |