Projet

General

Profil

Connector

beCPG supplies a standard and user friendly connector which extracts entities and its data lists (and export it to csv files) or documents (images, technical files) in their native format.

Installation

Install Java SDK 8 on your machine.
Download and unzip the connector becpg-connector-1.2.0-distribution.zip.

Configuration

To make some customization, you need to modify the configuration file becpg-connector.properties

- First, specify server information:

remote.scheme=http
remote.host=localhost
remote.port=8080
remote.login=admin
remote.password=becpg

- Then, specify where the CSV files have to be extracted :

connector.dest.path=

To do so, make sure that the path format in Windows operating systems respects the following criteria:

 c:\\Temp\\becpg-connector or c:/Temp/becpg-connector

- It is possible to send email notification at the end of the data extraction :

notify.enabled=false
connector.notify.from=support@becpg.fr
connector.notify.to=support@becpg.fr
mail.smtp.host=localhost
mail.smtp.port=25

- It is also possible to upload the extracted files to your FTP server. For that purpose, you just need to add your FTP server information :

tp.enabled=false
ftp.host=
ftp.port=21
ftp.login=
ftp.password=
ftp.destFolder=
ftp.deleteOnSuccess=false

- Specify the search query: the extracted list of entities is defined in the search query where %s is replaced by the last import date which is stored in lastImport file:

connector.query.template=(@cm\\:created:[%s TO MAX] OR @cm\\:modified:[%s TO MAX]) AND (ASPECT:\"bcpg:productAspect\" OR TYPE:\"bcpg:client\" OR TYPE:\"bcpg:supplier\")

In this example, all the entities of the product, client and supplier type which were modified or created after the last import operation (data extraction), are extracted.

Configure Extracted Fields

For each retrieved entity type, it’s a mandatory to specify extracted fields in the CSV file.

An example for finished Product type:

backslapping_finished Product=bcpg:code,bcpg:erpCode,cm:name,cm:title,bcpg:eanCode,bcpg:code,bcpg:legalName,cm:description,bcpg:entityTplRef\
                    ,bcpg:productHierarchy1,bcpg:productHierarchy2,bcpg:bestBeforeDate,bcpg:certificateDate,bcpg:contractDate\
                    ,bcpg:foodContact,bcpg:netWeightUnit,bcpg:numberOfServings,bcpg:packagingDescription,bcpg:periodAfterOpening\
                    ,bcpg:precautionOfUseRef,bcpg:preparationTips,bcpg:priceCurrency,bcpg:productComments,bcpg:productDensity\
                    ,bcpg:productMicrobioCriteriaRef,bcpg:productQty,bcpg:productSpecifications,bcpg:productState,bcpg:productUnit\
,bcpg:projectedQty,bcpg:servingSize,bcpg:startEffectivity,bcpg:storageConditionsRef\
,bcpg:supplierPlants,bcpg:suppliers,bcpg:suppliers|bcpg:code,bcpg:suppliers|bcpg:erpCode\
,bcpg:clients,bcpg:clients|bcpg:code,bcpg:clients|bcpg:erpCode,bcpg:unitPrice,bcpg:useByDate

Finally, you need to configure the exported data lists.

Example for nutrient and packagings lists :

mapping.csv.nutList=article|bcpg:code,article|bcpg:erpCode,bcpg:nutListNut,bcpg:nutListValue,bcpg:nutListFormulatedValue,bcpg:nutListUnit

mapping.csv.packagingList=article|bcpg:code,article|bcpg:erpCode,bcpg:packagingListProduct,bcpg:packagingListProduct|bcpg:erpCode,bcpg:packagingListQty,bcpg:packagingListUnit,bcpg:packagingListLossPerc,bcpg:packagingListPkgLevel,bcpg:packagingListIsMaster

Standard Documents Connector

Documents connector is a plugin of the standard connector. It can be activated by typing the following line in the becpg-connector.properties file.

connector.plugin.class=fr.becpg.connector.plugin.StandardDocumentVisitor

This line is supplied by default in the configuration file. Simply uncomment the line by deleting # symbol at the beginning of the sentence.

Note: you can choose which files will be generated or extracted for each entity type (finished product, semi-finished product, etc.).

Each entity has a mapping as below :

mapping.document.bcpg_<entity type> = <fields to be extracted>

Some default mapping can be used to extract technical files and images for raw-materials, semi-finished products and finished products:

mapping.document.bcpg_finishedProduct=/Images/produit.jpg|img_produit${bcpg:erpCode}.jpg;/Documents/${cm:name} - Fiche Technique Client.pdf|FT_client${bcpg:erpCode}.pdf
mapping.document.bcpg_rawMaterial=/Images/produit.jpg|img_produit${bcpg:erpCode}.jpg;/Documents/${cm:name} - Fiche Technique Client.pdf|FT_client${bcpg:erpCode}.pdf
mapping.document.bcpg_semiFinishedProduct=/Images/produit.jpg|img_produit${bcpg:erpCode}.jpg;/Documents/${cm:name} - Fiche Technique Client.pdf|FT_client${bcpg:erpCode}.pdf

Multilevel Connector

The multilevel connector is a plugin of the standard connector, which allows you to extract entities in CSV format and also their composition data lists , packaging data lists and other data lists.

Its name « multilevel connector » indicates that this tool is capable of showing level informations for each composition item.

In other words, this plugin extracts and shows raw-materials, calculates their quantities at the product level, even-though you still able to see the normal composition quantities in the composition information.

In the other hand, you can get your packaging information with extra information like number packaging in level 2, number packaging in level 3 and the quantity of each packaging item by product.

Example:
Finished Product composition :

As you can see in the example, we have in our composition: Semi-finished C item at the third depth level, and to calculate its quantity at the product level we need to do a recursive cross-multiplication starting by the second level.

First, we need to calculate the Semi-finished B quantity at the product level:

Semi-finished B QTY =  (Semi-finished B Weight / Semi-finished A Weight) * Semi-finished A Weight at the product level 

This result is the quantity which is needed to calculate Semi-finished C quantity at the product level by applying the cross-multiplication. Thus, each time you move deeper in the composition level, you will have to repeat this process.
It worth to mention that the quantity declared for entities (composition items) located in depth level 1 is the same quantity than for the product level and we don’t need to do a cross-multiplication.

This is illustrated in our example :

Semi-finished A quantity at the product level = 5 Kg.
Semi-finished B quantity at the product level after calculation = 2,348 Kg.
Semi-finished C quantity used in Semi-finished B composition = 0.1 Kg.
Then Semi-finished C quantity at the product level = (0,1 / 0,17) * 2,348 = 1,381 kg.

The multilevel plugin also calculates packaging values :
Products quantity per packaging level ;
Number of boxes per pallet ;
Packaging quantity used for each product.

This tool also extracts dynamic characteristics that you can just print or use in other more complex calculation as explained in the SPEL formulas section.

https://www.becpg.fr/redmine/projects/becpg-community/wiki/02_PLM_documentation#Made-features

Note: properties’ names are the same as written in the application, you just need to replace the white space with a dash ( _ ) and add the prefix *dyn_ at the beginning of property name’s.

For example :

property name : « qty multilevel »
extracted name: « dyn_qty_multilevel »

Multilevel Connector Configuration

As in the standard connector, to activate the multilevel connector, you need to uncomment the following line.

connector.plugin.class=fr.becpg.connector.plugin.MultiLevelCSVVisitor

This line is available in becpg-connector.properties file (you just have to delete the # symbol).

Once the plugin is loaded, you can modify which files you would like to extract
for each entity type (Finished Product, SemiFinished Product, Raw-material, etc.).

As it is illustrated in the previous part “Extracted fields configuration”, each entity has
a defined mapping which follows this criteria :

                    
mapping.document.bcpg_<Entity type> = <Field to be extracted>

This is also valid for the search request. However, here, we don’t have the intention of extracting other entities such as suppliers and clients.

connector.query.template=(@cm\\:created:[%s TO MAX] OR @cm\\:modified:[%s TO MAX]) AND ( TYPE:\"bcpg:finishedProduct\" OR TYPE:\"bcpg:semiFinishedProduct\")

SPEL Formulas

Spring Expression Language (SpEL for short) is an expression language that supports querying and manipulating Java objects. With SPEL you can customize extracted fields by using formulas in the extracted file header mapping.

You can calculate desired values based on existing properties as you can write plain text message if some properties values doesn’t respect your conditions.

Example

To calculate the quantity of a pallet item, we use the following formula:

formula|props["nbProductsPkgLevel3"]!=null ? props["nbProductsPkgLevel3"] * props["qty"] : props["qty"]

This means : if the product quantity in the pallet is not null, multiply this value by the quantity of the item at the product level. Otherwise, just print the value of the item composition.

SPEL Formula Syntax

To use SPEL formulas you have to consider 3 parts :

Part 1: the prefix formula (static word) used to state that this field is a SPEL formula ;
Part 2: Vertical bar or pipe ( | ) ;
Part 3: The actual SPEL formula.

The simplest SPEL consists in displaying standard, dynamic or calculated property. For example, to display ERP code property :

formula|props["bcpg:erpCode"]

Props is a list which contains all the extracted properties. Consequently, to get a property value from this list you need to write the property name between 2 brackets :

props [“EXTRACTED_PROPERTY_NAME”]

Complex SPEL Formula

As explained in the previous section, you can use all properties within a SPEL formula. To discover more in-depth information about SPEL capabilities, let’s show an example:

formula|props["qty"] != null ? props["qty"] / prop["bcpg:compoListQty"] : props["qty"]

In this formula we use a condition ( ? ) to test if the qty property is not null, use a simple mathematics operation ( / ) to calculate percentage qty to compoListQty otherwise just display qty.

It should be remembered that some functions like sum, avg , … are available.

For more information about SPEL language : http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/expressions.html

Usage

For Linux, run following command: ./becpg-connector.sh
For Windows, run the becpg-connector.bat file by double click on it.
CSV files are created under the connector.dest.path path folder

Example: generated files:
csv/
bcpg_client.csv bcpg_semiFinishedProduct.csv compoList.csv organoList.csv physicoChemList.csv
bcpg_finishedProduct.csv bcpg_supplier.csv nutList.csv packagingList.csv