调用WebAPI保存方法返回报错
金蝶云社区-mommmmmm
mommmmmm
0人赞赏了该文章 1,814次浏览 未经作者许可,禁止转载编辑于2017年06月01日 09:40:06

调用一个K3cloud单据的webAPI保存方法:

data:Json格式数据(详情参考Json格式数据)(必录)
2.1.Creator: 创建者名字(非必录)
2.2.NeedUpDateFields: 需要保存的字段,格式["fieldkey1","fieldkey2","entitykey1",...],数组类型(非必录)
2.3.NeedReturnFields:需要返回的结果字段,格式["fieldkey","entitykey.fieldkey",...](非必录):
2.4.IsDeleteEntry:是否删除分录,默认True删除(非必录):
2.5.SubSystemId:菜单所在子系统Id(非必录):
2.6.Model: 表单实体数据(必录)

if (result == 1)
{
client.Save("WYK_YGGSD","{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"Model\":{\"FID\":\"0\",\"F_WYK_MD\":{\"FNumber\":\"\"},\"F_WYK_Date\":\"1900-01-01\",\"F_WYK_YGGS\":\"0\"}}");
}
最后在调用完之后返回失败:
[2017-06-01 09:24:25] post:{
"NeedUpDateFields": [
""
],
"Model": {
"F_WYK_MD": {
"FNumber": "112042"
},
"FID": "146139",
"F_WYK_Date": "2017/4/30 0:00:00",
"F_WYK_YGGS": "100"
}
}
[2017-06-01 09:24:25] retrun:{
"Result": {
"ResponseStatus": {
"ErrorCode": 500,
"IsSuccess": false,
"Errors": [
{
"FieldName": "您要读取的数据在系统中不存在,可能已经被删除![ID=146139,Type=WYK_YGGSD]",
"Message": "\r\nServer stack trace: \r\n 在 Kingdee.BOS.Orm.DataManager.DataManagerImplement.Read(Object oid, OperateOption option)\r\n 在 Kingdee.BOS.App.Core.BusinessDataReader.LoadSingle(Object pk, DynamicObjectType type, Boolean loadReferenceData, OperateOption option)\r\n 在 Kingdee.BOS.App.Core.ViewService.LoadSingle(Context ctx, Object pk, DynamicObjectType type, OperateOption option)\r\n\r\nException rethrown at [0]: \r\n 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n 在 Kingdee.BOS.Contracts.IViewService.LoadSingle(Context ctx, Object pk, DynamicObjectType type, OperateOption option)\r\n 在 Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.LoadSingle(Context ctx, Object pk, DynamicObjectType type, OperateOption option)\r\n 在 Kingdee.BOS.Model.Bill.BillModel.Load(Object pk)\r\n 在 Kingdee.BOS.WebApi.FormService.Save.Revole()\r\n 在 Kingdee.BOS.WebApi.FormService.Save.Execute()\r\n 在 Kingdee.BOS.WebApi.FormService.BillOperationService.ExecuteOperation(FormOperation op, String data)",
"DIndex": 0
}
],
"SuccessEntitys": [],
"SuccessMessages": []
}
}
}

下面是c#调用的接口代码:
//调用保存接口
var resultstr = client.Execute("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", new object[] { "WYK_YGGSD", jsonRoot });
jsonRoot的数据为:
{ "NeedUpDateFields": [ "" ], "Model": { "F_WYK_MD": { "FNumber": "112042" }, "FID": "146139", "F_WYK_Date": "2017/4/30 0:00:00", "F_WYK_YGGS": "100" }}

请问大神有没有知道问题出在哪?