This commit is contained in:
2023-05-31 14:46:11 +08:00
parent ea3a325ecb
commit 9057618966

View File

@@ -90,8 +90,8 @@ namespace Tnb.BasicData
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)
.LeftJoin<DictionaryTypeEntity>((a, b) => b.EnCode == DictConst.MeasurementUnit && b.DeleteMark == null)
.LeftJoin<DictionaryDataEntity>((a, b, c) => c.DictionaryTypeId == b.Id && a.unit_id == c.EnCode)
.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()
@@ -101,7 +101,7 @@ namespace Tnb.BasicData
name = a.name,
descrip = a.descrip,
unit_id = a.unit_id,
unit_name = b.FullName,
unit_name = c.FullName,
}).ToPagedListAsync(queryInput.currentPage, queryInput.pageSize);
return PageResult<MaterialSelectOutput>.SqlSugarPageResult(result);
@@ -110,8 +110,8 @@ namespace Tnb.BasicData
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)
.LeftJoin<DictionaryTypeEntity>((a, b) => b.EnCode == DictConst.MeasurementUnit && b.DeleteMark == null)
.LeftJoin<DictionaryDataEntity>((a, b, c) => c.DictionaryTypeId == b.Id && a.unit_id == c.EnCode)
.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()
{
@@ -120,7 +120,7 @@ namespace Tnb.BasicData
name = a.name,
descrip = a.descrip,
unit_id = a.unit_id,
unit_name = b.FullName,
unit_name = c.FullName,
}).ToPagedListAsync(queryInput.currentPage, queryInput.pageSize);
return PageResult<MaterialSelectOutput>.SqlSugarPageResult(result);