调整在线开发,组织获取关联工序列表代码
This commit is contained in:
@@ -28,6 +28,12 @@ namespace Tnb.BasicData.Entities
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string process_id { get; set; }
|
||||
/// <summary>
|
||||
/// 工序编码
|
||||
/// </summary>
|
||||
public string process_code { get; set; }
|
||||
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// Desc:工序代码
|
||||
@@ -42,6 +48,10 @@ namespace Tnb.BasicData.Entities
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string station_id { get; set; }
|
||||
/// <summary>
|
||||
/// 工位编码
|
||||
/// </summary>
|
||||
public string station_code { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// Desc:工位代码
|
||||
|
||||
@@ -62,35 +62,42 @@ namespace Tnb.BasicData
|
||||
/// <returns></returns>
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var result = new List<ProcessListOutput>();
|
||||
var result = new SqlSugarPagedList<ProcessListOutput>();
|
||||
var db = _repository.AsSugarClient();
|
||||
var organize = await db.Queryable<OrganizeEntity>().FirstAsync(it => it.EnCode == input.station_code && it.Category == DictConst.RegionCategoryStationCode);
|
||||
if (organize != null)
|
||||
{
|
||||
var processIds = await db.Queryable<BasProcessStation>().Where(it => it.station_id == organize.Id).Select(it => it.process_id).ToListAsync();
|
||||
if (processIds?.Count > 0)
|
||||
var whereExpr = Expressionable.Create<BasProcess, BasProcessStation>();
|
||||
var curProcessIds = await db.Queryable<BasProcessStation>().Where(it => it.station_id == organize.Id).Select(it => it.process_id).ToListAsync();
|
||||
if (curProcessIds?.Count > 0)
|
||||
{
|
||||
result = await db.Queryable<BasProcess>().Where(it => processIds.Contains(it.id)).Select(it => new ProcessListOutput
|
||||
{
|
||||
id = it.id,
|
||||
process_code = it.process_code,
|
||||
process_name = it.process_name,
|
||||
process_collection = it.process_collection,
|
||||
status = it.status,
|
||||
station = it.station,
|
||||
must_pass = it.must_pass,
|
||||
defective_products_put_into_production = it.defective_products_put_into_production,
|
||||
single_scan_type = it.single_scan_type,
|
||||
only_scan_type = it.only_scan_type,
|
||||
material_traced_back_relationship = it.material_traced_back_relationship,
|
||||
report_template = it.report_template,
|
||||
descrip = it.descrip,
|
||||
org_id = it.org_id,
|
||||
create_id = it.create_id,
|
||||
modify_id = it.modify_id,
|
||||
modify_time = it.modify_time,
|
||||
}).ToListAsync();
|
||||
whereExpr = whereExpr.And((a, b) => curProcessIds.Contains(a.id)).Or((a, b) => string.IsNullOrEmpty(b.process_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
whereExpr = whereExpr.And((a, b) => string.IsNullOrEmpty(b.process_id));
|
||||
}
|
||||
result = await db.Queryable<BasProcess>().LeftJoin<BasProcessStation>((a, b) => a.id == b.process_id).Where(whereExpr.ToExpression()).Select(a => new ProcessListOutput
|
||||
{
|
||||
id = a.id,
|
||||
process_code = a.process_code,
|
||||
process_name = a.process_name,
|
||||
process_collection = a.process_collection,
|
||||
status = a.status,
|
||||
station = a.station,
|
||||
must_pass = a.must_pass,
|
||||
defective_products_put_into_production = a.defective_products_put_into_production,
|
||||
single_scan_type = a.single_scan_type,
|
||||
only_scan_type = a.only_scan_type,
|
||||
material_traced_back_relationship = a.material_traced_back_relationship,
|
||||
report_template = a.report_template,
|
||||
descrip = a.descrip,
|
||||
org_id = a.org_id,
|
||||
create_id = a.create_id,
|
||||
modify_id = a.modify_id,
|
||||
modify_time = a.modify_time,
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user