销售订单WebAPI-提示字段“销售员”是必填项
金蝶云社区-133xxxx4638
133xxxx4638
0人赞赏了该文章 2,271次浏览 未经作者许可,禁止转载编辑于2016年06月08日 11:19:38

代码如下:
try
{
//管理中心站点
ApiClient client = new ApiClient(WebAPIConfig.CloudUrl);
//调用登录接口,参数,数据中心ID,用户名,密码,语言id
bool ret = client.Login(WebAPIConfig.DbId, WebAPIConfig.UserName, WebAPIConfig.PassWord, WebAPIConfig.Lcid);
//登录成功
if (ret)
{
string strJson = JsonConvert.SerializeObject(saveModel);
object[] subInfo = new object[]
{
sFormId,
strJson
};
var strRet = client.Execute("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", subInfo);
WriteLog.WriteLogAndTime("WebAPI Msg" + strRet);
RetObject retObject = JsonConvert.DeserializeObject(strRet);
if (!retObject.Result.ResponseStatus.IsSuccess)
{
throw new Exception("接口错误!");
}
}
}
catch (Exception ex)
{
WriteLog.WriteLogAndTime("WebAPI接口错误" + ex.Message);
throw new Exception("接口错误" + ex.Message);
}

请求Json串
"{\"Creator\":\"Demo\",\"NeedUpDateFields\":[\"\"],\"Model\":{\"FID\":0,\"FBUSINESSTYPE\":\"NORMAL\",\"FBillTypeID\":{\"FNumber\":\"XSDD01_SYS\"},\"FSaleOrderFinance\":{\"FExchangeRate\":1},\"FDATE\":\"2016-06-08 11:05:41.914\",\"FMODIFYDATE\":\"2016-06-08 11:05:41.914\",\"FsaleDeptID\":{\"FNumber\":\"BM000001\"},\"FcustID\":{\"FNumber\":\"CUST0001\"},\"FSalerId\":{\"FNumber\":\"20140822\"},\"FSaleOrderEntry\":[{\"FID\":0,\"FMaterialID\":{\"FNUMBER\":\"1.01.0012222\"},\"FQty\":3.0,\"FBASEUNITQTY\":3.0,\"FTaxPrice\":100.0,\"FPriceUnitQty\":3.0},{\"FID\":0,\"FMaterialID\":{\"FNUMBER\":\"1.01.0012222\"},\"FQty\":9.0,\"FBASEUNITQTY\":9.0,\"FTaxPrice\":2300.0,\"FPriceUnitQty\":9.0}]}}"

返回Json串
"{\"Result\":{\"ResponseStatus\":{\"ErrorCode\":500,\"IsSuccess\":false,\"Errors\":[{\"FieldName\":\"FSalerId\",\"Message\":\"字段“销售员”是必填项\"},{\"FieldName\":\"FSaleOrderEntry\",\"Message\":\"分录实体“订单明细”是必填项\"},{\"FieldName\":\"AbstractInteractionResult\",\"Message\":
\"AbstractInteractionResult.InteractionContext is null\"}]},\"Id\":\"\"}}"

在这请求Json串里边包含FSalerId(销售员)字段,FSaleOrderEntry(单据明细)也存在。为什么还这样提示,这是哪里不对哦?