965: Configure order file template

Test Case #:965

Test Case Name:Configure order file template

System: OpenLMIS

Subsystem: requisition

Test case designed by: Paulina Borowa

Design Date:15.09.2016

Short description: As an implementor, I want to configure the order file template so that my order files are generated with my desired columns and formats to enable transfer of data via an FTP.

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       

Step


Action

Expected system response

Comment

1

Create requisitionLine.

In Url:
Method: Post
Example Body:
{

  {

      "id": "27d954cb-c79e-49ce-936c-00d222553979",

    "product":{"id": "1752b457-0a4b-4de0-bf94-5a6a8002427e"},

    "stockInHand": 10,

    "beginningBalance": 5,

    "totalReceivedQuantity": 5,

    "requestedQuantity": 15,

    "totalConsumedQuantity": 4,

    "approvedQuantity": 12,

    "requisition": { "id": "76b01375-97d7-472f-9bca-03e49e4db5ff" }

}

}

Status 201 Created


2

 Create Requisition.
In Url:
Method: Post
Example Body:

  {

    "id": "10000000-0000-0000-0000-000000000001",

    "createdDate": "2016-03-30T15:43:16",

    "facility": { "id": "3a5d1b1c-e1eb-452d-85e6-c657e942aa67" },

    "program": { "id": "7df82e47-577e-4a9f-81ad-8f0f285aef60" },

    "processingPeriod": { "id": "c2252ba4-ebfc-4a6d-859f-db25cdfaa4bd" },

    "status": "INITIATED",

    "emergency": "false",

    "requisitionLines": [    {

    "id": "27d954cb-c79e-49ce-936c-00d222553979",

    "product":{"id": "1752b457-0a4b-4de0-bf94-5a6a8002427e"},

    "stockInHand": 10,

    "beginningBalance": 5,

    "totalReceivedQuantity": 5,

    "requestedQuantity": 15,

    "totalConsumedQuantity": 4,

    "approvedQuantity": 12

}]

}

                                                                                                    

Status 201 Created

                                                              

 Create requisition with requisitionLine                          

2

 Create Order.
In Url:
Method: Post
Example Body:

 {

    "id": "00000000-0000-0000-0000-000000001111",

    "requisition": { "id": "76b01375-97d7-472f-9bca-03e49e4db5ff" },

    "createdDate": "2016-04-30T16:45:22",

    "createdBy": { "id": "c9f76777-ac6d-4207-bdd7-dbbd1ad92b14" },

    "program": { "id": "44af344c-d73f-48a5-aaab-59a017b026aa" },

    "requestingFacility": { "id": "b6b79a14-ae2a-4f39-b8ed-3a1be7be0d88" },

    "receivingFacility": { "id": "3bb20e25-3cab-43c2-8203-f91285b8b7b9" },

    "supplyingFacility": { "id": "30829158-3769-4cc5-b611-ccfcc5136b5a" },

    "orderCode": "ORD1122",

    "status": "RECEIVED",

    "quotedCost": 100000

}


Status 201 created

With previously created requisition

3

Edit orderFileTemplates data.

In Url:

http://localhost:8080/api/orderFileTemplates/?access_token=1781f31a-3a75-4667-9b9f-08cd90e6bd09

Method Post

Example Body:

{
  "id": "457ed5b0-80d7-4cb6-af54-e3f6138c8128",
  "filePrefix": "O",
  "headerInFile": true,
  "orderFileColumns": [
    {
      "id": "33b2d2e9-3167-46b0-95d4-1295be9afc21",
      "openLmisField": true,
      "dataFieldLabel": "fulfillment.header.order.number",
      "columnLabel": "Order number",
      "include": false,
      "position": 1,
      "format": "",
      "nested": "order",
      "keyPath": "orderCode",
      "orderFileTemplate": "457ed5b0-80d7-4cb6-af54-e3f6138c8128"
    },
    {
      "id": "21708d81-7c75-4aaf-aace-ed27c8b97331",
      "openLmisField": true,
      "dataFieldLabel": "fulfillment.header.facility.code",
      "columnLabel": "Facility code",
      "include": true,
      "position": 7,
      "format": "",
      "nested": "order",
      "keyPath": "requisition/facility/code",
      "orderFileTemplate": "457ed5b0-80d7-4cb6-af54-e3f6138c8128"
    },
    {
      "id": "9e825396-269d-4873-baa4-89054e2722f5",
      "openLmisField": true,
      "dataFieldLabel": "fulfillment.header.product.name",
      "columnLabel": "Product name123",
      "include": true,
      "position": 4,
      "format": "",
      "nested": "lineItem",
      "keyPath": "product/primaryName",
      "orderFileTemplate": "457ed5b0-80d7-4cb6-af54-e3f6138c8128"
    },
    {
      "id": "cd57f329-f549-4717-882e-ecbf98122c39",
      "openLmisField": true,
      "dataFieldLabel": "fulfillment.header.approved.quantity",
      "columnLabel": "Approved quantity",
      "include": false,
      "position": 2,
      "format": "",
      "nested": "lineItem",
      "keyPath": "approvedQuantity",
      "orderFileTemplate": "457ed5b0-80d7-4cb6-af54-e3f6138c8128"
    },
    {
      "id": "d0e1aec7-1556-4dc1-8e21-d80a2d76b678",
      "openLmisField": true,
      "dataFieldLabel": "fulfillment.header.period",
      "columnLabel": "Period",
      "include": true,
      "position": 6,
      "format": "MM/yyy",
      "nested": "order",
      "keyPath": "requisition/processingPeriod/startDate",
      "orderFileTemplate": "457ed5b0-80d7-4cb6-af54-e3f6138c8128"
    },
    {
      "id": "dab6eec0-4cb4-4d4c-94b7-820308da73ff",
      "openLmisField": true,
      "dataFieldLabel": "fulfillment.header.order.date",
      "columnLabel": "Order date",
      "include": false,
      "position": 7,
      "format": "yyyy/MM/dd",
      "nested": "order",
      "keyPath": "createdDate",
      "orderFileTemplate": "457ed5b0-80d7-4cb6-af54-e3f6138c8128"
    }
  ]
}

Status 200 OK

Check acceptance criteria:

* all column headers can be defined (renamed) by the implementor

* Facility code column populates the facility code from the requisition information

* Product Code column populates the product name from requisition information/reference data

* Product Name column populates the product name from requisition information/reference data

* Approved quantity column populates based on the approved quanitity column in the requisition

* Period information populates based on the requisition

* Period format is defined by the implementor, choices include

* Order date populates based on the date converted

* Order date format is defined by the implementor, choices include, same as period format

* Implementor can define the Order file prefix

4

To see if the changes save, check endpoint:

http://localhost:8080/api/orders/7ffe5fac-aeb1-431d-9049-249d6d6f0f3d/csv/?access_token=1781f31a-3a75-4667-9b9f-08cd90e6bd09

Method Get

Status 200 OK

For example:
  • all column headers can be defined (renamed) by the implementor:
  • Order date format is defined by the implementor, choices include, same as period format:


OpenLMIS: the global initiative for powerful LMIS software