I am building a utility to import BOM in customer format.
1. User will upload BOM in CSV format.
2. User can preview CSV in HTML and validate before uploading to windchill.
3. CSV wont be uploaded or lets say BOM wont be uploaded if there is any error in Line item.
4. Result of Upload Process should appear against CSV rows in HTML.
so you'll have to identify the part you want to link, export the structures (with expected config) from Windchill and build the part structure in your tool for the display before validation (pre-run).
For building your merged structure (windchill + what you want to import), you'll need some strategy. The most common would be either to replace the existing links, or only add new links...
Something you could consider is whether to create a baseline object from your import or not. It can be usefull to trace which version of the part were imported.
I don't know whether you already looked at what is available out of the box - Importable spreadsheets - http://support.ptc.com/cs/help/windchill_hc/wc110_hc/index.jspx?id=WPCOverview&action=show/ Import from Excel
Thanks for the base line Idea.
I want to build logic only to update usage attributes value for existing link. UsageLink wont be created or deleted.
I cant figure out how to show error result on back to CSV upload page.
Thank in advance for help. 🙂
we have explored this but we have specific format through which user will update BOM.
The import from spreadsheet functionality is customizable, I believe you can extend this as per your import format instead writing whole new codes.
can you please share some information on "How to Customize Import from Spread Sheet".
Not sure how much this is going to be helpful to you, but below are OOTB code for the 'Import from Spreadsheet'. It looks complicate to extend but this is the place to start with if it need/can be extended.
ImportJob job = new ImportJob();
ImportSpec importSpec = new ImportSpec();
WTContainer myContainer = part.getContainer();
ApplicationData appData =<Get you application Data Here, the spreadsheet attached to part/ doc etc..>
AdminDomainRef admindomainref = myContainer.getDefaultDomainReference();
ImportJobEvent importjobevent = new ImportJobEvent(ImportJobEvent.CREATED, job);
job = (ImportJob) PersistenceHelper.manager.save(job);
wt.content.ContentHolder contentHolder = (wt.content.ContentHolder) job;
ApplicationData applicationData = ApplicationData.newApplicationData(contentHolder);
ContentServerHelper.service.updateContent(contentHolder, applicationData, filePath);
job = StandardImportService.importSpreadsheet(job.getPersistInfo().getObjectIdentifier());