npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

blacklake-sync-sdk

v0.1.6

Published

将数据同步至黑湖数据库

Downloads

5

Readme

BlackLake Sync SDK

将数据同步至黑湖数据库

Installation

npm i blacklake-sync-sdk --save

Usage

引入 BlackLake Sync SDK

const BlcakLakeSync = require('blacklake-sync-sdk');

const client = new BlcakLakeSync(yourUsername, yourPassword);

API

connect()

  • 功能:连接黑湖服务器
  • 返回值:Promise对象
    • resolveConnect Success
    • reject为连接失败原因,如手机号不存在密码不正确连接被拒绝,请联系相关人员
  • Example
client.connect().then(data => {
  console.log(data);   // Connect Success
}).catch(err => {
  console.log(err);    // 密码不正确
});

batch(type, items)

  • 功能:批量导入数据
  • 参数
    • type: materialproductOrder
    • items: 数组形式,具体要求如下
material格式
items = [
    {
        name: '玻璃',                            // 物料名称
        code: 'glass',                          // 物料编码
        unit: '千克',                            // 单位
        category: '原料',                        // 类别(原料、半成品、成品)
    }
]

---

productOrder格式
注意`startTime`, `endTime`和`targetDate`必须为'yyyy-mm-dd hh:mm:ss'格式

items = [
    {
        productOrderNo: "1112",                 // 订单唯一No,string 
        materialCode: 'glass',                  // 产出物料的编码
        materialAmount: '123',                  // 产出物料的数量
        startTime: "2017-08-01 11:11:11",       // 在黑湖系统里显示的开始时间,'yyyy-mm-dd hh:mm:ss'
        endTime: "2017-08-02 11:11:11",         // 在黑湖系统里显示的结束时间,'yyyy-mm-dd hh:mm:ss'
        purchaseOrderNo: "123",                 // 订单号
        targetDate: "2017-08-20 11:11:11",      // 订单交货日期
        customer: "交通大学"                      // 订单客户名称
    }        
] 
  • 返回值:Promise对象
    • resolve为JSON对象:{ createdAmount: num1, updatedAmount: num2 },其中num1为新增数,num2为更新数
    • reject为连接失败原因,如items必须为Array, 找不到type参数错误
  • Example
const items = [
    {
        productOrderNo: "1112",
        materialCode: 'glass',
        materialAmount: '123',
        startTime: "2017-08-01 11:11:11",
        endTime: "2017-08-02 11:11:11",
        purchaseOrderNo: "123", 
        targetDate: "2017-08-20 11:11:11", 
        customer: "交通大学" 
    }        
];

client.batch('productOrder', items).then(result => {
    console.log(result);    // { createdAmount: 1, updatedAmount: 0 }
}).catch(err => {
    console.log(err);       // 错误原因
});