K3Cloud服务操作接口(ExcuteOperation)实战及更新冻结人字段
//Cloud禁用(Forbid:禁用)
cloudResult = ICloudLinkBll.CloudExcuteOperation(this._formId, "Forbid", "{\"CreateOrgId\":0,\"Numbers\":[\"" + retData.erpCode + "\"],\"Ids\":\"" + retData.id + "\"}");
retModel = CloudResultFormat(cloudResult, retData);
/// <summary>
/// 格化k3Cloud接口返回信息
/// </summary>
/// <param name="cloudResult">k3cloud webapi返回的接口调用信息</param>
/// <param name="retData">组装完成的数据</param>
/// <returns></returns>
private CloudRetModel CloudResultFormat(CloudResult cloudResult, MdmInModel retData)
{
var t = cloudResult.ToJson();
CloudRetModel ret = new CloudRetModel();
if (cloudResult.Result.ResponseStatus.IsSuccess != null
&& cloudResult.Result.ResponseStatus.IsSuccess.ToLower() == Define.CLOUDRESULT_RESPONSESTATUS_ISSUCCESS_TRUE
)
{
var strFId = cloudResult.Result.ResponseStatus.SuccessEntitys[0].Id;
var strFBillNo = string.Join(",", cloudResult.Result.ResponseStatus.SuccessEntitys
.Where(p => !string.IsNullOrEmpty(p.Number))
.GroupBy(t => t.Number.ToString()).Select(t => t.Key).ToList()
);
ret.IsSuccess = true;
ret.FBillNo = string.IsNullOrEmpty(strFBillNo) ? retData.erpCode : strFBillNo;
//ret.FBillNo = string.IsNullOrEmpty(strFBillNo)? (retData==null ?string.Empty: retData.erpCode) : strFBillNo;
ret.Ids = strFId;
ret.Detail = $"CLOUD单据生成成功_单据编号【{ret.FBillNo}】,FID【{strFId}】";
}
else
{
var crmErrMes = "";
foreach (var i in cloudResult.Result.ResponseStatus.Errors)
{
crmErrMes = $"{crmErrMes} {i.FieldName}_{(i.Message == null ? "" : i.Message)}";
}
//只是便于查看错误!!!
var tmpResult = $"原始cloudSaveRes:{cloudResult.ToJson()}";
ret.IsSuccess = false;
ret.Detail = $"CLOUD单据生成失败,formId:【{_formId}】,{crmErrMes}";
}
return ret;
}
K3Cloud服务操作接口(ExcuteOperation)实战及更新冻结人字段
本文2024-09-16 17:46:03发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-17802.html