FS 310488 Export EPOD docs as Images
Partnerlink
Export EPOD Docs as Images
CALIDUS EPOD
31st July 2013 - 0.4
Reference: FS 310488
Contents
Functional Overview
Client Requirement
The customer requires automatically-produced POD documents to be exported to TIFF Image format, compressed into black and white, and send via FTP to an existing document system, as documented in the appendices.
Solution Overview
The Site or Job Group may be configured through the Admin screens to allow exporting of Completion Documents.
The user will be able to add a new POD Export Configuration to an existing configuration. This will allow the user to specify:
- How the export will be achieved
- To where it will be sent
- What format will be used
- What image compression will be applied, if required
- What Job Types should be exported.
The existing Auto-Export process will be modified to complete this change. When this runs, and sites or job groups configured for export will build the report for the completed job in the format requested and send it via the mechanism specified to the destination set up on the Export configuration.
Scope
- Additional or updated external software will be required:
- HTML to PDF or Image conversion tools - Latest versions of WkHtmlToX, WkHtmlToPdf and WkHtmlToImage
- Image conversion/compression tools - ImageMagick
- No GIF images can be used, as they are not exported correctly by WkHtmlToX tools
- Although it is seen that this may be used to replace the existing POD Email code, at this time both methods will remain in place.
- Only proof of delivery documents are required to be sent to fulfil the customer request.
- Only the Operating Partner will be automatically sent the POD.
Set-up
Pre-requisites
- A working CALIDUS EPOD system.
- A link to the Vigo Partnerlink Online system, for testing purposes.
Menu Structure
None
Data
Data is expected to be configured as follows: Table EPOD_XF_CONFIG:
- EPL_XF_CONFIG_ID - As assigned to the Site or Job Group
- EPL_DESCRIPTION - As required
- EPL_XF_TYPE = "FTP"
- EPL_XF_DESTINATION = "ftp://www.partnerlinkonline.com"
- EPL_XF_ID = "POD"
- EPL_WEB_USER = Partner Code (EPL_SITE_ID) (lowercase)
- EPL_WEB_PASSWORD = Partner Code (EPL_SITE_ID) (lowercase)
- EPL_XF_DIRECTION = "O"
- EPL_EXPORT_FORMAT = "Image"
- EPL_IMAGE_TYPE = "TIFF"
- EPL_TIFF_COMPRESSION = "Fax"
- EPL_FILENAME = "PAR-<EPL_EXT_REF>-<date>-
- EPL_EXPORT_JOB_TYPES = "D"
Functional Description
Database
Table EPOD_XF_CONFIG requires the following modifications:
- EPL_EXPORT_FORMAT (New field) - nvarchar(10)
- EPL_IMAGE_TYPE (New field) - nvarchar(5)
- EPL_TIFF_COMPRESSION (New field) - nvarchar(5)
- EPL_FILENAME (New field) - nvarchar(100), allowed nulls
Existing packages will be modified to allow the creating, editing and selecting of the new fields, including but not limited to:
- EPOD_XF_CONFIG_INSERT
- EPOD_XF_CONFIG_SEARCH
- EPOD_XF_CONFIG_SELECT
- EPOD_XF_CONFIG_SELECT_INBOUND
- EPOD_XF_CONFIG_UPDATE
The existing EPOD_XF_CONFIG DAL object will be changed to:
- Read the new fields
- Add as parameters and searchable items
Table EPOD_JOB requires the following modifications:
- EPL_XFER_POD_FLAG (New field) - nvarchar(1), default to "N"
Existing packages will be modified to allow the creating, editing and selecting of the new field, including but not limited to:
- EPOD_JOB_INSERT
- EPOD_JOB_SEARCH
- EPOD_JOB_SELECT
- EPOD_JOB_SELECT_DATE_RANGE
- EPOD_JOB_UPDATE
The existing EPOD_JOB DAL object will be changed to:
- Read the new fields
- Add as parameters and searchable items
An index must be created for EPOD_JOB, containing:
- EPL_XFER_POD_FLAG
- EPL_STATUS
- EPL_JOB_TYPE
Note: Indexes MUST be checked and set on the EPOD_JOB table for the SELECT statements used in the Auto-Export process to be efficient - ensure that all required indexes have been created.
A new database procedure EPOD_XFER_SELECT_POD will be written to allow selection of EPOD_JOB records that are:
- at completed status (EPL_STATUS = "Y").
- with EPL_XFER_POD_FLAG = "N".
This procedure should link to EPOD_SITE and optionally to EPOD_JOB_GROUP and select all fields from EPOD JOB and EPOD_XF_CONFIG that match the following criteria:
- ej.EPL_STATUS = 'C'
- ej.EPL_XFER_POD_FLAG = 'N';
EPOD_XF_CONFIG should be optionally linked to from any configuration set up against the Site or Job Group, using EPL_XF_CONFIG of the appropriate file to link to the table, ensuring that only configurations for EPL_XF_ID of 'POD' are found. Additionally, these links should select only configurations if the Job Type of the job selected is in the configuration's Job Types, ensuring that the configuration will not be selected if the job is of the wrong type.
The fields reported in the query should be those of the Job Group configuration, if there is one, otherwise the Site configuration.
A prototype of the SQL SELECT statement is available.
DAL
A new DAL object will be written, EPOD_JOB_XFCONFIG, that will extend the existing EPOD_JOB object. The extended items will be:
- A new property of type EPOD_XF_CONFIG.
- A new constructor.
- A new public procedure to populate a list of EPOD_JOB_XFCONFIG objects from the new database procedure. This will be called GetJobsXferPOD, based on the existing similar procedures.
The purpose of this DAL object is to return Job and XF Config constructs in one object, to allow for more efficient processing through the database.
The new constructor will accept all parameters of the most complete of the original EPOD_JOB constructors, plus all the fields from EPOD_XF_CONFIG. Note that these fields should be preceded with XFC rather than EPL, to indicate that they belong to EPOD_XF_CONFIG.
The new constructor will call the most complete of the original EPOD_JOB constructors, specifying the parameter Hierarchy as passed in to the new EPOD_JOB_XFCONFIG constructor. Note that this procedure should NOT check the database again for the existence of the record - the record will already exist.
Additionally, if the parameter XFC_XF_CONFIG_ID is not null, the constructor will populate the new EPOD_JOB_XFCONFIG property EPOD_XF_CONFIG with a new call to the EPOD_XF_CONFIG constructor, passing in all the XFC fields from the new EPOD_JOB_XFCONFIG constructor.
The new procedure GetJobsXferPOD will receive a database connection parameter, and will call the new database procedure to retrieve EPOD_JOB and EPOD_XF_CONFIG records. This will then populate a List of new EPOD_JOB_XFCONFIG objects from each record returned, and return this.
Admin
Add the following new values to the XF Config Maintenance screen:
- EPL_XF_ID - the new value "POD" should be added to the options of the existing DDL.
Add the following new fields to the XF Config Maintenance screen:
- EPL_EXPORT_JOB_TYPES - A text field with allowed entries of C/D/S or any combination of these values together. This should be enabled for entry for export IDs "JOB" and "POD" only.
- EPL_EXPORT_FORMAT (new field) - A DDL with the following values: Image/PDF/HTML. This should be enabled to be entered only for Export ID "POD" only.
- EPL_IMAGE_TYPE (New field) - A DDL with the following values: JPG/PNG/TIFF. This should be enabled to be entered only for Export Format "Image" only.
- EPL_TIFF_COMPRESSION (New field) - A DDL with the following values: Fax/Zip/None. This should be enabled to be entered only for Image Type "TIFF" only.
- EPL_FILENAME (New Field) - text field to store the filename with replacement strings.
Note: All DDLs should be created with data-definable options.
Reports
Remove all GIF image files and replace them with PNG image files in all reports.
Signature Processing
The new EPOD_Export_Images_To_FS module must be modified to ensure that no GIF images are created.
The existing code calling EPOD_UTILS.Base64toImage will be used in all cases to create a .NET System Image file, which will then be saved as type JPG, through the overloaded Save method, specifying image format (System::Drawing::Imaging::ImageFormat::Jpg).
Export Processing
The Export process (ePOD_AutoExport.AutoExport.RunAutoExport) will be modified to add a new section for Exporting PODs. This will be a new procedure in EPOD_SYS_EXPORT called ExportAllPOD.
The new ExportAllPOD process will get a list of all Jobs at completed status where the POD has not yet been sent (through the new EPOD_JOB_XFCONFIG.GetJobsXferPOD procedure.
For each object in the list:
- If the EPOD_JOB_XFCONFIG.EPOD_XF_CONFIG object is not populated, the job does not require POD Export processing and so it can be marked as processed - the field EPOD_JOB_XFCONFIG.EPL_XFER_POD_FLAG should be set to "Y" and the record saved.
- If the EPOD_JOB_XFCONFIG.EPOD_XF_CONFIG object is populated, the job requires POD Export processing - call a new procedure EPOD_SYS_EXPORT.ExportPOD to process this object, passing in the Connection, EPOD_JOB_XFCONFIG object and a counter. If this is successful, the field EPOD_JOB_XFCONFIG.EPL_XFER_POD_FLAG should be set to "Y" and the record saved. If any failure is received, the status should be set to Error instead.
The new ExportPOD procedure will:
- Export the HTML as a page (input)
- Check the format:
- If PDF, run the input through the WkHtmlToPdf process to a temporary file (output)
- If Image:
- Run the input through the WkHtmlToImage process to a temporary file (output), passing the image type as a parameter.
- If TIFF format and Compression is required, run the output file through the compression process, as follows:
convert.exe <output> -compress <EPL_TIFF_COMPRESSION> <output>
- If HTML, set the temporary file (output) to input directly.
- Call the existing SendFile procedure, passing:
- EPOD_JOB_XFCONFIG.EPOD_XF_CONFIG
- "POD"
- EPOD_JOB_XFCONFIG
- output
- counter
- a response object (out)
The existing SendFile process will be modified to use the new EPL_XF_FILENAME parameter, if populated.
If the new field is populated, the filename in strExportFile should be populated as follows:
- search the string for tags (pattern-matched as "\<.*\>").
- replace tags found as follows:
- "date" - the current date, formatted as "YYYYMMDD".
- "time" - the current time, formatted as "HHMMSS".
- "uid" - the sequence, formatted as "0000".
- Any other uppercase tag should be taken from the EPOD_JOB record, using the tag name as the property to be found. So, for example, if a tag <EPL_EXT_REF> is found, this should be replaced with the data value of EPOD_JOB.EPL_EXT_REF.
- The extension should be removed from the filename (along with the period).
A new strExportFileExt string should be created, pre-populated with "XML". This will be set to the extension from the new EPL_XF_FILENAME parameter, if populated.
The existing FTP export procedure SendExportAsFTP will be called as now, populating the parameters as:
- strExportFilePath.
Note: The existing code that uses "C:\tempFileForFTP" as a temporary holding area for the file should be modified to ensure that a configurable parameter is used instead of hard-coding.
- strExportFile - as populated above
- EPOD_XF_CONFIG.EPL_XF_DESTINATION, as now
- ExportContent, as now
- strExportFileExt.
- All remaining parameters as now.
Appendix A: TEST PLAN
Test Script / Scenario Reference | Export EPOD Docs as Images | Call Number(s): 310488 |
Test Script / Scenario Description | Test the export of PODs | PASS / ISSUES / FAIL |
Menu Access | None | |
Pre-requisites | None | Tested By: |
Test Objective | To test that: Exporting of POD documents through Auto Export works as described; Files exported are acceptible to the existing external document system; Existing CALIDUS EPOD Export functionality is unaffected. | Date: |
Step | Action | Result | Remarks | P/F |
1 | Admin | |||
None | ||||
1.01 | Create a new POD configuration | All expected fields are prompted for, as described in the specification. | ||
1.02 | Edit an existing POD configuration | All expected fields can be modified, or are made available to be modified, as described in the specification. |
Step | Action | Result | Remarks | P/F |
2 | Auto-Export | |||
Configure the site as described in the specification. For safety and speed, ensure that there is no other configuration active, and that all non-test jobs have all XFER flags marked as Y, to ensure that no unexpected jobs are caught in the test. Ensure that the Vigo system administrator is informed of incoming test files. Create multiple Delivery jobs, and a single Collection and Service job. | ||||
2.01 | Complete the non-delivery jobs. Run the auto-export. | No POD documents are exported. | ||
2.02 | Complete a Delivery job. Run Auto-Export. | The POD document is exported to the PartnerlinkOnline FTP site. The report is in TIFF/fax format. The file is named correctly. | ||
2.03 | Change the configuration to a different or no compression. Complete a Delivery job. Run Auto-Export. | The POD document is exported to the PartnerlinkOnline FTP site. The report is in TIFF format with the correct compression. The file is named correctly. | ||
2.04 | Change the destination configuration to any local OBS FTP Server. Change the Image format to PNG. Complete a Delivery job. Run Auto-Export. | The POD document is exported to the changed FTP site. The report is in PNG format. The file is named correctly. | ||
2.05 | Change the configuration to export as PDF. Change the filename configuration. Complete a Delivery job. Run Auto-Export. | The POD document is exported to the FTP site. The report is in PDF format. The file is named correctly. | ||
2.06 | Change the configuration to export as HTML. Complete a Delivery job. Run Auto-Export. | The POD document is exported to the FTP site. The report is in HTML format. The file is named correctly. |
Appendix B: Quote & Document References
Cost Details | ||||
Activity | Estimate No. of Days |
No. of Days | Rate per Day (£) | Cost (£ Exc. VAT) |
Requirements | 0.00 | 0.00 | 0 | £0.00 |
Change Request Evaluation | 0.00 | 0.00 | 0 | £0.00 |
Functional Specification | 0.00 | 2.00 | 0 | £0.00 |
Technical Specification | 0.00 | 0.00 | 0 | £0.00 |
Development | 0.00 | 7.00 | 0 | £0.00 |
Testing and Release | 0.00 | 2.00 | 0 | £0.00 |
Implementation | 0.00 | 0.25 | 0 | £0.00 |
Project Management | First argument to "number_format" must be a number. | First argument to "number_format" must be a number. | 0 | £First argument to "number_format" must be a number. |
TOTAL | First argument to "number_format" must be a number. | First argument to "number_format" must be a number. | £First argument to "number_format" must be a number. |
Estimate excludes training, release to live and go live support. |
B.1 References
Ref No | Document Title & ID | Version | Date |
1 | Partnerlink POD Solution - Image and barcode Format.pdf | N/A | 10/02/2012 |
B.2 Glossary
Term | Definition |
---|---|
EPOD | Electronic Proof of Delivery. The OBS EPOD system is CALIDUS ePOD. |
CALIDUS eSERV | The OBS mobile system to complete Service functionality in the field. This is part of the CALIDUS ePOD system. |
PDA | The mobile device on which the C-ePOD system will run in the field. This can be a Phone, EDA or industrial PDA, running Android. |
DAL | Data Access Layer. A mechanism for accessing data by the system that is removed from the application, allowing for simplified access and providing protection to the data, as only approved DAL methods can be used to modify it. |
GPS | Global Positioning System. A mechanism of retrieving accurate positioning information in the form of Latitude and Longitude (Lat-Long) co-ordinates from a device. |
GPRS, 3G, HSDPA, Data Service | All terms referring to mobile device network connectivity, and the speed at which the device connects to the internet. |
B.3 Authorised By
Phil Harding | Project Manager | _____________________________ |