From 8b0f4f1ce2017bcc68b4cf940dd8918b82ef8f4a Mon Sep 17 00:00:00 2001 From: cjy Date: Thu, 14 Nov 2024 11:54:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=B7=E8=BF=90=E5=87=BA=E5=8F=A3=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=BC=98=E5=8C=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Op/Method/SeaExportService.cs | 50 ++++++++----------- .../Sys/Method/ClientCommonService.cs | 2 +- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index 027ccb28..82c1d0d4 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -120,31 +120,14 @@ public partial class SeaExportService : ISeaExportService var tenantDb = saasService.GetBizDbScopeById(user.TenantId); //启用海运出口列表可视数据权限 (ISugarQueryable query, _) = await commonService.GetVisibleDataRuleFilter(tenantDb); - ////是否分单标识 - //var otherConditons = request.GetOtherConditionalModels(db); - - //int isPart = 0; - - //if (otherConditons.IsNotNull() && otherConditons.Count > 0) - //{ - // foreach (ConditionalModel item in otherConditons) - // { - - // if (item.FieldName.ToLower() == "ispart") - // { - // isPart = int.Parse(item.FieldValue); - - // } - // } - //} - var partList = tenantDb.Queryable().ToList(); - - var orgList = db.Queryable().Where(x => x.Status == StatusEnum.Enable); + + var partList = await tenantDb.Queryable().ToListAsync(); + //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); //var result = tenantDb.Queryable() - var statusList = tenantDb.Queryable().Select().ToList(); - var ctnPrices = tenantDb.Queryable().ToList(); + var statusList = await tenantDb.Queryable().Select().ToListAsync(); + var ctnPrices = await tenantDb.Queryable().ToListAsync(); var result = query.Where(a => (a.IsRefund == false && a.IsChangeETD == false)) .InnerJoin((a, b) => a.Id == b.BusinessId) //.LeftJoin((a, b, c) => a.SaleOrgId == c.Id, "shippingweb8_dev.sys_org") @@ -152,19 +135,19 @@ public partial class SeaExportService : ISeaExportService .Select((a, b) => new SeaExportRes() { //SaleDeptName = c.OrgName, - QuotePrice = SqlFunc.Subqueryable() - .Where(s => s.BusinessId == a.Id) - .Select(s => s.QuotePrice), - FloorPrice = SqlFunc.Subqueryable() - .Where(s => s.BusinessId == a.Id) - .Select(s => s.FloorPrice) + //QuotePrice = SqlFunc.Subqueryable() + // .Where(s => s.BusinessId == a.Id) + // .Select(s => s.QuotePrice), + //FloorPrice = SqlFunc.Subqueryable() + // .Where(s => s.BusinessId == a.Id) + // .Select(s => s.FloorPrice) }, true)//true表示 其余字段自动映射,根据字段名字 //.Select() .MergeTable() .Mapper(it => { - it.BookingStatus = statusList.Where(x => x.BusinessId == it.Id).ToList(); + //it.BookingStatus = statusList.Where(x => x.BusinessId == it.Id).ToList(); //var ctnPrice = ctnPrices.First(x => x.BusinessId == it.Id); //it.QuotePrice = ctnPrice?.QuotePrice; //it.FloorPrice = ctnPrice?.FloorPrice; @@ -172,7 +155,6 @@ public partial class SeaExportService : ISeaExportService //it.StatusLog = }) .Where(whereList); - //.ToQueryPageAsync(request.PageCondition); var list = result.ToList(); var data = await result.ToQueryPageAsync(request.PageCondition); @@ -248,6 +230,14 @@ public partial class SeaExportService : ISeaExportService } item.StatusLog = ctnLogs; item.PartCount = partList.Where(x => x.BusinessId == item.Id).Count(); + var ctnPrice = ctnPrices.Where(x => x.BusinessId == item.Id).FirstOrDefault(); + if (ctnPrice.IsNotNull()) + { + item.QuotePrice = ctnPrice.QuotePrice; + item.FloorPrice = ctnPrice.FloorPrice; + } + + item.BookingStatus = statusList.Where(x => x.BusinessId == item.Id).ToList(); } var res = new SeaExportListRes() diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs index fd943556..4c56840b 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs @@ -429,7 +429,7 @@ public class ClientCommonService : IClientCommonService //var data = new ClientSelectInfoRes(); if (req.BusinessType == BusinessType.OceanShippingExport) { - var info = tenantDb.Queryable().First(x => x.Id == req.BusinessId); + var info = tenantDb.Queryable().Filter(null,true).First(x => x.Id == req.BusinessId); if (info.IsNull()) { return DataResult.Failed("业务信息不存在!");