点巡检复核
This commit is contained in:
@@ -84,25 +84,47 @@ namespace Tnb.BasicData
|
||||
public async Task<dynamic> GetMaterialSelectInfo(MaterialSelectQueryInput queryInput)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
List<string> ids = await GetAllChildrenMaterialId(queryInput.ebom_id,0);
|
||||
BasEbomH ebom = await db.Queryable<BasEbomH>().Where(x => x.id == queryInput.ebom_id).SingleAsync();
|
||||
ids.Add(ebom.material_id);
|
||||
var result = await db.Queryable<BasMaterial>()
|
||||
.LeftJoin<DictionaryDataEntity>((a, b) => a.unit_id == b.EnCode)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => b.DictionaryTypeId == c.Id && c.EnCode == DictConst.MeasurementUnit && c.DeleteMark == null)
|
||||
.WhereIF(!string.IsNullOrEmpty(queryInput.material_info), (a, b, c) => a.code.Contains(queryInput.material_info) || a.name.Contains(queryInput.material_info))
|
||||
.WhereIF(!string.IsNullOrEmpty(queryInput.ebom_id), (a, b, c) => ids.Contains(a.id))
|
||||
.Select((a, b, c) => new MaterialSelectOutput()
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
descrip = a.descrip,
|
||||
unit_id = a.unit_id,
|
||||
unit_name = b.FullName,
|
||||
}).ToPagedListAsync(queryInput.currentPage, queryInput.pageSize);
|
||||
if (!string.IsNullOrEmpty(queryInput.ebom_id))
|
||||
{
|
||||
List<string> ids = await GetAllChildrenMaterialId(queryInput.ebom_id,0);
|
||||
BasEbomH ebom = await db.Queryable<BasEbomH>().Where(x => x.id == queryInput.ebom_id).SingleAsync();
|
||||
ids.Add(ebom.material_id);
|
||||
var result = await db.Queryable<BasMaterial>()
|
||||
.LeftJoin<DictionaryDataEntity>((a, b) => a.unit_id == b.EnCode)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => b.DictionaryTypeId == c.Id && c.EnCode == DictConst.MeasurementUnit && c.DeleteMark == null)
|
||||
.WhereIF(!string.IsNullOrEmpty(queryInput.material_info), (a, b, c) => a.code.Contains(queryInput.material_info) || a.name.Contains(queryInput.material_info))
|
||||
.WhereIF(!string.IsNullOrEmpty(queryInput.ebom_id), (a, b, c) => ids.Contains(a.id))
|
||||
.Select((a, b, c) => new MaterialSelectOutput()
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
descrip = a.descrip,
|
||||
unit_id = a.unit_id,
|
||||
unit_name = b.FullName,
|
||||
}).ToPagedListAsync(queryInput.currentPage, queryInput.pageSize);
|
||||
|
||||
return PageResult<MaterialSelectOutput>.SqlSugarPageResult(result);
|
||||
return PageResult<MaterialSelectOutput>.SqlSugarPageResult(result);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = await db.Queryable<BasMaterial>()
|
||||
.LeftJoin<DictionaryDataEntity>((a, b) => a.unit_id == b.EnCode)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => b.DictionaryTypeId == c.Id && c.EnCode == DictConst.MeasurementUnit && c.DeleteMark == null)
|
||||
.WhereIF(!string.IsNullOrEmpty(queryInput.material_info), (a, b, c) => a.code.Contains(queryInput.material_info) || a.name.Contains(queryInput.material_info))
|
||||
.Select((a, b, c) => new MaterialSelectOutput()
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
descrip = a.descrip,
|
||||
unit_id = a.unit_id,
|
||||
unit_name = b.FullName,
|
||||
}).ToPagedListAsync(queryInput.currentPage, queryInput.pageSize);
|
||||
|
||||
return PageResult<MaterialSelectOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user