@adempiere/grpc-pos-api 中文文档教程
ADempiere POS Client for gRPC
ADempiere POS 客户端用 Javascript 编写 gRPC 服务,用它来连接 ADempiere-gRPC-Server。
Requirements
Using it
# installing via NPM
npm i @adempiere/grpc-pos-client --save
# installing via Yarn
yarn add @adempiere/grpc-pos-client
A Example
Declare POS
const POS = require('@adempiere/grpc-pos-client');
let data = new POS(GRPC_HOST, 'Session UUID');
Declare POS with specific language
const POS = require('@adempiere/grpc-pos-client');
let data = new POS(GRPC_HOST, 'Session UUID', 'es_VE');
Request a simple Object based on Table and UUID
// Request a single Object
data.getProductPrice(searchValue: 'Patio Fun', priceListUuid: '8cc49692-fb40-11e8-a479-7a0060f0aa01')
.then(productPrice => {
console.log("Product Price");
// Value
console.log(productPrice);
})
.catch(err => console.log("Error: " + err.message));
输出
Product Price
Recreate proto stub class (only for contribute to project)
对于重新创建存根类,您必须遵循:
注意:您还可以通过转到存储库目录并运行命令来安装 protoc
和 protoc-gen-grpc-web
:
sh install-protoc.sh
安装完成后,使用安装后检查版本,
protoc --version
只需转到源代码文件夹并运行它:
然后为销售点运行它
cd ../../protos
yarn global add grpc-tools
grpc_tools_node_protoc --js_out=import_style=commonjs,binary:src/grpc --grpc_out=src/grpc --plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin` proto/client.proto proto/core_functionality.proto proto/point_of_sales.proto
或运行:
sh generate-stub.sh
结果生成于:src/grpc 文件夹
pont_of_sales_pb.js
pont_of_sales_grpc_web_pb.js
ADempiere POS Client for gRPC
ADempiere POS Client write in Javascript for gRPC service, use it for connect with ADempiere-gRPC-Server.
Requirements
Using it
# installing via NPM
npm i @adempiere/grpc-pos-client --save
# installing via Yarn
yarn add @adempiere/grpc-pos-client
A Example
Declare POS
const POS = require('@adempiere/grpc-pos-client');
let data = new POS(GRPC_HOST, 'Session UUID');
Declare POS with specific language
const POS = require('@adempiere/grpc-pos-client');
let data = new POS(GRPC_HOST, 'Session UUID', 'es_VE');
Request a simple Object based on Table and UUID
// Request a single Object
data.getProductPrice(searchValue: 'Patio Fun', priceListUuid: '8cc49692-fb40-11e8-a479-7a0060f0aa01')
.then(productPrice => {
console.log("Product Price");
// Value
console.log(productPrice);
})
.catch(err => console.log("Error: " + err.message));
Output
Product Price
Recreate proto stub class (only for contribute to project)
For recreate stub class you must have follow:
Note: You can also install protoc
and protoc-gen-grpc-web
by going to the repository directory and run the command:
sh install-protoc.sh
When installation is complete, check the version with
protoc --version
After installed it just go to source code folder and run it:
And run it for Point Of Sales
cd ../../protos
yarn global add grpc-tools
grpc_tools_node_protoc --js_out=import_style=commonjs,binary:src/grpc --grpc_out=src/grpc --plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin` proto/client.proto proto/core_functionality.proto proto/point_of_sales.proto
Or run:
sh generate-stub.sh
The result is generated on: src/grpc folder
pont_of_sales_pb.js
pont_of_sales_grpc_web_pb.js