User Tools

Site Tools


implementation:wms:printevents

On the Print Events tab you can indicate which report has to be generated and printed on which event.

The list of print events is available here.

Print Events

2.6.1. Set up a print event

1. Select the necessary event in the Event drop-down menu.

2. Select the report to be generated upon the occurrence of the event in the Report drop-down menu.

3. Provide the number of copies to be printed in the Number of Copies field. The value provided in the field means that the system prints exactly this number of copies. Value 0 and 1 mean that the system prints exactly 1 copy.

4. Printing

If the Ask operator for reprint in the mobile client? setting is enabled, the system displays the Reprint Label screen on the Mobile Client and asks if more copies should be printed after the given number of copies has been printed.

If the Ask operator to choose printer in the mobile client? setting is enabled, the system displays the Select a Printer screen on the Mobile Client and lists the printers available in the warehouse where the Mobile Client is set. If the setting is not enabled, the system uses the default printer.

5. Optional: In the Filter drop-down menu select a predefined filter, a condition that has to be met for the report to be generated.

The following filters can be selected:

a) Filter by Warehouse Move Matrix UDT(PRFWMM)
The filter can be used for warehouse move documents. It uses the settings of the Warehouse Move Matrix UDT to check whether a document should be printed.

b) Customer Collect (PRFCUCO) and Not for Customer Collect (PRFNCUCO)

  • PRFCUCO: The document is only printed for customer collects.
  • PRFNCUCO: The document is not 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

c) Document Line (PRFDOCLI)
The filter can be used for print event 204 - Picking: after item is picked and it uses the setting Print after item picked of the Produmex Pick List Types (PMX_PLTY) UDT to check whether a document should be printed.

d) LUID Generated Printed (PRFLUIDG)
When a logistic unit is received with a valid logistic label containing an SSCC, the system does 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

e) Script (PRFSCRIP)
It offers the possibility to develop criteria for determining when and how a label should be printed. Please see section 5.1.6.2. Scripted print filters below.

6. Click Add.  

2.6.2. 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)
Click the Edit button.

Script filter

The following script editor opens and you can paste the script.

Script Editor

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.

Note: In Hana queries are case sensitive. Pls write field names as follows: \“fieldname\” for example: \“CardCode\”

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

Validate and test

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:

  1. What should be avoided:
    SELECT * FROM "OITM" WHERE "ItemCode" = 'ITEM01'
  2. 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' 

Below you can find another demonstration script which explains how to access more than one parameter in your print filter. It can be relevant as the 204 - Picking: after item is picked print event takes two parameters.

Note: In HANA make sure that you use the parameter of the print event. The list of print events and their parameters are available here.

using System;
using System.Collections.Generic;
using System.Text;
using Produmex.Foundation.Data.Sbo.Providers;
using Produmex.Sbo.Logex.Data.Extensions;
using Produmex.Foundation.Diagnostics;
using Produmex.Sbo.Logex.Data.BusinessObjects;
using Produmex.Foundation.Data.Sbo.BusinessObjects;
using Produmex.Foundation.Data.Sbo.Utilities;
using Produmex.Sbo.Logex.Data.BusinessObjects.Definitions.Tables;
using Produmex.Foundation.Data.SqlClient;
using System.Reflection;
using Produmex.Foundation.Data.Sbo.BusinessObjects.Definitions.Tables;
using System.Globalization;
using Produmex.Foundation.Data.Sbo;
using Produmex.Sbo.Logex.Data.Providers;

public class Script
{
    private static readonly ILog s_log = LogProvider.GetLogger(MethodInfo.GetCurrentMethod().DeclaringType);

    public static bool PrintReport( PmxPrintReportEventType eventType, IDictionary<string,object> parameters, PmxDbConnection dbConn )
    {
    // Only print if we have just picked an item where an UDF on Item Master Data is set to yes, otherwise do not print
    // Adapt this query to your needs
        string query = "SELECT PMX_PLLI.InternalKey, OITM.U_LabelPrint FROM PMX_PLLI" +
                       " LEFT JOIN OITM ON PMX_PLLI.ItemCode = OITM.ItemCode" +
                       " WHERE U_YourUDF = 'Yes' AND PMX_PLLI.DocEntry = " + 
                         parameters["@docEntry"].ToString() +
                       " AND PMX_PLLI.LineNum = " + 
                         parameters["@lineNum"].ToString();

    //Run the query
        using (ISboRecordset rs = SboRecordsetHelper.RunQuery(s_log, query, dbConn))
        {
            if (!rs.EoF)//Check if you get result from the query
            {
                return true; //Label will be printed
            }
        }
        return false; //Label will not be printed
    }
}
implementation/wms/printevents.txt · Last modified: 2022/01/26 10:57 by vise