AutoLab4j Configuration

From Commander4j
Revision as of 17:19, 25 August 2024 by Dgarratt (talk | contribs) (Created page with "==config.xml== The configuration file which is called config.xml is located in the xml/config folder. An example file is shown below and a description of it's contents follow. A single instance of the application can support multiple printers if required. In this example it's setup to support 2 production lines each with 1 printer. One of the core concepts underlying the design of this module is resilience. It is designed so that it can be run even if there is a netw...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

config.xml

The configuration file which is called config.xml is located in the xml/config folder. An example file is shown below and a description of it's contents follow.

A single instance of the application can support multiple printers if required. In this example it's setup to support 2 production lines each with 1 printer.

One of the core concepts underlying the design of this module is resilience. It is designed so that it can be run even if there is a network or server/database issue. As far as is practical the software is designed to be self contained and to accept data from external systems via ascii files rather than a database connection.

Some of the configuration items held in the XML below will share the same name as their Commander4j counterparts which are stored in the database.

<?xml version="1.0" encoding="UTF-8"?>
<config name="AutoLab">
    
    <debug suppressLabelPrint="false" suppressOutputMessage="false"/>
    
    <watchDog port="8000"/>
    
    <email enabled="false"/>
    
    <updateURL>file:/myupdatepath/updates.xml</updateURL>
    <updateMode>MANUAL</updateMode>
    
    <!-- Folders -->
    
    <paths>
        <labelSync path="./remote_labels" frequency="120"/>
        <dataSet path="./remote_dataset"/>
        <output path="./interface/output/ProdDec"/>
        <ssccSequence path=""/>
    </paths>
    
    <!-- Label Quantities -->
    
    <labels>
        <pallet ssccPerPallet="1" labelsPerSSCC="2"/>
        <semiPallet ssccPerPallet="2" labelsPerSSCC="2"/>
    </labels>
    
    <!-- Customer Specific Batch Formats -->
    
    <batchFormats>
        <customer id="SELF" pattern="{YEAR1}{JULIAN_DAY}{PROCESS_ORDER}"/>
    </batchFormats>
    
    <!-- Copy of some System Keys normally read from database (jdbc) -->
    
    <controls>
        <system key="HOST REF" value="DEMO"/>
        <system key="PLANT" value="1234"/>
        <system key="BATCH FORMAT" value="{YEAR1}{JULIAN_DAY}{PROCESS_ORDER}"/>
        <system key="BATCH EXPIRY TIME" value="-"/>     
        <system key="LABEL_HEADER_COMMENT" value="Free format text"/>
        <system key="EXPIRY DATE MODE" value="SSCC"/>
        <system key="SSCC AUTO CONFIRM" value="Y"/>
    </controls>
    
    <!-- URL of Internet Web Service used to display label on screen -->
    
    <labelary enabled="true">
    	<url>http://api.labelary.com/v1/printers/8dpmm/labels/6x9/0/</url>
    </labelary>
    
    <productionLines>
        
        <!-- LINE1 1 -->

        <productionLine name="LINE 1" enabled="Y"> 
            <modbus name="ADAM-6050">
                <ipAddress>127.0.0.1</ipAddress>
                <portNumber>502</portNumber>
                <coilAddress>1</coilAddress>
                <timeout>4000</timeout>
                <retryDelay>1000</retryDelay>
                <coilTriggerValue>true</coilTriggerValue>
                <semiPalletCoilAddress>2</semiPalletCoilAddress>
            </modbus>
            <printer name="LABELLER 1"/>
            <SSCC filename="LABELLER 1.xml"/>
        </productionLine>
        
        <!-- LINE 2 -->
        
       <productionLine name="LINE 2" enabled="Y"> 
            <modbus name="ADAM-6050">
                <ipAddress>127.0.0.1</ipAddress>
                <portNumber>502</portNumber>
                <coilAddress>3</coilAddress>
                <timeout>4000</timeout>
                <retryDelay>1000</retryDelay>
                <coilTriggerValue>true</coilTriggerValue>
                <semiPalletCoilAddress>4</semiPalletCoilAddress>
            </modbus> 
            <printer name="LABELLER 2"/>
            <SSCC filename="LABELLER 2.xml"/>
        </productionLine>
                
    </productionLines>
    
    <!-- Alias field names so we can use unmodified .lbl templayte file -->  
    
    <fieldNamesLookup>
        <fieldName csv="MATERIAL_DESCRIPTION" db="DESCRIPTION"/>
        <fieldName csv="PROD_EAN" db="EAN"/>
        <fieldName csv="PROD_UOM" db="UOM"/>
        <fieldName csv="PROD_QUANTITY" db="QUANTITY"/>
        <fieldName csv="DATE_OF_MANUFACTURE" db="DATE_CREATED"/>
    </fieldNamesLookup>
        
    <!-- Make unmodified copy of Quantity for use in ProdDec XML -->   
    
     <clone>
         <field from="QUANTITY" to="QUANTITY_DECIMALS"/>
     </clone>   
     
    <!-- Overide format of Quantity so we can use in ZPL -->   
    
    <formats>
        <field name="QUANTITY" format="0000"/>
        <field name="BASE_QUANTITY" format="0000"/>
    </formats>
    
</config>

| Element | Description | | :- | :- | | `<debug suppressLabelPrint="false" suppressOutputMessage="false"/>` | This section is used for test/debug purposes only. By changing these values you can run the Auto Labeller module and suppress either the Label and/or the Message to Commander4j. (Production Declaration / Goods Receipt) | | `<watchDog port="8000"/>` | This is used to ensure that only 1 instance of the software can be running at once. If a second instance is loaded then the first copy is requested to close automatically. | | `<email enabled="false"/>` | This option allows you to enable or disable the generation of emails by the application. You need to have configured EMAIL.XML correctly if emails are to be sent. | | `<updateURL>file:/myupdatepath/updates.xml</updateURL>` | Where to look for updates. | | `<updateMode>MANUAL</updateMode>` | Can be either MANUAL or AUTOMATIC | | `<paths>` | -------------- | | `<labelSync path="./remote_labels" frequency="120"/>` | This is the location where the application should search for updated label templates. | | `<dataSet path="./remote_dataset"/>` | This is where the application looks for data files which contain the base data for the label. This will be a CSV file and has been designed to use the CSV generated by Commander4j. | | `<output path="./interface/output/ProdDec"/>` | This is the location for output messages which contain a record of the labels which have been printed. Typically these would be collected by Commandeer4j / Middleware4j so that the pallet data can be inserted into the C4J database.| | `<ssccSequence path=""/>` | If left blank this path will default to the xml/sscc folder within the application folder. You can override this if necessary by specifying a path here. | | `</paths>` | -------------- | | `<labels>` | -------------- | | ` <pallet ssccPerPallet="1" labelsPerSSCC="2"/>` | Two types of pallet configuration are supported pallet and semiPallet | | ` <semiPallet ssccPerPallet="2" labelsPerSSCC="2"/>` | Two types of pallet configuration are supported pallet and semiPallet | | `</labels>` | -------------- | | `<batchFormats>` | -------------- | | `<customer id="SELF" pattern="{YEAR1}{JULIAN_DAY}{PROCESS_ORDER}"/>` | The format of the system generated batch number on a customer by customer basis.| | `</batchFormats>` | -------------- | | `<controls>` | -------------- | | ` <system key="HOST REF" value="DEMO>` | Used in the creation of production confirmation messages back to Commander4j or other | | ` <system key="PLANT" value="1234">` | Used in the creation of production confirmation messages back to Commander4j or other | | ` <system key="BATCH_FORMAT" value="{YEAR1}{JULIAN_DAY}{PROCESS_ORDER}">` | Default Batch Format if no customer specific one defined. | | ` <system key="BATCH_EXPIRY_TIME" value="-">` | Determines the format of the batch expiry time. | | ` <system key="LABEL_HEADER_COMMENT" value="Free format text">` | Optional text message on label | | ` <system key="EXPIRY DATE MODE" value="SSCC">` | BATCH or SSCC | | ` <system key="SSCC AUTO CONFIRM" value="Y">` | Flag to determine if Commander4j automatically determines that the pallet exists and can be confirmed - OR requires a separate confirmation scan. | | `</controls>` | -------------- | | `<labelary enabled="true">` | The application can display a preview of the label using a very useful webite https://labelary.com/viewer.html | | `<url>http://api.labelary.com/v1/printers/8dpmm/labels/6x9/0/</url>` | URL which includes dpi and paper size| | `</labelary>` |-------------- | | `<productionLines>` |-------------- | | ` <productionLine name="LINE 1" enabled="Y">` |-------------- | | ` <modbus name="ADAM-6050">` | Description of the Modbus device| | ` <ipaddress>127.0.0.1</ipaddress>` |IP Address of the Modbus device | | ` <portNumber>502</ipaddress>` |Port number of the Modbus device | | ` <coilAddress>1</coilAddress>` |The coil number to monitor for trigger events | | ` <timeout>4000</timeout>` |Modbus timeout | | ` <retryDelay>1000</retryDelay>` |Delay before trying to connect again | | ` <coilTriggerValue>true</coilTriggerValue>` |Trigger value | | ` <semiPalletCoilAddress>2</semiPalletCoilAddress>` |Alternative coil to use for secondary pallet configuration.| | ` </modbus>` |-------------- | | ` </productionLine>` |-------------- | | `</productionLines>` |-------------- | | `<fieldNamesLookup>` |-------------- | | ` <fieldName csv="MATERIAL_DESCRIPTION" db="DESCRIPTION"/>` | | | ` <fieldName csv="PROD_EAN" db="EAN"/>` | | | ` <fieldName csv="PROD_UOM" db="UOM"/>` | | | ` <fieldName csv="PROD_QUANTITY" db="QUANTITY"/>` | | | ` <fieldName csv="DATE_OF_MANUFACTURE" db="DATE_CREATED"/>` | | | `</fieldNamesLookup>` |-------------- | | `<clone>` |-------------- | | ` <field from="QUANTITY" to="QUANTITY_DECIMALS"/>` | | | `</clone>` |-------------- | | `<formats>` |-------------- | | ` <field name="QUANTITY" format="0000"/>` | | | ` <field name="BASE_QUANTITY" format="0000"/>` | | | `</formats>` |-------------- |


sscc.xml

<?xml version="1.0" encoding="UTF-8"?>
<sscc>
    <prefix>384133182</prefix>
    <sequence>00011079</sequence>
    <checkDigit>3</checkDigit>
    <warninglimit>00021030</warninglimit>
    <upperlimit>00030000</upperlimit>
</sscc>

email.xml

<?xml version="1.0" encoding="UTF-8"?>
<emailSettings>    
    <!-- The section called "configuration" is always the active one - rename as appropriate-->
    
    <!-- Microsoft smtp.live.com Example -->
    
    <configuration>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.starttls.enable" value="true"/>
        <property name="mail.smtp.host" value="smtp.live.com"/>
        <property name="mail.smtp.socketFactory.port" value="25"/>
        <property name="mail.smtp.user" value="email@outlook.com"/>
        <property name="mail.smtp.password" value="password"/>  -->
        <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.port" value="25"/>
        <property name="mail.smtp.from" value="email@outlook.com"/>
        <property name="mail.debug" value="true"/>
    </configuration>

    <!-- Google gmail Example -->
    
    <configuration1>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.starttls.enable" value="true"/>
        <property name="mail.smtp.host" value="smtp.gmail.com"/>
        <property name="mail.smtp.socketFactory.port" value="465"/>
        <property name="mail.smtp.user" value="email@gmail.com"/>
        <property name="mail.smtp.password" value="password"/>
        <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.port" value="465"/>
        <property name="mail.smtp.from" value="email@gmail.com"/>
        <property name="mail.debug" value="true"/>
    </configuration1>
    
    <!-- SMTP No Authentication Example -->
    
    <configuration2>
        <property name="mail.smtp.starttls.enable" value="false"/>
        <property name="mail.smtp.host" value="smtp.demo.com"/>
        <property name="mail.smtp.socketFactory.port" value="25"/>
        <property name="mail.smtp.user" value="demo@email.com"/>
        <property name="mail.smtp.password" value=""/>
        <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
        <property name="mail.smtp.auth" value="false"/>
        <property name="mail.smtp.port" value="25"/>
        <property name="mail.smtp.from" value="demo@email.com"/>
        <property name="mail.debug" value="true"/>
    </configuration2>   

    <!-- Distribution Lists are referred to within message mapping Config.xml -->

    <distributionList id="StartStop" enabled="Y" maxFrequencyMins="0">
        <toAddressList>example@email.com</toAddressList>
    </distributionList>

    <distributionList id="LabelSync" enabled="N" maxFrequencyMins="0">
        <toAddressList>example@email.com</toAddressList>
    </distributionList>
    
    <distributionList id="Logs" enabled="Y" maxFrequencyMins="0">
        <toAddressList>example@email.com</toAddressList>
    </distributionList>

    <distributionList id="Config" enabled="Y" maxFrequencyMins="0">
        <toAddressList>example@email.com</toAddressList>
    </distributionList>

    <distributionList id="Monitor" enabled="Y" maxFrequencyMins="0">
        <toAddressList>example@email.com</toAddressList>
    </distributionList>

    <distributionList id="Info" enabled="Y" maxFrequencyMins="0">
        <toAddressList>example@email.com</toAddressList>
    </distributionList>

    <distributionList id="Error" enabled="Y" maxFrequencyMins="5">
        <toAddressList>example@email.com</toAddressList>
    </distributionList>
    
    <distributionList id="SSCC" enabled="Y" maxFrequencyMins="5">
        <toAddressList>example@email.com</toAddressList>
    </distributionList>
    
     <distributionList id="OrderAssigned" enabled="Y" maxFrequencyMins="0">
        <toAddressList>example@email.com</toAddressList>
    </distributionList>
</emailSettings>