This commit is contained in:
2023-12-05 14:14:58 +08:00
parent a07768b4af
commit 1ee00e692a
2 changed files with 14 additions and 1 deletions

View File

@@ -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; }
}
}

View File

@@ -116,8 +116,10 @@ namespace Tnb.ProductionMgr
.LeftJoin<UserEntity>((a, b, c, d) => a.create_id == d.Id)
.LeftJoin<DictionaryTypeEntity>((a, b, c, d, e) => e.EnCode == DictConst.AndonStatus)
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f) => a.status == f.EnCode && e.Id == f.DictionaryTypeId)
.LeftJoin<AndonBreakDown>((a,b,c,d,e,f,g)=>a.breakdown==g.id)
.LeftJoin<AndonType>((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<dynamic> AddAndon(AddAndonInput input)
{
AndonInfo andonInfo = await _db.Queryable<AndonInfo>().SingleAsync(x => x.id == input.andon_info_id);
AndonBreakDown andonBreakDown = await _db.Queryable<AndonBreakDown>().SingleAsync(x => x.id == input.andon_breakdown_id);
AndonRecords andonRecords = input.Adapt<AndonRecords>();
andonRecords.breakdown = input.andon_breakdown_id;
andonRecords.breakdown_type = andonBreakDown?.type_id;
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
{
@@ -279,6 +286,7 @@ namespace Tnb.ProductionMgr
{
_ = await _db.Updateable<AndonRecords>()
.SetColumns(x => x.repair_id == _userManager.UserId)
.SetColumns(x=>x.status==DictConst.AndonStatusYXY)
.SetColumns(x => x.response_time == DateTime.Now)
.ExecuteCommandAsync();
Dictionary<string, string> postData = new()
@@ -320,6 +328,7 @@ namespace Tnb.ProductionMgr
{
_ = await _db.Updateable<AndonRecords>()
.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<AndonRecords>()
.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<AndonRecords>()
.SetColumns(x => x.confirm_time == DateTime.Now)
.SetColumns(x=>x.status==DictConst.AndonStatusYWC)
.Where(x => x.id == id)
.ExecuteCommandAsync();
return true;