65.1、WebApi,保存接口,NeedReturnFields,需返回结果的字段原创
15人赞赏了该文章
1万次浏览
编辑于2021年06月22日 13:41:56
业务场景:用WebApi,新增采购订单
1、修改 第 62 节代码
private void button1_Click(object sender, EventArgs e) { K3CloudApiClient client = new K3CloudApiClient("http://127.0.0.1/K3Cloud/"); var loginResult = client.ValidateLogin("5c52e430f93eb6", "Administrator", "88888888", 2052); var resultType = JObject.Parse(loginResult)["LoginResultType"].Value<int>(); //登录结果类型等于1,代表登录成功 if (resultType == 1) { this.textBox2.Text = client.Save("PUR_PurchaseOrder", this.textBox1.Text); } else { this.textBox2.Text = "登录失败"; } }
采购订单,唯一标识 PUR_PurchaseOrder
2、点启动,Json去掉 NeedReturnFields,返回结果如下图,空
{ "Creator": "", "Model": { "FBillTypeID": { "FNUMBER": "CGDD01_SYS" }, "FDate": "2020-07-18", "FSupplierId": { "FNumber": "001" }, "FPurchaseOrgId": { "FNumber": "100" }, "FPOOrderFinance": { "FSettleCurrId": { "FNumber": "PRE001" }, "FEXCHANGETYPEID": { "FNumber": "HLTX01_SYS" }, "FEXCHANGERATE": 1 }, "FPOOrderEntry": [{ "FMaterialId": { "FNumber": "001" }, "FPriceUnitId": { "FNumber": "Pcs" }, "FQty": 300.0, "FTaxPrice": 10, "FEntryTaxRate": 17.00 }] } }
3、点启动,Json 加上 NeedReturnFields,返回结果如下图
{ "Creator": "", "NeedReturnFields":[ "FID","FBillNo","FPOOrderEntry.FENTRYID","FPOOrderEntry.FMaterialID"], "Model": { "FBillTypeID": { "FNUMBER": "CGDD01_SYS" }, "FDate": "2020-07-18", "FSupplierId": { "FNumber": "001" }, "FPurchaseOrgId": { "FNumber": "100" }, "FPOOrderFinance": { "FSettleCurrId": { "FNumber": "PRE001" }, "FEXCHANGETYPEID": { "FNumber": "HLTX01_SYS" }, "FEXCHANGERATE": 1 }, "FPOOrderEntry": [{ "FMaterialId": { "FNumber": "001" }, "FPriceUnitId": { "FNumber": "Pcs" }, "FQty": 300.0, "FTaxPrice": 10, "FEntryTaxRate": 17.00 }] } }
NeedReturnFields:需返回结果的字段集合,数组类型,
格式:[key,entitykey.key,...](非必录) 注(返回单据体字段格式:entitykey.key)
单据体标识 FPOOrderEntry
4、添加需要返回的值 数量 FQty
"Creator": "", "NeedReturnFields": [ "FID", "FBillNo", "FPOOrderEntry.FENTRYID", "FPOOrderEntry.FMaterialID", "FQty" ], "Model": { "FBillTypeID": { "FNUMBER": "CGDD01_SYS" }, "FDate": "2020-07-18", "FSupplierId": { "FNumber": "001" }, "FPurchaseOrgId": { "FNumber": "100" }, "FPOOrderFinance": { "FSettleCurrId": { "FNumber": "PRE001" }, "FEXCHANGETYPEID": { "FNumber": "HLTX01_SYS" }, "FEXCHANGERATE": 1 }, "FPOOrderEntry": [ { "FMaterialId": { "FNumber": "001" }, "FPriceUnitId": { "FNumber": "Pcs" }, "FQty": 300, "FTaxPrice": 10, "FEntryTaxRate": 17 }
视频下载链接:
链接:https://pan.baidu.com/s/1mqafW_phsRbs7MDB3QLkeA
提取码:KISS
总目录链接
赞 15
15人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读