From 6642720a7ce95e12716b18a0c236ab2cdb7a4be7 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Thu, 31 Aug 2023 16:29:07 +0800 Subject: [PATCH] =?UTF-8?q?pda=E4=BB=BB=E5=8A=A1=E5=8D=95=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E8=AE=B0=E5=BD=95=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/AppPrdMoTaskLogListOutput.cs | 31 +++++ .../Entity/PrdMoTaskLog.cs | 10 ++ .../APP/AppPrdMoTaskLogService.cs | 125 ++++++++++++++++++ .../APP/AppPrdMoTaskOneService.cs | 1 - .../APP/AppPrdMoTaskTwoService.cs | 1 - 5 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskLogListOutput.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskLogListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskLogListOutput.cs new file mode 100644 index 00000000..52ad5685 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskLogListOutput.cs @@ -0,0 +1,31 @@ +namespace Tnb.ProductionMgr.Entities.Entity +{ + public class AppPrdMoTaskLogListOutput + { + public string id { get; set; } + public string mo_task_code { get; set; } + public string mo_task_status { get; set; } + public string material_id { get; set; } + public string material_id_id { get; set; } + public string material_code { get; set; } + public string material_name { get; set; } + public string mold_id { get; set; } + public string mold_id_id { get; set; } + public string mold_code { get; set; } + public string eqp_id { get; set; } + public string eqp_id_id { get; set; } + public string equip_code { get; set; } + + public string process_id { get; set; } + public string process_id_id { get; set; } + public string process_code { get; set; } + public string mbom_process_id { get; set; } + public int? scheduled_qty { get; set; } + public int? reported_work_qty { get; set; } + public int? scrap_qty { get; set; } + + public string plan_start_date { get; set; } + + public string plan_end_date { get; set; } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskLog.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskLog.cs index 602beb67..f10ade62 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskLog.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskLog.cs @@ -73,5 +73,15 @@ public partial class PrdMoTaskLog : BaseEntity /// 任务单编号 /// public string? mo_task_code { get; set; } + + /// + /// 工位编号 + /// + public string? station_code { get; set; } + + /// + /// 工序编号 + /// + public string? process_code { get; set; } } diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs new file mode 100644 index 00000000..14186d66 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs @@ -0,0 +1,125 @@ +using COSXML.Model.Tag; +using JNPF.Common.Core.Manager; +using JNPF.Common.Filter; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Interfaces; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using Tnb.ProductionMgr.Entities; +using Tnb.BasicData.Entities; +using Tnb.EquipMgr.Entities; +using Tnb.BasicData; + +namespace Tnb.ProductionMgr.APP +{ + /// + /// 移动端任务单操作记录 + /// + [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + [OverideVisualDev(ModuleId)] + public class AppPrdMoTaskLogService : IOverideVisualDevService, IDynamicApiController, ITransient + { + private const string ModuleId = "28491200142101"; + private readonly ISqlSugarRepository _repository; + private readonly IDictionaryDataService _dictionaryDataService; + private readonly IUserManager _userManager; + private readonly IRunService _runService; + private readonly IVisualDevService _visualDevService; + private readonly ISqlSugarClient _db; + private readonly IBillRullService _billRuleService; + + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + public AppPrdMoTaskLogService( + ISqlSugarRepository repository, + IDictionaryDataService dictionaryDataService, + IUserManager userManager, + IRunService runService, + IBillRullService billRullService, + IVisualDevService visualDevService + ) + { + _repository = repository; + _userManager = userManager; + _runService = runService; + _visualDevService = visualDevService; + _db = _repository.AsSugarClient(); + OverideFuncs.GetListAsync = GetList; + _dictionaryDataService = dictionaryDataService; + _billRuleService = billRullService; + } + + private async Task GetList(VisualDevModelListQueryInput input) + { + var db = _repository.AsSugarClient(); + Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; + string material_code = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : ""; + string equip_code = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : ""; + var result = await db.Queryable() + .LeftJoin((a, b) => a.material_id == b.id) + .LeftJoin((a, b, c) => a.mold_id == c.id) + .LeftJoin((a, b, c, d) => a.eqp_id == d.id) + .LeftJoin((a, b, c, d, e) => e.EnCode == a.mo_task_status && e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId) + .LeftJoin((a,b,c,d,e,f)=>a.process_id==f.id) + .WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d, e) => a.mo_task_code.Contains(mo_task_code)) + .WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code)) + .WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code)) + .OrderByDescending(a => a.create_time) + .Select((a, b, c, d, e,f) => new AppPrdMoTaskOneListOutput + { + id = a.id, + mo_task_code = a.mo_task_code, + mo_task_status = e.FullName, + material_id_id = a.material_id, + material_id = b.code+"/"+b.name, + material_code = b.code, + material_name = b.name, + mold_id_id = a.mold_id, + mold_id = c.mold_code, + mold_code = c.mold_code, + eqp_id_id = a.eqp_id, + eqp_id = d.code, + equip_code = d.code, + process_id_id = a.process_id, + process_id = f.process_name, + process_code = f.process_code, + mbom_process_id = a.mbom_process_id, + scheduled_qty = a.scheduled_qty, + reported_work_qty = a.reported_work_qty, + scrap_qty = a.scrap_qty, + plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), + plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), + }).ToPagedListAsync(input.currentPage, input.pageSize); + return PageResult.SqlSugarPageResult(result); + } + + /// + /// 根据任务单id获取操作记录 + /// + /// + /// + [HttpPost] + public async Task GetLogById(Dictionary dic) + { + string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : ""; + if (string.IsNullOrEmpty(mo_task_id)) return Array.Empty(); + Dictionary statsDic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + return await _db.Queryable().Where(x=>x.mo_task_id==mo_task_id) + .OrderBy(x=>x.create_time) + .Mapper(x => + { + if (statsDic.ContainsKey(x.status)) + { + x.status = statsDic[x.status].ToString(); + } + }) + .ToListAsync(); + } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs index a10453fe..82f0bedd 100644 --- a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs @@ -37,7 +37,6 @@ namespace Tnb.ProductionMgr.APP public AppPrdMoTaskOneService( ISqlSugarRepository repository, IUserManager userManager, - IDictionaryDataService dictionaryDataService, IRunService runService, IBillRullService billRullService, IVisualDevService visualDevService diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs index 87130e60..9499db64 100644 --- a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs @@ -37,7 +37,6 @@ namespace Tnb.ProductionMgr.APP public AppPrdMoTaskTwoService( ISqlSugarRepository repository, IUserManager userManager, - IDictionaryDataService dictionaryDataService, IRunService runService, IBillRullService billRullService, IVisualDevService visualDevService