0
This commit is contained in:
@@ -66,6 +66,13 @@ namespace Gatedge.K3Cloud.Utils
|
||||
orgNum: orgNum
|
||||
);
|
||||
this._userInfo = User;
|
||||
|
||||
_cloudApi.LoginByAppSecret(
|
||||
DBID,
|
||||
userName,
|
||||
kingdeeOption?.AppID,
|
||||
kingdeeOption?.AppSec,
|
||||
lcId);
|
||||
}
|
||||
|
||||
|
||||
@@ -157,16 +164,34 @@ namespace Gatedge.K3Cloud.Utils
|
||||
public ListResult QueryList(Query queryParam)
|
||||
{
|
||||
var datastr = queryParam.ToString();
|
||||
var resultString = _cloudApi.BillQuery(datastr);
|
||||
var ApiResult = _cloudApi.ExecuteBillQuery(datastr);
|
||||
|
||||
var resultString = Newtonsoft.Json.JsonConvert.SerializeObject(ApiResult);
|
||||
// 包含ErrorCode认定为失败
|
||||
if (resultString.Contains("ErrorCode"))
|
||||
{
|
||||
var errorResult = JsonSerializer.Deserialize<KingdeeResult>(resultString);
|
||||
var errResultString = Newtonsoft.Json.JsonConvert.SerializeObject(ApiResult.First().First());
|
||||
var errorResult = JsonSerializer.Deserialize<KingdeeResult>(errResultString);
|
||||
var responseStatus = errorResult?.Result?.ResponseStatus;
|
||||
Exception error = new K3CloudException("查看单据列表出错", responseStatus);
|
||||
throw error;
|
||||
}
|
||||
List<Dictionary<string, object>>? result = JsonSerializer.Deserialize<List<Dictionary<string, object>>>(resultString);
|
||||
var fieldKeys = queryParam?.FieldKeys?.Split(',').ToList();
|
||||
if (fieldKeys == null || fieldKeys.Count == 0)
|
||||
{
|
||||
return new ListResult(new List<Dictionary<string, object>>());
|
||||
}
|
||||
List<Dictionary<string, object>> result = new List<Dictionary<string, object>>();
|
||||
foreach (var item in ApiResult)
|
||||
{
|
||||
var line = new Dictionary<string, object>();
|
||||
foreach (var fieldkey in fieldKeys)
|
||||
{
|
||||
var index = fieldKeys.IndexOf(fieldkey);
|
||||
line.Add(fieldkey, item[index]);
|
||||
}
|
||||
result.Add(line);
|
||||
}
|
||||
return new ListResult(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Gatedge.K3Cloud.Utils.Model.K3Request
|
||||
/// 过滤条件
|
||||
/// </summary>
|
||||
//public List<FilterItem>? FilterString { get; set; }
|
||||
public List<FilterItem>? FilterString { get; set; }
|
||||
public string? FilterString { get; set; }
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user