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

kingdee-k3

v1.0.0

Published

Kingdee K3 Cloud.

Downloads

3

Readme

Kingdee K3 Cloud

Automatically complete the saving and auditing of bills in Kingdee K3 Cloud.

Installation

###Using npm:

$ npm i -g kingdee-k3
$ npm i --save kingdee-k3

###In Node.js:

var K3CloudApiClient = require('kingdee-k3-webapi'),
    K3 = require('../lib');

var client = new K3CloudApiClient('http://your.k3.site');

var outstockbill = {
  // 销售组织,组织编码
  FSaleOrgId: {
    FNumber: '123'
  },
  // 客户,客户编码
  FCustomerID: {
    FNumber: 'CUST01234'
  },
  // 发货组织,组织编码 
  FStockOrgId : {
    FNumber: '123'
  },
  // 收货方
  FReceiverID: {
    FNumber: 'CUST01234'
  },
  // 结算方
  FSettleID: {
    FNumber: 'CUST01234'
  },
  // 付款方
  FPayerID: {
    FNumber: 'CUST01234'
  },
  SubHeadEntity: {
    // 结算组织
    FSettleOrgID: {
      FNumber: '123'
    }
  },
  FEntities: [
    {
      // 物料编码
      FMaterialID: {
        FNumber: '01.03.01.001'
      },
      // 实发数量
      FRealQty: '2',
      // 单价,价格为商品单价
      FPrice: '198',
      // 是否赠品
      FIsFree: false,
      // 含税单价
      FTaxPrice: '198',
      // 货主
      FOwnerID: {
        FNumber: '123'
      },
      // 销售数量
      FSALUNITQTY: '2',
      // 销售基本数量
      FSALBASEQTY: '2',
      // 计价基本数量
      FPRICEBASEQTY: '2'
    }, {
      FMaterialID: {
        FNumber: '01.02.01.004'
      },
      FRealQty: '1',
      FPrice: '68',
      FIsFree: false,
      FTaxPrice: '68',
      FOwnerID: {
        FNumber: '123'
      },
      FSALUNITQTY: '1',
      FSALBASEQTY: '1',
      FPRICEBASEQTY: '1'
    }, {
      FMaterialID: {
        FNumber: '04.01.04.003'
      },
      FRealQty: '4',
      FPrice: '0',
      FIsFree: true,
      FTaxPrice: '0',
      FOwnerID: {
        FNumber: '123'
      },
      FSALUNITQTY: '4',
      FSALBASEQTY: '4',
      FPRICEBASEQTY: '4'
    }
  ]
};

var receivebill = {
  // 往来单位,客户编码 
  FCONTACTUNIT: {
    FNumber: "CUST01234"
  },
  // 付款单位,客户编码 
  FPAYUNIT: {
    FNumber: "CUST01234"
  },
  // 收款组织,组织编码
  FPAYORGID: {
    FNumber: "100"
  },
  // 结算组织,组织编码 
  FSETTLEORGID: {
    FNumber: "100"
  },
  // 销售组织,组织编码
  FSALEORGID: {
    FNumber: "100"
  },
  // 单据头备注
  FREMARK: "商品销售",
  FEntities: [
    {
      // 结算方式
      FSETTLETYPEID: {
        FNumber: K3.BD.SettleType.Cash
      },
      // 收款用途
      FPURPOSEID: {
        FNumber: K3.CN.RecPayPurpose.Sale
      },
      // 预收项目类型,销售收款
      FRECEIVEITEMTYPE: " ",
      // 表体-应收金额
      FRECTOTALAMOUNTFOR: 975.0,
      // 收款金额
      FRECAMOUNTFOR_E: 975.0,
      // 手续费
      FHANDLINGCHARGEFOR: 2.35,
      // 备注
      FCOMMENT: "商品销售",
      // 收款金额本位币
      FRECAMOUNT_E: 975.0,
      // 登账日期
      FPOSTDATE: ""
    }
  ]
};

// Log on to Kingdee K3 Cloud using a 3rd party app account.
client.login('dbId', 'user', 'appId', 'appSecret', lang)
  .then((data) => {
    console.log('Log on to K3 Cloud success.');
      
    if (data.LoginResultType == 1) {
      K3.STK.Inventory.query(client, { 'FStockOrgId': 699033, 'FMaterialId.FNumber': '05.11.01.051' })
        .then((data) => {
          console.log(data);
        })
        .catch((err) => {
          console.log(err);
        });

      K3.SAL.OutStock.saveAndAudit(client, outstockbill)
        .then((data) => {
          console.log(data);
        })
        .catch((err) => {
          console.log(err);
          console.log(err.err.ResponseStatus.Errors);
        });

      K3.AR.ReceiveBill.saveAndAudit(client, receivebill)
        .then((data) => {
          console.log(data);
        })
        .catch((err) => {
          console.log(err);
          console.log(err.err.ResponseStatus.Errors);
        });
    }
  })
  .catch((err) => {
    console.log('Log on to K3 Cloud failed.');
    console.log(err.message);
  });

See the package source for more details.