Java Application Query Library for Pixel Production Database




Files required  (to be added to CLASSPATH variable):

classes111.zip
PDB_LIBRARY.jar



Import:


import PIXLibrary.*;
import java.awt.*;
import java.awt.event.*;

import java.lang.*;
import java.sql.*;



Example files:


TestPDBlib.java

TestSensorTestLib.java
TestModuleTestLib.java
TestFlexTestLib.java

TestPDBlib_Shipments.java

ModuleRanking.java
ModuleRankingByLab.java


HOW  TO  START

You must have Java Standard Edition installed on your computer.


Take one of the examples (i.e. ModuleRanking.java) and put it to your working directory.

Take classes111.zip (you probably already have it) and  PDB_LIBRARY.jar and add them to the CLASSPATH variable.

Compile the example with javac:

javac ModuleRanking.java

you will have the following files:

ModuleRanking.java
ModuleRanking.class
ModuleRanking$1.class
ModuleRanking$2.class

Archive them in your working directory with the command:

jar cvf MY_LIBRARY.jar *.class

put the new archive MY_LIBRARY.jar to the standard place and add it to the CLASSPATH variable.

Now you can run the application from any directory on your computer:

java ModuleRanking



ITEMS



Establish the connection with PDB:


Connection PDB_Lib.connectToDB(username, passwd)

Returns  Connection  identificator to be used in queries.




Find Item serial number in the ITEMS table by Item parameters:

String[] PDB_Lib.SNquery_ITEMS (Connection conn,

                                  String serial_number_start,    
                                  String serial_number_stop,    
                                  String item_type,

                                  String entry_date_start,
                                  String entry_date_stop,
                                  String passed,

                                  String assembled,       
                                  String trashed,       
                                  String colour,       
                                  String manufacturer,            
                                  String mfr_ser_no,
                                  String initials,          
                                  String location_name,      
                                  String last_modified_start,
                                  String last_modified_stop,
                                 
String owner)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are Item serial numbers found by query, where  n = Integer.parseInt(array[0])

Maximum array dimension is set up to   1 000 000.

Input parameter not participating in query must be set to "%".

Date format is  "DD/MM/YYYY", "today" is acceptable.

Passed, Assembled, Trashed format is "YES" or "NO"

Colour format is
"red", "yellow" or "green"

If  no  Item  found, array[0] = "0" .


Find Item parameters by serial number in the ITEMS table:

String[] PDB_Lib.ParametersByItemSN (Connection conn, String Item_serial_number)

Returns array dimension 13 of  String  where

array [0]  is Item serial number
array [1]  is Item type
array [2]  is entry date, format  "DD/MM/YYYY"
array [3]  is PASSED flag, "YES" or "NO"
array [4]  is ASSEMBLED flag, "YES" or "NO"
array [5]  is TRASHED flag, "YES" or "NO"
array [6]  is colour (for FEchips mostly), "red", "yellow" or "green"
array [7]  is manufacturer
array [8]  is manufacturer serial number
array [9]  is initials
array[10]  is location name
array[11]  is last modified date, format  "DD/MM/YYYY"
array[12]  is owner


If  Item  is not found in the PDB  ITEMS  table, all the values of array are being set up to "-1".




Find Item Category by Item type in the DESCRIPTIONS table:

String PDB_Lib.CategoryByItemType (Connection conn, String Item_type)

Returns  String Category .

If  Item type is not found in the DESCRIPTIONS  table, all the routine returns "-1".



TESTS



Find Test numbers by Item serial number in the TESTS table:


String[] PDB_Lib.TestNumberByItemSN (Connection conn, String Item_serial_number)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are Test  numbers found by query, where  n = Integer.parseInt(array[0])
If  no  Test  found, array[0] = "0" .

Maximum array dimension is set up to  1000 .




Find Test parameters by test number in the TESTS table:

String[] PDB_Lib.TestParametersByTN (Connection conn, String Test_number)

Returns array dimension 11 of  String  where

