作者 tangxuhui

调整 文档描述

... ... @@ -62,7 +62,7 @@ func (c *Client) Login(acctID string, username string, password string, lcid ...
}
// ExecuteBillQuery 单据查询
func (c *Client) ExecuteBillQuery(param RequestExecuteBillQuery) (*QueryResult, error) {
func (c *Client) ExecuteBillQuery(param RequestExecuteBillQuery) (*BillQueryResult, error) {
api := "/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc"
paramFomat := []interface{}{param}
resp, err := c.PostRequest(api, paramFomat)
... ... @@ -75,6 +75,11 @@ func (c *Client) ExecuteBillQuery(param RequestExecuteBillQuery) (*QueryResult,
if err != nil {
return nil, err
}
queryResult := newQueryResult(dataByte, param.FieldKeys)
queryResult := newBillQueryResult(dataByte, param.FieldKeys)
return queryResult, queryResult.Error()
}
//QueryGroupInfo 分组信息查询
func (c *Client) QueryGroupInfo() {
}
... ...
package material
//物料数据字段
//FormId
const (
FORM_ID_BD_MATERIAL string = "BD_MATERIAL"
)
//物料字段FieldKey 描述
const (
//物料表主键
FMATERIALID string = "FMATERIALID"
/*
数据状态,对应描述如下
"Z":暂存,"A":创建,"B":审核中,"C":已审核,"D":重新审核
*/
FDocumentStatus string = "FDocumentStatus"
//物料名称
FName string = "FName"
//物料编码
FNumber string = "FNumber"
//规格型号
FSpecification string = "FSpecification"
/*
禁用状态,对应描述如下
"A":否,"B":是
*/
FForbidStatus string = "FForbidStatus"
/*
物料属性
10:资产,9:配置,2:自制,11:费用,12:模型,5:虚拟,7:一次性
12:产品系列,3:委外,4:特征,6:服务,1:外购
*/
FErpClsID string = "FErpClsID"
//基本单位id
FBASEUNITID string = "FBaseUnitId"
//基本单位 名称
FBaseUnitId_FName string = "FBaseUnitId.FName"
//创建日期 如:"2022-01-08T19:36:06.843"
FCreateDate string = "FCreateDate"
//修改日期 如: "2022-01-08T19:36:06.843"
FModifyDate string = "FModifyDate"
//禁用日期 如:"2022-01-08T19:36:06.843"
FForbidDate string = "FForbidDate"
//审核日期 如:"2022-01-08T19:36:06.843"
FApproveDate string = "FApproveDate"
//物料分组id
FMaterialGroup string = "FMaterialGroup"
//物料分组名称
FMaterialGroup_FName string = "FMaterialGroup.FName"
/*
是否使用
1:是,0:否
*/
FRefStatus string = "FRefStatus"
// ...其他有需要的在补充
)
... ... @@ -30,26 +30,25 @@ func (qe QueryError) Error() string {
return str
}
/*QueryResult 单据查询结果
/*BillQueryResult 单据查询结果
当接口调用失败时得到的json 结构对应[][]QueryError,如:
[[{"Result":{"ResponseStatus":{"Errors":[{"Message":"元数据中标识为FUseOrg的字段不存在"}]}}}]]
当接口调用成功的得到的json结构对应[][]interface{},如:
[["xxx","abc",2345]]
*/
type QueryResult struct {
type BillQueryResult struct {
FieldKeys []string //对应的键名 ,注意数据的顺序
Buf []byte //原始的数据byte
}
func newQueryResult(buf []byte, keys string) *QueryResult {
return &QueryResult{
func newBillQueryResult(buf []byte, keys string) *BillQueryResult {
return &BillQueryResult{
Buf: buf,
FieldKeys: strings.Split(keys, ","),
}
}
func (result *QueryResult) ToMapString() []map[string]string {
func (result *BillQueryResult) ToMapString() []map[string]string {
if result.IsError() {
return nil
}
... ... @@ -70,7 +69,7 @@ func (result *QueryResult) ToMapString() []map[string]string {
return mapResult
}
func (result *QueryResult) ToMap() []map[string]interface{} {
func (result *BillQueryResult) ToMap() []map[string]interface{} {
if result.IsError() {
return nil
}
... ... @@ -91,7 +90,7 @@ func (result *QueryResult) ToMap() []map[string]interface{} {
return mapResult
}
func (result *QueryResult) Error() error {
func (result *BillQueryResult) Error() error {
var (
errMsg QueryError
err error
... ... @@ -112,11 +111,11 @@ func (result *QueryResult) Error() error {
}
//TODO 将结果解析为结构体
// func (result *QueryResult) ToStruct(v interface{}) error {
// func (result *BillQueryResult) ToStruct(v interface{}) error {
// return nil
// }
func (result *QueryResult) IsError() bool {
func (result *BillQueryResult) IsError() bool {
jResult := gjson.ParseBytes(result.Buf)
for _, arr1 := range jResult.Array() {
for _, item := range arr1.Array() {
... ...
... ... @@ -4,7 +4,7 @@ import "testing"
func TestErrorResult(t *testing.T) {
jsonByte := []byte(`[[{"Result":{"ResponseStatus":{"ErrorCode":500,"IsSuccess":false,"Errors":[{"FieldName":null,"Message":"元数据中标识为FUseOrg的字段不存在","DIndex":0}],"SuccessEntitys":[],"SuccessMessages":[],"MsgCode":9}}}]]`)
result := newQueryResult(jsonByte, "")
result := newBillQueryResult(jsonByte, "")
if !result.IsError() {
t.Error("没有正确识别错误的消息数据")
return
... ... @@ -24,7 +24,7 @@ func TestErrorResult(t *testing.T) {
func TestRightResult(t *testing.T) {
jsonByte := []byte(`[["xxx","abc",2345],["xxa","abc1",23457],["xxb","abc2",23458]]`)
result := newQueryResult(jsonByte, "name,desc,number")
result := newBillQueryResult(jsonByte, "name,desc,number")
if result.IsError() {
t.Error("数据解析失败")
return
... ...
## API
| 名称 | 链接 |
| -------------- | ---------------------------------------------------------------------------------- |
| _登陆验证接口_ | /Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc |
| _单据查询_ | /Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc |
| _元数据查询_ | /Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.QueryBusinessInfo.common.kdsvc |
| | |
| | |
## FORMID
| FORMID | 模块 | 备注 |
| :---------------- | --------------------------- | ---- |
| BD_MATERIAL | 基础管理-基础资料-物料 | |
| SAL_MATERIALGROUP | 基础管理-基础资料-物料-分组 | |
| | | |
## 物料字段描述(部分)
| 字段名 | 备注 |
| -------------------- | ------------------------------------------------------------------------------------------------------------- |
| FMATERIALID | 物料表主键 |
| FDocumentStatus | _数据状态,对应描述如下_ _"Z":暂存,"A":创建,"B":审核中,"C":已审核,"D":重新审核_ |
| FName | _物料名称_ |
| FNumber | _物料编码_ |
| FSpecification | _规格型号_ |
| FForbidStatus | _禁用状态,对应描述如下_"A":否,"B":是 |
| FErpClsID | _物料属性_ _10:资产,9:配置,2:自制,11:费用,12:模型,5:虚拟,7:一次性_ _12:产品系列,3:委外,4:特征,6:服务,1:外购_ |
| FBaseUnitId | _基本单位 id_ |
| FBaseUnitId.FName | _基本单位名称_ |
| FCreateDate | _创建日期 如:"2022-01-08T19:36:06.843"_ |
| FModifyDate | _修改日期 如: "2022-01-08T19:36:06.843"_ |
| FForbidDate | _禁用日期 如:"2022-01-08T19:36:06.843"_ |
| FApproveDate | _审核日期 如:"2022-01-08T19:36:06.843"_ |
| FMaterialGroup | _物料分组 id_ |
| FMaterialGroup.FName | _物料分组名称_ |
| FRefStatus | _是否使用_ _1:是,0:否_ |
| | |
### 分组列表字段描述
| 字段名 | 备注 | 类型 |
| --------- | --------- | -------- |
| FID | 表主键 id | 整型数字 |
| FNumber | 分组编码 | 字符串 |
| FName | 分组名称 | 字符串 |
| FParentId | 上级分组 | 字符串 |
| | | |
... ...