Tuesday, February 9, 2010

How to run mql command in Java

You can execute mql command in JSP and JPO. Here is one example. The following function is used to check if a Part is an assembly or not by check the existence of Bill of Material.


public Boolean isAssembly(Context context, String objectId) throws Exception {
String mql = "expand bus "+objectId+" from rel EBOM select bus id dump ";
MQLCommand cmd = new MQLCommand();
cmd.open(context);
cmd.executeCommand(context,mql);
String sResult = cmd.getResult().trim();
cmd.close(context);
if (sResult.length()>0) {
return true;
} else {
return false;
}
}

How to remove signature when demoting a business object

You use the following trigger script to remove all existing signatures when demoting a business object.


tcl;
eval {
set err [catch {
set sObjectId [mql get env OBJECTID];
mql push context user "superuser" password "superpassword";
mql trigger off;
mql unsign bus $sObjectId signature all;
mql trigger on;
mql pop context;
} msg]
if {$err} {
puts $msg
}
exit 0 ;
}

Monday, February 8, 2010

Enovia Matrixone MQL

Enovia Matrixone provides programming interface to access database through:
  • JAVA API
  • MQL
You can use JAVA API when developing JSP pages or JPO. You also write a TCL/MQL script to access database through MQL windows especially when you do mass data loading or updating. MQL/TCL scripts is my favorite scripting language. You can use TCL/MQL to implement trigger program to implement complicated business logic in a very short program.

MQL and TCL are integrated together. You need to know the basic syntax of TCL. Here the link to access the TCL online documentation.

http://www.tcl.tk/doc/

MQL stands for Matrix Query Language. It is something like SQL. by you MQl, You can query database, update database. Here is the most comon-used MQl Commands:
  • temp query businessobject - query database
  • print business object - print business objects
  • expand business object - expand business object by type and relationship
  • modify business object - change attributes of business object
  • new business object - create a new business object
  • business object execute method - execute a method of a business object
Here is an example - how to obtain all components of an assembly.
  • method 1: print bus Part 100 1 select from[EBOM].businessobject.id dump ]
  • method 2: expand bus Part 100 1 from rel [EBOM] select bus id dump |
Here is the another example of TCL/MQL scripts
==================================
tcl;
set lCurrentBOM ""
set lMMComponents [split [mql expand bus $sObjectId to rel "EBOM" from rel "EBOM" dump |] "\n"];
foreach elem $lMMComponents {
set elem [split $elem |]
set sCompNum [lindex $elem 4]
if {[lsearch $lCurrentBOM $sCompNum] == "-1"} {
lappend lCurrentBOM $sCompNum
}
}
puts $lCurrentBOM
============================

The above scripts will find all component number and add it to a list named lCurrentBOM.

Sunday, February 7, 2010

ECO Auto Creation when the ECO is approved

In the Enovia eMatrix Engineering Central, ECO is used to implement one or more ECRs. The OOTB process requires you create an ECO manually and then connect to an approved ECR. Again, this is a manually process and there is lots of room for mistakes. How about the product engineer connects an ECO to a wrong ECR? How about the product engineer forgets to connect to any ECR? I heard lots of a complaints about this. Therefore, I need to fix this process. How?
  1. First of all, I disabled the OOTB auto ECO creation popup. It is useless. The reason is simple. The last person who approves the ECR will see the popup. Unfortunately, that person is not the resposnbile design engineer and should create ECO and take ownership.
  2. I developed an trigger to create ECO automatically when the ECR is approved. I connected the ECO to the ECR at the same time and all affected items are revised. I also send email to the responsible design engineer to notify him/her the ECO is created.
  3. Finally , to make ECR/ECO process simple, I disabled the ECO creation command. For the new part and new spec release, we require engineer to create ECR first.

Now, then ECR/ECO become one change process. One ECR, One ECO. The change request and change implementation becomes a seamless process!

Enovia Engineering Central ECR Creation Enhancment

Enovia Engineering Central implements a Change Management process to manage the release of Parts and and its related specification. There are two type of objects:
  • ECR - Engineering Change Request
  • ECO - Engineering Change Order

ECR is used to tell your team members why you want to make a change and which items are affected. ECO is used to implment an ECR. The concept of the ECR/ECO process is good, but it is not user friendly. The out-of-box features need to tons of clicks to complete the ECR/ECO process and it also makes our engineers feel un-confortable to use the tool and always make mistakes. Keep in mind, product engineer are not computer guru and they focus on how to make a good product instead of focus on how to use the PDM system!


Therefore, it is very necessary to customize the Enovia eMatrix Engineering Central to make a user-friendly ECR/ECO process.


First of all, We need to have a new ECR Creation Form. The ECR Creation Form implements the following features:



  • Fill in the ECR Form (same as the OOTB ECR form)

  • List all affected components.

  • Do a WHERE-USED Report, and automatically find all affected assemblies.

  • Find all possible revisable specifications at the the same time.

  • Allow user to enter the specification number

  • Allow user to create suppporting document at the same time.

  • According to above information, create an ECR and link all affected items to the ECR automatically.

  • List those product lines an engineering working on. Don't list all possible product lines.

Here is the screenshot of the ECR Creation form. The new ECR creation will help product engineer to create and prepare an ECR within one screen and implmented the foundation of change management - when initiating a change, product engineer need to know the impact of the change! All PLM systems in the market today missed this fundamental thought and they throw the ball to the product engineer - "It is your resposiblity to do a where-used report and figure out by youself". I personally completely disagree about this.

















If you need to know about how to implement this or how to query database on the fly, please feel free to contact with me.

Product Structure Viewer for Enovia eMatrix Engineering Central

Enovia eMatrix EngineeringCentral is used to manage Parts, Specifications and Bill of Materials.



  • A Part object can be a Component or an assembly. If a part is an assembly, it has a list of components or assemblies

  • A specification document is used to describe characteristic of a Part. Typically, a speification document is the following types of document:


    • 3D Model

    • 2D Drawing Print

    • Material Property Specification

    • Control and Test Specification

    • Engineering Application Speification

    • PPAP Document

    • Customer Approved Specification

    • Supplier Approved Specification.

    • Other importation documents

  • Bill of Material is a list a components or sub-assemblies which are used to assemble a product.




Enovia eMatrix Engineering Central is able to manage Parts, Specifications and Bill of Material very well. Like most other PLM Tools, Enovia eMatrix Engineering Central doesn't offer a tool to access those information at screen.



I have developed a tool which is called Prodocut Structure Viewer. The Product Structure Viewer provide the following features:


  • Display Bill of Material, Specifications, files on one page.

  • Generate alerts for the followings


    • When the revision of Part and Specification is not the latest revision.

    • When the state of Part and Specification is not released.

    • Others business rule related to the specification

    • Display the alerts when pointing to the alerts icon.

    • Reduce a lots of number of clicks

    • Able to tell which parts and specification are changed.

Here is the screenshot of the Product Structure Viewer.




There are lots of other features such as:



  • WHERE-USED - When pointing to the Part number of document number, the Product Strucuture Viewer will display where that part is used or where the is document is used. You don't have to open the select part and do a where used report.

  • Download files or view files by using autovue. The Product Structure Viewer will display all files checked in the specification object. When pointing to file icon, it will display the file name. When clicking the file icon it will download the file to your local drive or launch the Autovue viewer to view the file online depends on the format of the file.

  • Display the Bill of Materials at the same time.

If you want to know how to implemnt this, please feel free to contact with me.