Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Version: Windchill 12.1
Use Case: Windchill Publishing is currently set to publish drawings using the As-Stored configuration. This ensures that a REV A drawing is never re-published using a REV B model, for example. But sometimes users check-in a model after the last time they check-in the drawing. Then the drawing publishes "incorrectly". Uses don't notice this because their workspace always has "latest" versions of the model and drawing.
Description:
Has anyone developed a customization or business rule to check that during a promotion request / change notice, that the drawing is more recent than the associated drawing models of that drawing. I would be open to other suggestions on how to prevent publishing the wrong drawing other than changing the publishing configuration to "Latest". If there was an option to check for "Latest Iteration" of the model, that might work, but I do not want a solution that creates the potential for a Revision mismatch.
Years ago, I seem to remember a warning when the "model is more recent than the drawing" but I think it was just in Pro/Engineer (yeah, that long ago.)
Would an acceptable solution be to set the config to “Latest” but only publish if the drawing’s rev and the drawing’s model’s rev match?
If yes, this is doable.
The goal is to get the "correct" version of the drawing to publish... I don't want to not publish.
The simplest solution is to make sure that the drawing is always checked in after any changes to the model. So, I think that is what needs to be enforced before the objects are Promoted / ECN is approved. The "As-Stored" version of a drawing should be a good piece of information for other use cases besides publishing. So, with that assumption, I believe I am looking for a rule check during a workflow, not at publishing.
Ok, so the solution is to ensure drawings on promotion request or ECN resulting object are ALWAYS later than their drawing models prior to workflow promote/approve task.
Why not simple write Java code to validate this condition and run the code in the workflow before the promote/approve task?
If the validation doesn’t pass mustard workflow sends task to user explaining the problem and the solution.
I’d also run the same code in the promote/approve task’s transition or at least right after the task just in to make sure everything is still valid at the moment of approval.
Is this something you really need?
Or is this more of a it would be nice to have, but not really necessary?
Did you find anyone who is willing to give you code they’ve written?
Keep in mind you can’t simply check the “modified” dates of the model and the drawing.
You also need to check the dates on their corresponding files in the file vault.
Why you ask? Because it’s possible to check out a Cad object without the WGM, edit an attribute, add and attachment, etc. and check it back in.
Modified date changes but the file in the file vault does not.
In the case of an instance it gets even more complicated at the dB level. Doable for sure but not as straight forward as non-family table object.
Lots to consider.
If you need help, feel free to reach out.
Felcos' Object Validator will probably do this checking along with a myriad of other checks:
Hi @MM_10260548,
I wanted to see if you got the help you needed.
If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation.
Thanks,
Anurag
I had the exact same problem, I made some workflow code to check the drawing and the referenced models, you will need a workflow variable "errorMsg" which you also put in the error activity to display the error message to the assignee, hopefully its some use to you:
wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice) primaryBusinessObject;
// Refresh promotion targets
com.ptc.windchill.enterprise.maturity.PromotionNoticeWorkflowHelper.refresh(pn);
// Get the promotion targets
wt.fc.QueryResult qr = wt.maturity.MaturityHelper.service.getPromotionTargets(pn, false);
boolean allOK = true;
StringBuilder errorMessages = new StringBuilder();
while (qr.hasMoreElements()) {
wt.maturity.PromotionTarget pt = (wt.maturity.PromotionTarget) qr.nextElement();
String oid = pt.getPromotable().toString();
ObjectIdentifier oid1 = ObjectIdentifier.newObjectIdentifier(oid);
wt.fc.WTObject obj = (wt.fc.WTObject) wt.fc.PersistenceHelper.manager.refresh(oid1);
// Only check drawings
if (obj.getDisplayType().getLocalizedMessage(java.util.Locale.ENGLISH).contains("Drawing")) {
wt.epm.EPMDocument epm = (wt.epm.EPMDocument) obj;
int DRAWING_MODEL_DEP_TYPE = 4;
wt.epm.workspaces.EPMAsStoredConfigSpec as_stored_config = wt.epm.workspaces.EPMAsStoredConfigSpec.newEPMAsStoredConfigSpec(epm);
wt.query.QuerySpec ref_filter_qs = new wt.query.QuerySpec();
Class qc = wt.epm.structure.EPMReferenceLink.class;
int idx = ref_filter_qs.addClassList(qc, true);
ref_filter_qs.appendWhere(new wt.query.SearchCondition(qc, wt.epm.structure.EPMReferenceLink.REQUIRED, wt.query.SearchCondition.IS_TRUE), new int[]{idx});
ref_filter_qs.appendAnd();
ref_filter_qs.appendWhere(new wt.query.SearchCondition(qc, wt.epm.structure.EPMReferenceLink.DEP_TYPE, wt.query.SearchCondition.EQUAL, DRAWING_MODEL_DEP_TYPE), new int[]{idx});
wt.fc.QueryResult qr2 = wt.epm.structure.EPMStructureHelper.service.navigateReferencesToIteration(epm, ref_filter_qs, true, as_stored_config);
while (qr2.hasMoreElements()) {
wt.epm.EPMDocument ref = (wt.epm.EPMDocument) qr2.nextElement();
String refS = ref.toString();
// Get latest iteration of referenced model
wt.epm.EPMDocConfigSpec epmConfigSpec = wt.epm.EPMDocConfigSpec.newEPMDocConfigSpec();
epmConfigSpec.setLatestActive();
epmConfigSpec.setWorkingIncluded(false);
wt.fc.QueryResult resultLatestEPM = wt.vc.config.ConfigHelper.service.filteredIterationsOf(ref.getMaster(), epmConfigSpec);
if (resultLatestEPM.hasMoreElements()) {
wt.epm.EPMDocument latestRef = (wt.epm.EPMDocument) resultLatestEPM.nextElement();
String latestRefS = latestRef.toString();
// Check if the referenced model is not the latest
if (!refS.equals(latestRefS)) {
allOK = false;
errorMessages.append("<p>").append(epm.getCADName()).append("</p>");
}
}
}
}
}
// Set result based on findings
if (allOK) {
result = "Approve";
} else {
result = "Rework";
errorMsg = errorMessages.toString();
}