| | |
| | | package org.springblade.mdm.machinefile.service; |
| | | |
| | | import com.qiniu.util.IOUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.mdm.basesetting.machine.entity.Machine; |
| | | import org.springblade.mdm.basesetting.machine.service.MachineService; |
| | | import org.springblade.mdm.commons.contants.RegExpConstants; |
| | |
| | | import org.springblade.mdm.gkw.programnode.vo.ProgramNameVO; |
| | | import org.springblade.mdm.machinefile.entity.FileSendRecord; |
| | | import org.springblade.mdm.machinefile.entity.MachineFile; |
| | | import org.springblade.mdm.program.entity.ProgramOnMachine; |
| | | import org.springblade.mdm.program.service.ProgramAnnotationService; |
| | | import org.springblade.mdm.program.service.ProgramOnMachineService; |
| | | import org.springblade.mdm.program.service.programannotation.AnnotationUtil; |
| | | import org.springblade.mdm.program.service.programannotation.*; |
| | | import org.springblade.mdm.utils.FileContentUtil; |
| | | import org.springblade.mdm.utils.ProgramFileNameParser; |
| | | import org.springblade.system.pojo.entity.DictBiz; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.BufferedInputStream; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.*; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | |
| | | private ProgramOnMachineService programOnMachineService; |
| | | @Autowired |
| | | private FileSendRecordService fileSendRecordService; |
| | | @Autowired |
| | | private AnnotationProcessorHelper annoProcessHelper; |
| | | @Autowired |
| | | private ProgramAnnotationService programAnnotationService; |
| | | |
| | | /** |
| | | * æä»¶åæ³æ§æ£æ¥ |
| | | * @param machineFile |
| | |
| | | if(!checkFilePath.toFile().exists()){ |
| | | return; |
| | | } |
| | | |
| | | AnnotationProperties annoProps = AnnotationProperties.getDefault(); |
| | | try(InputStream fileIns = Files.newInputStream(checkFilePath);) { |
| | | int excepType = MachineFile.EXCEPTION_OK; |
| | | if(!FileContentUtil.isTextFile(fileIns)){ |
| | | ByteArrayInputStream byteStream = new ByteArrayInputStream(IOUtils.toByteArray(fileIns)); |
| | | if(!FileContentUtil.isTextFile(byteStream)){ |
| | | //éææ¬ |
| | | excepType = MachineFile.EXCEPTION_NOT_TEXT; |
| | | }else{ |
| | |
| | | excepType = MachineFile.EXCEPTION_NOT_MATCH_SEND; |
| | | } |
| | | } |
| | | |
| | | if(excepType == MachineFile.EXCEPTION_NOT_MATCH_SEND){ |
| | | //妿æä»¶æªä¸åè¿ï¼æ¥çæ¯å¦æç°åºç¼ç¨è®°å½ |
| | | byteStream.reset(); |
| | | |
| | | //AnnotationProcessor processor = annoProcessHelper.getProcessor(machine.getControlSystem()); |
| | | String lgLine = FileContentUtil.readLineAt(byteStream,annoProps.getDeviationLineIndex()); |
| | | String textWithoutAnno = AnnotationUtil.removeAnnotation(machine.getControlSystem(),lgLine,programAnnotationService.getAnnotionDictList()); |
| | | String[] strArr = Func.split(textWithoutAnno,":");//ä¸´æ¶æ´æ¹åæ¯åå·åéï¼å颿¯åå· |
| | | long progOnMachineCount = programOnMachineService.lambdaQuery() |
| | | .eq(ProgramOnMachine::getDrawingNo,progNameVO.getDrawingNo()) |
| | | .eq(ProgramOnMachine::getProcessNo,progNameVO.getProcessNo()) |
| | | .eq(ProgramOnMachine::getProcessEdition,progNameVO.getProcessEdition()) |
| | | .eq(strArr.length==2,ProgramOnMachine::getDeviation,strArr[1])//ä¸´æ¶æ´æ¹åå¹é
|
| | | |
| | | .eq(ProgramOnMachine::getMachineCode,machineFile.getMachineCode()).count(); |
| | | |
| | | if(progOnMachineCount > 0){//æç°åºç¼ç¨è®°å½ï¼æ£æ¥éè¿ |
| | | excepType = MachineFile.EXCEPTION_OK; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | annoData.setProgramStatus(status); |
| | | annoData.setDeviation(programPackageNode.getDeviation()); |
| | | annoData.setFilename(programFile.getName()); |
| | | |
| | | InputStream addedInsFinal = annoProcessor.putAnnotation(annoData,inputStream); |
| | | addedInsFinal.reset(); |
| | | /* |
| | |
| | | |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.mdm.program.service.ProgramAnnotationService; |
| | | import org.springblade.mdm.utils.FileContentUtil; |
| | | import org.springblade.system.pojo.entity.DictBiz; |
| | |
| | | byteInputStream.reset(); |
| | | |
| | | if(AnnotationUtil.isAnnotation(sendDirLine,getControlSystem(),annoDicts)){ |
| | | finishedStream = FileContentUtil.replaceAtLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation); |
| | | String planText = AnnotationUtil.removeAnnotation(getControlSystem(),sendDirLine,annoDicts); |
| | | if(!planText.equals(sendPath)) { |
| | | //éè·¯å¾ç注éï¼æå
¥ |
| | | finishedStream = FileContentUtil.insertLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation); |
| | | }else{ |
| | | //æ¯è·¯å¾ï¼ä¸å¤çç´æ¥è¿ååè¾å
¥æµ |
| | | finishedStream = inputStream; |
| | | } |
| | | //finishedStream = FileContentUtil.replaceAtLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation); |
| | | }else{ |
| | | finishedStream = FileContentUtil.insertLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation); |
| | | } |
| | |
| | | } |
| | | @Override |
| | | public InputStream putFilenameAnnotation(String fileName, InputStream inputStream) throws IOException { |
| | | List<DictBiz> annoDicts = programAnnotationService.getAnnotionDictList(); |
| | | ByteArrayInputStream bais = new ByteArrayInputStream(com.qiniu.util.IOUtils.toByteArray(inputStream)); |
| | | List<DictBiz> annoDicts = programAnnotationService.getAnnotionDictList();//TODO è¿éåºè¯¥ä¸ç¨å è½½ï¼åæ°ä¼ è¿æ¥å°±è¡ |
| | | ByteArrayInputStream byteStream = new ByteArrayInputStream(IOUtils.toByteArray(inputStream)); |
| | | |
| | | String line = FileContentUtil.readLineAt(bais, annotationProperties.getProgramNameLineIndex()); |
| | | bais.reset(); |
| | | boolean isAnnotation = AnnotationUtil.isAnnotation(line,this.getControlSystem(),annoDicts); |
| | | InputStream insAfter; |
| | | String programNameLine = FileContentUtil.readLineAt(byteStream, annotationProperties.getProgramNameLineIndex()); |
| | | byteStream.reset(); |
| | | boolean isAnnotation = AnnotationUtil.isAnnotation(programNameLine,this.getControlSystem(),annoDicts); |
| | | InputStream insAfterProgramName; |
| | | //å å
¥ç¨åºå注éè¡ |
| | | String proNameLine = AnnotationUtil.generateAnnotation(FilenameUtils.removeExtension(fileName),getControlSystem(),annoDicts); |
| | | String proNameAnnotation = AnnotationUtil.generateAnnotation(FilenameUtils.removeExtension(fileName),getControlSystem(),annoDicts); |
| | | |
| | | if(isAnnotation){//æ¯æ³¨é |
| | | //æå注éå
æå |
| | | //String planText = AnnotationUtil.removeAnnotation(getControlSystem(),programNameline,annoDicts); |
| | | if(!StringUtils.equals(programNameLine,proNameAnnotation)) { |
| | | //注é䏿¯ç¨åºåï¼å·¥èºåèªå·±åçæ³¨éï¼ï¼æå
¥ |
| | | insAfterProgramName = FileContentUtil.insertLine(byteStream,annotationProperties.getProgramNameLineIndex(),proNameAnnotation); |
| | | }else{ |
| | | //æ¯ç¨åºå注éï¼ä¸å¤çï¼è¿ååstream |
| | | insAfterProgramName = byteStream; |
| | | } |
| | | }else{ |
| | | //éæ³¨éï¼æå
¥ç¶æ |
| | | insAfterProgramName = FileContentUtil.insertLine(byteStream,annotationProperties.getProgramNameLineIndex(),proNameAnnotation); |
| | | } |
| | | /* |
| | | if(isAnnotation){ |
| | | insAfter = FileContentUtil.replaceAtLine(bais, annotationProperties.getProgramNameLineIndex(),proNameLine); |
| | | }else{ |
| | | insAfter = FileContentUtil.insertLine(bais, annotationProperties.getProgramNameLineIndex(),proNameLine); |
| | | } |
| | | return insAfter; |
| | | }*/ |
| | | return insAfterProgramName; |
| | | } |
| | | |
| | | @Override |
| | |
| | | ByteArrayInputStream byteInputStream = new ByteArrayInputStream(IOUtils.toByteArray(inputStream)); |
| | | |
| | | //1å å
¥åéè·¯å¾ç注é |
| | | /* |
| | | String sendPathAnnotation = AnnotationUtil.generateAnnotation(annoData.getSendPath(),getControlSystem(),annoDicts);//å äºæ³¨éä¹åçææ¬ |
| | | |
| | | String sendDirLine = FileContentUtil.readLineAt(byteInputStream,annotationProperties.getSendPathLineIndex());//第2è¡æ¯åéè·¯å¾ |
| | | byteInputStream.reset(); |
| | | String statusLine = FileContentUtil.readLineAt(byteInputStream,annotationProperties.getStatusLineIndex());//ç¶ææ³¨é |
| | | byteInputStream.reset(); |
| | | |
| | | InputStream insAfterSetSendDir ; |
| | | if(AnnotationUtil.isAnnotation(sendDirLine,getControlSystem(),annoDicts)){ |
| | | insAfterSetSendDir = FileContentUtil.replaceAtLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation); |
| | | }else{ |
| | | insAfterSetSendDir = FileContentUtil.insertLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation); |
| | | } |
| | | |
| | | insAfterSetSendDir.reset(); |
| | | */ |
| | | |
| | | InputStream insAfterSetSendDir = putSendPathAnnotation(annoData.getSendPath(),byteInputStream,annoDicts); |
| | | |
| | | /* |
| | | String statusLine = FileContentUtil.readLineAt(insAfterSetSendDir,annotationProperties.getStatusLineIndex());//ç¶ææ³¨é |
| | | insAfterSetSendDir.reset(); |
| | | |
| | | //å å
¥ç¶ææ³¨éè¡ |
| | | InputStream insAfterStatus; |
| | | String statusAnnotation = AnnotationUtil.generateAnnotation(annoData.getProgramStatus(),getControlSystem(),annoDicts);//注éåçç¶æææ¬ |
| | | if(AnnotationUtil.isAnnotation(statusLine,getControlSystem(),annoDicts)){ |
| | | finishedStream = FileContentUtil.replaceAtLine(insAfterSetSendDir,annotationProperties.getStatusLineIndex(),statusAnnotation); |
| | | insAfterStatus = FileContentUtil.replaceAtLine(insAfterSetSendDir,annotationProperties.getStatusLineIndex(),statusAnnotation); |
| | | }else{ |
| | | finishedStream = FileContentUtil.insertLine(insAfterSetSendDir,annotationProperties.getStatusLineIndex(),statusAnnotation); |
| | | insAfterStatus = FileContentUtil.insertLine(insAfterSetSendDir,annotationProperties.getStatusLineIndex(),statusAnnotation); |
| | | }*/ |
| | | InputStream insAfterStatus = putStatusAnnotation(annoData.getProgramStatus(),insAfterSetSendDir,annoDicts); |
| | | |
| | | if(StringUtils.isNotBlank(annoData.getDeviation())){ |
| | | finishedStream = putDeviationAnnotation(annoData.getDeviation(),insAfterStatus,annoDicts); |
| | | }else{ |
| | | //æ¯æ´æ¹åå·ï¼ä¸å¤çç´æ¥è¿ååè¾å
¥æµ |
| | | finishedStream = insAfterStatus; |
| | | } |
| | | } |
| | | |
| | | return finishedStream; |
| | | } |
| | | |
| | | protected InputStream putStatusAnnotation(String status,InputStream inputStream,List<DictBiz> annoDicts) throws IOException { |
| | | InputStream insAfterStatus; |
| | | //å å
¥lgåå· |
| | | |
| | | String statusLine = FileContentUtil.readLineAt(inputStream,annotationProperties.getStatusLineIndex());//ç¶ææ³¨é |
| | | String stationAnnotation = AnnotationUtil.generateAnnotation(status,getControlSystem(),annoDicts); |
| | | |
| | | inputStream.reset(); |
| | | if(AnnotationUtil.isAnnotation(statusLine,getControlSystem(),annoDicts) ){ |
| | | //æ¯æ³¨é |
| | | //æå注éå
æå |
| | | String planText = AnnotationUtil.removeAnnotation(getControlSystem(),statusLine,annoDicts); |
| | | if(!StringUtils.equalsAny(planText,AnnotationUtil.SQ,AnnotationUtil.GH,AnnotationUtil.LG)) { |
| | | //注é䏿¯ç¶æï¼å·¥èºåèªå·±åçæ³¨éï¼ï¼æå
¥ |
| | | insAfterStatus = FileContentUtil.insertLine(inputStream,annotationProperties.getStatusLineIndex(),stationAnnotation); |
| | | }else{ |
| | | //æ¯ç¶ææ³¨éï¼æ¿æ¢ |
| | | insAfterStatus = FileContentUtil.replaceAtLine(inputStream,annotationProperties.getStatusLineIndex(),stationAnnotation); |
| | | } |
| | | }else{ |
| | | //éæ³¨éï¼æå
¥ç¶æ |
| | | insAfterStatus = FileContentUtil.insertLine(inputStream,annotationProperties.getStatusLineIndex(),stationAnnotation); |
| | | } |
| | | return insAfterStatus; |
| | | } |
| | | |
| | | protected InputStream putDeviationAnnotation(String deviation,InputStream inputStream,List<DictBiz> annoDicts) throws IOException { |
| | | InputStream insAfter1; |
| | | //å å
¥lgåå· |
| | | String devLine = FileContentUtil.readLineAt(inputStream,annotationProperties.getDeviationLineIndex());//ç¶ææ³¨é |
| | | |
| | | String devAnnotation = AnnotationUtil.generateAnnotation(deviation,getControlSystem(),annoDicts); |
| | | |
| | | inputStream.reset(); |
| | | if(AnnotationUtil.isAnnotation(devLine,getControlSystem(),annoDicts) ){ |
| | | //æ¯æ³¨é |
| | | //æå注éå
æå |
| | | String planText = AnnotationUtil.removeAnnotation(getControlSystem(),devLine,annoDicts); |
| | | if(!planText.equals(deviation)) { |
| | | //注é䏿¯ä¸´æ¶æ´æ¹åå·ï¼å·¥èºåèªå·±åçæ³¨éï¼ï¼æå
¥ |
| | | insAfter1 = FileContentUtil.insertLine(inputStream,annotationProperties.getDeviationLineIndex(),devAnnotation); |
| | | }else{ |
| | | //æ¯æ´æ¹åå·ï¼ä¸å¤çç´æ¥è¿ååè¾å
¥æµ |
| | | insAfter1 = inputStream; |
| | | } |
| | | }else{ |
| | | //éæ³¨éï¼ææå
¥lgå· |
| | | insAfter1 = FileContentUtil.insertLine(inputStream,annotationProperties.getDeviationLineIndex(),devAnnotation); |
| | | } |
| | | return insAfter1; |
| | | } |
| | | |
| | | @Override |
| | | public abstract void setControlSystem(String controlSystemDictVal) ; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.springblade.mdm.program.service.programannotation; |
| | | |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * è´è´£åæ¢åéçæ³¨éå¤çå¨ |
| | | */ |
| | | @Component |
| | | public class AnnotationProcessorHelper { |
| | | @Autowired |
| | | private MachineAnnotationConfig annotationConfig; |
| | | |
| | | public AnnotationProcessor getProcessor(String controlSystem){ |
| | | AnnotationProperties props = annotationConfig.getConfigMap().get(controlSystem); |
| | | AnnotationProcessor processor; |
| | | if(props != null){ |
| | | processor = SpringUtil.getBean(props.getBeanId()); |
| | | processor.setAnnotationProperties(props); |
| | | |
| | | }else{ |
| | | processor = SpringUtil.getBean(DefaultProcessor.class); |
| | | processor.setAnnotationProperties(AnnotationProperties.getDefault()); |
| | | } |
| | | processor.setControlSystem(controlSystem); |
| | | return processor; |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private ReceiveFileCheckService receiveFileCheckService; |
| | | |
| | | @Autowired |
| | | private ReceiveDirMoveService receiveDirMoveService; |
| | | |
| | | // æ¯5ç§æ§è¡ä¸æ¬¡ |
| | | //@Scheduled(fixedRate = 1000000) |
| | | //@Scheduled(cron = "0 1 0 * * ?") // æ¯å¤©ä¸å0ç¹1åæ§è¡ |
| | |
| | | log.info("reccheckfile start"); |
| | | checkFiles(); |
| | | |
| | | //æ£æ¥å®æï¼ç´æ¥ç§»å¨æ å¼å¸¸çæä»¶ |
| | | receiveDirMoveService.moveValidateFiles(); |
| | | log.info("reccheckfile end"); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.springblade.mdm.task; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.mdm.basesetting.machine.entity.Machine; |
| | | import org.springblade.mdm.basesetting.machine.service.MachineService; |
| | | import org.springblade.mdm.commons.service.ParamService; |
| | | import org.springblade.mdm.machinefile.entity.MachineFile; |
| | | import org.springblade.mdm.machinefile.service.MachineFileService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æºåºåä¼ æä»¶å¤¹recï¼ç®å½æä»¶è¶
è¿æºåºè®¾å®çæ¶é´ç§»å¨å°tempæä»¶å¤¹ |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @EnableScheduling |
| | | public class ReceiveDirMoveService { |
| | | @Autowired |
| | | private MachineFileService machineFileService; |
| | | @Autowired |
| | | private MachineService machineService; |
| | | |
| | | |
| | | /** |
| | | * æ«ææ°æ®åºè®°å½ï¼è¶
æ¶åç§»å¨æä»¶ |
| | | */ |
| | | public void moveValidateFiles() { |
| | | List<Machine> machines = machineService.getEnableMachines(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | for (Machine machine : machines) { |
| | | |
| | | //LocalDateTime earlyTime = now.minusHours(remainHours); |
| | | List<MachineFile> pendingFiles = this.machineFileService.lambdaQuery() |
| | | .eq(MachineFile::getDirType,MachineFile.DIR_TYPE_REC) |
| | | .eq(MachineFile::getExceptionType,MachineFile.EXCEPTION_OK) |
| | | .eq(MachineFile::getMachineCode,machine.getCode()).list(); |
| | | |
| | | |
| | | for(MachineFile overTimeFile : pendingFiles){ |
| | | try { |
| | | moveFileToTemp(overTimeFile, machine); |
| | | }catch(Exception e){ |
| | | log.error("ç§»å¨recæä»¶å¤±è´¥:{}",overTimeFile.getName(),e); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * æä»¶ç§»å¨å°temp |
| | | * @param overTimeFile |
| | | */ |
| | | private void moveFileToTemp(MachineFile overTimeFile,Machine machine) throws IOException { |
| | | String srcFilepath = MachineFileService.getBasePath(machine,overTimeFile.getDirType())+ File.separator+overTimeFile.getName(); |
| | | Path source = Paths.get(srcFilepath); |
| | | if(!source.toFile().exists()){ |
| | | return; |
| | | } |
| | | String targetFilepath = MachineFileService.getBasePath(machine,MachineFile.DIR_TYPE_TEMP)+ File.separator+overTimeFile.getName(); |
| | | Path target = Paths.get(targetFilepath); |
| | | |
| | | Path targetDir = target.getParent(); |
| | | if (targetDir != null && !Files.exists(targetDir)) { |
| | | Files.createDirectories(targetDir); |
| | | } |
| | | |
| | | // ä½¿ç¨ REPLACE_EXISTING é项æ¥è¦çå·²åå¨çæä»¶ |
| | | Files.move(source, target, StandardCopyOption.REPLACE_EXISTING); |
| | | } |
| | | } |
| | |
| | | */ |
| | | private static final int DEFAULT_HOUR = 0; |
| | | |
| | | @Scheduled(cron = "${task.cron.machine_rec_move:0 3 * * * ?}") |
| | | //@Scheduled(cron = "${task.cron.machine_rec_move:0 3 * * * ?}") |
| | | /* |
| | | public void execute() { |
| | | String networkType = paramService.getParamValue(ParamService.NETWORK_TYPE,ParamService.NETWORK_TYPE_SHEMI); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * æ«ææ°æ®åºè®°å½ï¼è¶
æ¶åç§»å¨æä»¶ |
| | | */ |
| | | |
| | | public void moveValidateFiles() { |
| | | List<Machine> machines = machineService.getEnableMachines(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | for (Machine machine : machines) { |
| | | int remainHours = machine.getReceiveDirExpiryHours() != null ?machine.getReceiveDirExpiryHours():DEFAULT_HOUR; |
| | | /*if(remainHours == 0){ |
| | | continue; |
| | | }*/ |
| | | |
| | | //LocalDateTime earlyTime = now.minusHours(remainHours); |
| | | List<MachineFile> pendingFiles = this.machineFileService.lambdaQuery() |
| | | .eq(MachineFile::getDirType,MachineFile.DIR_TYPE_REC) |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * æä»¶ç§»å¨å°temp |
| | | * @param overTimeFile |
| | | */ |
| | | private void moveFileToTemp(MachineFile overTimeFile,Machine machine) throws IOException { |
| | | String srcFilepath = MachineFileService.getBasePath(machine,overTimeFile.getDirType())+ File.separator+overTimeFile.getName(); |
| | | Path source = Paths.get(srcFilepath); |
| | |
| | | // ä½¿ç¨ REPLACE_EXISTING é项æ¥è¦çå·²åå¨çæä»¶ |
| | | Files.move(source, target, StandardCopyOption.REPLACE_EXISTING); |
| | | } |
| | | */ |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.springblade.mdm.machinefile.service; |
| | | |
| | | import org.junit.jupiter.api.Assertions; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springblade.core.tool.utils.Func; |
| | | |
| | | public class ReceiveFileCheckServiceTest { |
| | | @Test |
| | | public void testSplie(){ |
| | | String[] arr = Func.split("LG",":"); |
| | | Assertions.assertEquals(1, arr.length); |
| | | |
| | | arr = Func.split(null,":"); |
| | | Assertions.assertEquals(0, arr.length); |
| | | } |
| | | } |
| | |
| | | `tenant_id` varchar(6) DEFAULT NULL COMMENT 'æå±ç§æ·', |
| | | `code` varchar(100) NOT NULL COMMENT 'æºåºç¼å·', |
| | | `name` varchar(100) NOT NULL COMMENT 'æºåºæè¿°/åå·', |
| | | `avatar` varchar(400) DEFAULT NULL COMMENT 'å¾çå°å', |
| | | `equipment_code` varchar(100) DEFAULT NULL COMMENT '设å¤ç¼å·', |
| | | `machine_group_code` varchar(255) NOT NULL COMMENT 'æå±æºåºç»ä»£ç ï¼,å¨ä¸å¡åå
¸é
ç½®ï¼key=machine_groupï¼', |
| | | `machine_spec` varchar(40) DEFAULT NULL COMMENT 'æºå¨è§æ ¼:01车åº/02é£åº,å¨ä¸å¡åå
¸é
ç½®ï¼key=machine_specï¼', |
| | | `operator` varchar(100) COMMENT 'æä½åï¼ææ¬å½å
¥', |
| | |
| | | `process_name` varchar(20) NULL COMMENT 'å·¥åºåç§°', |
| | | `process_no` varchar(100) NULL COMMENT 'å·¥åºå·', |
| | | `machine_code` varchar(100) DEFAULT NULL COMMENT '设å¤ç¼å·/æºåºç¼å·', |
| | | `equipment_code` varchar(100) DEFAULT NULL COMMENT '设å¤ç¼å·', |
| | | `drawing_no` varchar(100) NULL COMMENT 'é¶ç»ä»¶ç¼å·/å¾å·', |
| | | `process_edition` varchar(40) DEFAULT NULL COMMENT 'å·¥åºç次ï¼åçå°±æ¯åæ´æ¹è¯¥å段ï¼éè¦ä¿çåå²è®°å½', |
| | | `craft_edition` varchar(40) DEFAULT NULL COMMENT 'å·¥èºç次', |
| | |
| | | `err_msg` varchar(200) NULL COMMENT 'é误æè
æç¤ºä¿¡æ¯', |
| | | `process_instance_id` varchar(64) NULL COMMENT 'å
³èçæµç¨å®ä¾idï¼æµç¨åèµ·åå¡«å
', |
| | | `program_no` varchar(20) NULL COMMENT 'æ°æ§ç¨åºç¼å·ï¼æµç¨åèµ·åå¡«å
', |
| | | `mes_task_id` varchar(100) NULL COMMENT 'MESä»»å¡å¯ä¸æ è¯', |
| | | `operation_id` varchar(100) NULL COMMENT 'å·¥åºå¯ä¸ç (MESåé)', |
| | | `process_card` varchar(40) NULL COMMENT 'è¿ç¨å¡å·ï¼mesæä¾ï¼', |
| | | `inspector` varchar(40) NULL COMMENT 'æ£éªåï¼mesæä¾ï¼', |
| | | `check_time` datetime DEFAULT NULL COMMENT 'æ£éªæ¶é´', |
| | | `operator` varchar(40) NULL COMMENT 'æä½è
ï¼mesæä¾ï¼', |
| | |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='å·¥æ§ç½æºåºæä»¶ä¿®æ¹åå²'; |
| | | |
| | | |
| | | |
| | | DROP TABLE IF EXISTS `mdm_file_send_record`; |
| | | CREATE TABLE `mdm_file_send_record` ( |
| | | `id` bigint NOT NULL, |
| | |
| | | PRIMARY KEY (`drawing_no`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='é¶ç»ä»¶å·ä¸ææ°æ®'; |
| | | |
| | | |
| | | DROP TABLE IF EXISTS `mdm_program_on_machine`; |
| | | CREATE TABLE `mdm_program_on_machine` ( |
| | | `id` bigint NOT NULL, |
| | | `tenant_id` varchar(6) DEFAULT NULL COMMENT 'æå±ç§æ·', |
| | | `drawing_no` varchar(100) NULL COMMENT 'é¶ç»ä»¶ç¼å·/å¾å·', |
| | | `process_no` varchar(100) NULL COMMENT 'å·¥åºå·', |
| | | `process_edition` varchar(40) DEFAULT NULL COMMENT 'å·¥åºç次', |
| | | `machine_code` varchar(100) DEFAULT NULL COMMENT '设å¤ç¼å·/æºåºç¼å·', |
| | | `process_instance_id` varchar(64) DEFAULT NULL COMMENT 'æµç¨å®ä¾id', |
| | | `status` int DEFAULT NULL COMMENT 'ä¸å¡ç¶æ', |
| | | `create_dept` bigint DEFAULT NULL COMMENT 'å建åä½', |
| | | `is_deleted` int DEFAULT NULL, |
| | | `create_time` datetime DEFAULT NULL COMMENT 'å建æ¶é´', |
| | | `create_user` bigint DEFAULT NULL COMMENT 'å建人', |
| | | `update_time` datetime DEFAULT NULL COMMENT 'æ´æ°æ¶é´', |
| | | `update_user` bigint DEFAULT NULL COMMENT 'æ´æ°äºº', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='ç°åºç¼ç¨è®°å½'; |
| | | |
| | | DROP TABLE IF EXISTS `mdm_mes_sync`; |
| | | CREATE TABLE `mdm_mes_sync` ( |
| | | `id` bigint NOT NULL, |
| | | `operation_id` varchar(100) NULL COMMENT 'å·¥åºå¯ä¸ç ', |
| | | `program_no` varchar(100) NOT NULL COMMENT 'ç¨åºç¼å·', |
| | | `cured_time` datetime NOT NULL COMMENT 'åºåæ¶é´', |
| | | `try_times` int NOT NULL DEFAULT 0 COMMENT 'éè¯æ¬¡æ°', |
| | | `status` int NOT NULL COMMENT 'ç¶æï¼1:åå§å
¥åº; 2:忥æå;3:åæ¥å¤±è´¥', |
| | | `create_time` datetime NOT NULL COMMENT 'å建æ¶é´', |
| | | `update_time` datetime NOT NULL COMMENT 'æ´æ°æ¶é´', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='åMESåä¼ æ°æ®'; |