From cba5adf5f3d1faf5f81f0f40e2a9f5718be40392 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 21 Jul 2023 10:31:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BD=90=E5=A5=97=E6=90=AD=E9=85=8D=E6=96=B9?= =?UTF-8?q?=E6=A1=88=EF=BC=8C=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Inputs/MESCollocationSchemeQueryInput.cs | 3 ++- .../Dto/Outputs/CollocationSchemeOutput.cs | 6 ++++++ .../IWmsCollocationSchemeSevice.cs | 2 +- .../Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs | 14 ++++++++------ .../Tnb.WarehouseMgr/WmsSetSortingService.cs | 1 - .../Tnb.WarehouseMgr/WmskittingOutService.cs | 5 ++++- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs index 9ad7c3c1..26ea874e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using JNPF.Common.Filter; namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { - public class MESCollocationSchemeQueryInput + public class MESCollocationSchemeQueryInput : PageInputBase { /// /// 齐套出库主表 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs index 6986be71..1a23c508 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; +using Org.BouncyCastle.Asn1.Mozilla; using SqlSugar; namespace Tnb.WarehouseMgr.Entities.Dto.Outputs @@ -64,7 +65,12 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// /// 齐套明细输出 /// + [JsonIgnore] public List? CollocationSchemeDs { get; set; } + /// + /// 齐套明细Json + /// + public string CollocationSchemeDsJson { get; set; } [JsonIgnore] public List? list { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs index 9e25e026..06731b64 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs @@ -17,6 +17,6 @@ namespace Tnb.WarehouseMgr.Interfaces /// /// /// - Task MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input); + Task MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs index 1a15b5d0..4c367e00 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs @@ -7,6 +7,7 @@ using Aop.Api.Domain; using Aspose.Cells.Drawing; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Extension; +using JNPF.Common.Filter; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; @@ -15,6 +16,7 @@ using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; using SqlSugar; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Dto.Inputs; @@ -89,25 +91,25 @@ namespace Tnb.WarehouseMgr /// [HttpPost] //[NonUnify] - public async Task MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input) + public async Task MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input) { if (input.IsNull()) throw new ArgumentNullException("input"); - var data = new List(); + SqlSugarPagedList pageData = new(); try { - data = await _db.Queryable() + pageData = await _db.Queryable() .Where(a => a.material_id == input.material_id) .Select(a => new CollocationSchemeOutput { list = SqlFunc.Subqueryable().Where(b => b.bill_id == a.id).ToList(), }, true) - .Mapper(it => it.CollocationSchemeDs = it.list?.Adapt>()) - .ToListAsync(); + .Mapper(it => it.CollocationSchemeDsJson = JsonConvert.SerializeObject(it.list)) + .ToPagedListAsync(input.currentPage, input.pageSize); } catch (Exception) { } - return data; + return pageData == null ? Enumerable.Empty() : PageResult.SqlSugarPageResult(pageData); } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index 079c898c..671d6354 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -314,7 +314,6 @@ namespace Tnb.WarehouseMgr await _db.Updateable(curSortingDetails).ExecuteCommandAsync(); if (curSortingDetails.All(it => it.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) { - await _db.Updateable().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); } var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 7a649a6b..4f4ad195 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; +using System.Transactions; using Aop.Api.Domain; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; @@ -304,7 +305,7 @@ namespace Tnb.WarehouseMgr carrys.Add(carry); if (carrys?.Count > 0) { - await _db.Ado.BeginTranAsync(); + await _db.Ado.BeginTranAsync(); var tasks = new List>(); foreach (var carryIt in carrys) { @@ -313,7 +314,9 @@ namespace Tnb.WarehouseMgr var all = await Task.WhenAll(tasks); await _db.Ado.CommitTranAsync(); if (all.All(x => x > 0)) + { isOk = all?.Length > 0; + } } } if (!isOk) throw Oops.Oh(ErrorCode.COM1001);