1
This commit is contained in:
@@ -687,6 +687,27 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工位id获取车间信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetWorkshopByWorkstationId(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
var db = _repository.AsSugarClient();
|
||||
OrganizeEntity organizeEntity = await db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == id);
|
||||
if (organizeEntity != null && !string.IsNullOrEmpty(organizeEntity.OrganizeIdTree))
|
||||
{
|
||||
string[] arr = organizeEntity.OrganizeIdTree.Split(",");
|
||||
return await db.Queryable<OrganizeEntity>().SingleAsync(x => arr.Contains(x.Id) && x.Category == DictConst.RegionCategoryWorkshopCode);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ using Mapster;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -559,7 +560,17 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
|
||||
{
|
||||
try
|
||||
{
|
||||
return (await Preview(id, input)).ToObject<List<Dictionary<string, object>>>().FirstOrDefault().Keys.ToList();
|
||||
//modifyby zhoukeda 20230803
|
||||
var result = await Preview(id, input);
|
||||
if (result is DataTable)
|
||||
{
|
||||
List<Dictionary<string,Object>> list = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(JsonConvert.SerializeObject(result));
|
||||
return list.FirstOrDefault()?.Keys.ToList() ?? Enumerable.Empty<string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
return result.ToObject<List<Dictionary<string, object>>>().FirstOrDefault().Keys.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user