| | |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.mdm.basesetting.machine.entity.Machine; |
| | | import org.springblade.mdm.gkw.programnode.entity.MachineFile; |
| | | import org.springblade.mdm.program.entity.NcNode; |
| | | import org.springblade.mdm.program.service.NcNodeService; |
| | | import org.springblade.mdm.task.MachineFileScanTask; |
| | | import org.springblade.mdm.utils.FileContentUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | |
| | | @Autowired |
| | | private NcNodeService service; |
| | | |
| | | @Autowired |
| | | private MachineFileScanTask machineFileScanTask; |
| | | |
| | | /** |
| | | * 新增 |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @GetMapping("/readline") |
| | | @Operation(summary = "like", description = "like") |
| | | public R<String> like(String file,int line) throws IOException { |
| | | FileInputStream fis = new FileInputStream(file); |
| | | return R.data(FileContentUtil.readLineAt(fis,line)); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/scan") |
| | | @Operation(summary = "test扫描", description = "test扫描") |
| | | public R<Void> scan() throws IOException { |
| | | Machine machine = new Machine(); |
| | | machine.setCode("M_01_FN"); |
| | | machine.setProgReceiveDir("d:/data/machine1/rec"); |
| | | machineFileScanTask.scanDir(machine, MachineFile.DIR_TYPE_REC); |
| | | return R.success(); |
| | | } |
| | | |
| | | } |