Commit 6265e4e7 by xin.yang

fix bug

parent 99b73ad8
......@@ -44,7 +44,8 @@ namespace Siger.ApiACC.Controllers
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize);
var list = new List<ResponseAutomationLocation>();
var locations = _autoLocationRepository.GetLocationList(ProjectId);
foreach(var item in data.Data)
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
foreach (var item in data.Data)
{
if(item.fixturetoolid > 0 && string.IsNullOrEmpty(item.sn))
{
......@@ -71,8 +72,22 @@ namespace Siger.ApiACC.Controllers
locationIds.Distinct().Reverse();
item.locationIds = locationIds;
}
var cates = GetParentCategoryList(item.cate_guid, categorys);
var cateIds = cates.Select(q => q.id).ToList();
cateIds.Reverse();
item.categoryIds = cateIds;
list.Add(item);
}
return new PagedObjectResult(list, data.Total, page, pagesize);
}
return new PagedObjectResult(data.Data, data.Total, page, pagesize);
private IEnumerable<siger_automation_fixture_tools_category> GetParentCategoryList(string parentId, List<siger_automation_fixture_tools_category> sections)
{
var query = from c in sections where c.guid == parentId select c;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentCategoryList(t.parent, sections)));
}
private IEnumerable<siger_wms_storage_location> GetParentLocations(int pid, IEnumerable<siger_wms_storage_location> types)
......
......@@ -53,7 +53,7 @@ namespace Siger.ApiACC.Controllers
list.Add(item);
}
return new PagedObjectResult(data.Data, data.Total, page, pagesize);
return new PagedObjectResult(list, data.Total, page, pagesize);
}
private IEnumerable<siger_automation_fixture_tools_category> GetParentCategoryList(string parentId, List<siger_automation_fixture_tools_category> sections)
......
......@@ -56,7 +56,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "",
sn = m.sn ?? "",
route = r.name ?? "",
routenumber = r == null ? "" : r.serialNumber.ToString()
routenumber = r == null ? "" : r.serialNumber.ToString(),
cate_guid = c.guid ?? ""
};
Expression<Func<ResponseAutomationLocation, bool>> wavehouseidExpression = f => true;
if (wavehouseid > 0)
......
......@@ -50,6 +50,8 @@ namespace Siger.Middlelayer.AccRepository.Response
public int status { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public List<int> categoryIds { get; set; } = new List<int>();
public string cate_guid { get; set; }
}
public class ResponseAutomationLocationList
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment