This is an old revision of the document!
5.1.6. Print events
On the Print events tab you can indicate which report has to be generated and printed on which event. You can find the list of the events here: List of print events.
5.1.6.1. Setting up a print event
To set up a print event proceed as follows.
1. Select the necessary event in the drop-down menu.
2. Select the report to be generated upon the occurrence of the event.
3. Provide the number of copies to be printed.
4. Check in the Ask for reprint? option if you want the system to ask if more copies should be printed after the given number of copies has been printed.
5. Optional: select a predefined filter, a condition that has to be met for the report to be generated. Please see section 5.1.6.2. Predefined filters.
6. Click Add
.
5.1.6.2. Predefined filters
1. PRFLUIDG
The filter PRFLUIDG determines that when a logistic unit is received with a valid logistic label containing an SSCC, the system will NOT generate a new reception label with a new system-generated SSCC. The filter can be used for the following print events:
- 101 Reception new LU identified
- 200 Picking: new LU full
- 400 Production: LU produced
- 500 Packing: finished LU
- 700 WHS: created LU
- 702 WHS: created master LU
2. PRFWMM
The filter PRFWMM can be used for warehouse move documents. It will use the settings on the Warehouse move Matrix UDT to check whether a document should be printed.
3. - 4. PRFCUCO and PRFNCUCO
The filter PRFCUCO determines that the document will not be printed for customer collects. On the other hand, the filter PRFNCUCO determines that the document will only be printed for customer collects. These filters can be used for the following print events:
- 200 Picking: new LU full
- 300 Shipping: sales delivery note created
- 302 Shipping: picklist shipped
- 500 Packing: finished LU
5. PRFSCRIP
The filter PRFSCRIP offers users the possibility to develop own criteria for determining when and how a label should be printed. Please see section 5.1.6.3. Scripted print filters below.
5.1.6.3. Scripted print filters
It is possible to define a custom print filter. It will allow to block printing for certain parameters.
A typical print filter consists of 3 main sections
- Running of SELECT QUERY to get needed info for document
- Determination of TRUE or FALSE value according to needed info
- Return RESULT
Creation of a new print filter
In the Produmex Organizational Structure, go to the Print Events tab:
Here you can add a filter to the desired print event.
Select Filter → IPrintReportFilter – Script (PRFSCRIPT)
Then select the ‘Edit’ button.
The following script editor opens, here we will paste our script.
Press the ‘Empty script’ button to open a script template designed for the selected print event. We recommend to use this template instead of starting from an empty script.
The template contains two print report methods.
- Use the first method if the report has only one parameter.
- Use the second method if the report has more than one parameters.
Here you can find a demonstration script that explains what is needed.
using System; using System.Reflection; using Produmex.Foundation.Data.Sbo; using Produmex.Foundation.Diagnostics; using Produmex.Sbo.Logex.Data.BusinessObjects; using Produmex.Sbo.Logex.Data.Providers; using Produmex.Foundation.Data.Sbo.BusinessObjects; using Produmex.Foundation.Data.Sbo.Utilities; using Produmex.Foundation.Data.SqlClient; public class Script { private static readonly ILog s_log = LogProvider.GetLogger(MethodInfo.GetCurrentMethod().DeclaringType); public static bool PrintReport(PmxPrintReportEventType eventType, int key, PmxDbConnection dbConn) { //Create the query you want to use string query = "SELECT [COLUMNAME1], [COLUMNAME2] FROM [TABLENAME] WHERE [Key] = " + key.ToString(); //Run the query using (ISboRecordset rs = SboRecordsetHelper.RunQuery(s_log, query, dbConn)) { if (!rs.EoF)//Check if you get result from the query { string var1 = rs.GetTypedValue<string>("COLUMNAME");//Get a string value int var2 = rs.GetTypedValue<int>("COLUMNAME2");//Get an int value //Possibility to add a check on the result //In this case if the value of column with name 'COLUMNAME2' equals to 99, //a label should be printed if (var2 == 99) { return true; //Label will be printed } else { return false; //Label will not be printed } } } return false; //Label will not be printed } }
So you can modify this script to fit your needs:
- Modify the query to lookup the needed info
- Get the needed values from the query result
- Modify the check on the result and return the correct TRUE or FALSE
You can also use this screen to:
- Validate the Script
- Do a test run with a KEY from the database :
The key is what is passed to the report. So for the print event ProductionLogisticUnitProduced this is the LUID of the produced pallet.
In order to avoid performance issues, do not use ‘SELECT *’ syntax in the select query. Select only the required columns or the primary key.
Example:
- What should be avoided:
SELECT * FROM "OITM" WHERE "ItemCode" = 'ITEM01'
- What to use instead:
SELECT "InvntItem", "MinLevel" FROM "OITM" WHERE "ItemCode" = 'ITEM01'
SELECT "ItemCode" FROM "OITM" WHERE "ItemCode" = 'ITEM01'
It’s also recommended to add the WITH (NOLOCK) hint to all tables used in these queries.
For example:
SELECT "ItemCode" FROM "OITM" WITH (NOLOCK) WHERE "ItemCode" = 'ITEM01'
- Or with a join (NOLOCK on all tables):
SELECT "OITM"."InvntItem" FROM "DLN1" WITH (NOLOCK) JOIN "OITM" WITH (NOLOCK) ON "DLN1"."ItemCode" = "OITM"."ItemCode" WHERE "DLN1"."ItemCode" = 'ITEM01'