andon增加状态

This commit is contained in:
2023-10-10 14:53:22 +08:00
parent ac1c140e4a
commit e4cb261e22
5 changed files with 94 additions and 24 deletions

View File

@@ -24,6 +24,7 @@ using Tnb.ProductionMgr.Interfaces;
using Tnb.BasicData.Entities;
using JNPF.Systems.Entitys.System;
using JNPF.Message.Entitys.Entity;
using Tnb.BasicData;
using Tnb.BasicData.Interfaces;
using MessageTemplateEntity = JNPF.Message.Entitys.Entity.MessageTemplateEntity;
@@ -59,8 +60,11 @@ namespace Tnb.ProductionMgr
.LeftJoin<AndonInfo>((a, b) => a.andon_info_id == b.id)
.LeftJoin<UserEntity>((a, b, c) => a.repair_id == c.Id)
.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)
.Where((a, b, c, d) => a.andon_type_id == input.andon_type_id)
.Select((a, b, c, d) => new AndonPadListOutput
.WhereIF(!string.IsNullOrEmpty(input.status),(a, b, c, d)=>a.status==input.status)
.Select((a, b, c, d,e,f) => new AndonPadListOutput
{
id = a.id,
andon_info_name = b.name,
@@ -71,6 +75,7 @@ namespace Tnb.ProductionMgr
start_repair_time = a.start_repair_time == null ? "" : a.start_repair_time.Value.ToString("yyyy-MM-dd hh:mm:ss"),
end_repair_time = a.end_repair_time == null ? "" : a.end_repair_time.Value.ToString("yyyy-MM-dd hh:mm:ss"),
confirm_time = a.confirm_time == null ? "" : a.confirm_time.Value.ToString("yyyy-MM-dd hh:mm:ss"),
status = f.FullName,
}).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<AndonPadListOutput>.SqlSugarPageResult(result);
@@ -87,6 +92,7 @@ namespace Tnb.ProductionMgr
andonRecords.create_time = DateTime.Now;
andonRecords.create_id = _userManager.UserId;
andonRecords.status = DictConst.AndonStatusHJZ;
List<string> toUsers = new List<string>();
@@ -208,17 +214,25 @@ namespace Tnb.ProductionMgr
}
else
{
await _db.Updateable<AndonRecords>()
.SetColumns(x => x.repair_id == _userManager.UserId)
.SetColumns(x=>x.response_time==DateTime.Now)
.ExecuteCommandAsync();
Dictionary<string, string> postData = new Dictionary<string, string>()
if (andonRecords.status != DictConst.AndonStatusHJZ)
{
["id"] = andonRecords.id
};
await _basPushRuleLogService.Stop(postData);
throw Oops.Bah($"状态错误");
}
else
{
await _db.Updateable<AndonRecords>()
.SetColumns(x => x.repair_id == _userManager.UserId)
.SetColumns(x=>x.response_time==DateTime.Now)
.ExecuteCommandAsync();
Dictionary<string, string> postData = new Dictionary<string, string>()
{
["id"] = andonRecords.id
};
await _basPushRuleLogService.Stop(postData);
return true;
}
return true;
}
}
else
@@ -234,11 +248,19 @@ namespace Tnb.ProductionMgr
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
if (andonRecords != null)
{
await _db.Updateable<AndonRecords>()
.SetColumns(x=>x.start_repair_time==DateTime.Now)
.Where(x=>x.id==id)
.ExecuteCommandAsync();
return true;
if (andonRecords.status != DictConst.AndonStatusYXY)
{
throw Oops.Bah($"状态错误");
}
else
{
await _db.Updateable<AndonRecords>()
.SetColumns(x=>x.start_repair_time==DateTime.Now)
.Where(x=>x.id==id)
.ExecuteCommandAsync();
return true;
}
}
else
{
@@ -253,11 +275,19 @@ namespace Tnb.ProductionMgr
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
if (andonRecords != null)
{
await _db.Updateable<AndonRecords>()
.SetColumns(x=>x.end_repair_time==DateTime.Now)
.Where(x=>x.id==id)
.ExecuteCommandAsync();
if (andonRecords.status != DictConst.AndonStatusCLZ)
{
throw Oops.Bah($"状态错误");
}
else
{
await _db.Updateable<AndonRecords>()
.SetColumns(x=>x.end_repair_time==DateTime.Now)
.Where(x=>x.id==id)
.ExecuteCommandAsync();
return true;
}
}
else
{
@@ -272,11 +302,19 @@ namespace Tnb.ProductionMgr
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
if (andonRecords != null)
{
await _db.Updateable<AndonRecords>()
.SetColumns(x=>x.confirm_time==DateTime.Now)
.Where(x=>x.id==id)
.ExecuteCommandAsync();
return true;
if (andonRecords.status != DictConst.AndonStatusYWC)
{
throw Oops.Bah($"状态错误");
}
else
{
await _db.Updateable<AndonRecords>()
.SetColumns(x=>x.confirm_time==DateTime.Now)
.Where(x=>x.id==id)
.ExecuteCommandAsync();
return true;
}
}
else
{