Commit 6265e4e7 by xin.yang

fix bug

parent 99b73ad8
...@@ -44,7 +44,8 @@ namespace Siger.ApiACC.Controllers ...@@ -44,7 +44,8 @@ namespace Siger.ApiACC.Controllers
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize); var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize);
var list = new List<ResponseAutomationLocation>(); var list = new List<ResponseAutomationLocation>();
var locations = _autoLocationRepository.GetLocationList(ProjectId); 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)) if(item.fixturetoolid > 0 && string.IsNullOrEmpty(item.sn))
{ {
...@@ -70,9 +71,23 @@ namespace Siger.ApiACC.Controllers ...@@ -70,9 +71,23 @@ namespace Siger.ApiACC.Controllers
var locationIds = locas.Select(q => q.id).ToList(); var locationIds = locas.Select(q => q.id).ToList();
locationIds.Distinct().Reverse(); locationIds.Distinct().Reverse();
item.locationIds = locationIds; 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(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)
{
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) private IEnumerable<siger_wms_storage_location> GetParentLocations(int pid, IEnumerable<siger_wms_storage_location> types)
......
...@@ -53,7 +53,7 @@ namespace Siger.ApiACC.Controllers ...@@ -53,7 +53,7 @@ namespace Siger.ApiACC.Controllers
list.Add(item); 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) 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 ...@@ -56,7 +56,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "", updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "",
sn = m.sn ?? "", sn = m.sn ?? "",
route = r.name ?? "", 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; Expression<Func<ResponseAutomationLocation, bool>> wavehouseidExpression = f => true;
if (wavehouseid > 0) if (wavehouseid > 0)
......
...@@ -50,6 +50,8 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -50,6 +50,8 @@ namespace Siger.Middlelayer.AccRepository.Response
public int status { get; set; } public int status { get; set; }
public List<int> locationIds { get; set; } = new List<int>(); 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 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