| | |
| | | |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.mail.MessagingException; |
| | | import jakarta.xml.soap.SOAPException; |
| | | import jakarta.xml.ws.WebServiceContext; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.neethi.AssertionBuilderFactory; |
| | | import org.apache.ws.commons.schema.XmlSchemaSerializer; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | | import org.springblade.mdm.basesetting.machine.entity.Machine; |
| | | import org.springblade.mdm.gkw.programnode.entity.MachineFile; |
| | | import org.springblade.mdm.commons.service.InternalEmailService; |
| | | import org.springblade.mdm.flow.excution.events.CureFinishedEvent; |
| | | import org.springblade.mdm.flow.service.MesSyncService; |
| | | import org.springblade.mdm.flow.service.WIthdrawService; |
| | | import org.springblade.mdm.machinefile.entity.MachineFile; |
| | | import org.springblade.mdm.machinefile.service.MachineFileScanService; |
| | | import org.springblade.mdm.program.entity.NcNode; |
| | | import org.springblade.mdm.program.service.NcNodeHisService; |
| | | import org.springblade.mdm.program.service.NcNodeService; |
| | | import org.springblade.mdm.program.service.ProgramAnnotationService; |
| | | import org.springblade.mdm.task.InternalEmailNotifyTask; |
| | | import org.springblade.mdm.task.MachineFileScanTask; |
| | | import org.springblade.mdm.utils.FileContentUtil; |
| | | import org.springblade.system.feign.IDictBizClient; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.wsdl.WSDLException; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | |
| | | @Autowired |
| | | private NcNodeService service; |
| | | |
| | | @Autowired |
| | | private MachineFileScanTask machineFileScanTask; |
| | | private MesSyncService mesSyncService; |
| | | @Autowired |
| | | private ProgramAnnotationService programAnnotationService; |
| | | @Autowired |
| | | private IDictBizClient bizDictClient; |
| | | @Autowired |
| | | private InternalEmailService mailService; |
| | | @Autowired |
| | | private MachineFileScanService machineFileScanService; |
| | | @Autowired |
| | | private WIthdrawService withdrawService; |
| | | @Autowired |
| | | private InternalEmailNotifyTask notifyTask; |
| | | |
| | | @Autowired |
| | | private NcNodeHisService nodeHisService; |
| | | /** |
| | | * 新增 |
| | | */ |
| | |
| | | |
| | | } |
| | | |
| | | @GetMapping("/scan") |
| | | @GetMapping("/scandir") |
| | | @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); |
| | | machineFileScanService.scanDir(machine, MachineFile.DIR_TYPE_REC); |
| | | return R.success(); |
| | | } |
| | | |
| | | @GetMapping("/repalce-anno") |
| | | @Operation(summary = "替换注释", description = "test扫描") |
| | | public R<List<String>> repalceAnno() throws IOException { |
| | | InputStream res; |
| | | try(FileInputStream fis = new FileInputStream("d:/b.txt");) { |
| | | res = programAnnotationService.setSendDirAndStatusAnnotation("D:/mysend", "PL", fis,"FANUC"); |
| | | } |
| | | List<String> lines = null; |
| | | if(res!=null) { |
| | | try(res) { |
| | | lines = IOUtils.readLines(res, "utf-8"); |
| | | } |
| | | } |
| | | return R.data(lines); |
| | | } |
| | | |
| | | @GetMapping("/dict-biz") |
| | | @Operation(summary = "biz", description = "test扫描") |
| | |
| | | return this.bizDictClient.getList (code); |
| | | } |
| | | |
| | | @GetMapping("/sendmail") |
| | | @Operation(summary = "sendmail", description = "sendmail") |
| | | public R<Void> sendmail(String code) throws IOException, MessagingException { |
| | | |
| | | return R.success(); |
| | | } |
| | | |
| | | @GetMapping("/withdraw") |
| | | public R<Void> withdraw(String id) throws IOException, MessagingException { |
| | | withdrawService.withdraw(id); |
| | | return R.success(); |
| | | } |
| | | |
| | | @GetMapping("/scanfile") |
| | | public void scanFile(){ |
| | | machineFileScanService.scanMachineFile(); |
| | | } |
| | | |
| | | @GetMapping("/notify") |
| | | public void emailNotify(){ |
| | | SOAPException s; |
| | | notifyTask.execute(); |
| | | } |
| | | |
| | | @GetMapping("/movehis") |
| | | public void moveHis(Date time){ |
| | | //format:?time=2025-09-16%2010:11:10 |
| | | nodeHisService.mergeNodeToHisGeTime(time); |
| | | } |
| | | @GetMapping("/mes-sync") |
| | | public void mesSync(){ |
| | | mesSyncService.syncToMes(); |
| | | } |
| | | |
| | | @GetMapping("/publish-cure") |
| | | public void publishCure(){ |
| | | CureFinishedEvent e = new CureFinishedEvent(this,"0000000173"); |
| | | SpringUtil.publishEvent(e); |
| | | } |
| | | |
| | | } |