andon相关接口
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||||
|
{
|
||||||
|
public class AndonCascaderOptionsOuput
|
||||||
|
{
|
||||||
|
public string label { get; set; }
|
||||||
|
public string value { get; set; }
|
||||||
|
public bool disabled { get; set; } = false;
|
||||||
|
public List<AndonCascaderOptionsOuput> children { get; set; } = new List<AndonCascaderOptionsOuput>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,5 +11,11 @@ namespace Tnb.ProductionMgr.Interfaces
|
|||||||
{
|
{
|
||||||
Task<dynamic> GetPrdTask(string stationId);
|
Task<dynamic> GetPrdTask(string stationId);
|
||||||
Task SaveData(AndonRecordInput AndonRecordInput);
|
Task SaveData(AndonRecordInput AndonRecordInput);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取andon级联选择项数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<dynamic> GetAndonCascaderOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.Interfaces;
|
||||||
using MessageTemplateEntity = JNPF.Message.Entitys.Entity.MessageTemplateEntity;
|
using MessageTemplateEntity = JNPF.Message.Entitys.Entity.MessageTemplateEntity;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
@@ -35,16 +36,19 @@ namespace Tnb.ProductionMgr
|
|||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private SendMessageService _sendMessageService;
|
private SendMessageService _sendMessageService;
|
||||||
|
private readonly IBasPushRuleLogService _basPushRuleLogService;
|
||||||
private readonly TimeTaskService _timeTaskService;
|
private readonly TimeTaskService _timeTaskService;
|
||||||
|
|
||||||
public AndonRecordService(ISqlSugarRepository<AndonRecords> repository,
|
public AndonRecordService(ISqlSugarRepository<AndonRecords> repository,
|
||||||
SendMessageService sendMessageService,
|
SendMessageService sendMessageService,
|
||||||
TimeTaskService timeTaskService,
|
TimeTaskService timeTaskService,
|
||||||
|
IBasPushRuleLogService basPushRuleLogService,
|
||||||
IUserManager userManager)
|
IUserManager userManager)
|
||||||
{
|
{
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_sendMessageService = sendMessageService;
|
_sendMessageService = sendMessageService;
|
||||||
_timeTaskService = timeTaskService;
|
_timeTaskService = timeTaskService;
|
||||||
|
_basPushRuleLogService = basPushRuleLogService;
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +123,8 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _db.Insertable<AndonRecords>(andonRecords).ExecuteCommandAsync();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.IsSuccess)
|
if (result.IsSuccess)
|
||||||
@@ -206,6 +212,11 @@ namespace Tnb.ProductionMgr
|
|||||||
.SetColumns(x => x.repair_id == _userManager.UserId)
|
.SetColumns(x => x.repair_id == _userManager.UserId)
|
||||||
.SetColumns(x=>x.response_time==DateTime.Now)
|
.SetColumns(x=>x.response_time==DateTime.Now)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
|
Dictionary<string, string> postData = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
["id"] = andonRecords.id
|
||||||
|
};
|
||||||
|
await _basPushRuleLogService.Stop(postData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,6 +235,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
await _db.Updateable<AndonRecords>()
|
await _db.Updateable<AndonRecords>()
|
||||||
.SetColumns(x=>x.start_repair_time==DateTime.Now)
|
.SetColumns(x=>x.start_repair_time==DateTime.Now)
|
||||||
|
.Where(x=>x.id==id)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -242,6 +254,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
await _db.Updateable<AndonRecords>()
|
await _db.Updateable<AndonRecords>()
|
||||||
.SetColumns(x=>x.end_repair_time==DateTime.Now)
|
.SetColumns(x=>x.end_repair_time==DateTime.Now)
|
||||||
|
.Where(x=>x.id==id)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -260,6 +273,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
await _db.Updateable<AndonRecords>()
|
await _db.Updateable<AndonRecords>()
|
||||||
.SetColumns(x=>x.confirm_time==DateTime.Now)
|
.SetColumns(x=>x.confirm_time==DateTime.Now)
|
||||||
|
.Where(x=>x.id==id)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using JNPF.Systems.Interfaces.System;
|
|||||||
using JNPF.TaskScheduler;
|
using JNPF.TaskScheduler;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.EquipMgr.Interfaces;
|
using Tnb.EquipMgr.Interfaces;
|
||||||
@@ -83,5 +84,44 @@ namespace Tnb.ProductionMgr
|
|||||||
andonRecord.create_id = _userManager.UserId;
|
andonRecord.create_id = _userManager.UserId;
|
||||||
await _db.Insertable(andonRecord).ExecuteCommandAsync();
|
await _db.Insertable(andonRecord).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetAndonCascaderOptions()
|
||||||
|
{
|
||||||
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||||
|
List<AndonType> andonTypes = await _db.Queryable<AndonType>().ToListAsync();
|
||||||
|
List<AndonInfo> andonInfos = await _db.Queryable<AndonInfo>().ToListAsync();
|
||||||
|
List<AndonBreakDown> andonBreakDowns = await _db.Queryable<AndonBreakDown>().ToListAsync();
|
||||||
|
List<AndonCascaderOptionsOuput> options = new List<AndonCascaderOptionsOuput>();
|
||||||
|
foreach (var andonType in andonTypes)
|
||||||
|
{
|
||||||
|
options.Add(new AndonCascaderOptionsOuput()
|
||||||
|
{
|
||||||
|
label = andonType.name,
|
||||||
|
value = andonType.id,
|
||||||
|
children = andonInfos.Where(x=>x.andon_type==andonType.id).Select(x=>new AndonCascaderOptionsOuput()
|
||||||
|
{
|
||||||
|
label = x.name,
|
||||||
|
value = x.id,
|
||||||
|
children = andonBreakDowns.Where(y=>x.breakdown_id.Contains(y.id)).Select(y=>new AndonCascaderOptionsOuput()
|
||||||
|
{
|
||||||
|
label = y.name,
|
||||||
|
value = y.id
|
||||||
|
}).ToList()
|
||||||
|
}).ToList()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
string defaultValue = "";
|
||||||
|
if (!string.IsNullOrEmpty(andonInfos.FirstOrDefault()?.breakdown_id))
|
||||||
|
{
|
||||||
|
string[] breakdownIdArr = JsonConvert.DeserializeObject<string[]>(andonInfos.FirstOrDefault()?.breakdown_id);
|
||||||
|
defaultValue = breakdownIdArr[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Add("options",options);
|
||||||
|
result.Add("defaultValue",defaultValue);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user