| | |
| | | import org.springblade.mdm.program.service.NcNodeService; |
| | | import org.springblade.mdm.program.service.NcProgramApprovedService; |
| | | import org.springblade.mdm.program.service.ProgramAnnotationService; |
| | | import org.springblade.mdm.program.service.programannotation.AnnotationProperties; |
| | | import org.springblade.mdm.program.service.programannotation.AnnotationUtil; |
| | | import org.springblade.mdm.program.service.programannotation.MachineAnnotationConfig; |
| | | import org.springblade.mdm.utils.EntityUtil; |
| | | import org.springblade.system.feign.ISysClient; |
| | | import org.springblade.system.pojo.entity.DictBiz; |
| | |
| | | @Component("normalCureFinishDataHandler") |
| | | public class NormalCureFinishDataHandler implements FinishDataHandler { |
| | | @Autowired |
| | | private NcProgramApprovedService approvedService; |
| | | @Autowired |
| | | private ApproveRecordService approveRecordService; |
| | | private MachineAnnotationConfig config; |
| | | |
| | | @Autowired |
| | | private FlowProgramFileService flowProgramFileService; |
| | | @Autowired |
| | |
| | | |
| | | /** |
| | | * 将节点和历史节点挪动到固化的同级节点下 |
| | | * @param pkgNode 要固化的节点 |
| | | * @param pkgNode1 要固化的节点 |
| | | * @param historyProgramPackageNodes 程序包名 历史节点 |
| | | */ |
| | | void moveNodeToCuredTree(NcNode pkgNode1,List<NcNode> historyProgramPackageNodes, FlowProgramProperties programProperties) throws IOException { |
| | |
| | | newProgNode.setFlowProgramFileId(flowProgramFile.getId()); |
| | | newProgNode.setIsCured(1); |
| | | |
| | | setGhAnnotation(flowProgramFile,machine.getMachineGroupCode(),annoDicts); |
| | | setGhAnnotation(flowProgramFile,machine.getControlSystem(),annoDicts); |
| | | |
| | | nodeService.save(newProgNode); |
| | | } |
| | |
| | | * @param flowProgramFile oss 文件 |
| | | * |
| | | */ |
| | | void setGhAnnotation(FlowProgramFile flowProgramFile,String machineGroup,List<DictBiz> annoDicts) throws IOException { |
| | | void setGhAnnotation(FlowProgramFile flowProgramFile,String controlSystem,List<DictBiz> annoDicts) throws IOException { |
| | | String ossName = flowProgramFile.getOssName(); |
| | | // |
| | | try(InputStream ins = ossTemplate.statFileStream(ossName);){ |
| | | byte[] bytes = IOUtils.toByteArray(ins); |
| | | ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bytes); |
| | | |
| | | InputStream finishedStream = programAnnotationService.setGHAnnotation(byteInputStream,machineGroup,annoDicts); |
| | | |
| | | //InputStream finishedStream = programAnnotationService.setGHAnnotation(byteInputStream,controlSystem,annoDicts); |
| | | List<DictBiz> annoDictList = programAnnotationService.getAnnotionDictList(); |
| | | AnnotationProperties annoProps = config.getConfigMap().get(controlSystem); |
| | | if(annoProps == null){ |
| | | annoProps = AnnotationProperties.getDefault(); |
| | | } |
| | | InputStream finishedStream =AnnotationUtil.setAnnotationAndGetInputStream(byteInputStream, "GH", annoProps.getStatusLineIndex(), controlSystem, annoDictList); |
| | | try(finishedStream) { |
| | | finishedStream.reset(); |
| | | BladeFile bfile = ossTemplate.putFile(flowProgramFile.getName(), finishedStream); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算有效期 |
| | | * @return |