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>
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
#region WarehouseMgr

View File

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

View File

@@ -11,5 +11,6 @@ namespace Tnb.ProductionMgr.Entities.Dto
public string? start_repair_time { get; set; }
public string? end_repair_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? confirm_time { get; set; }
public string status { get; set; }
}
}

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>();
@@ -207,6 +213,12 @@ namespace Tnb.ProductionMgr
throw Oops.Bah($"{user.RealName}已响应");
}
else
{
if (andonRecords.status != DictConst.AndonStatusHJZ)
{
throw Oops.Bah($"状态错误");
}
else
{
await _db.Updateable<AndonRecords>()
.SetColumns(x => x.repair_id == _userManager.UserId)
@@ -217,9 +229,11 @@ namespace Tnb.ProductionMgr
["id"] = andonRecords.id
};
await _basPushRuleLogService.Stop(postData);
return true;
}
}
}
else
{
@@ -233,6 +247,12 @@ namespace Tnb.ProductionMgr
string id = dic.ContainsKey("id") ? dic["id"] : "";
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
if (andonRecords != null)
{
if (andonRecords.status != DictConst.AndonStatusYXY)
{
throw Oops.Bah($"状态错误");
}
else
{
await _db.Updateable<AndonRecords>()
.SetColumns(x=>x.start_repair_time==DateTime.Now)
@@ -240,6 +260,8 @@ namespace Tnb.ProductionMgr
.ExecuteCommandAsync();
return true;
}
}
else
{
throw Oops.Bah($"无该andon记录");
@@ -252,6 +274,12 @@ namespace Tnb.ProductionMgr
string id = dic.ContainsKey("id") ? dic["id"] : "";
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
if (andonRecords != null)
{
if (andonRecords.status != DictConst.AndonStatusCLZ)
{
throw Oops.Bah($"状态错误");
}
else
{
await _db.Updateable<AndonRecords>()
.SetColumns(x=>x.end_repair_time==DateTime.Now)
@@ -259,6 +287,8 @@ namespace Tnb.ProductionMgr
.ExecuteCommandAsync();
return true;
}
}
else
{
throw Oops.Bah($"无该andon记录");
@@ -271,6 +301,12 @@ namespace Tnb.ProductionMgr
string id = dic.ContainsKey("id") ? dic["id"] : "";
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
if (andonRecords != null)
{
if (andonRecords.status != DictConst.AndonStatusYWC)
{
throw Oops.Bah($"状态错误");
}
else
{
await _db.Updateable<AndonRecords>()
.SetColumns(x=>x.confirm_time==DateTime.Now)
@@ -278,6 +314,8 @@ namespace Tnb.ProductionMgr
.ExecuteCommandAsync();
return true;
}
}
else
{
throw Oops.Bah($"无该andon记录");