Commit ee0f5d9d by xin.yang

fix bug

parent 9d78ae09
...@@ -38,6 +38,7 @@ namespace Siger.ApiACC.Controllers ...@@ -38,6 +38,7 @@ namespace Siger.ApiACC.Controllers
_routeRepository = routeRepository; _routeRepository = routeRepository;
} }
[HttpGet]
public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize) public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize)
{ {
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize); var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize);
...@@ -61,18 +62,6 @@ namespace Siger.ApiACC.Controllers ...@@ -61,18 +62,6 @@ namespace Siger.ApiACC.Controllers
{ {
item.materialstate = 4;//无工装有工件 item.materialstate = 4;//无工装有工件
} }
var monitor = _fixtureMonitor.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.locationId == item.locationid).
OrderByDescending(q => q.updatetime).FirstOrDefault();
if(monitor != null)
{
item.sn = monitor.sn;
var route = _routeRepository.Get(q => q.id == monitor.route && q.projectId == ProjectId && q.status == (int)RowState.Valid);
if(route != null)
{
item.route = route.name;
item.routenumber = route.serialNumber.ToString();
}
}
var loca = locations.FirstOrDefault(q => q.locationid == item.locaid); var loca = locations.FirstOrDefault(q => q.locationid == item.locaid);
if(loca != null) if(loca != null)
......
...@@ -30,6 +30,10 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -30,6 +30,10 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join w in _context.siger_wms_storage on l.storageid equals w.id join w in _context.siger_wms_storage on l.storageid equals w.id
join u in _context.siger_project_user on q.updator equals u.mid into uu join u in _context.siger_project_user on q.updator equals u.mid into uu
from u in uu.DefaultIfEmpty() from u in uu.DefaultIfEmpty()
join m in _context.siger_automation_fixture_tools_moniter on q.fixturetools equals m.fixtureguid into mm
from m in mm.DefaultIfEmpty()
join r in _context.siger_project_product_route on m.route equals r.id into rr
from r in rr.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocation select new ResponseAutomationLocation
{ {
...@@ -49,7 +53,10 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -49,7 +53,10 @@ namespace Siger.Middlelayer.AccRepository.Repositories
remark = q.remark, remark = q.remark,
updator = u.name ?? "", updator = u.name ?? "",
status = q.status, status = q.status,
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 ?? "",
route = r.name ?? "",
routenumber = r == null ? "" : r.serialNumber.ToString()
}; };
Expression<Func<ResponseAutomationLocation, bool>> wavehouseidExpression = f => true; Expression<Func<ResponseAutomationLocation, bool>> wavehouseidExpression = f => true;
if (wavehouseid > 0) if (wavehouseid > 0)
...@@ -84,6 +91,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -84,6 +91,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join c in _context.siger_automation_fixture_tools_category on t.category equals c.guid join c in _context.siger_automation_fixture_tools_category on t.category equals c.guid
join l in _context.siger_wms_storage_location on q.locationid equals l.locationid join l in _context.siger_wms_storage_location on q.locationid equals l.locationid
join w in _context.siger_wms_storage on l.storageid equals w.id join w in _context.siger_wms_storage on l.storageid equals w.id
join m in _context.siger_automation_fixture_tools_moniter on q.fixturetools equals m.fixtureguid into mm
from m in mm.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocationList select new ResponseAutomationLocationList
{ {
...@@ -97,9 +106,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -97,9 +106,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
fixturetoolid = t.id, fixturetoolid = t.id,
code = t.code, code = t.code,
name = t.name, name = t.name,
materialsn = "TestData" materialsn = m.sn ?? ""
}; };
var entities = query.OrderByDescending(q => q.id).AsNoTracking().ToList(); var entities = query.AsNoTracking().ToList();
return entities; return entities;
} }
} }
......
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