用于 Infor M3/Infor ION 的角 HTTP 库
这个Angular库简化了API与Infor M3和Infor ION的通信,提供了管理交易的实用方法,用户上下文,以及CSRF令牌. 它汇总了参数处理,上下文管理,错误处理等常见功能来简化API集成.
特征
- M3 V2 API: (英语) 支持 M3 v2 端点.
- M3 散装 API : M3散列API支持.
- 丢入 Odin 替换 : 该项目的目标是,从Odin移徙应尽可能简单.
安装
要安装库, 请添加到您的 Angular 项目中 :
npm install @beredo/ngx-ion-client
开始
在提供者中添加 HttpClientModule
如果使用独立组件,也可以在组件中配置.
无论是在你的应用模块. ts
...
import { HttpClientModule } from '@angular/common/http';
...
@NgModule({
...
providers: [
...
HttpClientModule
...
]
...
或者在你的应用程序中
...
import { provideHttpClient } from '@angular/common/http';
export const appConfig: ApplicationConfig = {
providers: [
....
provideHttpClient(),
...
],
};
导入库
import { HttpClientModule } from '@angular/common/http';
import { MIService, UserService } from '@beredo/ngx-ion-client';
@NgModule({
imports: [
HttpClientModule,
// Other imports
],
providers: [MIService, UserService],
})
export class AppModule {}
使用图书馆
做一个基本的m3呼叫
要简单的 API 呼叫, 导入服务并使用执行或执行V2 方法
import { Component } from '@angular/core';
import { MIService } from "@beredo/ngx-ion-client";
@Component({
selector: 'app-transaction',
template: `<pre>{{ transactionResult | json }}</pre>`,
})
export class TransactionComponent {
transactionResult: any;
constructor(private miService: MIService) {
this.miService
.execute({
program: 'MMS001MI',
transaction: 'LstItems',
record: { ITNO: 'ITEM001' },
})
.subscribe(
(result) => {
this.transactionResult = result;
},
(error) => {
console.error('Transaction error', error);
}
);
}
}
或与 V2 API
import { Component } from '@angular/core';
import { MIService } from "@beredo/ngx-ion-client";
@Component({
selector: 'app-transaction',
template: `<pre>{{ transactionResult | json }}</pre>`,
})
export class TransactionComponent {
transactionResult: any;
constructor(private miService: MIService) {
return this.miService.executeV2<
GetHeadInputs,
GetHeadOutputs
>({
program: "OIS100MI",
transaction: "GetHead",
records: params,
});
}
}
用户背景
用户上下文在本地开发时使用MNS150MI.
import { Component, OnInit } from '@angular/core';
import { UserService, UserContext } from "@beredo/ngx-ion-client";
@Component({
selector: 'app-user-context',
template: `<pre>{{ userContext | json }}</pre>`,
})
export class UserContextComponent implements OnInit {
userContext: UserContext | undefined;
constructor(private userService: UserService) {}
ngOnInit() {
this.userService.getUserContext().subscribe((context) => {
this.userContext = context;
});
}
}
打开体验设计程序
EdaLauncherService 打开 H5 中的经验设计器应用程序.
shortName 是应用程序在体验设计师管理中的简称( 不)
它的显示名称)。 每个参数密钥都是应用程序的组件显示 ids
作为 Component.Field; 空值被忽略, 其他则被忽略
是URI编码的.
import { Component, inject } from '@angular/core';
import { EdaLauncherService } from "@beredo/ngx-ion-client";
@Component({
selector: 'app-customer-link',
template: `<button (click)="open('10001')">Customer info</button>`,
})
export class CustomerLinkComponent {
private eda = inject(EdaLauncherService);
open(cuno: string) {
// mp://CUSTINFO?title=Customer%20info&IndexList_Customers.CUNO=10001
this.eda.launch({
shortName: 'CUSTINFO',
title: 'Customer info',
params: { 'IndexList_Customers.CUNO': cuno },
});
}
}
edaLink(...) 返回同一链接而不打开,以及
launchLink('mp://...') 打开保存在其他地方的链接.
许可证发放
此图书馆仅供非商业用途. 如果你想在商业项目中使用这个,你可以联系我们讨论许可问题.