From 9559165536397332a28d9ba096d10716617ff402 Mon Sep 17 00:00:00 2001 From: qianjiawei <1184704771@qq.com> Date: Fri, 4 Aug 2023 15:10:14 +0800 Subject: [PATCH 1/2] 1 --- QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs | 16 ++++ QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs | 83 +++++++++++++++++++++ QcMgr/Tnb.QcMgr/QcCheckTaskService.cs | 59 ++++++++++++++- 3 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs index a451bb01..cbe7eed4 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs @@ -6,6 +6,22 @@ using System.Threading.Tasks; namespace Tnb.QcMgr.Entities.Dto { + public class QcCheckExecHOut + { + public string? id { get; set; } + public string? materialid { get; set; } + public string? checktype { get; set; } + public string? workid { get; set; } + public string? processid { get; set; } + public string? wareid { get; set; } + public string? checknum { get; set; } + public string? status { get; set; } + public string? result { get; set; } + public string? tasktime { get; set; } + public string? exectime { get; set; } + public string? execuser { get; set; } + + } public class CheckTaskOut { public string? mainid { get; set; } diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs new file mode 100644 index 00000000..21c4a099 --- /dev/null +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Aspose.Cells.Drawing; +using JNPF.Common.Core.Manager; +using JNPF.Common.Filter; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Entitys.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using SqlSugar; +using Tnb.BasicData.Entities; +using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities.Dto; + +namespace Tnb.QcMgr +{ /// + /// 质检任务模块 + /// + [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)] + [Route("api/[area]/[controller]/[action]")] + [OverideVisualDev(ModuleId)] + public class QcCheckTaskResultServic:IDynamicApiController, ITransient, IOverideVisualDevService + { + private const string ModuleId = "26873741070613"; + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + public QcCheckTaskResultServic(ISqlSugarRepository repository, IUserManager userManager) + { + _repository = repository; + _userManager = userManager; + OverideFuncs.GetListAsync = GetListAsync; + } + private async Task GetListAsync(VisualDevModelListQueryInput input) + { + var db = _repository.AsSugarClient(); + Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : ""; + string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : ""; + string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; + var list = await db.Queryable() + .LeftJoin((a, b) => a.DictionaryTypeId == b.Id) + .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync(); + var result = await db.Queryable() + .LeftJoin((a, b) => a.materialid == b.id) + .LeftJoin((a, b, c) => a.processid == c.id) + .LeftJoin((a, b, c, d) => a.workid == d.Id) + .LeftJoin((a, b, c, d, e) => a.execuser == e.Id) + .WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid) + .WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype) + .WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status) + .Where((a, b, c, d, e) => a.status == list.Where(p => p.FullName == "已完成").First().Id) + .Select((a, b, c, d, e) => new QcCheckExecHOut + { + id = a.id, + materialid = b.name, + checktype = a.checktype, + workid = d.FullName, + processid = c.process_name, + wareid = a.wareid, + checknum = a.checknum, + status = a.status, + result = a.result, + tasktime = a.tasktime == null ? "" : a.tasktime, + exectime = a.exectime == null ? "" : a.exectime, + execuser = e.RealName == null ? "" : e.RealName, + }).OrderByDescending(a => a.tasktime).ToPagedListAsync(input.currentPage, input.pageSize); + foreach (var item in result.list) + { + item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : ""; + item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : ""; + } + return PageResult.SqlSugarPageResult(result); + } + } +} diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs index d18ec401..7d57caca 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Aspose.Cells.Drawing; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; +using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -13,13 +15,22 @@ using JNPF.FriendlyException; using JNPF.JsonSerialization; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; using SqlSugar; +using Tnb.BasicData.Entities; +using Tnb.BasicData; +using Tnb.EquipMgr.Entities; +using Tnb.ProductionMgr.Entities.Dto; +using Tnb.ProductionMgr.Entities; using Tnb.QcMgr.Entities; using Tnb.QcMgr.Entities.Dto; using Tnb.QcMgr.Entities.Entity; using Tnb.QcMgr.Interfaces; +using JNPF.Common.Extension; namespace Tnb.QcMgr { @@ -28,14 +39,60 @@ namespace Tnb.QcMgr /// [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)] [Route("api/[area]/[controller]/[action]")] - public class QcCheckTaskService : IQcCheckTaskService, IDynamicApiController, ITransient + [OverideVisualDev(ModuleId)] + public class QcCheckTaskService : IQcCheckTaskService, IDynamicApiController, ITransient, IOverideVisualDevService { + private const string ModuleId = "26745613138709"; private readonly ISqlSugarRepository _repository; private readonly IUserManager _userManager; + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); public QcCheckTaskService(ISqlSugarRepository repository, IUserManager userManager) { _repository = repository; _userManager = userManager; + OverideFuncs.GetListAsync = GetListAsync; + } + + private async Task GetListAsync(VisualDevModelListQueryInput input) + { + var db = _repository.AsSugarClient(); + Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : ""; + string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : ""; + string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; + var list = await db.Queryable() + .LeftJoin((a, b) => a.DictionaryTypeId == b.Id) + .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync(); + var result = await db.Queryable() + .LeftJoin((a, b) => a.materialid == b.id) + .LeftJoin((a, b, c) => a.processid == c.id) + .LeftJoin((a, b, c, d) => a.workid == d.Id) + .LeftJoin((a, b, c, d, e) => a.execuser == e.Id) + .WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid) + .WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype) + .WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status) + .Where((a,b,c,d,e)=>a.status== list.Where(p=>p.FullName=="待执行").First().Id) + .Select((a, b, c, d, e) => new QcCheckExecHOut + { + id = a.id, + materialid = b.name, + checktype = a.checktype, + workid = d.FullName, + processid = c.process_name, + wareid = a.wareid, + checknum = a.checknum, + status = a.status, + result = a.result, + tasktime = a.tasktime == null ? "" : a.tasktime, + exectime = a.exectime == null ? "" : a.exectime, + execuser = e.RealName == null ? "" : e.RealName, + }).OrderByDescending(a => a.tasktime).ToPagedListAsync(input.currentPage, input.pageSize); + foreach (var item in result.list) + { + item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : ""; + item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : ""; + } + return PageResult.SqlSugarPageResult(result); } /// /// 获取任务执行明细 From 67dc22f9b9d78fc6ee517b8651144f1233cfcc43 Mon Sep 17 00:00:00 2001 From: FanLian Date: Fri, 4 Aug 2023 15:31:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=BD=BD=E5=85=B7=E6=9D=A1=E7=A0=81?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=93=E5=BA=93ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs | 1 + WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs | 1 + WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index c171d8a9..dc23aa1b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -449,6 +449,7 @@ namespace Tnb.WarehouseMgr x.id = SnowflakeIdHelper.NextId(); x.is_out = 0; x.carry_id = instock!.carry_id!; + x.warehouse_id = instock!.warehouse_id!; }); await _db.Insertable(carryCodes).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs index e513798d..ef3d8398 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs @@ -187,6 +187,7 @@ namespace Tnb.WarehouseMgr x.carry_id = input.data[nameof(WmsHandleH.carry_id)].ToString()!; x.create_id = _userManager.UserId; x.create_time = DateTime.Now; + x.warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!; }); await _db.Insertable(carryCodes).ExecuteCommandAsync(); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index 3b594c4d..f56a4a8f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -219,6 +219,7 @@ namespace Tnb.WarehouseMgr x.id = SnowflakeIdHelper.NextId(); x.is_out = 0; x.carry_id = input.data[nameof(WmsCarryCode.carry_id)]?.ToString()!; + x.warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(); }); //生成入库申请条码 var instockDetails = await _db.Queryable()