海运出口列表优化1

dev
cjy 1 week ago
parent c170af43e3
commit 8b0f4f1ce2

@ -120,31 +120,14 @@ public partial class SeaExportService : ISeaExportService
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//启用海运出口列表可视数据权限
(ISugarQueryable<SeaExport> query, _) = await commonService.GetVisibleDataRuleFilter<SeaExport>(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<SeaExportBillManage>().ToList();
var orgList = db.Queryable<SysOrg>().Where(x => x.Status == StatusEnum.Enable);
var partList = await tenantDb.Queryable<SeaExportBillManage>().ToListAsync();
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
//var result = tenantDb.Queryable<SeaExport>()
var statusList = tenantDb.Queryable<BookingStatus>().Select<BookingStatusRes>().ToList();
var ctnPrices = tenantDb.Queryable<BusinessCtnPrice>().ToList();
var statusList = await tenantDb.Queryable<BookingStatus>().Select<BookingStatusRes>().ToListAsync();
var ctnPrices = await tenantDb.Queryable<BusinessCtnPrice>().ToListAsync();
var result = query.Where(a => (a.IsRefund == false && a.IsChangeETD == false))
.InnerJoin<BusinessFeeStatus>((a, b) => a.Id == b.BusinessId)
//.LeftJoin<SysOrg>((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<BusinessCtnPrice>()
.Where(s => s.BusinessId == a.Id)
.Select(s => s.QuotePrice),
FloorPrice = SqlFunc.Subqueryable<BusinessCtnPrice>()
.Where(s => s.BusinessId == a.Id)
.Select(s => s.FloorPrice)
//QuotePrice = SqlFunc.Subqueryable<BusinessCtnPrice>()
// .Where(s => s.BusinessId == a.Id)
// .Select(s => s.QuotePrice),
//FloorPrice = SqlFunc.Subqueryable<BusinessCtnPrice>()
// .Where(s => s.BusinessId == a.Id)
// .Select(s => s.FloorPrice)
},
true)//true表示 其余字段自动映射,根据字段名字
//.Select<SeaExportRes>()
.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()

@ -429,7 +429,7 @@ public class ClientCommonService : IClientCommonService
//var data = new ClientSelectInfoRes();
if (req.BusinessType == BusinessType.OceanShippingExport)
{
var info = tenantDb.Queryable<SeaExport>().First(x => x.Id == req.BusinessId);
var info = tenantDb.Queryable<SeaExport>().Filter(null,true).First(x => x.Id == req.BusinessId);
if (info.IsNull())
{
return DataResult<UnitSelectInfoRes>.Failed("业务信息不存在!");

Loading…
Cancel
Save