Commit 8dae8a1b by jiawei.su

someupdate

parent 09f1d9db
......@@ -361,7 +361,17 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult GetLocationList(string productcode, int fillsn=0)
{
return new ObjectResult(_autoLocationRepository.GetDataList(ProjectId, fillsn, productcode).ToList());
var locations = _autoLocationRepository.GetFulllocation(ProjectId, fillsn);
return new ObjectResult(locations);
//if (fillsn == 1)
//{
// var locations = _autoLocationRepository.GetFulllocation(ProjectId,fillsn);
// return new ObjectResult(locations);
//}
//else
//{
// return new ObjectResult(_autoLocationRepository.GetDataList(ProjectId, fillsn, productcode).ToList());
//}
}
}
}
......@@ -134,7 +134,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
producExpression = q => q.productcode==productcode;
}
var expression = locationidExpression.And(producExpression);
var entities = query.Where(expression).GroupBy(g=>g.typeid).Select(f=>f.FirstOrDefault());
var entities = query.Where(expression);
return entities;
}
......@@ -210,5 +210,33 @@ namespace Siger.Middlelayer.AccRepository.Repositories
throw;
}
}
public IEnumerable<ResponseAutomationLocationList> GetFulllocation(int projectId,int full)
{
var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
where q.projectId==projectId && !string.IsNullOrEmpty(q.sn)
select new ResponseAutomationLocationList
{
id = q.id,
typeid = t.id,
fixtureguid = t.guid,
locationid = q.locationid,
fixturetoolid = t.id,
code = t.code,
name = t.name,
materialsn =q.sn
};
Expression<Func<ResponseAutomationLocationList, bool>> locationidExpression = f => true;
if (full != 0)
{
locationidExpression = q => !string.IsNullOrEmpty(q.materialsn);
}else
{
locationidExpression = q => string.IsNullOrEmpty(q.materialsn);
}
return query.Where(locationidExpression);
}
}
}
......@@ -25,5 +25,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
IEnumerable<siger_wms_storage_location> GetLocationList(int projectid);
CommonImportResult ImportData(IEnumerable<AutomationLocationTemplate> list, int projectid, int userid);
IEnumerable<ResponseAutomationLocationList> GetFulllocation(int projectId, int full);
}
}
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