diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListOutput.cs index c522a234..11d503c0 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListOutput.cs @@ -12,5 +12,7 @@ namespace Tnb.ProductionMgr.Entities.Dto public string? end_repair_time { get; set; } public string? confirm_time { get; set; } public string status { get; set; } + public string breakdown_name { get; set; } + public string andon_type_name { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs index 9ef16b97..d2d2ce09 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs @@ -116,8 +116,10 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b, c, d) => a.create_id == d.Id) .LeftJoin((a, b, c, d, e) => e.EnCode == DictConst.AndonStatus) .LeftJoin((a, b, c, d, e, f) => a.status == f.EnCode && e.Id == f.DictionaryTypeId) + .LeftJoin((a,b,c,d,e,f,g)=>a.breakdown==g.id) + .LeftJoin((a,b,c,d,e,f,g,h)=>a.andon_type_id==h.id) .WhereIF(statusList.Count > 0, a => statusList.Contains(a.status)) - .Select((a, b, c, d, e, f) => new AndonPadListOutput + .Select((a, b, c, d, e, f,g,h) => new AndonPadListOutput { id = a.id, andon_info_name = b.name, @@ -129,6 +131,8 @@ namespace Tnb.ProductionMgr end_repair_time = a.end_repair_time == null ? "" : a.end_repair_time.Value.ToString(DbTimeFormat.SS), confirm_time = a.confirm_time == null ? "" : a.confirm_time.Value.ToString(DbTimeFormat.SS), status = f.FullName, + andon_type_name = h.name, + breakdown_name = g.name }) .MergeTable() .OrderBy($"{input.sidx} {input.sort}") @@ -142,7 +146,10 @@ namespace Tnb.ProductionMgr public async Task AddAndon(AddAndonInput input) { AndonInfo andonInfo = await _db.Queryable().SingleAsync(x => x.id == input.andon_info_id); + AndonBreakDown andonBreakDown = await _db.Queryable().SingleAsync(x => x.id == input.andon_breakdown_id); AndonRecords andonRecords = input.Adapt(); + andonRecords.breakdown = input.andon_breakdown_id; + andonRecords.breakdown_type = andonBreakDown?.type_id; DbResult result = await _db.Ado.UseTranAsync(async () => { @@ -279,6 +286,7 @@ namespace Tnb.ProductionMgr { _ = await _db.Updateable() .SetColumns(x => x.repair_id == _userManager.UserId) + .SetColumns(x=>x.status==DictConst.AndonStatusYXY) .SetColumns(x => x.response_time == DateTime.Now) .ExecuteCommandAsync(); Dictionary postData = new() @@ -320,6 +328,7 @@ namespace Tnb.ProductionMgr { _ = await _db.Updateable() .SetColumns(x => x.start_repair_time == DateTime.Now) + .SetColumns(x=>x.status==DictConst.AndonStatusCLZ) .Where(x => x.id == id) .ExecuteCommandAsync(); return true; @@ -356,6 +365,7 @@ namespace Tnb.ProductionMgr { _ = await _db.Updateable() .SetColumns(x => x.end_repair_time == DateTime.Now) + .SetColumns(x=>x.status==DictConst.AndonStatusDQR) .Where(x => x.id == id) .ExecuteCommandAsync(); return true; @@ -392,6 +402,7 @@ namespace Tnb.ProductionMgr { _ = await _db.Updateable() .SetColumns(x => x.confirm_time == DateTime.Now) + .SetColumns(x=>x.status==DictConst.AndonStatusYWC) .Where(x => x.id == id) .ExecuteCommandAsync(); return true;