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

@@ -138,6 +138,33 @@ public static class DictConst
/// </summary> /// </summary>
public const string TaskStatus = "TaskStatus"; public const string TaskStatus = "TaskStatus";
/// <summary>
/// andon状态key
/// </summary>
public const string AndonStatus = "AndonStatus";
/// <summary>
/// andon状态呼叫中
/// </summary>
public const string AndonStatusHJZ = "1";
/// <summary>
/// andon状态已响应
/// </summary>
public const string AndonStatusYXY = "2";
/// <summary>
/// andon状态处理中
/// </summary>
public const string AndonStatusCLZ = "3";
/// <summary>
/// andon状态待确认
/// </summary>
public const string AndonStatusDQR = "4";
/// <summary>
/// andon状态已完成
/// </summary>
public const string AndonStatusYWC = "5";
#endregion #endregion
#region WarehouseMgr #region WarehouseMgr

View File

@@ -4,6 +4,8 @@ namespace Tnb.ProductionMgr.Entities.Dto
{ {
public string andon_type_id { get; set; } public string andon_type_id { get; set; }
public string status { get; set; }
/// <summary> /// <summary>
/// 页码. /// 页码.
/// </summary> /// </summary>

View File

@@ -11,5 +11,6 @@ namespace Tnb.ProductionMgr.Entities.Dto
public string? start_repair_time { get; set; } public string? start_repair_time { get; set; }
public string? end_repair_time { get; set; } public string? end_repair_time { get; set; }
public string? confirm_time { get; set; } public string? confirm_time { get; set; }
public string status { get; set; }
} }
} }

View File

@@ -45,5 +45,7 @@ namespace Tnb.ProductionMgr.Entities
public DateTime? end_repair_time { get; set; } public DateTime? end_repair_time { get; set; }
public DateTime? confirm_time { get; set; } public DateTime? confirm_time { get; set; }
public string status { get; set; }
} }
} }

View File

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