| | |
| | | //非文本 |
| | | excepType = MachineFile.EXCEPTION_NOT_TEXT; |
| | | }else{ |
| | | //Matcher matcher = RegExpConstants.PROGRAM_FILE_PATTERN.matcher(machineFile.getName()); |
| | | ProgramNameVO progNameVO = ProgramFileNameParser.parseProgramName(machineFile.getName()); |
| | | boolean filenameValid = progNameVO.isValidFilename(); |
| | | if(!filenameValid){ |
| | |
| | | if(matchCount != progNameVO.getSegmentCount()){//文件段数缺失 |
| | | excepType = MachineFile.EXCEPTION_LOST_FILES; |
| | | }else{ |
| | | //检查是否匹配机床回传任务? |
| | | |
| | | //检查是否匹配下发记录的段数 |
| | | //正负3秒作为查询时间 |
| | | //Date beginTime = new Date(machineFile.getFileCreateTime().getTime()-3000); |
| | | //Date endTime = new Date(machineFile.getFileCreateTime().getTime()+3000); |
| | | String likeStr; |
| | | String nameLikeStr; |
| | | if(StringUtils.isNotBlank(progNameVO.getLgPart())){ |
| | | likeStr = prefix +"%P%"; |
| | | nameLikeStr = prefix +"%P%"; |
| | | }else{ |
| | | likeStr = prefix; |
| | | nameLikeStr = prefix; |
| | | } |
| | | Optional<FileSendRecord> optFile = fileSendRecordService.lambdaQuery() |
| | | .eq(FileSendRecord::getMachineCode,machineFile.getMachineCode()) |
| | | .likeRight(FileSendRecord::getName,likeStr).last("limit 1") |
| | | .likeRight(FileSendRecord::getName,nameLikeStr).last("limit 1") |
| | | .orderByDesc(FileSendRecord::getCreateTime).oneOpt(); |
| | | |
| | | boolean matchSendRecord;//文件是否有下发记录 |
| | |
| | | |
| | | if(!matchSendRecord){//如果文件未下发过,查看是否有现场编程记录 |
| | | byteStream.reset(); |
| | | |
| | | /* |
| | | String planStatusLine = AnnotationUtil.removeAnnotation(machine.getControlSystem(),FileContentUtil.readLineAt(byteStream,annoProps.getStatusLineIndex()),programAnnotationService.getAnnotionDictList()); |
| | | |
| | | String lgNo;//更改单号 |
| | | if(AnnotationUtil.LG.equals(planStatusLine)) {//是更改单 |
| | | String lgLine = FileContentUtil.readLineAt(byteStream, annoProps.getDeviationLineIndex()); |
| | | lgNo = AnnotationUtil.removeAnnotation(machine.getControlSystem(), lgLine, programAnnotationService.getAnnotionDictList()); |
| | | }else{ |
| | | lgNo = null; |
| | | }*/ |
| | | |
| | | String devSerial = null; |
| | | if(StringUtils.isNotBlank(progNameVO.getLgPart())){ |