steltixlabs-ais-client

js classes to call e1 ais services

Usage no npm install needed!

<script type="module">
  import steltixlabsAisClient from 'https://cdn.skypack.dev/steltixlabs-ais-client';
</script>

README

steltixlabs-ais-client

helper classes to interact with JD Edwards AIS services in JS client applications

Install

npm i steltixlabs-ais-client

Usage

{ // using dataservices

  // init new client
  const AIS = new AisClient({
    username: conn.username,
    password: conn.password,
    url: conn.aisUrl,
    deviceName: 'AISCLIENT'
  });

  const WOTable = 'F554111E'; // Custom Box ID table

  // create query
  const validateWOQuery = AIS.createDataQuery(WOTable)
    .select(['DOCO', '55BOXID', 'UORG', '55UDF01', '55BOXNO'])
    .where('55BOXID').eq(BOXID).and('55UDF01').noteq('Y');

  // post to AIS
  const results = await AIS.fetch(validateWOQuery);
  // logout
  await AIS.logOut(AIS.token);
  // check my results
  if (Array.isArray(results) && results.length > 0 && results[0]['55UDF01'] !== 'Y') {
    return results;
  } else {
    return null;
  }

}

{ // using simple form post with req as object literal
  const AIS = new AisClient({
    username: conn.username,
    password: conn.password,
    url: conn.aisUrl,
    deviceName: 'AISCLIENT'
  });
  // force a new token - this is optional as simplePost will also call _ensureToken()
  const token = await AIS.getToken(true);

  // build up your own object literal
  var udcJSON = {
    "token": token,
    "deviceName": "smithScanning",
    "formName": "P554111E_W554111EC",
    "formInputs": [{
      "value": BOXNO,
      "id": "1"
    }],
    "formActions": [{
        "command": "SetControlValue",
        "controlID": "35",
        "value": "Y"
      },
      {
        "controlID": "11",
        "command": "DoAction"
      }
    ]
  }

  // await the ais formservice call
  var aisCallResults = await AIS.simpleFormCall(udcJSON);
  // chck results
  if (!aisCallResults || typeof aisCallResults === 'undefined') {
    return null
  } else {
    return results
  }

}



{ // using formService class helpers

  // init new client
  const AIS = new AisClient({
    username: conn.username,
    password: conn.password,
    url: conn.aisUrl,
    deviceName: 'AISCLIENT'
  });

  const addItemsForm = 'P4101_W4101A'; // Custom Box ID table

  // create post object
  const formServiceReq = AIS.createFormServiceCall(addItemsForm)
    .returns('17, 324, 277')._addAction({
      command: "DoAction",
      controlID: "12"
    })
    ._addInput({
      id: "1",
      value: "2424"
    })

  // post to AIS
  const results = await AIS.fetch(formServiceReq);

  // logout
  await AIS.logOut(AIS.token);

  // check my results
  if (Array.isArray(results) && results.length > 0 && results[0]['55UDF01'] !== 'Y') {
    return results;
  } else {
    return null;
  }

}


License

MIT