array [0]  is Test number
array [1]  is Item serial number
array [2]  is Test name        
array [3]  is test date, format  "DD/MM/YYYY"            
array [4]  is run number   
array [5]  is PASSED flag, "YES" or "NO"
array [6]  is problem flag, "YES" or "NO"
array [7]  is initials
array [8]  is location name
array [9]  is last modified date, format  "DD/MM/YYYY"
array[10]  is owner


If  Test  is not found in the PDB  TESTS  table, all the values of array are being set up to "-1".



Find Test number in the TESTS table by Test parameters:

String[] PDB_Lib.TNquery_TESTS (Connection conn,

                                  String test_number_start,    
                                  String test_number_stop,    
                                  String serial_number_start,    
                                  String serial_number_stop,    
                                  String test_name,
                                  String test_date_start,
                                  String test_date_stop,
                                  String run_number,
                                  String test_passed,
                                  String problem,       
                                  String initials,          
                                  String location_name,      
                                  String last_modified_start,
                                  String last_modified_stop,
                                 
String owner)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are Test numbers found by query, where  n = Integer.parseInt(array[0])

Maximum array dimension is set up to   1 000 000

Input parameter not participating in query must be set to "%".

Input parameter:  run_number may be set to "%"+<known part of run number>+"%".

Date format is  "DD/MM/YYYY", "today" is acceptable.

If  no  Test  found, array[0] = "0" .

Example.


TEST DATA: SENSORS



TEST DATA: MODULES SPECIFIC



TEST DATA: FLEX OBJECTS



TEST DATA: ELECTRONICS


ASSEMBLIES


Find Component serial  numbers by Item (as Assembly) serial number in the ASSEMBLIES table:

String[] PDB_Lib.ComponentSNByAssemblySN (Connection conn, String Item_serial_number)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are component serial  numbers found by query, where  n = Integer.parseInt(array[0])
If  no  component  found, array[0] = "0" .

Maximum array dimension is set up to  1000 .



Find Component serial  numbers and Component Item Types by Item (as Assembly) serial number in the ASSEMBLIES table:

String[] PDB_Lib.ComponentSNandTypeByAssemblySN (Connection conn, String Item_serial_number)

Returns array of  String  where array[0] is the number of components found,
array[odd_number]  or array[i]   are component serial  numbers found by query ( i  is odd).
array[even_number] or array[i+1] are component Item types

If  no  component  found, array[0] = "0" .

Maximum array dimension is set up to  2000 .



Find Assembly serial  numbers by Item (as Component) serial number in the ASSEMBLIES table:

String[] PDB_Lib.AssemblySNByComponentSN (Connection conn, String Item_serial_number)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are assembly serial  numbers found by query, where  n = Integer.parseInt(array[0])
If  no  assembly  found, array[0] = "0" .

Note that there may be more than one Assembly for given Component s/n  if this Component is one from Stock
(for example, components of FlexLoaded: capacitors, resistors, etc.).

Maximum array dimension is set up to  1000 .



Find Assembly serial  numbers and Assembly Item Types by Item (as Component) serial number in the ASSEMBLIES table:

String[] PDB_Lib.AssemblySNandTypeByComponentSN (Connection conn, String Item_serial_number)
Returns array of  String  where array[0] is the number of Assemblies found,
array[odd_number]  or array[i] are Assembly serial  numbers found by query ( i  is odd).
array[even_number]
or array[i+1] are Assembly Item types

If  no  assembly  found, array[0] = "0" .
Note that there may be more than one Assembly for given Component s/n  if this Component is one from Stock
(for example, components of FlexLoaded: capacitors, resistors, etc.).

Maximum array dimension is set up to  2000 .



Find Assembly Record  parameters by Assemby, Component and Position numbers in the ASSEMBLIES table:

String[] PDB_Lib.AssemblyParametersBySNandPosition (Connection conn,
                                                String assembly_sn
,
                                                String component_sn
,
                                                String position
)

Only ONE  of  these input parameters:   component_sn, position   can be set to "%" (*) !

Returns array dimension 7 of  String  where

