andon
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Andon

This library is designed to facilitate the implementation of Andon systems in manufacturing processes. It provides a set of tools for real-time process monitoring, issue resolution, and support for lean methodologies.

Getters

get signal(): string; // "Green" | "Yellow" | "Red" | "Blue" | "White"
get alert(): Alert; // {message: string | null, timestamp: Date | null}
get currentState(): // {identifier: string; signal: Signal; timestamp: Date; alert: Alert;};
get docs():
// {
//     Green: {color: Color; condition: string; action: string;};
//     Yellow: {color: Color; condition: string; action: string;};
//     Red: {color: Color; condition: string; action: string;};
//     White: {color: Color; condition: string; action: string;};
//     Blue: {color: Color; condition: string; action: string;};
//     Unknown: {color: string; condition: string; action: string;};
// };

Methods

setAlert(message: string): void; // Result: {message: string, timestamp: new Date()}
clearAlert(): void; // Result: {message: null, timestamp: null}

// type Signal = "Green" | "Yellow" | "Red" | "Blue" | "White"
// actionFunction = function
setSignal(signal: Signal, actionFunction?: () => void | Promise<void>): Promise<void>;

Usage

import {Andon, Color} from "andon";

const data = {
  identifier: "Oxtica Robot", // _id, equipment name, machine name, etc.
  signal: Color.Green, // type Signal = "Green" | "Yellow" | "Red" | "Blue" | "White"
};

const andon = new Andon(data.identifier, data.signal); // Signal can be undefined, it will be "Green" by default

console.log(andon.currentState);
// {
//   identifier: "Oxtica Robot",
//   signal: "Green",
//   timestamp: "2023-11-22T12:54:38.947Z",
//   alert: {message: null, timestamp: null},
// };

andon.setSignal(Color.Yellow);
andon.setAlert("Pneumatic hose is potentially broken.");
console.log(andon.currentState);
// {
//     identifier: 'Oxtica Robot',
//     signal: 'Yellow',
//     timestamp: 2023-11-22T12:54:38.956Z,
//     alert: {
//       message: 'Pneumatic hose is potentially broken.',
//       timestamp: 2023-11-22T12:54:38.956Z
//     }
// }

console.log(andon.alert); // {message: "Pneumatic hose is potentially broken.", timestamp: "2023-11-22T12:54:38.956Z"}

andon.setSignal(Color.Red, () => {
  andon.setAlert("Pneumatic hose must be replaced with the new one");
  console.log(andon.alert);
  //   {
  //     message: 'Pneumatic hose must be replaced with the new one',
  //     timestamp: 2023-11-22T12:54:38.964Z
  //   }
  console.log("Calling andon APIs...");
  console.log(andon.currentState);
  //   {
  //     identifier: 'Oxtica Robot',
  //     signal: 'Red',
  //     timestamp: 2023-11-22T12:54:38.963Z,
  //     alert: {
  //       message: 'Pneumatic hose must be replaced with the new one',
  //       timestamp: 2023-11-22T12:54:38.964Z
  //     }
  //   }
});

andon.setSignal(Color.Green);
andon.clearAlert();

console.log(andon.alert); // { message: null, timestamp: null }
console.log(andon.currentState);
// {
//     identifier: 'Oxtica Robot',
//     signal: 'Green',
//     timestamp: 2023-11-22T12:54:38.972Z,
//     alert: { message: null, timestamp: null }
// }

const docs = andon.docs;
console.log(docs);
// {
//     Green: {
//       color: 'Green',
//       condition: 'Normal: Everything is running well.',
//       action: 'Process is under control. No action necessary.'
//     },
//     Yellow: {
//       color: 'Yellow',
//       condition: 'Warning: Trouble is on the horizon.',
//       action: 'Solve the problem quickly to prevent process stoppage.'
//     },
//     Red: {
//       color: 'Red',
//       condition: 'Critical: Process has been halted.',
//       action: 'Call for help, solve the problem before restarting.'
//     },
//     White: {
//       color: 'White',
//       condition: 'Information: Process stopped for a legitimate reason.',
//       action: 'Completion of a production run or shift change.'
//     },
//     Blue: {
//       color: 'Blue',
//       condition: 'Attention: Potential quality problem detected.',
//       action: 'Solve quickly to prevent escalation.'
//     },
//     Unknown: {
//       color: 'Unknown',
//       condition: 'Unknown signal.',
//     }
// }

Package Sidebar

Install

npm i andon

Homepage

oxtica.com

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

16.2 kB

Total Files

18

Last publish

Collaborators

  • oxtica