Skip to main content
10-Marble
September 14, 2024
Solved

Retrieve the API of all objects affected by change notifications in WTpart through programming

  • September 14, 2024
  • 1 reply
  • 857 views

I need to retrieve the API of all objects affected by change notifications in WTpart through programming, because I need to control whether the WTPart objects of the affected objects already have other changes when creating a new ECN. If so, the current change will be canceled and the customer will be prompted that there are already other changes in the objects. Please complete them first before initiating the change

Best answer by Daniel_Ada
QueryResult activities = ChangeHelper2.service.getAffectingChangeActivities(part);
while (activities.hasMoreElements()) {
WTChangeActivity2 activity = (WTChangeActivity2) activities.nextElement();
QueryResult orders = ChangeHelper2.service.getChangeOrder(activity);
while (orders.hasMoreElements()) {
WTChangeOrder2 order = (WTChangeOrder2) orders.nextElement();
QueryResult qrProcs = WfEngineHelper.service.getAssociatedProcesses(order,
WfState.OPEN_RUNNING, null);
if (qrProcs.size() > 0) {
showFlag = false;
message = "Part:" + part.getNumber() + "-" + part.getName() + "has a running change process and is not allowed to initiate it again";
}
}
}

1 reply

13-Aquamarine
September 14, 2024
QueryResult activities = ChangeHelper2.service.getAffectingChangeActivities(part);
while (activities.hasMoreElements()) {
WTChangeActivity2 activity = (WTChangeActivity2) activities.nextElement();
QueryResult orders = ChangeHelper2.service.getChangeOrder(activity);
while (orders.hasMoreElements()) {
WTChangeOrder2 order = (WTChangeOrder2) orders.nextElement();
QueryResult qrProcs = WfEngineHelper.service.getAssociatedProcesses(order,
WfState.OPEN_RUNNING, null);
if (qrProcs.size() > 0) {
showFlag = false;
message = "Part:" + part.getNumber() + "-" + part.getName() + "has a running change process and is not allowed to initiate it again";
}
}
}
10-Marble
September 14, 2024

Thank you very much for your reply. My issue has been resolved. thank you