Code Monkey home page Code Monkey logo

ifs-ap's Introduction

ifs-ap

This is a package allowed to connect to the IFS ERP system from the Node.js environment.

If you create your own application (like an app on the phone or website) and want to get some data from the IFS ERP system you have two options.

  • The first option is to use IFS Access Provider, a package delivered by IFS.
    Unfortunately, those packages delivered by IFS are only for only two programming languages, .Net and Java.
    This forces us to use servers written in those two languages, and all servers are written in a different language (line for example Node.js) are excluded from the possibility to connect to IFS.
  • The second option is connected to Oracle directly, but this type of connection many times are forbidden because of licence limitations.

The purpose of this package is to expand the above possibilities by allowing to connect to IFS from the Node.js ecosystem. This package connects with the IFS Extender Server and exchanges messages in the same binary format as IFS Access Provider do.
Look to the folder with examples to get more information about functions provided by this library.

The next step, I hope, will be allowed to connect the app directly to IFS without any servers in the middle.

Install

npm install ifs-ap

SQL query

import { Connection } from "ifs-ap";
const conn = new Connection("https://ifs.demo.com:48080/", "ifsapp", "ifsapp", "IFS10" );

conn.Sql(
    `SELECT customer_id,
            name,
            country
       FROM &AO.customer_info
      WHERE ROWNUM <= :count `,
    { count: 20 }
  )
  .then((result) => {
    console.log(result.result);
    /*
    [
      { CUSTOMER_ID: 'FR_AIRBUS', NAME: 'Airbus France', COUNTRY: 'ANDORRA' },
      { CUSTOMER_ID: 'FR_AIRBUS_GERMANY', NAME: 'Airbus Germany', COUNTRY: 'GERMANY' },
      ... next 18 records
    ]  
    */
  });

PL/SQL block

import { Connection } from "ifs-ap";
const conn = new Connection("https://ifs.demo.com:48080/", "ifsapp", "ifsapp", "IFS10" );

conn.PlSql(
    `
    DECLARE
        order_no_  VARCHAR2(20);
    BEGIN
        order_no_ := :order_no;
        IF &AO.Customer_Order_API.Get_Objstate( order_no_ ) = 'Planned' THEN
            &AO.Customer_Order_API.Set_Released( order_no_ );
        END IF;
        :objstate := &AO.Customer_Order_API.Get_Objstate( order_no_ );
    END;`,
    { order_no: "P10576", objstate: "" }
  )
  .then((result) => {
    console.log(result.bindings);
    /*
    { order_no: null, objstate: 'Released' }
    */
  });

Download Attachment

import { Connection } from "ifs-ap";
import * as fs from 'fs';
const conn = new Connection("https://ifs.demo.com:48080/", "ifsapp", "ifsapp", "IFS10" );
const attachment = conn.Attachments();

attachment.GetFilesByRef('Voucher', 'ACCOUNTING_YEAR=2020^COMPANY=10^VOUCHER_NO=2020000000^VOUCHER_TYPE=I^') // get all attachments by lu and ref
    .then(result => {
        if (result) {
            console.log( result );
            for(const file of result){
                if (file.fileName && file.fileData) {
                    fs.writeFile( file.fileName, Buffer.from( file.fileData ), _err => {} );
                }
            }
        }
    })

ifs-ap's People

Contributors

syjupl avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.