array [0]  is assembly serial number
array [1]  is component serial number
array [2]  is position number
array [3]  is assembly Item type
array [4]  is component Item type      
array [5]  is last modified date, format  "DD/MM/YYYY".
array [6]  is owner

If  Record  is not found in the PDB  ASSEMBLIES  table, all the values of array are being set up to "-1".

_______
(*) In case of Stock components and position set to "%" this routine returns the last position for given component.
The known Stock components up to now are components of FlexLoaded or FlexLoadedPrototype assembly.



Find Assemby, Component and Position numbers by Record parameters by  in the ASSEMBLIES table:

String[] PDB_Lib.AssemblySNandPositionByParameters (Connection conn,
                                                String assembly_sn
_start,
                                                String assembly_sn_stop,
                                                String component_sn_start,
                                                String component_sn_stop,
                                                String position
_start,
                                                String position_stop,
                                                String assembly_item_type,
                                                String component_item_type,
                                                String last_modified_start,
                                                String last_modified_stop,
                                                String owner)

Returns array of  String  where array[0] is the number of  Records found,

array[i] are Assembly serial  numbers found by query ( i  = 1, 4, 7, 10, ...).
array[i+1] are Component serial numbers found by query ( i+1  = 2, 5, 8, 11, ...).
array[i+2] are position of Component in Assembly found by query ( i+2  = 3, 6, 9, 12, ...).

Date format is  "DD/MM/YYYY", "today" is acceptable.

If  no  assembly  found, array[0] = "0" .

Maximum array dimension is set up to  3 000 000 .



SHIPMENTS



Find general Shipment parameters by Shipment number in the SHIPMENTS table:

String[] PDB_Lib.ShipmentParametersByShipN (Connection conn, String Shipment_number)

Returns array dimension 14 of  String  where

array [0]  is Shipment number
array [1]  is Sender Location name
array [2]  is Sender Initials    
array [3]  is Destination Location name
array [4] 
is Destination Initials    
array [5]  is Carrier    
array [6]  is Carrier Reference
array [7]  is Shipment Reference
array [8]  is Weight
array [9]  is Number of packages
array[10]  is Shipment date, format  "DD/MM/YYYY"            
array[11]  is Confirmation date, format  "DD/MM/YYYY"    
array[12]  is last modified date, format  "DD/MM/YYYY"
array[13]  is owner

If  Shipment is not found in the PDB SHIPMENTS  table, all the values of array are being set up to "-1".



Find Shipment number in the SHIPMENTS table by general Shipment parameters:

String[] PDB_Lib.
ShipNByShipmentParameters (Connection conn,
                                  String sender_location_name,    
                                  String
sender_initials,    
                                  String destination_location_name,    
                                  String 
destination_initials,    
                                  String carrier,
                                  String carrier_reference,
                                  String shipment_date_start,
                                  String shipment_date_stop,
                                  String confirmation_date_start,
                                  String confirmation_date_stop,
                                  String last_modified_start,
                                  String last_modified_stop,
                                 
String owner)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are Shipment numbers found by query, where  n = Integer.parseInt(array[0])

Maximum array dimension is set up to   1 000 000

Input parameter not participating in query must be set to "%".

Input parameters:  carrier and  carrier_reference may be set to "%"+<known part>+"%".

Date format is  "DD/MM/YYYY", "today" is acceptable.

If  no  Shipment  found, array[0] = "0" .

Example.



Find  Item serial numbers by Shipment number in the SHIPPED ITEMS table:

String[] PDB_Lib.ItemSNByShipN (Connection conn, String Shipment_number)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are Item serial numbers found by query, where  n = Integer.parseInt(array[0])
If  no Item serial number  found, array[0] = "0" .

Maximum array dimension is set up to  1 000 000 .



Find Shipment numbers by Item serial number in the SHIPPED ITEMS table:

String[] PDB_Lib.ShipNByItemSN (Connection conn, String Item_serial_number)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are Shipment numbers found by query, where  n = Integer.parseInt(array[0])
If  no Shipment number  found, array[0] = "0" .

Maximum array dimension is set up to  1 000 000 .



Find Shipped Item parameters by (Shipment + Item) number in the SHIPPED ITEMS table:

