K3 Cloud系统集成,上传附件报错, 哪位大神帮看下, 要去Demo下, 之前3.0可以,现在升级到5.0+最新补丁似乎不行,
是否语法有变。
{"远程服务器返回错误: (500) 内部服务器错误。"}
代码如下:
using (var query = QueryServiceProxy.Create(formId, fields, client))
{
var orderstring = "FBillNo ASC";
var filterstring = string.Format("FBillNo = '{0}'", billNo);
obj = query.Query(filterstring, orderstring, null);
}
// client.Dispose();
if (obj == null || obj.Count <= 0)
return false;
save.Model.FInterID = obj[0][0].ToString();//单据内码
save.Model.FEntryInterID = "-1";// 不是单据体分录附件,需要设置-1
save.Model.FBillType = "ER_ExpReimbursement";//单据类型,;费用报销单
save.Model.FBillNo = billNo;//单据编号
string filePath = doc.DocType.ImagePath;//文件路径
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
BinaryReader br = new BinaryReader(fs);
save.Model.FAttachment = br.ReadBytes((int)fs.Length);// 附件内容
save.Model.FAttachmentName = fs.Name.Substring(fs.Name.LastIndexOf('\\') + 1);
save.Model.FAttachmentSize = Convert.ToString(Math.Round((Decimal)fs.Length / 1024, 2));
save.Model.FExtName = fs.Name.Substring(fs.Name.LastIndexOf('.'));
}
var ret = client.Send
}
catch (Exception ex)
{
externalOutParams["ErrorMsg"] = ex.Message;
return false;
}
推荐阅读