| | |
| | | import org.springblade.mdm.flow.constants.FlowConstant; |
| | | import org.springblade.mdm.flow.entity.FlowProgramFile; |
| | | import org.springblade.mdm.flow.service.FlowProgramFileService; |
| | | import org.springblade.mdm.flow.service.TaskDispatchService; |
| | | import org.springblade.mdm.program.entity.NcNode; |
| | | import org.springblade.mdm.program.entity.NcNodeHis; |
| | | import org.springblade.mdm.program.entity.NcProgramApproved; |
| | |
| | | private final OssTemplate ossTemplate; |
| | | private final FlowProgramFileService flowProgramFileService; |
| | | private final HistoryService historyService; |
| | | |
| | | private final TaskDispatchService taskDispatchService; |
| | | private final MachineAnnotationConfig annotationConfig; |
| | | |
| | | private final AnnotationProcessorHelper annotationProcessorHelper; |
| | | /** |
| | | * 导出dnc压缩包 |
| | | * @param approvedIdArray 待导出审批表id数组 |
| | |
| | | |
| | | Machine machine = machineService.getByCode(packageNodeHis.getMachineCode());//程序包节点,获取注释用 |
| | | |
| | | //List<NcNode> programNodes = ncNodeService.lambdaQuery().eq(NcNode::getIsLastEdition,1).eq(NcNode::getParentId, approved.getNcNodeId()).list(); |
| | | List<NcNodeHis> programNodes = ncNodeHisService.lambdaQuery().eq(NcNodeHis::getParentId, approved.getNcNodeId()).list(); |
| | | |
| | | FlowProgramFile programFile; |
| | |
| | | } |
| | | long deviationSerial = -1;//偏离单序号 ,-1为非偏离单,不需要加入 |
| | | if(packageNodeHis.isDeviationProgram()) { |
| | | deviationSerial = ncNodeHisService.getDeviationSerialForNode(packageNodeHis); |
| | | deviationSerial = taskDispatchService.getDeviationSerial(packageNodeHis.getProgramNo()); |
| | | } |
| | | |
| | | //List<DictBiz> annotationDictList= programAnnotationService.getAnnotionDictList(); |
| | | for (NcNodeHis node : programNodes) { |
| | | String filePathInZip = genFilePathInZip(packageFolder,node,deviationSerial); |
| | | programFile = this.flowProgramFileService.getById(node.getFlowProgramFileId()); |
| | |
| | | InputStream inputStream = ossTemplate.statFileStream(programFile.getOssName()); |
| | | String sendDir = machine.getProgSendDir()==null? StringUtil.EMPTY:machine.getProgSendDir(); |
| | | |
| | | AnnotationProcessor annoProcessor = ProcessorHelper.getProcessor(machine.getControlSystem(),annotationConfig); |
| | | //AnnotationProcessor annoProcessor = ProcessorHelper.getProcessor(machine.getControlSystem(),annotationConfig); |
| | | AnnotationProcessor annoProcessor = this.annotationProcessorHelper.getProcessor(machine.getControlSystem()); |
| | | AnnotationData annoData = new AnnotationData(); |
| | | annoData.setSendPath(sendDir); |
| | | annoData.setProgramStatus(status); |
| | |
| | | |
| | | InputStream addedInsFinal = annoProcessor.putAnnotation(annoData,inputStream); |
| | | addedInsFinal.reset(); |
| | | /* |
| | | InputStream addedInsFinal; |
| | | InputStream addedIns2 = programAnnotationService.setSendDirAndStatusAnnotation(sendDir,status,inputStream,machine.getControlSystem()); |
| | | if(StringUtils.isNotBlank(programPackageNode.getDeviation())) { |
| | | //偏离单,增加偏离单号 |
| | | addedInsFinal = programAnnotationService.setPldAnnotation(programPackageNode.getDeviation(),addedIns2, machine.getControlSystem(), annotationDictList);; |
| | | }else{ |
| | | addedInsFinal = addedIns2; |
| | | }*/ |
| | | |
| | | this.addInputStreamToZip(zipOut, addedInsFinal, filePathInZip); |
| | | } |
| | | } |
| | |
| | | * 生成在zip中的文件路径 |
| | | * @param packageFolder zip中的文件夹 |
| | | * @param programNode 程序节点 |
| | | * @param deviationSerial 偏离单序号 |
| | | * @param deviationSerial 临时更改单序号 |
| | | * @return zip中的文件路径 |
| | | */ |
| | | String genFilePathInZip(String packageFolder,NcNodeHis programNode,long deviationSerial){ |