String[] PDB_Lib.ShipITEMParametersByNN (Connection conn, String Shipment_number, String Item_serial_number)

Returns array dimension 5 of  String  where

array [0]  is Shipment number
array [1]  is Item serial number
array [2]  is Received    
array [3]  is last modified date, format  "DD/MM/YYYY"
array [4]  is owner

If  (Shipment + Item) combination is not found in the PDB SHIPPED ITEMS  table, all the values of array are being set up to "-1".



Find (Shipment + Item) numbers in the SHIPPED ITEMS table by Shipped Item parameters:

String[] PDB_Lib.
NNByShipITEMParameters (Connection conn,
                                  String item_serial_number_start,    
                                  String
item_serial_number_stop,    
                                  String received,    
                                  String last_modified_start,
                                  String last_modified_stop,
                                 
String owner)

Returns array of  String  where array[0] is the number of (Shipment + Item) combination found,
n = Integer.parseInt(array[0]).

array[odd_number]  or array[i] are Shipment  numbers found by query (i  is odd).
array[even_number]
or array[i+1] are Item serial numbers

Maximum array dimension is set up to   2 000 000

Input parameter not participating in query must be set to "%".

Date format is  "DD/MM/YYYY", "today" is acceptable.

If  no (Shipment + Item) combination found, array[0] = "0" .



COMMENTS



Find Comment parameters by Comment number  in the ITEM COMMENTS table:

String[] PDB_Lib.ParametersByItemCommentNumber (Connection conn, String comment_no)

Returns array dimension 6 of  String  where

array [0]  is Item serial number
array [1]  is Comment  text
array [2]  is Comment date, format  "DD/MM/YYYY"
array [3]  is Initials of the person who made this Comment
array [4] 
is last modified date, format  "DD/MM/YYYY"
array [5]  is Comment owner   

If  Comment is not found in the  PDB ITEM COMMENTS  table, all the values of array are being set up to "-1".



Find Comment number by parameters in the  ITEM COMMENTS table:

String[] PDB_Lib.
ItemCommentNumberByParameters (Connection conn,
                                         String comment_no_start,
                                         String comment_no_stop,
                                         String ser_no_start,
                                         String ser_no_stop,
                                         String comment_text,
                                         String comment_date_start,
                                         String comment_date_stop,
                                         String comment_initls,
                                         String comment_owner,
                                         String last_mod_start,
                                         String last_mod_stop)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are Comment numbers found by query, where  n = Integer.parseInt(array[0])

Maximum array dimension is set up to   1 000 000

Input parameter not participating in query must be set to "%".

Input parameter  comment_text may be set to "%"+<known part>+"%".

Date format is  "DD/MM/YYYY", "today" is acceptable.

If  no  Comment  found, array[0] = "0" .


Find Comment parameters by Comment number  in the  TEST COMMENTS table:

String[] PDB_Lib.ParametersByTestCommentNumber (Connection conn, String comment_no)

Returns array dimension 4 of  String  where

array [0]  is Test number
array [1]  is Comment  text
array [2]  is last modified date, format  "DD/MM/YYYY"
array [3]  is Comment owner   

If  Comment is not found in the  PDB TEST COMMENTS  table, all the values of array are being set up to "-1".



Find Comment number by parameters in the  TEST COMMENTS table:

String[] PDB_Lib.
TestCommentNumberByParameters (Connection conn,
                                         String comment_no_start,
                                         String comment_no_stop,
                                         String test_no_start,
                                         String test_no_stop,
                                         String comment_text,
                                         String comment_owner,
                                         String last_mod_start,
                                         String last_mod_stop)

Returns array of  String  where array[0] is the number of non-zero elements and
array[1] - array[n] are Comment numbers found by query, where  n = Integer.parseInt(array[0])

Maximum array dimension is set up to   1 000 000

Input parameter not participating in query must be set to "%".

Input parameter  comment_text may be set to "%"+<known part>+"%".

Date format is  "DD/MM/YYYY", "today" is acceptable.

If  no  Comment  found, array[0] = "0" .