1
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -371,3 +371,4 @@ JetBrains Rider
|
||||
*.sln.DotSettings.VS2019.user
|
||||
/apihost/Tnb.API.Entry/Configurations/AppSetting.json
|
||||
/Tnb.Server.sln
|
||||
/Tnb.Server.sln
|
||||
|
||||
5
Directory.Build.props
Normal file
5
Directory.Build.props
Normal file
@@ -0,0 +1,5 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -138,4 +138,6 @@ public partial class ToolMolds : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string item_json { get; set; }
|
||||
|
||||
public string qrcode { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
@@ -26,14 +33,91 @@ namespace Tnb.EquipMgr
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class ToolMoldsService : IToolMoldsService, IDynamicApiController, ITransient
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class ToolMoldsService : IOverideVisualDevService, IToolMoldsService, IDynamicApiController, ITransient
|
||||
{
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
private const string ModuleId = "26103059189781";
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ISqlSugarRepository<ToolMolds> _repository;
|
||||
public ToolMoldsService(IUserManager userManager, ISqlSugarRepository<ToolMolds> repository)
|
||||
private readonly IRunService _runService;
|
||||
public ToolMoldsService(IUserManager userManager, ISqlSugarRepository<ToolMolds> repository, IVisualDevService visualDevService, IRunService runService)
|
||||
{
|
||||
_visualDevService = visualDevService;
|
||||
_userManager = userManager;
|
||||
_repository = repository;
|
||||
_runService = runService;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
OverideFuncs.UpdateAsync = Update;
|
||||
}
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput visualDevModelDataCrInput)
|
||||
{
|
||||
string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"].ToString() : "";
|
||||
if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable<BasQrcode>().AnyAsync(x => x.code == qrcode))
|
||||
{
|
||||
throw Oops.Bah("二维码总表中已存在该二维码");
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Create(templateEntity, visualDevModelDataCrInput);
|
||||
|
||||
string ToolId = visualDevModelDataCrInput.data["ReturnIdentity"].ToString() ?? "";
|
||||
|
||||
if (!string.IsNullOrEmpty(qrcode))
|
||||
{
|
||||
BasQrcode basQrcode = new BasQrcode()
|
||||
{
|
||||
code = visualDevModelDataCrInput.data["qrcode"].ToString(),
|
||||
source_id = ToolId,
|
||||
source_name = "TOOL_MOLDS",
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
};
|
||||
await _repository.AsSugarClient().Insertable<BasQrcode>(basQrcode).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
private async Task<dynamic> Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput)
|
||||
{
|
||||
string qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"].ToString() : "";
|
||||
if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable<BasQrcode>().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id != id))
|
||||
{
|
||||
throw Oops.Bah("二维码总表中已存在该二维码");
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Update(id, templateEntity, visualDevModelDataUpInput);
|
||||
|
||||
if (!string.IsNullOrEmpty(qrcode))
|
||||
{
|
||||
if (await _repository.AsSugarClient().Queryable<BasQrcode>().AnyAsync(x => x.source_id == id))
|
||||
{
|
||||
await _repository.AsSugarClient().Updateable<BasQrcode>()
|
||||
.SetColumns(x => x.code == visualDevModelDataUpInput.data["qrcode"].ToString()).Where(x => x.source_id == id)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
BasQrcode basQrcode = new BasQrcode()
|
||||
{
|
||||
code = visualDevModelDataUpInput.data["qrcode"].ToString(),
|
||||
source_id = id,
|
||||
source_name = "TOOL_MOLDS",
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
};
|
||||
await _repository.AsSugarClient().Insertable<BasQrcode>(basQrcode).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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 SaveData(AndonRecordInput AndonRecordInput);
|
||||
|
||||
/// <summary>
|
||||
/// 获取andon级联选择项数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<dynamic> GetAndonCascaderOptions();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Interfaces;
|
||||
using MessageTemplateEntity = JNPF.Message.Entitys.Entity.MessageTemplateEntity;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
@@ -35,16 +36,19 @@ namespace Tnb.ProductionMgr
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private SendMessageService _sendMessageService;
|
||||
private readonly IBasPushRuleLogService _basPushRuleLogService;
|
||||
private readonly TimeTaskService _timeTaskService;
|
||||
|
||||
public AndonRecordService(ISqlSugarRepository<AndonRecords> repository,
|
||||
SendMessageService sendMessageService,
|
||||
TimeTaskService timeTaskService,
|
||||
IBasPushRuleLogService basPushRuleLogService,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_sendMessageService = sendMessageService;
|
||||
_timeTaskService = timeTaskService;
|
||||
_basPushRuleLogService = basPushRuleLogService;
|
||||
_db = repository.AsSugarClient();
|
||||
}
|
||||
|
||||
@@ -119,6 +123,8 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Insertable<AndonRecords>(andonRecords).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
if (result.IsSuccess)
|
||||
@@ -206,6 +212,12 @@ namespace Tnb.ProductionMgr
|
||||
.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;
|
||||
}
|
||||
}
|
||||
@@ -224,6 +236,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
await _db.Updateable<AndonRecords>()
|
||||
.SetColumns(x=>x.start_repair_time==DateTime.Now)
|
||||
.Where(x=>x.id==id)
|
||||
.ExecuteCommandAsync();
|
||||
return true;
|
||||
}
|
||||
@@ -242,6 +255,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
await _db.Updateable<AndonRecords>()
|
||||
.SetColumns(x=>x.end_repair_time==DateTime.Now)
|
||||
.Where(x=>x.id==id)
|
||||
.ExecuteCommandAsync();
|
||||
return true;
|
||||
}
|
||||
@@ -260,6 +274,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
await _db.Updateable<AndonRecords>()
|
||||
.SetColumns(x=>x.confirm_time==DateTime.Now)
|
||||
.Where(x=>x.id==id)
|
||||
.ExecuteCommandAsync();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.TaskScheduler;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
@@ -83,5 +84,44 @@ namespace Tnb.ProductionMgr
|
||||
andonRecord.create_id = _userManager.UserId;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ namespace Tnb.ProductionMgr
|
||||
complete_rate = a.reported_work_qty==null?0:SqlFunc.ToDecimal(a.reported_work_qty*100)/SqlFunc.ToDecimal(a.plan_qty),
|
||||
children = SqlFunc.Subqueryable<PrdMoTask>()
|
||||
.LeftJoin<DictionaryDataEntity>((x,y)=>x.mo_task_status==y.EnCode && y.DictionaryTypeId==DictConst.PrdTaskStatusTypeId)
|
||||
.Where(x=>x.mo_id==a.id && !SqlFunc.IsNullOrEmpty(x.parent_id))
|
||||
.Where(x=>x.mo_id==a.id && SqlFunc.IsNullOrEmpty(x.parent_id))
|
||||
.OrderByDesc((x,y)=>x.create_time)
|
||||
.ToList((x,y)=>new PrdMoStatisticsDetailOutput()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user