调用方法

地址说明

  • 通过获取程序Api地址接口返回参数中ApiServerAddress的值

调用方法

  • POST
  • ContentType: application/x-www-form-urlencoded;Charset=UTF-8

参数:

参数名必选类型说明
managename是string接口名 固定值为:GraspCMServerApi.dll
dbname是string数据库名称
processtype是int过账类型 目前只支持 0保存 6存为草稿
vchtype是int单据类型 详见具体单据
vchcode是int单据vchcode,目前始终传0
billdata是string单据数据json 详见文档:单据Json格式
apiparam是string通过获取程序API地址接口返回
apitype是string接口类型 传process
sign是string签名字符串
mobile是string云平台手机号 获取API地址返回的GraspCloudMobile,为空时传0
serviceid是string云平台ServerID 获取API地址返回的GraspCloudServerId,为空时传0
interiorapi是int该参数始终为1

参数传入说明
1、采用x-www-form-urlencode的方式传参,即参数通过key=value&key=value拼接成字符串,再通过Body传入。
2.再拼接字符串时需要对参数中的所有value做URLEncode,特别注意只有再拼接Post传入参数时才对Value做URLEncode,而计算签名时不要进行转译

sign签名规则

  1. 将上述参数中除了sign以外的所有参数,根据参数名按照字母排序,以Key+Value的形式拼接字符串。
  2. 字符串拼接后在结尾加上SignKey。(SignKey获取方法见:获取接口所需SignStr接口)
  3. 将这个最终拼接成的字符串通过MD5加密,取32位小写。
    MD5加密前字符串示例
    apiparam7/eAVT1NN2MtBY+MkAylEBVN/FsnC9BL4IzSHtHyt+2s+jAZRVqfMAwzFgSudBH3eDau916Vd6aNEFxve2ZoYey1Zvi+Vp8xb7VrAnJNbCs=apitypeprocessbilldata{"date":"2019-11-19","summary":"","inputno":"会计主管","billtype":0,"logondate":"2019-11-19","detail":[{"ausercode":"1001","afullname":"库存现金","total":100,"discounttotal":100,"tax_total":100,"comment":"","usedtype":1},{"ausercode":"1002","afullname":"银行存款","total":10,"usedtype":2}]}dbnameM7215API测试interiorapi1managenameGraspCMServerApi.dllmobile0processtype6serviceid0vchcode0vchtype112020cmgmsignkeyappkey@#986

关于数量单价金额的换算关系
系统里面有3套价格体系 分别是折前 折后 和含税
数量 qty 折扣discount 税率 tax
折前单价 price 折后单价 discountprice 含税单价taxprice 税额 taxtotal
折前金额 total 折后金额 discounttotal 价税合计tax_total
首先必须要满足每组价格体系的数量乘以单价等于金额
也就是qtyprice=total qtydiscountprice = discounttotal qtytaxprice = tax_total
然后折后金额=折前金额
折扣 discounttotal = totaldiscount
最后价税合计=折后金额
(1+税率/100)tax_total = discounttotal*(1+tax/100)
税额=价税合计-折后金额 taxtotal = tax_total - discounttotal

当接口返回错误信息提示数量单价金额换算不合法时,请检查是否满足对应的数量*单价=金额或者金额÷数量=单价。

PostMan传参示例
image.png

返回参数说明

参数名类型说明
codestring小于等于0表示失败 成功时会返回单据的vchcode
messagestring单据过账消息 成功还是失败都会返回消息
responsejson数组失败时会返回具体的错误信息

错误信息response

参数名类型说明
errormessagestring错误信息

返回参数示例

 {
  "code": "-1",
  "message": "单据过账失败。",
  "response": [
    {
      "errormessage": "单据表头的仓库不存在"
    },
    {
      "errormessage": "单据表头的结算单位不存在"
    }
  ]
}