diff --git a/.gitignore b/.gitignore index ebf4f1f1..1279fe48 100644 --- a/.gitignore +++ b/.gitignore @@ -371,3 +371,4 @@ JetBrains Rider *.sln.DotSettings.VS2019.user /apihost/Tnb.API.Entry/Configurations/AppSetting.json /Tnb.Server.sln +/Tnb.Server.sln diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..8e0a6337 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,5 @@ + + + $(MSBuildThisFileDirectory) + + \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMolds.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMolds.cs index c93b2913..3674be98 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMolds.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMolds.cs @@ -138,4 +138,6 @@ public partial class ToolMolds : BaseEntity /// public string item_json { get; set; } + public string qrcode { get; set; } + } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs index 86c41af4..6b010062 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs @@ -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 /// [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 _repository; - public ToolMoldsService(IUserManager userManager, ISqlSugarRepository repository) + private readonly IRunService _runService; + public ToolMoldsService(IUserManager userManager, ISqlSugarRepository repository, IVisualDevService visualDevService, IRunService runService) { + _visualDevService = visualDevService; _userManager = userManager; _repository = repository; + _runService = runService; + OverideFuncs.CreateAsync = Create; + OverideFuncs.UpdateAsync = Update; + } + private async Task Create(VisualDevModelDataCrInput visualDevModelDataCrInput) + { + string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"].ToString() : ""; + if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable().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).ExecuteCommandAsync(); + } + } + return await Task.FromResult(true); + } + + private async Task Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput) + { + string qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"].ToString() : ""; + if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable().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().AnyAsync(x => x.source_id == id)) + { + await _repository.AsSugarClient().Updateable() + .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).ExecuteCommandAsync(); + } + } + } + return await Task.FromResult(true); } /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonCascaderOptionsOuput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonCascaderOptionsOuput.cs new file mode 100644 index 00000000..861d6a70 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonCascaderOptionsOuput.cs @@ -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 children { get; set; } = new List(); + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs index 31e453dc..c7b815cc 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs @@ -11,5 +11,11 @@ namespace Tnb.ProductionMgr.Interfaces { Task GetPrdTask(string stationId); Task SaveData(AndonRecordInput AndonRecordInput); + + /// + /// 获取andon级联选择项数据 + /// + /// + Task GetAndonCascaderOptions(); } } diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs index 37acd24f..c9b2fc87 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs @@ -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 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).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 postData = new Dictionary() + { + ["id"] = andonRecords.id + }; + await _basPushRuleLogService.Stop(postData); + return true; } } @@ -224,6 +236,7 @@ namespace Tnb.ProductionMgr { await _db.Updateable() .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() .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() .SetColumns(x=>x.confirm_time==DateTime.Now) + .Where(x=>x.id==id) .ExecuteCommandAsync(); return true; } diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonService.cs index 24c38703..e8ca5a9e 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonService.cs @@ -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 GetAndonCascaderOptions() + { + Dictionary result = new Dictionary(); + List andonTypes = await _db.Queryable().ToListAsync(); + List andonInfos = await _db.Queryable().ToListAsync(); + List andonBreakDowns = await _db.Queryable().ToListAsync(); + List options = new List(); + 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(andonInfos.FirstOrDefault()?.breakdown_id); + defaultValue = breakdownIdArr[0]; + } + + result.Add("options",options); + result.Add("defaultValue",defaultValue); + return result; + } } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index 4b418519..593aa663 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -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() .LeftJoin((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() { diff --git a/WmsSignForDeliveryService.txt b/WmsSignForDeliveryService.txt deleted file mode 100644 index e69de29b..00000000