From 22bb8ab4255b84e61d733d9175010440e5d83398 Mon Sep 17 00:00:00 2001
From: xiaolipro <2357729423@qq.com>
Date: Tue, 21 Apr 2026 17:54:52 +0800
Subject: [PATCH] ai-fix
---
SimpleAdmin.sln.DotSettings.user | 4 +-
.../Services/Channels/AutoTriggerService.cs | 18 +-----
.../Services/Channels/KpiAreaService.cs | 24 ++------
.../Services/Channels/LabelTemplateService.cs | 9 +--
.../Channels/SalesProductService.Helpers.cs | 32 +++-------
.../Services/Channels/SalesProductService.cs | 58 +++++-------------
.../Channels/ServiceChannelService.Helpers.cs | 23 ++-----
.../Channels/ServiceChannelService.cs | 53 +++++-----------
.../Channels/WeightRoundingService.cs | 23 ++-----
.../Services/Channels/WeightRuleService.cs | 23 ++-----
.../Services/Customers/CustomerService.cs | 34 ++++-------
.../Operations/InboundRecordService.cs | 13 ++--
.../Services/Operations/LabelPrintService.cs | 17 +++---
.../Operations/OutboundRecordService.cs | 11 ++--
.../Services/Orders/OrderService.Helpers.cs | 60 +++++--------------
.../Services/Orders/OrderService.cs | 12 +---
.../Services/Recharge/RechargeService.cs | 30 +++-------
.../Services/System/WarehouseService.cs | 19 ++----
.../Channels/AutoTriggerRepository.cs | 2 +-
.../Channels/KpiAreaRepository.cs | 12 ++--
.../Channels/LabelTemplateRepository.cs | 4 +-
.../Channels/SalesProductRepository.cs | 53 ++++++++--------
.../Channels/ServiceChannelRepository.cs | 49 +++++++--------
.../Channels/WeightRoundingRepository.cs | 12 ++--
.../Channels/WeightRuleRepository.cs | 12 ++--
.../Customers/CustomerRepository.cs | 10 ++--
.../Customers/CustomerSubAccountRepository.cs | 6 +-
.../Operations/InboundRecordRepository.cs | 2 +-
.../Operations/LabelPrintRecordRepository.cs | 2 +-
.../Operations/OutboundRecordRepository.cs | 2 +-
.../Orders/OrderRepository.cs | 18 +++---
.../Orders/OrderTaskRepository.cs | 6 +-
.../Orders/OrderTemplateRepository.cs | 4 +-
.../Recharge/RechargeRecordRepository.cs | 4 +-
.../System/WarehouseAddressRepository.cs | 4 +-
35 files changed, 222 insertions(+), 443 deletions(-)
diff --git a/SimpleAdmin.sln.DotSettings.user b/SimpleAdmin.sln.DotSettings.user
index c58fa73..01d3b13 100644
--- a/SimpleAdmin.sln.DotSettings.user
+++ b/SimpleAdmin.sln.DotSettings.user
@@ -1,5 +1,7 @@
ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
- ForceIncluded
\ No newline at end of file
+ ForceIncluded
+ ForceIncluded
\ No newline at end of file
diff --git a/src/Oms.Application/Services/Channels/AutoTriggerService.cs b/src/Oms.Application/Services/Channels/AutoTriggerService.cs
index 5de70ff..10b7df4 100644
--- a/src/Oms.Application/Services/Channels/AutoTriggerService.cs
+++ b/src/Oms.Application/Services/Channels/AutoTriggerService.cs
@@ -55,7 +55,6 @@ public class AutoTriggerService : ApplicationService
[HttpPost("/channel/auto-trigger/create")]
public async Task CreateAsync(AutoTriggerSaveInput input)
{
- var now = DateTime.Now;
var entity = new AutoTrigger
{
Status = input.Status,
@@ -63,10 +62,7 @@ public class AutoTriggerService : ApplicationService
TriggerTiming = input.TriggerTiming,
TriggerCondition = input.TriggerCondition,
PromptMessage = input.PromptMessage,
- Notifier = input.Notifier,
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = CurrentUser.GetId()
+ Notifier = input.Notifier
};
await AutoTriggerRepository.InsertAsync(entity);
}
@@ -92,8 +88,6 @@ public class AutoTriggerService : ApplicationService
entity.TriggerCondition = input.TriggerCondition;
entity.PromptMessage = input.PromptMessage;
entity.Notifier = input.Notifier;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await AutoTriggerRepository.UpdateAsync(entity);
}
@@ -112,10 +106,7 @@ public class AutoTriggerService : ApplicationService
public async Task DeleteAsync(IdInput input)
{
var entity = await GetEntityOrThrowAsync(input.Id);
- entity.IsDeleted = true;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
- await AutoTriggerRepository.UpdateAsync(entity);
+ await AutoTriggerRepository.DeleteAsync(entity);
}
///
@@ -134,8 +125,6 @@ public class AutoTriggerService : ApplicationService
{
var entity = await GetEntityOrThrowAsync(input.Id);
entity.Status = input.Status;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await AutoTriggerRepository.UpdateAsync(entity);
}
@@ -144,7 +133,6 @@ public class AutoTriggerService : ApplicationService
var operation = input.Operation?.Trim();
var triggerTiming = input.TriggerTiming?.Trim();
return entity =>
- !entity.IsDeleted &&
(string.IsNullOrWhiteSpace(operation) || entity.Operation == operation) &&
(string.IsNullOrWhiteSpace(triggerTiming) || entity.TriggerTiming == triggerTiming);
}
@@ -156,7 +144,7 @@ public class AutoTriggerService : ApplicationService
throw new BusinessException("自动触发不存在");
}
- var entity = await AutoTriggerRepository.FirstOrDefaultAsync(x => !x.IsDeleted && x.Id == id.Value);
+ var entity = await AutoTriggerRepository.FirstOrDefaultAsync(x => x.Id == id.Value);
if (entity == null)
{
throw new BusinessException("自动触发不存在");
diff --git a/src/Oms.Application/Services/Channels/KpiAreaService.cs b/src/Oms.Application/Services/Channels/KpiAreaService.cs
index 27f3550..9748a04 100644
--- a/src/Oms.Application/Services/Channels/KpiAreaService.cs
+++ b/src/Oms.Application/Services/Channels/KpiAreaService.cs
@@ -59,16 +59,12 @@ public class KpiAreaService : ApplicationService
public async Task CreateAsync(KpiAreaSaveInput input)
{
await ValidateAreaNameAsync(input.AppKey, input.AreaType, input.Name, null);
- var now = DateTime.Now;
var entity = new KpiArea
{
AppKey = input.AppKey,
AreaType = input.AreaType,
Name = input.Name,
- SystemName = input.SystemName,
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = CurrentUser.GetId()
+ SystemName = input.SystemName
};
await KpiAreaRepository.InsertAsync(entity);
}
@@ -93,8 +89,6 @@ public class KpiAreaService : ApplicationService
entity.AreaType = input.AreaType;
entity.Name = input.Name;
entity.SystemName = input.SystemName;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await KpiAreaRepository.UpdateAsync(entity);
}
@@ -113,10 +107,7 @@ public class KpiAreaService : ApplicationService
public async Task DeleteAsync(IdInput input)
{
var entity = await GetAreaOrThrowAsync(input.Id);
- entity.IsDeleted = true;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
- await KpiAreaRepository.UpdateAsync(entity);
+ await KpiAreaRepository.DeleteAsync(entity);
}
///
@@ -160,7 +151,6 @@ public class KpiAreaService : ApplicationService
public async Task AddInfoAsync(KpiAreaInfoSaveInput input)
{
await GetAreaOrThrowAsync(input.AreaId);
- var now = DateTime.Now;
await KpiAreaRepository.InsertInfoAsync(new KpiAreaInfo
{
AreaId = input.AreaId,
@@ -169,10 +159,7 @@ public class KpiAreaService : ApplicationService
Province = input.Province,
City = input.City,
LeftPostcode = input.LeftPostcode,
- RightPostcode = input.RightPostcode,
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = CurrentUser.GetId()
+ RightPostcode = input.RightPostcode
});
}
@@ -199,8 +186,6 @@ public class KpiAreaService : ApplicationService
entity.City = input.City;
entity.LeftPostcode = input.LeftPostcode;
entity.RightPostcode = input.RightPostcode;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await KpiAreaRepository.UpdateInfoAsync(entity);
}
@@ -227,7 +212,6 @@ public class KpiAreaService : ApplicationService
var appKey = input.AppKey?.Trim();
var areaType = input.AreaType?.Trim();
return entity =>
- !entity.IsDeleted &&
(string.IsNullOrWhiteSpace(appKey) || entity.AppKey == appKey) &&
(string.IsNullOrWhiteSpace(areaType) || entity.AreaType == areaType);
}
@@ -248,7 +232,7 @@ public class KpiAreaService : ApplicationService
throw new BusinessException("分区不存在");
}
- var entity = await KpiAreaRepository.FirstOrDefaultAsync(x => !x.IsDeleted && x.Id == id.Value);
+ var entity = await KpiAreaRepository.FirstOrDefaultAsync(x => x.Id == id.Value);
if (entity == null)
{
throw new BusinessException("分区不存在");
diff --git a/src/Oms.Application/Services/Channels/LabelTemplateService.cs b/src/Oms.Application/Services/Channels/LabelTemplateService.cs
index 29d1ada..540d29e 100644
--- a/src/Oms.Application/Services/Channels/LabelTemplateService.cs
+++ b/src/Oms.Application/Services/Channels/LabelTemplateService.cs
@@ -34,8 +34,6 @@ public class LabelTemplateService : ApplicationService
entity.Name = input.Name;
entity.TemplateType = input.TemplateType;
entity.TemplateJson = OmsDocHelper.SerializeJson(input.TemplateJson);
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await LabelTemplateRepository.UpdateAsync(entity);
}
else
@@ -45,10 +43,7 @@ public class LabelTemplateService : ApplicationService
{
Name = input.Name,
TemplateType = input.TemplateType,
- TemplateJson = OmsDocHelper.SerializeJson(input.TemplateJson),
- IsDeleted = false,
- CreateTime = DateTime.Now,
- CreateUserId = CurrentUser.GetId()
+ TemplateJson = OmsDocHelper.SerializeJson(input.TemplateJson)
};
entity = await LabelTemplateRepository.InsertAsync(entity);
}
@@ -67,7 +62,7 @@ public class LabelTemplateService : ApplicationService
private async Task GetEntityOrThrowAsync(long id)
{
- var entity = await LabelTemplateRepository.FirstOrDefaultAsync(x => !x.IsDeleted && x.Id == id);
+ var entity = await LabelTemplateRepository.FirstOrDefaultAsync(x => x.Id == id);
if (entity == null)
{
throw new BusinessException("标签模板不存在");
diff --git a/src/Oms.Application/Services/Channels/SalesProductService.Helpers.cs b/src/Oms.Application/Services/Channels/SalesProductService.Helpers.cs
index 9140568..ed8829e 100644
--- a/src/Oms.Application/Services/Channels/SalesProductService.Helpers.cs
+++ b/src/Oms.Application/Services/Channels/SalesProductService.Helpers.cs
@@ -31,7 +31,7 @@ public partial class SalesProductService
throw new Fake.Application.BusinessException("销售产品不存在");
}
- var entity = await SalesProductRepository.FirstOrDefaultAsync(x => !x.IsDeleted && x.Id == id.Value);
+ var entity = await SalesProductRepository.FirstOrDefaultAsync(x => x.Id == id.Value);
if (entity == null)
{
throw new Fake.Application.BusinessException("销售产品不存在");
@@ -102,7 +102,7 @@ public partial class SalesProductService
var channelIds = providers.Where(x => x.ServiceChannelId.HasValue).Select(x => x.ServiceChannelId!.Value).Distinct().ToArray();
var channels = channelIds.Length == 0
? []
- : await ServiceChannelRepository.GetListAsync(x => !x.IsDeleted && channelIds.Contains(x.Id));
+ : await ServiceChannelRepository.GetListAsync(x => channelIds.Contains(x.Id));
var channelMap = channels.ToDictionary(x => x.Id, x => x.ChannelName);
return new SalesProductAllocationOutput
@@ -199,10 +199,7 @@ public partial class SalesProductService
PublishUser = string.IsNullOrWhiteSpace(CurrentUser.UserName) ? CurrentUser.GetId().ToString() : CurrentUser.UserName!,
PublishTime = DateTime.Now,
Description = description,
- Content = OmsDocHelper.SerializeJson(snapshot),
- IsDeleted = false,
- CreateTime = DateTime.Now,
- CreateUserId = CurrentUser.GetId()
+ Content = OmsDocHelper.SerializeJson(snapshot)
});
}
@@ -245,12 +242,8 @@ public partial class SalesProductService
// 规则回滚既恢复产品配置,也恢复排货服务商列表。
var product = await GetProductOrThrowAsync(input.SalesProductId);
ApplyProductInput(product, rulesSnapshot.Product);
- product.UpdateTime = DateTime.Now;
- product.UpdateUserId = CurrentUser.GetId();
await SalesProductRepository.UpdateAsync(product);
- var now = DateTime.Now;
- var userId = CurrentUser.GetId();
var providers = rulesSnapshot.Providers.Select(provider => new SalesProductAllocationProvider
{
SalesProductId = input.SalesProductId,
@@ -258,10 +251,7 @@ public partial class SalesProductService
ProviderName = provider.ProviderName,
ServiceChannelId = provider.ServiceChannelId,
Weight = provider.Weight,
- CustomerIds = OmsDocHelper.SerializeJson(provider.CustomerIds),
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ CustomerIds = OmsDocHelper.SerializeJson(provider.CustomerIds)
}).ToList();
await SalesProductRepository.ReplaceAllocationProvidersAsync(input.SalesProductId, providers);
}
@@ -361,21 +351,18 @@ public partial class SalesProductService
};
}
- private static List BuildSalesProductPriceFactors(IEnumerable inputs, DateTime now, int userId, long? priceId = null)
+ private static List BuildSalesProductPriceFactors(IEnumerable inputs, long? priceId = null)
{
return inputs.Select(input => new SalesProductPriceFactor
{
PriceId = priceId ?? 0,
SerialNumber = input.SerialNumber,
Factor = input.Factor,
- FactorValues = OmsDocHelper.SerializeJson(input.FactorValues),
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ FactorValues = OmsDocHelper.SerializeJson(input.FactorValues)
}).ToList();
}
- private static List BuildSalesProductPriceDetails(IEnumerable inputs, DateTime now, int userId, long? priceId = null)
+ private static List BuildSalesProductPriceDetails(IEnumerable inputs, long? priceId = null)
{
return inputs.Select(input => new SalesProductPriceDetail
{
@@ -383,10 +370,7 @@ public partial class SalesProductService
FactorValuesJson = OmsDocHelper.SerializeJson(input.FactorValuesJson),
CalculationFormula = input.CalculationFormula,
CalculatedValue = input.CalculatedValue,
- CustomerGroupValues = OmsDocHelper.SerializeJson(input.CustomerGroupValues),
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ CustomerGroupValues = OmsDocHelper.SerializeJson(input.CustomerGroupValues)
}).ToList();
}
diff --git a/src/Oms.Application/Services/Channels/SalesProductService.cs b/src/Oms.Application/Services/Channels/SalesProductService.cs
index 37633d8..aa8f540 100644
--- a/src/Oms.Application/Services/Channels/SalesProductService.cs
+++ b/src/Oms.Application/Services/Channels/SalesProductService.cs
@@ -81,12 +81,7 @@ public partial class SalesProductService : ApplicationService
public async Task CreateAsync(SalesProductSaveInput input)
{
await ValidateProductCodeAsync(input.ProductCode, null);
- var entity = new SalesProduct
- {
- IsDeleted = false,
- CreateTime = DateTime.Now,
- CreateUserId = CurrentUser.GetId()
- };
+ var entity = new SalesProduct();
ApplyProductInput(entity, input);
await SalesProductRepository.InsertAsync(entity);
}
@@ -108,8 +103,6 @@ public partial class SalesProductService : ApplicationService
var entity = await GetProductOrThrowAsync(input.Id);
await ValidateProductCodeAsync(input.ProductCode, entity.Id);
ApplyProductInput(entity, input);
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await SalesProductRepository.UpdateAsync(entity);
}
@@ -128,10 +121,7 @@ public partial class SalesProductService : ApplicationService
public async Task DeleteAsync(IdInput input)
{
var entity = await GetProductOrThrowAsync(input.Id);
- entity.IsDeleted = true;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
- await SalesProductRepository.UpdateAsync(entity);
+ await SalesProductRepository.DeleteAsync(entity);
}
///
@@ -151,8 +141,6 @@ public partial class SalesProductService : ApplicationService
var entity = await GetProductOrThrowAsync(input.Id);
await ValidateProductCodeAsync(input.ProductCode, entity.Id);
ApplyProductInput(entity, input);
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await SalesProductRepository.UpdateAsync(entity);
}
@@ -192,8 +180,6 @@ public partial class SalesProductService : ApplicationService
public async Task CreatePriceAsync(SalesProductPriceSaveInput input)
{
await GetProductOrThrowAsync(input.SalesProductId);
- var now = DateTime.Now;
- var userId = CurrentUser.GetId();
await SalesProductRepository.InsertPriceAsync(
new SalesProductPrice
{
@@ -205,13 +191,10 @@ public partial class SalesProductService : ApplicationService
CostUnit = input.CostUnit,
Currency = input.Currency,
ChargingTime = input.ChargingTime,
- ChargingCondition = input.ChargingCondition,
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ ChargingCondition = input.ChargingCondition
},
- BuildSalesProductPriceFactors(input.Factors, now, userId),
- BuildSalesProductPriceDetails(input.Details, now, userId));
+ BuildSalesProductPriceFactors(input.Factors),
+ BuildSalesProductPriceDetails(input.Details));
}
///
@@ -242,12 +225,10 @@ public partial class SalesProductService : ApplicationService
price.Currency = input.Currency;
price.ChargingTime = input.ChargingTime;
price.ChargingCondition = input.ChargingCondition;
- price.UpdateTime = DateTime.Now;
- price.UpdateUserId = CurrentUser.GetId();
await SalesProductRepository.UpdatePriceAsync(
price,
- BuildSalesProductPriceFactors(input.Factors, DateTime.Now, CurrentUser.GetId()),
- BuildSalesProductPriceDetails(input.Details, DateTime.Now, CurrentUser.GetId()));
+ BuildSalesProductPriceFactors(input.Factors),
+ BuildSalesProductPriceDetails(input.Details));
}
///
@@ -301,8 +282,6 @@ public partial class SalesProductService : ApplicationService
public async Task SavePriceAsync(SalesProductPriceSaveAllInput input)
{
await GetProductOrThrowAsync(input.SalesProductId);
- var now = DateTime.Now;
- var userId = CurrentUser.GetId();
var prices = new List();
var factors = new List();
var details = new List();
@@ -323,13 +302,10 @@ public partial class SalesProductService : ApplicationService
CostUnit = priceInput.CostUnit,
Currency = priceInput.Currency,
ChargingTime = priceInput.ChargingTime,
- ChargingCondition = priceInput.ChargingCondition,
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ ChargingCondition = priceInput.ChargingCondition
});
- factors.AddRange(BuildSalesProductPriceFactors(priceInput.Factors, now, userId, currentTempId));
- details.AddRange(BuildSalesProductPriceDetails(priceInput.Details, now, userId, currentTempId));
+ factors.AddRange(BuildSalesProductPriceFactors(priceInput.Factors, currentTempId));
+ details.AddRange(BuildSalesProductPriceDetails(priceInput.Details, currentTempId));
}
await SalesProductRepository.ReplacePricesAsync(input.SalesProductId, prices, factors, details);
@@ -372,12 +348,8 @@ public partial class SalesProductService : ApplicationService
{
var product = await GetProductOrThrowAsync(input.SalesProductId);
product.Scheme = input.Scheme;
- product.UpdateTime = DateTime.Now;
- product.UpdateUserId = CurrentUser.GetId();
await SalesProductRepository.UpdateAsync(product);
- var now = DateTime.Now;
- var userId = CurrentUser.GetId();
var providers = input.Providers.Select(provider => new SalesProductAllocationProvider
{
SalesProductId = input.SalesProductId,
@@ -385,10 +357,7 @@ public partial class SalesProductService : ApplicationService
ProviderName = provider.ProviderName,
ServiceChannelId = provider.ServiceChannelId,
Weight = provider.Weight,
- CustomerIds = OmsDocHelper.SerializeJson(provider.CustomerIds),
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ CustomerIds = OmsDocHelper.SerializeJson(provider.CustomerIds)
}).ToList();
await SalesProductRepository.ReplaceAllocationProvidersAsync(input.SalesProductId, providers);
@@ -470,10 +439,11 @@ public partial class SalesProductService : ApplicationService
{
var productGroup = input.ProductGroup?.Trim();
var keyword = input.Keyword?.Trim();
+ var hasIsActiveFilter = input.IsActive.HasValue;
+ var isActiveValue = input.IsActive.GetValueOrDefault();
return entity =>
- !entity.IsDeleted &&
(string.IsNullOrWhiteSpace(productGroup) || entity.ProductGroup == productGroup) &&
(string.IsNullOrWhiteSpace(keyword) || entity.ProductCode.Contains(keyword) || entity.ProductName.Contains(keyword)) &&
- (!input.IsActive.HasValue || entity.IsActive == input.IsActive.Value);
+ (!hasIsActiveFilter || entity.IsActive == isActiveValue);
}
}
diff --git a/src/Oms.Application/Services/Channels/ServiceChannelService.Helpers.cs b/src/Oms.Application/Services/Channels/ServiceChannelService.Helpers.cs
index 5be7c63..7d4d487 100644
--- a/src/Oms.Application/Services/Channels/ServiceChannelService.Helpers.cs
+++ b/src/Oms.Application/Services/Channels/ServiceChannelService.Helpers.cs
@@ -38,7 +38,7 @@ public partial class ServiceChannelService
throw new Fake.Application.BusinessException("服务渠道不存在");
}
- var entity = await ServiceChannelRepository.FirstOrDefaultAsync(x => !x.IsDeleted && x.Id == id.Value);
+ var entity = await ServiceChannelRepository.FirstOrDefaultAsync(x => x.Id == id.Value);
if (entity == null)
{
throw new Fake.Application.BusinessException("服务渠道不存在");
@@ -168,10 +168,7 @@ public partial class ServiceChannelService
PublishUser = string.IsNullOrWhiteSpace(CurrentUser.UserName) ? CurrentUser.GetId().ToString() : CurrentUser.UserName!,
PublishTime = DateTime.Now,
Description = description,
- Content = OmsDocHelper.SerializeJson(snapshot),
- IsDeleted = false,
- CreateTime = DateTime.Now,
- CreateUserId = CurrentUser.GetId()
+ Content = OmsDocHelper.SerializeJson(snapshot)
});
}
@@ -213,8 +210,6 @@ public partial class ServiceChannelService
var entity = await GetEntityOrThrowAsync(input.ServiceChannelId);
ApplyInput(entity, rulesSnapshot.Channel);
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await ServiceChannelRepository.UpdateAsync(entity);
}
@@ -303,21 +298,18 @@ public partial class ServiceChannelService
};
}
- private static List BuildPriceFactors(IEnumerable inputs, DateTime now, int userId, long? priceId = null)
+ private static List BuildPriceFactors(IEnumerable inputs, long? priceId = null)
{
return inputs.Select(input => new ServiceChannelPriceFactor
{
PriceId = priceId ?? 0,
SerialNumber = input.SerialNumber,
Factor = input.Factor,
- FactorValues = OmsDocHelper.SerializeJson(input.FactorValues),
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ FactorValues = OmsDocHelper.SerializeJson(input.FactorValues)
}).ToList();
}
- private static List BuildPriceDetails(IEnumerable inputs, DateTime now, int userId, long? priceId = null)
+ private static List BuildPriceDetails(IEnumerable inputs, long? priceId = null)
{
return inputs.Select(input => new ServiceChannelPriceDetail
{
@@ -325,10 +317,7 @@ public partial class ServiceChannelService
FactorValuesJson = OmsDocHelper.SerializeJson(input.FactorValuesJson),
CalculationFormula = input.CalculationFormula,
CalculatedValue = input.CalculatedValue,
- CustomerGroupValues = OmsDocHelper.SerializeJson(input.CustomerGroupValues),
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ CustomerGroupValues = OmsDocHelper.SerializeJson(input.CustomerGroupValues)
}).ToList();
}
diff --git a/src/Oms.Application/Services/Channels/ServiceChannelService.cs b/src/Oms.Application/Services/Channels/ServiceChannelService.cs
index 47cc745..dfa0f83 100644
--- a/src/Oms.Application/Services/Channels/ServiceChannelService.cs
+++ b/src/Oms.Application/Services/Channels/ServiceChannelService.cs
@@ -81,12 +81,7 @@ public partial class ServiceChannelService : ApplicationService
public async Task CreateAsync(ServiceChannelSaveInput input)
{
await ValidateChannelCodeAsync(input.ChannelCode, null);
- var entity = new ServiceChannel
- {
- IsDeleted = false,
- CreateTime = DateTime.Now,
- CreateUserId = CurrentUser.GetId()
- };
+ var entity = new ServiceChannel();
ApplyInput(entity, input);
await ServiceChannelRepository.InsertAsync(entity);
}
@@ -108,8 +103,6 @@ public partial class ServiceChannelService : ApplicationService
var entity = await GetEntityOrThrowAsync(input.Id);
await ValidateChannelCodeAsync(input.ChannelCode, entity.Id);
ApplyInput(entity, input);
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await ServiceChannelRepository.UpdateAsync(entity);
}
@@ -128,10 +121,7 @@ public partial class ServiceChannelService : ApplicationService
public async Task DeleteAsync(IdInput input)
{
var entity = await GetEntityOrThrowAsync(input.Id);
- entity.IsDeleted = true;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
- await ServiceChannelRepository.UpdateAsync(entity);
+ await ServiceChannelRepository.DeleteAsync(entity);
}
///
@@ -151,8 +141,6 @@ public partial class ServiceChannelService : ApplicationService
var entity = await GetEntityOrThrowAsync(input.Id);
await ValidateChannelCodeAsync(input.ChannelCode, entity.Id);
ApplyInput(entity, input);
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await ServiceChannelRepository.UpdateAsync(entity);
}
@@ -192,8 +180,6 @@ public partial class ServiceChannelService : ApplicationService
public async Task CreatePriceAsync(ServiceChannelPriceSaveInput input)
{
await GetEntityOrThrowAsync(input.ServiceChannelId);
- var now = DateTime.Now;
- var userId = CurrentUser.GetId();
await ServiceChannelRepository.InsertPriceAsync(
new ServiceChannelPrice
{
@@ -205,13 +191,10 @@ public partial class ServiceChannelService : ApplicationService
CostUnit = input.CostUnit,
Currency = input.Currency,
ChargingTime = input.ChargingTime,
- ChargingCondition = input.ChargingCondition,
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ ChargingCondition = input.ChargingCondition
},
- BuildPriceFactors(input.Factors, now, userId),
- BuildPriceDetails(input.Details, now, userId));
+ BuildPriceFactors(input.Factors),
+ BuildPriceDetails(input.Details));
}
///
@@ -242,12 +225,10 @@ public partial class ServiceChannelService : ApplicationService
price.Currency = input.Currency;
price.ChargingTime = input.ChargingTime;
price.ChargingCondition = input.ChargingCondition;
- price.UpdateTime = DateTime.Now;
- price.UpdateUserId = CurrentUser.GetId();
await ServiceChannelRepository.UpdatePriceAsync(
price,
- BuildPriceFactors(input.Factors, DateTime.Now, CurrentUser.GetId()),
- BuildPriceDetails(input.Details, DateTime.Now, CurrentUser.GetId()));
+ BuildPriceFactors(input.Factors),
+ BuildPriceDetails(input.Details));
}
///
@@ -301,8 +282,6 @@ public partial class ServiceChannelService : ApplicationService
public async Task SavePriceAsync(ServiceChannelPriceSaveAllInput input)
{
await GetEntityOrThrowAsync(input.ServiceChannelId);
- var now = DateTime.Now;
- var userId = CurrentUser.GetId();
var prices = new List();
var factors = new List();
var details = new List();
@@ -323,13 +302,10 @@ public partial class ServiceChannelService : ApplicationService
CostUnit = priceInput.CostUnit,
Currency = priceInput.Currency,
ChargingTime = priceInput.ChargingTime,
- ChargingCondition = priceInput.ChargingCondition,
- IsDeleted = false,
- CreateTime = now,
- CreateUserId = userId
+ ChargingCondition = priceInput.ChargingCondition
});
- factors.AddRange(BuildPriceFactors(priceInput.Factors, now, userId, currentTempId));
- details.AddRange(BuildPriceDetails(priceInput.Details, now, userId, currentTempId));
+ factors.AddRange(BuildPriceFactors(priceInput.Factors, currentTempId));
+ details.AddRange(BuildPriceDetails(priceInput.Details, currentTempId));
}
await ServiceChannelRepository.ReplacePricesAsync(input.ServiceChannelId, prices, factors, details);
@@ -410,10 +386,13 @@ public partial class ServiceChannelService : ApplicationService
private static Expression> BuildListPredicate(ServiceChannelListInput input)
{
var keyword = input.Keyword?.Trim();
+ var hasGroupFilter = input.GroupId.HasValue;
+ var groupIdValue = input.GroupId.GetValueOrDefault();
+ var hasIsActiveFilter = input.IsActive.HasValue;
+ var isActiveValue = input.IsActive.GetValueOrDefault();
return entity =>
- !entity.IsDeleted &&
- (!input.GroupId.HasValue || entity.GroupId == input.GroupId.Value) &&
+ (!hasGroupFilter || entity.GroupId == groupIdValue) &&
(string.IsNullOrWhiteSpace(keyword) || entity.ChannelCode.Contains(keyword) || entity.ChannelName.Contains(keyword)) &&
- (!input.IsActive.HasValue || entity.IsActive == input.IsActive.Value);
+ (!hasIsActiveFilter || entity.IsActive == isActiveValue);
}
}
diff --git a/src/Oms.Application/Services/Channels/WeightRoundingService.cs b/src/Oms.Application/Services/Channels/WeightRoundingService.cs
index ad4e521..edfc1c8 100644
--- a/src/Oms.Application/Services/Channels/WeightRoundingService.cs
+++ b/src/Oms.Application/Services/Channels/WeightRoundingService.cs
@@ -62,10 +62,7 @@ public class WeightRoundingService : ApplicationService
await WeightRoundingRepository.InsertAsync(new WeightRounding
{
AppKey = input.AppKey,
- Name = input.Name,
- IsDeleted = false,
- CreateTime = DateTime.Now,
- CreateUserId = CurrentUser.GetId()
+ Name = input.Name
});
}
@@ -87,8 +84,6 @@ public class WeightRoundingService : ApplicationService
await ValidateNameAsync(input.AppKey, input.Name, entity.Id);
entity.AppKey = input.AppKey;
entity.Name = input.Name;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await WeightRoundingRepository.UpdateAsync(entity);
}
@@ -107,10 +102,7 @@ public class WeightRoundingService : ApplicationService
public async Task DeleteAsync(IdInput input)
{
var entity = await GetEntityOrThrowAsync(input.Id);
- entity.IsDeleted = true;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
- await WeightRoundingRepository.UpdateAsync(entity);
+ await WeightRoundingRepository.DeleteAsync(entity);
}
///
@@ -161,10 +153,7 @@ public class WeightRoundingService : ApplicationService
EndValue = input.EndValue,
Public = input.Public,
CustomerGroup1 = input.CustomerGroup1,
- CustomerGroup2 = input.CustomerGroup2,
- IsDeleted = false,
- CreateTime = DateTime.Now,
- CreateUserId = CurrentUser.GetId()
+ CustomerGroup2 = input.CustomerGroup2
});
}
@@ -190,8 +179,6 @@ public class WeightRoundingService : ApplicationService
entity.Public = input.Public;
entity.CustomerGroup1 = input.CustomerGroup1;
entity.CustomerGroup2 = input.CustomerGroup2;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await WeightRoundingRepository.UpdateInfoAsync(entity);
}
@@ -216,7 +203,7 @@ public class WeightRoundingService : ApplicationService
private static Expression> BuildPredicate(WeightRoundingListInput input)
{
var appKey = input.AppKey?.Trim();
- return entity => !entity.IsDeleted && (string.IsNullOrWhiteSpace(appKey) || entity.AppKey == appKey);
+ return entity => string.IsNullOrWhiteSpace(appKey) || entity.AppKey == appKey;
}
private async Task ValidateNameAsync(string appKey, string name, long? id)
@@ -235,7 +222,7 @@ public class WeightRoundingService : ApplicationService
throw new BusinessException("计重进位不存在");
}
- var entity = await WeightRoundingRepository.FirstOrDefaultAsync(x => !x.IsDeleted && x.Id == id.Value);
+ var entity = await WeightRoundingRepository.FirstOrDefaultAsync(x => x.Id == id.Value);
if (entity == null)
{
throw new BusinessException("计重进位不存在");
diff --git a/src/Oms.Application/Services/Channels/WeightRuleService.cs b/src/Oms.Application/Services/Channels/WeightRuleService.cs
index 39a770b..e809cd3 100644
--- a/src/Oms.Application/Services/Channels/WeightRuleService.cs
+++ b/src/Oms.Application/Services/Channels/WeightRuleService.cs
@@ -62,10 +62,7 @@ public class WeightRuleService : ApplicationService
await WeightRuleRepository.InsertAsync(new WeightRule
{
AppKey = input.AppKey,
- Name = input.Name,
- IsDeleted = false,
- CreateTime = DateTime.Now,
- CreateUserId = CurrentUser.GetId()
+ Name = input.Name
});
}
@@ -87,8 +84,6 @@ public class WeightRuleService : ApplicationService
await ValidateNameAsync(input.AppKey, input.Name, entity.Id);
entity.AppKey = input.AppKey;
entity.Name = input.Name;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await WeightRuleRepository.UpdateAsync(entity);
}
@@ -107,10 +102,7 @@ public class WeightRuleService : ApplicationService
public async Task DeleteAsync(IdInput input)
{
var entity = await GetEntityOrThrowAsync(input.Id);
- entity.IsDeleted = true;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
- await WeightRuleRepository.UpdateAsync(entity);
+ await WeightRuleRepository.DeleteAsync(entity);
}
///
@@ -160,10 +152,7 @@ public class WeightRuleService : ApplicationService
Client = input.Client,
Condition = input.Condition,
BillableWeight = input.BillableWeight,
- VolumetricFactor = input.VolumetricFactor,
- IsDeleted = false,
- CreateTime = DateTime.Now,
- CreateUserId = CurrentUser.GetId()
+ VolumetricFactor = input.VolumetricFactor
});
}
@@ -188,8 +177,6 @@ public class WeightRuleService : ApplicationService
entity.Condition = input.Condition;
entity.BillableWeight = input.BillableWeight;
entity.VolumetricFactor = input.VolumetricFactor;
- entity.UpdateTime = DateTime.Now;
- entity.UpdateUserId = CurrentUser.GetId();
await WeightRuleRepository.UpdateInfoAsync(entity);
}
@@ -214,7 +201,7 @@ public class WeightRuleService : ApplicationService
private static Expression> BuildPredicate(WeightRuleListInput input)
{
var appKey = input.AppKey?.Trim();
- return entity => !entity.IsDeleted && (string.IsNullOrWhiteSpace(appKey) || entity.AppKey == appKey);
+ return entity => string.IsNullOrWhiteSpace(appKey) || entity.AppKey == appKey;
}
private async Task ValidateNameAsync(string appKey, string name, long? id)
@@ -233,7 +220,7 @@ public class WeightRuleService : ApplicationService
throw new BusinessException("计重规则不存在");
}
- var entity = await WeightRuleRepository.FirstOrDefaultAsync(x => !x.IsDeleted && x.Id == id.Value);
+ var entity = await WeightRuleRepository.FirstOrDefaultAsync(x => x.Id == id.Value);
if (entity == null)
{
throw new BusinessException("计重规则不存在");
diff --git a/src/Oms.Application/Services/Customers/CustomerService.cs b/src/Oms.Application/Services/Customers/CustomerService.cs
index b5fb73c..74c7432 100644
--- a/src/Oms.Application/Services/Customers/CustomerService.cs
+++ b/src/Oms.Application/Services/Customers/CustomerService.cs
@@ -92,15 +92,12 @@ public class CustomerService : ApplicationService
if (!string.IsNullOrWhiteSpace(input.Email))
{
var duplicatedEmail = await CustomerRepository.GetByEmailAsync(input.Email);
- if (duplicatedEmail != null && !duplicatedEmail.IsDeleted)
+ if (duplicatedEmail != null)
{
throw new BusinessException("邮箱已存在");
}
}
- var now = DateTime.Now;
- var userId = CurrentUser.GetId();
-
var entity = new Customer
{
CustomerCode = await GenerateCustomerCodeAsync(),
@@ -114,10 +111,7 @@ public class CustomerService : ApplicationService
Remark = input.Remark,
Salesman = input.Salesman,
CustomerService = input.CustomerService,
- CustomerGroup = input.CustomerGroup,
- IsDeleted = false,
- CreateUserId = userId,
- CreateTime = now
+ CustomerGroup = input.CustomerGroup
};
await CustomerRepository.InsertAsync(entity);
@@ -142,7 +136,7 @@ public class CustomerService : ApplicationService
if (!string.IsNullOrWhiteSpace(input.Email))
{
var duplicatedEmail = await CustomerRepository.GetByEmailAsync(input.Email);
- if (duplicatedEmail != null && duplicatedEmail.Id != entity.Id && !duplicatedEmail.IsDeleted)
+ if (duplicatedEmail != null && duplicatedEmail.Id != entity.Id)
{
throw new BusinessException("邮箱已存在");
}
@@ -155,8 +149,6 @@ public class CustomerService : ApplicationService
entity.Salesman = input.Salesman;
entity.CustomerService = input.CustomerService;
entity.CustomerGroup = input.CustomerGroup;
- entity.UpdateUserId = CurrentUser.GetId();
- entity.UpdateTime = DateTime.Now;
await CustomerRepository.UpdateAsync(entity);
}
@@ -176,10 +168,7 @@ public class CustomerService : ApplicationService
public async Task DeleteAsync(IdInput input)
{
var entity = await GetCustomerOrThrowAsync(input.Id);
- entity.IsDeleted = true;
- entity.UpdateUserId = CurrentUser.GetId();
- entity.UpdateTime = DateTime.Now;
- await CustomerRepository.UpdateAsync(entity);
+ await CustomerRepository.DeleteAsync(entity);
}
///
@@ -198,8 +187,6 @@ public class CustomerService : ApplicationService
{
var entity = await GetCustomerOrThrowAsync(input.Id);
entity.Password = OmsPasswordHelper.ToMd5(input.NewPassword);
- entity.UpdateUserId = CurrentUser.GetId();
- entity.UpdateTime = DateTime.Now;
await CustomerRepository.UpdateAsync(entity);
}
@@ -208,22 +195,25 @@ public class CustomerService : ApplicationService
var keyword = input.Keyword?.Trim();
var salesman = input.Salesman?.Trim();
var customerService = input.CustomerService?.Trim();
+ var hasStatusFilter = input.Status.HasValue;
+ var statusValue = input.Status.GetValueOrDefault();
+ var hasCustomerGroupFilter = input.CustomerGroup.HasValue;
+ var customerGroupValue = input.CustomerGroup.GetValueOrDefault();
return customer =>
- !customer.IsDeleted &&
(string.IsNullOrWhiteSpace(keyword) ||
customer.CustomerCode.Contains(keyword) ||
customer.Phone.Contains(keyword) ||
(customer.Email ?? string.Empty).Contains(keyword)) &&
- (!input.Status.HasValue || customer.Status == input.Status.Value) &&
- (!input.CustomerGroup.HasValue || customer.CustomerGroup == input.CustomerGroup.Value) &&
+ (!hasStatusFilter || customer.Status == statusValue) &&
+ (!hasCustomerGroupFilter || customer.CustomerGroup == customerGroupValue) &&
(string.IsNullOrWhiteSpace(salesman) || customer.Salesman == salesman) &&
(string.IsNullOrWhiteSpace(customerService) || customer.CustomerService == customerService);
}
private async Task GetCustomerOrThrowAsync(long id)
{
- var entity = await CustomerRepository.FirstOrDefaultAsync(x => x.Id == id && !x.IsDeleted);
+ var entity = await CustomerRepository.FirstOrDefaultAsync(x => x.Id == id);
if (entity == null)
{
throw new BusinessException("客户不存在");
@@ -238,7 +228,7 @@ public class CustomerService : ApplicationService
{
var code = $"W{DateTime.Now:yyMMddHHmmss}{Random.Shared.Next(10, 99)}";
var exists = await CustomerRepository.GetByCustomerCodeAsync(code);
- if (exists == null || exists.IsDeleted)
+ if (exists == null)
{
return code;
}
diff --git a/src/Oms.Application/Services/Operations/InboundRecordService.cs b/src/Oms.Application/Services/Operations/InboundRecordService.cs
index 0467491..77d3cb1 100644
--- a/src/Oms.Application/Services/Operations/InboundRecordService.cs
+++ b/src/Oms.Application/Services/Operations/InboundRecordService.cs
@@ -43,10 +43,7 @@ public class InboundRecordService : ApplicationService
DestinationCountry = input.DestinationCountry,
WarehouseId = input.WarehouseId,
OperateTime = now,
- OperatorId = operatorId,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = now
+ OperatorId = operatorId
};
var savedEntity = await InboundRecordRepository.InsertAsync(entity);
@@ -68,8 +65,10 @@ public class InboundRecordService : ApplicationService
[HttpGet("/operation/inbound/recent-list")]
public async Task> GetRecentListAsync([FromQuery] int limit = 20, [FromQuery] long? warehouseId = null)
{
+ var hasWarehouseFilter = warehouseId.HasValue;
+ var warehouseIdValue = warehouseId.GetValueOrDefault();
var entities = await InboundRecordRepository.GetPagedListAsync(
- x => !x.IsDeleted && (!warehouseId.HasValue || x.WarehouseId == warehouseId),
+ x => !hasWarehouseFilter || x.WarehouseId == warehouseIdValue,
1,
limit <= 0 ? 20 : limit,
new Dictionary { [nameof(InboundRecord.OperateTime)] = false, [nameof(InboundRecord.Id)] = false });
@@ -78,10 +77,10 @@ public class InboundRecordService : ApplicationService
var warehouseIds = entities.Where(x => x.WarehouseId.HasValue).Select(x => x.WarehouseId!.Value).Distinct().ToArray();
var products = salesProductIds.Length == 0
? []
- : await SalesProductRepository.GetListAsync(x => !x.IsDeleted && salesProductIds.Contains(x.Id));
+ : await SalesProductRepository.GetListAsync(x => salesProductIds.Contains(x.Id));
var warehouses = warehouseIds.Length == 0
? []
- : await WarehouseAddressRepository.GetListAsync(x => !x.IsDeleted && warehouseIds.Contains(x.Id));
+ : await WarehouseAddressRepository.GetListAsync(x => warehouseIds.Contains(x.Id));
var productMap = products.ToDictionary(x => x.Id);
var warehouseMap = warehouses.ToDictionary(x => x.Id);
diff --git a/src/Oms.Application/Services/Operations/LabelPrintService.cs b/src/Oms.Application/Services/Operations/LabelPrintService.cs
index 352d588..cef45ae 100644
--- a/src/Oms.Application/Services/Operations/LabelPrintService.cs
+++ b/src/Oms.Application/Services/Operations/LabelPrintService.cs
@@ -33,7 +33,7 @@ public class LabelPrintService : ApplicationService
LabelTemplate? labelTemplate = null;
if (input.LabelTemplateId.HasValue)
{
- labelTemplate = await LabelTemplateRepository.FirstOrDefaultAsync(x => x.Id == input.LabelTemplateId.Value && !x.IsDeleted);
+ labelTemplate = await LabelTemplateRepository.FirstOrDefaultAsync(x => x.Id == input.LabelTemplateId.Value);
if (labelTemplate == null)
{
throw new BusinessException("标签模板不存在");
@@ -42,7 +42,7 @@ public class LabelPrintService : ApplicationService
else if (!string.IsNullOrWhiteSpace(input.TemplateType))
{
var list = await LabelTemplateRepository.GetListAsync(
- x => !x.IsDeleted && x.TemplateType == input.TemplateType);
+ x => x.TemplateType == input.TemplateType);
labelTemplate = list.OrderByDescending(x => x.UpdateTime).ThenByDescending(x => x.Id).FirstOrDefault();
}
@@ -79,10 +79,7 @@ public class LabelPrintService : ApplicationService
LabelTemplateId = labelTemplate?.Id ?? input.LabelTemplateId,
PrintSuccess = EnableStatus.Enabled,
PrintTime = now,
- OperatorId = operatorId,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = now
+ OperatorId = operatorId
};
var savedEntity = await LabelPrintRecordRepository.InsertAsync(entity);
@@ -107,8 +104,10 @@ public class LabelPrintService : ApplicationService
[HttpGet("/operation/print-label/recent-list")]
public async Task> GetRecentListAsync([FromQuery] int limit = 20, [FromQuery] long? labelTemplateId = null)
{
+ var hasTemplateFilter = labelTemplateId.HasValue;
+ var labelTemplateIdValue = labelTemplateId.GetValueOrDefault();
var entities = await LabelPrintRecordRepository.GetPagedListAsync(
- x => !x.IsDeleted && (!labelTemplateId.HasValue || x.LabelTemplateId == labelTemplateId),
+ x => !hasTemplateFilter || x.LabelTemplateId == labelTemplateIdValue,
1,
limit <= 0 ? 20 : limit,
new Dictionary { [nameof(LabelPrintRecord.PrintTime)] = false, [nameof(LabelPrintRecord.Id)] = false });
@@ -116,7 +115,7 @@ public class LabelPrintService : ApplicationService
var templateIds = entities.Where(x => x.LabelTemplateId.HasValue).Select(x => x.LabelTemplateId!.Value).Distinct().ToArray();
var templates = templateIds.Length == 0
? []
- : await LabelTemplateRepository.GetListAsync(x => !x.IsDeleted && templateIds.Contains(x.Id));
+ : await LabelTemplateRepository.GetListAsync(x => templateIds.Contains(x.Id));
var templateMap = templates.ToDictionary(x => x.Id);
var items = new List(entities.Count);
foreach (var entity in entities)
@@ -149,7 +148,7 @@ public class LabelPrintService : ApplicationService
public async Task> GetTemplateDropdownListAsync([FromQuery] string? templateType = null)
{
var entities = await LabelTemplateRepository.GetListAsync(
- x => !x.IsDeleted && (string.IsNullOrWhiteSpace(templateType) || x.TemplateType == templateType));
+ x => string.IsNullOrWhiteSpace(templateType) || x.TemplateType == templateType);
var items = entities
.Select(entity => ObjectMapper.Map(entity))
diff --git a/src/Oms.Application/Services/Operations/OutboundRecordService.cs b/src/Oms.Application/Services/Operations/OutboundRecordService.cs
index 3e60f4c..6067ea1 100644
--- a/src/Oms.Application/Services/Operations/OutboundRecordService.cs
+++ b/src/Oms.Application/Services/Operations/OutboundRecordService.cs
@@ -35,10 +35,7 @@ public class OutboundRecordService : ApplicationService
WaybillNo = input.WaybillNo,
WarehouseId = input.WarehouseId,
OperateTime = now,
- OperatorId = operatorId,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = now
+ OperatorId = operatorId
};
var savedEntity = await OutboundRecordRepository.InsertAsync(entity);
@@ -60,8 +57,10 @@ public class OutboundRecordService : ApplicationService
[HttpGet("/operation/outbound/recent-list")]
public async Task> GetRecentListAsync([FromQuery] int limit = 20, [FromQuery] long? warehouseId = null)
{
+ var hasWarehouseFilter = warehouseId.HasValue;
+ var warehouseIdValue = warehouseId.GetValueOrDefault();
var entities = await OutboundRecordRepository.GetPagedListAsync(
- x => !x.IsDeleted && (!warehouseId.HasValue || x.WarehouseId == warehouseId),
+ x => !hasWarehouseFilter || x.WarehouseId == warehouseIdValue,
1,
limit <= 0 ? 20 : limit,
new Dictionary { [nameof(OutboundRecord.OperateTime)] = false, [nameof(OutboundRecord.Id)] = false });
@@ -69,7 +68,7 @@ public class OutboundRecordService : ApplicationService
var warehouseIds = entities.Where(x => x.WarehouseId.HasValue).Select(x => x.WarehouseId!.Value).Distinct().ToArray();
var warehouses = warehouseIds.Length == 0
? []
- : await WarehouseAddressRepository.GetListAsync(x => !x.IsDeleted && warehouseIds.Contains(x.Id));
+ : await WarehouseAddressRepository.GetListAsync(x => warehouseIds.Contains(x.Id));
var warehouseMap = warehouses.ToDictionary(x => x.Id);
var items = entities.Select(entity =>
diff --git a/src/Oms.Application/Services/Orders/OrderService.Helpers.cs b/src/Oms.Application/Services/Orders/OrderService.Helpers.cs
index 361f6de..cea1f36 100644
--- a/src/Oms.Application/Services/Orders/OrderService.Helpers.cs
+++ b/src/Oms.Application/Services/Orders/OrderService.Helpers.cs
@@ -29,7 +29,7 @@ public partial class OrderService
var weights = await OrderRepository.GetWeightsByOrderIdsAsync(orderIds);
var warehouses = warehouseIds.Length == 0
? []
- : await WarehouseAddressRepository.GetListAsync(x => !x.IsDeleted && warehouseIds.Contains(x.Id));
+ : await WarehouseAddressRepository.GetListAsync(x => warehouseIds.Contains(x.Id));
var senderMap = senders.GroupBy(x => x.OrderId).ToDictionary(x => x.Key, x => x.First());
var recipientMap = recipients.GroupBy(x => x.OrderId).ToDictionary(x => x.Key, x => x.First());
@@ -114,10 +114,9 @@ public partial class OrderService
private async Task> BuildPriceCheckOutputsAsync(OrderPriceCheckInput input)
{
var products = await SalesProductRepository.GetListAsync(
- x => !x.IsDeleted &&
- x.IsActive == Oms.Domain.Shared.Enums.EnableStatus.Enabled &&
+ x => x.IsActive == Oms.Domain.Shared.Enums.EnableStatus.Enabled &&
(string.IsNullOrWhiteSpace(input.ShippingMethod) || x.ProductName.Contains(input.ShippingMethod) || x.ProductCode.Contains(input.ShippingMethod)));
- var warehouses = await WarehouseAddressRepository.GetListAsync(x => !x.IsDeleted);
+ var warehouses = await WarehouseAddressRepository.GetListAsync();
var warehouse = warehouses.OrderBy(x => x.Id).FirstOrDefault();
var volumetricWeight = input.Length.HasValue && input.Width.HasValue && input.Height.HasValue
? Math.Round((input.Length.Value * input.Width.Value * input.Height.Value) / 6000M, 3)
@@ -153,7 +152,6 @@ public partial class OrderService
var pageSize = OmsDocHelper.NormalizePageSize(input.PageSize);
var keyword = input.Keyword?.Trim();
var predicate = (Expression>)(x =>
- !x.IsDeleted &&
(string.IsNullOrWhiteSpace(input.Type) || x.Type == input.Type) &&
(string.IsNullOrWhiteSpace(keyword) || x.Name.Contains(keyword) || (x.TemplateKey ?? string.Empty).Contains(keyword)));
@@ -182,7 +180,7 @@ public partial class OrderService
private async Task BuildTemplateDownloadAsync(long templateId)
{
- var template = await OrderTemplateRepository.FirstOrDefaultAsync(x => x.Id == templateId && !x.IsDeleted);
+ var template = await OrderTemplateRepository.FirstOrDefaultAsync(x => x.Id == templateId);
if (template == null)
{
throw new BusinessException("模板不存在");
@@ -233,7 +231,7 @@ public partial class OrderService
throw new BusinessException("上传文件不能为空");
}
- var template = await OrderTemplateRepository.FirstOrDefaultAsync(x => x.Id == input.TemplateId && !x.IsDeleted);
+ var template = await OrderTemplateRepository.FirstOrDefaultAsync(x => x.Id == input.TemplateId);
if (template == null)
{
throw new BusinessException("模板不存在");
@@ -247,10 +245,7 @@ public partial class OrderService
FailCount = 0,
Status = "processing",
TemplateId = template.Id,
- CustomerId = template.CustomerId,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = DateTime.Now
+ CustomerId = template.CustomerId
});
var quantity = 0;
@@ -292,8 +287,6 @@ public partial class OrderService
task.SuccessCount = successCount;
task.FailCount = failCount;
task.Status = "completed";
- task.UpdateUserId = CurrentUser.GetId();
- task.UpdateTime = DateTime.Now;
await OrderTaskRepository.UpdateAsync(task);
return new OrderUploadOutput { TaskId = task.Id };
}
@@ -329,10 +322,7 @@ public partial class OrderService
IsCod = GetBoolCell(rowDict, "IsCod") ? (byte)1 : (byte)0,
IsIntercept = 0,
IsRemote = 0,
- OrderStatus = OrderStatusCodes.PendingPayment,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = DateTime.Now
+ OrderStatus = OrderStatusCodes.PendingPayment
});
var weight = BuildForecastWeight(order.Id, rowDict);
@@ -348,7 +338,6 @@ public partial class OrderService
var pageSize = OmsDocHelper.NormalizePageSize(input.PageSize);
var keyword = input.Keyword?.Trim();
var predicate = (Expression>)(x =>
- !x.IsDeleted &&
(string.IsNullOrWhiteSpace(input.Status) || x.Status == input.Status) &&
(string.IsNullOrWhiteSpace(keyword) || x.TaskName.Contains(keyword)));
var tasks = await OrderTaskRepository.GetPagedListAsync(
@@ -376,7 +365,7 @@ public partial class OrderService
private async Task GetTaskDetailCoreAsync(long taskId)
{
- var task = await OrderTaskRepository.FirstOrDefaultAsync(x => x.Id == taskId && !x.IsDeleted);
+ var task = await OrderTaskRepository.FirstOrDefaultAsync(x => x.Id == taskId);
if (task == null)
{
throw new BusinessException("任务不存在");
@@ -465,10 +454,7 @@ public partial class OrderService
Quantity = input.Quantity,
IsIntercept = 0,
IsRemote = 0,
- OrderStatus = OrderStatusCodes.PendingPayment,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = DateTime.Now
+ OrderStatus = OrderStatusCodes.PendingPayment
};
}
@@ -493,10 +479,7 @@ public partial class OrderService
Phone = input.Sender.Phone,
TelePhone = input.Sender.TelePhone,
Email = input.Sender.Email,
- IsDefault = 0,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = now
+ IsDefault = 0
});
order.SenderId = sender.Id;
}
@@ -524,10 +507,7 @@ public partial class OrderService
CertificateType = input.Receiver.CertificateType,
CertificateNo = input.Receiver.CertificateNo,
Eori = input.Receiver.Eori,
- Vat = input.Receiver.Vat,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = now
+ Vat = input.Receiver.Vat
});
order.RecipientId = recipient.Id;
}
@@ -563,10 +543,7 @@ public partial class OrderService
SalesLink = x.SalesLink,
Model = x.Model,
Specifications = x.Specifications,
- Comment = x.Comment,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = now
+ Comment = x.Comment
}));
}
@@ -581,15 +558,10 @@ public partial class OrderService
ActualWeight = input.ActualWeight,
VolumetricWeight = input.VolumetricWeight,
ChargeableWeight = input.ChargeableWeight,
- Cubic = input.Cubic,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = now
+ Cubic = input.Cubic
}
]);
- order.UpdateUserId = CurrentUser.GetId();
- order.UpdateTime = now;
await OrderRepository.UpdateAsync(order);
}
@@ -750,7 +722,6 @@ public partial class OrderService
RowNumber = rowNumber,
Reason = reason,
RawDataJson = JsonSerializer.Serialize(rawData),
- IsDeleted = false,
CreateUserId = 0,
CreateTime = DateTime.Now
};
@@ -786,10 +757,7 @@ public partial class OrderService
ActualWeight = actualWeight,
VolumetricWeight = volumetricWeight,
ChargeableWeight = chargeableWeight,
- Cubic = cubic,
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = DateTime.Now
+ Cubic = cubic
};
}
}
diff --git a/src/Oms.Application/Services/Orders/OrderService.cs b/src/Oms.Application/Services/Orders/OrderService.cs
index 5e29b90..27fce63 100644
--- a/src/Oms.Application/Services/Orders/OrderService.cs
+++ b/src/Oms.Application/Services/Orders/OrderService.cs
@@ -161,9 +161,9 @@ public partial class OrderService : ApplicationService
public async Task DeleteAsync(OrderActionInput input)
{
var order = await GetOrderOrThrowAsync(input.Id);
- order.IsDeleted = true;
order.OrderStatus = OrderStatusCodes.Deleted;
- await UpdateOrderAsync(order);
+ await OrderRepository.UpdateAsync(order);
+ await OrderRepository.DeleteAsync(order);
}
///
@@ -387,7 +387,6 @@ public partial class OrderService : ApplicationService
var start = createTimeStart.Value;
var end = createTimeEnd.Value;
return order =>
- !order.IsDeleted &&
(!hasStatusFilter || order.OrderStatus == status) &&
(!hasKeywordFilter ||
order.ServiceNo.Contains(keyword!) ||
@@ -401,7 +400,6 @@ public partial class OrderService : ApplicationService
{
var start = createTimeStart.Value;
return order =>
- !order.IsDeleted &&
(!hasStatusFilter || order.OrderStatus == status) &&
(!hasKeywordFilter ||
order.ServiceNo.Contains(keyword!) ||
@@ -414,7 +412,6 @@ public partial class OrderService : ApplicationService
{
var end = createTimeEnd.Value;
return order =>
- !order.IsDeleted &&
(!hasStatusFilter || order.OrderStatus == status) &&
(!hasKeywordFilter ||
order.ServiceNo.Contains(keyword!) ||
@@ -424,7 +421,6 @@ public partial class OrderService : ApplicationService
}
return order =>
- !order.IsDeleted &&
(!hasStatusFilter || order.OrderStatus == status) &&
(!hasKeywordFilter ||
order.ServiceNo.Contains(keyword!) ||
@@ -434,7 +430,7 @@ public partial class OrderService : ApplicationService
private async Task GetOrderOrThrowAsync(long id)
{
- var entity = await OrderRepository.FirstOrDefaultAsync(x => x.Id == id && !x.IsDeleted);
+ var entity = await OrderRepository.FirstOrDefaultAsync(x => x.Id == id);
if (entity == null)
{
throw new BusinessException("订单不存在");
@@ -445,8 +441,6 @@ public partial class OrderService : ApplicationService
private async Task UpdateOrderAsync(Order entity)
{
- entity.UpdateUserId = CurrentUser.GetId();
- entity.UpdateTime = DateTime.Now;
await OrderRepository.UpdateAsync(entity);
}
}
diff --git a/src/Oms.Application/Services/Recharge/RechargeService.cs b/src/Oms.Application/Services/Recharge/RechargeService.cs
index 8cd5a6d..fa3a153 100644
--- a/src/Oms.Application/Services/Recharge/RechargeService.cs
+++ b/src/Oms.Application/Services/Recharge/RechargeService.cs
@@ -38,27 +38,22 @@ public class RechargeService : ApplicationService
throw new BusinessException("客户ID不能为空");
}
- var customer = await CustomerRepository.FirstOrDefaultAsync(x => x.Id == customerId && !x.IsDeleted);
+ var customer = await CustomerRepository.FirstOrDefaultAsync(x => x.Id == customerId);
if (customer == null)
{
throw new BusinessException("客户不存在");
}
- var now = DateTime.Now;
- var userId = CurrentUser.GetId();
var entity = new RechargeRecord
{
CustomerId = customer.Id,
SerialNumber = await GenerateSerialNumberAsync(),
- RechargeTime = now,
+ RechargeTime = DateTime.Now,
PayType = input.PayType,
RechargeAmount = input.RechargeAmount,
RechargeScreenshot = input.RechargeScreenshot,
RechargeStatus = RechargeStatus.Pending,
- Remark = input.Remark,
- IsDeleted = false,
- CreateUserId = userId,
- CreateTime = now
+ Remark = input.Remark
};
var savedEntity = await RechargeRecordRepository.InsertAsync(entity);
@@ -85,25 +80,20 @@ public class RechargeService : ApplicationService
throw new BusinessException("只有待审核记录才能审核通过");
}
- var customer = await CustomerRepository.FirstOrDefaultAsync(x => x.Id == record.CustomerId && !x.IsDeleted);
+ var customer = await CustomerRepository.FirstOrDefaultAsync(x => x.Id == record.CustomerId);
if (customer == null)
{
throw new BusinessException("客户不存在");
}
var now = DateTime.Now;
- var userId = CurrentUser.GetId();
record.RechargeStatus = RechargeStatus.Approved;
record.Remark = input.Remark;
record.AuditTime = now;
record.AuditBy = CurrentUser.UserName;
- record.UpdateUserId = userId;
- record.UpdateTime = now;
customer.Balance += record.RechargeAmount;
- customer.UpdateUserId = userId;
- customer.UpdateTime = now;
await RechargeRecordRepository.UpdateAsync(record);
await CustomerRepository.UpdateAsync(customer);
@@ -133,8 +123,6 @@ public class RechargeService : ApplicationService
record.Remark = input.Remark;
record.AuditTime = DateTime.Now;
record.AuditBy = CurrentUser.UserName;
- record.UpdateUserId = CurrentUser.GetId();
- record.UpdateTime = DateTime.Now;
await RechargeRecordRepository.UpdateAsync(record);
}
@@ -168,7 +156,7 @@ public class RechargeService : ApplicationService
var customerIds = entities.Select(x => x.CustomerId).Distinct().ToArray();
var customers = customerIds.Length == 0
? []
- : await CustomerRepository.GetListAsync(x => !x.IsDeleted && customerIds.Contains(x.Id));
+ : await CustomerRepository.GetListAsync(x => customerIds.Contains(x.Id));
var customerMap = customers.ToDictionary(x => x.Id);
// 列表返回时补齐客户信息,避免前端为了展示字段额外发起关联查询。
@@ -212,7 +200,7 @@ public class RechargeService : ApplicationService
var customerIds = records.Select(x => x.CustomerId).Distinct().ToArray();
var customers = customerIds.Length == 0
? []
- : await CustomerRepository.GetListAsync(x => !x.IsDeleted && customerIds.Contains(x.Id));
+ : await CustomerRepository.GetListAsync(x => customerIds.Contains(x.Id));
var customerMap = customers.ToDictionary(x => x.Id);
var exportRows = records.Select(record => new
@@ -258,7 +246,7 @@ public class RechargeService : ApplicationService
private async Task GetRechargeRecordOrThrowAsync(long id)
{
- var record = await RechargeRecordRepository.FirstOrDefaultAsync(x => x.Id == id && !x.IsDeleted);
+ var record = await RechargeRecordRepository.FirstOrDefaultAsync(x => x.Id == id);
if (record == null)
{
throw new BusinessException("充值记录不存在");
@@ -346,7 +334,6 @@ public class RechargeService : ApplicationService
var start = startTime.Value;
var end = endTime.Value;
return record =>
- !record.IsDeleted &&
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!)) &&
@@ -358,7 +345,6 @@ public class RechargeService : ApplicationService
{
var start = startTime.Value;
return record =>
- !record.IsDeleted &&
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!)) &&
@@ -369,7 +355,6 @@ public class RechargeService : ApplicationService
{
var end = endTime.Value;
return record =>
- !record.IsDeleted &&
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!)) &&
@@ -377,7 +362,6 @@ public class RechargeService : ApplicationService
}
return record =>
- !record.IsDeleted &&
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!));
diff --git a/src/Oms.Application/Services/System/WarehouseService.cs b/src/Oms.Application/Services/System/WarehouseService.cs
index 49f15ab..4e8c98c 100644
--- a/src/Oms.Application/Services/System/WarehouseService.cs
+++ b/src/Oms.Application/Services/System/WarehouseService.cs
@@ -92,7 +92,7 @@ public class WarehouseService : ApplicationService
public async Task CreateAsync(CreateWarehouseInput input)
{
var duplicatedWarehouse = await WarehouseAddressRepository.GetByWarehouseNameAsync(input.WarehouseName);
- if (duplicatedWarehouse != null && !duplicatedWarehouse.IsDeleted)
+ if (duplicatedWarehouse != null)
{
throw new BusinessException("仓库名称已存在");
}
@@ -106,10 +106,7 @@ public class WarehouseService : ApplicationService
ShippingAddress = input.ShippingAddress,
ServicePhone = input.ServicePhone,
ServiceWechat = input.ServiceWechat,
- ServiceWechatFiles = JsonStringArrayHelper.Serialize(input.ServiceWechatFiles),
- IsDeleted = false,
- CreateUserId = CurrentUser.GetId(),
- CreateTime = DateTime.Now
+ ServiceWechatFiles = JsonStringArrayHelper.Serialize(input.ServiceWechatFiles)
};
await WarehouseAddressRepository.InsertAsync(entity);
@@ -131,7 +128,7 @@ public class WarehouseService : ApplicationService
{
var entity = await GetWarehouseOrThrowAsync(input.Id);
var duplicatedWarehouse = await WarehouseAddressRepository.GetByWarehouseNameAsync(input.WarehouseName);
- if (duplicatedWarehouse != null && duplicatedWarehouse.Id != entity.Id && !duplicatedWarehouse.IsDeleted)
+ if (duplicatedWarehouse != null && duplicatedWarehouse.Id != entity.Id)
{
throw new BusinessException("仓库名称已存在");
}
@@ -144,8 +141,6 @@ public class WarehouseService : ApplicationService
entity.ServicePhone = input.ServicePhone;
entity.ServiceWechat = input.ServiceWechat;
entity.ServiceWechatFiles = JsonStringArrayHelper.Serialize(input.ServiceWechatFiles);
- entity.UpdateUserId = CurrentUser.GetId();
- entity.UpdateTime = DateTime.Now;
await WarehouseAddressRepository.UpdateAsync(entity);
}
@@ -165,10 +160,7 @@ public class WarehouseService : ApplicationService
public async Task DeleteAsync(IdInput input)
{
var entity = await GetWarehouseOrThrowAsync(input.Id);
- entity.IsDeleted = true;
- entity.UpdateUserId = CurrentUser.GetId();
- entity.UpdateTime = DateTime.Now;
- await WarehouseAddressRepository.UpdateAsync(entity);
+ await WarehouseAddressRepository.DeleteAsync(entity);
}
private Expression> BuildPaginatedPredicate(WarehousePaginatedInput input)
@@ -177,7 +169,6 @@ public class WarehouseService : ApplicationService
var warehouseType = input.WarehouseType?.Trim();
return warehouse =>
- !warehouse.IsDeleted &&
(string.IsNullOrWhiteSpace(warehouseType) || warehouse.WarehouseType == warehouseType) &&
(string.IsNullOrWhiteSpace(keyword) ||
warehouse.WarehouseName.Contains(keyword) ||
@@ -187,7 +178,7 @@ public class WarehouseService : ApplicationService
private async Task GetWarehouseOrThrowAsync(long id)
{
- var entity = await WarehouseAddressRepository.FirstOrDefaultAsync(x => x.Id == id && !x.IsDeleted);
+ var entity = await WarehouseAddressRepository.FirstOrDefaultAsync(x => x.Id == id);
if (entity == null)
{
throw new BusinessException("仓库不存在");
diff --git a/src/Oms.SqlSugarCore/Channels/AutoTriggerRepository.cs b/src/Oms.SqlSugarCore/Channels/AutoTriggerRepository.cs
index 2270261..1847102 100644
--- a/src/Oms.SqlSugarCore/Channels/AutoTriggerRepository.cs
+++ b/src/Oms.SqlSugarCore/Channels/AutoTriggerRepository.cs
@@ -10,7 +10,7 @@ public class AutoTriggerRepository : OmsSqlSugarRepository, IAutoTr
{
public async Task> GetEnabledListAsync(CancellationToken cancellationToken = default)
{
- var list = await GetListAsync(x => !x.IsDeleted && x.Status == EnableStatus.Enabled, cancellationToken: cancellationToken);
+ var list = await GetListAsync(x => x.Status == EnableStatus.Enabled, cancellationToken: cancellationToken);
return list;
}
}
diff --git a/src/Oms.SqlSugarCore/Channels/KpiAreaRepository.cs b/src/Oms.SqlSugarCore/Channels/KpiAreaRepository.cs
index c2a84ae..e7b31d9 100644
--- a/src/Oms.SqlSugarCore/Channels/KpiAreaRepository.cs
+++ b/src/Oms.SqlSugarCore/Channels/KpiAreaRepository.cs
@@ -9,19 +9,19 @@ public class KpiAreaRepository : OmsSqlSugarRepository, IKpiAreaReposit
{
public Task GetByAppKeyTypeAndNameAsync(string appKey, string areaType, string name, CancellationToken cancellationToken = default)
{
- return FirstOrDefaultAsync(x => !x.IsDeleted && x.AppKey == appKey && x.AreaType == areaType && x.Name == name, cancellationToken);
+ return FirstOrDefaultAsync(x => x.AppKey == appKey && x.AreaType == areaType && x.Name == name, cancellationToken);
}
public Task ExistsNameAsync(string appKey, string areaType, string name, CancellationToken cancellationToken = default)
{
- return AnyAsync(x => !x.IsDeleted && x.AppKey == appKey && x.AreaType == areaType && x.Name == name, cancellationToken);
+ return AnyAsync(x => x.AppKey == appKey && x.AreaType == areaType && x.Name == name, cancellationToken);
}
public async Task> GetInfosAsync(long areaId, int pageIndex, int pageSize, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && x.AreaId == areaId)
+ .Where(x => x.AreaId == areaId)
.OrderBy(x => x.Id, SqlSugar.OrderByType.Desc)
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
}
@@ -29,7 +29,7 @@ public class KpiAreaRepository : OmsSqlSugarRepository, IKpiAreaReposit
public async Task CountInfosAsync(long areaId, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- return await db.Queryable().Where(x => !x.IsDeleted && x.AreaId == areaId).CountAsync(cancellationToken);
+ return await db.Queryable().Where(x => x.AreaId == areaId).CountAsync(cancellationToken);
}
public async Task InsertInfoAsync(KpiAreaInfo info, CancellationToken cancellationToken = default)
@@ -41,7 +41,7 @@ public class KpiAreaRepository : OmsSqlSugarRepository, IKpiAreaReposit
public async Task GetInfoByIdAsync(long id, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- return await db.Queryable().FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
+ return await db.Queryable().FirstAsync(x => x.Id == id, cancellationToken);
}
public async Task UpdateInfoAsync(KpiAreaInfo info, CancellationToken cancellationToken = default)
@@ -53,6 +53,6 @@ public class KpiAreaRepository : OmsSqlSugarRepository, IKpiAreaReposit
public async Task DeleteInfoAsync(long id, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- await db.Updateable().SetColumns(x => x.IsDeleted, true).Where(x => x.Id == id).ExecuteCommandAsync(cancellationToken);
+ await db.Deleteable().Where(x => x.Id == id).ExecuteCommandAsync(cancellationToken);
}
}
diff --git a/src/Oms.SqlSugarCore/Channels/LabelTemplateRepository.cs b/src/Oms.SqlSugarCore/Channels/LabelTemplateRepository.cs
index 5db1341..ab762c4 100644
--- a/src/Oms.SqlSugarCore/Channels/LabelTemplateRepository.cs
+++ b/src/Oms.SqlSugarCore/Channels/LabelTemplateRepository.cs
@@ -10,12 +10,12 @@ public class LabelTemplateRepository : OmsSqlSugarRepository, ILa
public Task GetByNameAndTypeAsync(string name, string? templateType, CancellationToken cancellationToken = default)
{
return FirstOrDefaultAsync(
- x => !x.IsDeleted && x.Name == name && x.TemplateType == templateType,
+ x => x.Name == name && x.TemplateType == templateType,
cancellationToken);
}
public Task ExistsNameAsync(string name, string? templateType, CancellationToken cancellationToken = default)
{
- return AnyAsync(x => !x.IsDeleted && x.Name == name && x.TemplateType == templateType, cancellationToken);
+ return AnyAsync(x => x.Name == name && x.TemplateType == templateType, cancellationToken);
}
}
diff --git a/src/Oms.SqlSugarCore/Channels/SalesProductRepository.cs b/src/Oms.SqlSugarCore/Channels/SalesProductRepository.cs
index f4847c3..ef0f85e 100644
--- a/src/Oms.SqlSugarCore/Channels/SalesProductRepository.cs
+++ b/src/Oms.SqlSugarCore/Channels/SalesProductRepository.cs
@@ -10,19 +10,19 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
{
public Task GetByProductCodeAsync(string productCode, CancellationToken cancellationToken = default)
{
- return FirstOrDefaultAsync(x => !x.IsDeleted && x.ProductCode == productCode, cancellationToken);
+ return FirstOrDefaultAsync(x => x.ProductCode == productCode, cancellationToken);
}
public Task HasProductCodeAsync(string productCode, CancellationToken cancellationToken = default)
{
- return AnyAsync(x => !x.IsDeleted && x.ProductCode == productCode, cancellationToken);
+ return AnyAsync(x => x.ProductCode == productCode, cancellationToken);
}
public async Task> GetPricesAsync(long salesProductId, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && x.SalesProductId == salesProductId)
+ .Where(x => x.SalesProductId == salesProductId)
.OrderBy(x => x.SerialNumber)
.ToListAsync(cancellationToken);
}
@@ -31,7 +31,7 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
+ .FirstAsync(x => x.Id == id, cancellationToken);
}
public async Task> GetPriceFactorsAsync(IEnumerable priceIds, CancellationToken cancellationToken = default)
@@ -40,7 +40,7 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
if (ids.Length == 0) return [];
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && ids.Contains(x.PriceId))
+ .Where(x => ids.Contains(x.PriceId))
.OrderBy(x => x.SerialNumber)
.ToListAsync(cancellationToken);
}
@@ -51,7 +51,7 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
if (ids.Length == 0) return [];
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && ids.Contains(x.PriceId))
+ .Where(x => ids.Contains(x.PriceId))
.ToListAsync(cancellationToken);
}
@@ -68,13 +68,11 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
{
var db = await GetDbContextAsync(cancellationToken);
await db.Updateable(price).ExecuteCommandAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
- .Where(x => !x.IsDeleted && x.PriceId == price.Id)
+ await db.Deleteable()
+ .Where(x => x.PriceId == price.Id)
.ExecuteCommandAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
- .Where(x => !x.IsDeleted && x.PriceId == price.Id)
+ await db.Deleteable()
+ .Where(x => x.PriceId == price.Id)
.ExecuteCommandAsync(cancellationToken);
await InsertPriceChildrenAsync(db, price.Id, factors, details, cancellationToken);
}
@@ -82,16 +80,13 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
public async Task DeletePriceAsync(long id, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
+ await db.Deleteable()
.Where(x => x.Id == id)
.ExecuteCommandAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
+ await db.Deleteable()
.Where(x => x.PriceId == id)
.ExecuteCommandAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
+ await db.Deleteable()
.Where(x => x.PriceId == id)
.ExecuteCommandAsync(cancellationToken);
}
@@ -101,7 +96,7 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
var db = await GetDbContextAsync(cancellationToken);
await db.Updateable()
.SetColumns(x => x.Status, status)
- .Where(x => !x.IsDeleted && x.Id == id)
+ .Where(x => x.Id == id)
.ExecuteCommandAsync(cancellationToken);
}
@@ -109,16 +104,16 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
{
var db = await GetDbContextAsync(cancellationToken);
var oldPrices = await db.Queryable()
- .Where(x => !x.IsDeleted && x.SalesProductId == salesProductId)
+ .Where(x => x.SalesProductId == salesProductId)
.ToListAsync(cancellationToken);
var oldPriceIds = oldPrices.Select(x => x.Id).ToArray();
if (oldPriceIds.Length > 0)
{
// 批量保存采用全量替换策略,旧价格树先统一软删,避免残留旧明细。
- await db.Updateable().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.Id)).ExecuteCommandAsync(cancellationToken);
- await db.Updateable().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
- await db.Updateable().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
+ await db.Deleteable().Where(x => oldPriceIds.Contains(x.Id)).ExecuteCommandAsync(cancellationToken);
+ await db.Deleteable().Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
+ await db.Deleteable().Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
}
var priceList = prices.Select(x => new
@@ -153,7 +148,7 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && x.SalesProductId == salesProductId)
+ .Where(x => x.SalesProductId == salesProductId)
.OrderBy(x => x.SerialNumber)
.ToListAsync(cancellationToken);
}
@@ -161,8 +156,8 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
public async Task ReplaceAllocationProvidersAsync(long salesProductId, IEnumerable providers, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- await db.Updateable().SetColumns(x => x.IsDeleted, true)
- .Where(x => !x.IsDeleted && x.SalesProductId == salesProductId)
+ await db.Deleteable()
+ .Where(x => x.SalesProductId == salesProductId)
.ExecuteCommandAsync(cancellationToken);
var items = providers.Select(x => { x.Id = 0; x.SalesProductId = salesProductId; return x; }).ToArray();
if (items.Length > 0)
@@ -175,7 +170,7 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && x.SalesProductId == salesProductId && x.OperatorType == operatorType)
+ .Where(x => x.SalesProductId == salesProductId && x.OperatorType == operatorType)
.OrderBy(x => x.PublishTime, SqlSugar.OrderByType.Desc)
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
}
@@ -184,7 +179,7 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && x.SalesProductId == salesProductId && x.OperatorType == operatorType)
+ .Where(x => x.SalesProductId == salesProductId && x.OperatorType == operatorType)
.CountAsync(cancellationToken);
}
@@ -197,7 +192,7 @@ public class SalesProductRepository : OmsSqlSugarRepository, ISale
public async Task GetPublishRecordByIdAsync(long id, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- return await db.Queryable().FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
+ return await db.Queryable().FirstAsync(x => x.Id == id, cancellationToken);
}
private static async Task InsertPriceChildrenAsync(
diff --git a/src/Oms.SqlSugarCore/Channels/ServiceChannelRepository.cs b/src/Oms.SqlSugarCore/Channels/ServiceChannelRepository.cs
index c71bdc5..0c06d08 100644
--- a/src/Oms.SqlSugarCore/Channels/ServiceChannelRepository.cs
+++ b/src/Oms.SqlSugarCore/Channels/ServiceChannelRepository.cs
@@ -10,25 +10,25 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
{
public Task GetByChannelCodeAsync(string channelCode, CancellationToken cancellationToken = default)
{
- return FirstOrDefaultAsync(x => !x.IsDeleted && x.ChannelCode == channelCode, cancellationToken);
+ return FirstOrDefaultAsync(x => x.ChannelCode == channelCode, cancellationToken);
}
public Task HasChannelCodeAsync(string channelCode, CancellationToken cancellationToken = default)
{
- return AnyAsync(x => !x.IsDeleted && x.ChannelCode == channelCode, cancellationToken);
+ return AnyAsync(x => x.ChannelCode == channelCode, cancellationToken);
}
public async Task> GetGroupsAsync(CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- return await db.Queryable().Where(x => !x.IsDeleted).ToListAsync(cancellationToken);
+ return await db.Queryable().ToListAsync(cancellationToken);
}
public async Task> GetPricesAsync(long serviceChannelId, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && x.ServiceChannelId == serviceChannelId)
+ .Where(x => x.ServiceChannelId == serviceChannelId)
.OrderBy(x => x.SerialNumber)
.ToListAsync(cancellationToken);
}
@@ -37,7 +37,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
+ .FirstAsync(x => x.Id == id, cancellationToken);
}
public async Task> GetPriceFactorsAsync(IEnumerable priceIds, CancellationToken cancellationToken = default)
@@ -46,7 +46,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
if (ids.Length == 0) return [];
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && ids.Contains(x.PriceId))
+ .Where(x => ids.Contains(x.PriceId))
.OrderBy(x => x.SerialNumber)
.ToListAsync(cancellationToken);
}
@@ -57,7 +57,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
if (ids.Length == 0) return [];
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && ids.Contains(x.PriceId))
+ .Where(x => ids.Contains(x.PriceId))
.ToListAsync(cancellationToken);
}
@@ -74,13 +74,11 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
{
var db = await GetDbContextAsync(cancellationToken);
await db.Updateable(price).ExecuteCommandAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
- .Where(x => !x.IsDeleted && x.PriceId == price.Id)
+ await db.Deleteable()
+ .Where(x => x.PriceId == price.Id)
.ExecuteCommandAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
- .Where(x => !x.IsDeleted && x.PriceId == price.Id)
+ await db.Deleteable()
+ .Where(x => x.PriceId == price.Id)
.ExecuteCommandAsync(cancellationToken);
await InsertPriceChildrenAsync(db, price.Id, factors, details, cancellationToken);
}
@@ -88,16 +86,13 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
public async Task DeletePriceAsync(long id, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
+ await db.Deleteable()
.Where(x => x.Id == id)
.ExecuteCommandAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
+ await db.Deleteable()
.Where(x => x.PriceId == id)
.ExecuteCommandAsync(cancellationToken);
- await db.Updateable()
- .SetColumns(x => x.IsDeleted, true)
+ await db.Deleteable()
.Where(x => x.PriceId == id)
.ExecuteCommandAsync(cancellationToken);
}
@@ -107,7 +102,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
var db = await GetDbContextAsync(cancellationToken);
await db.Updateable()
.SetColumns(x => x.Status, status)
- .Where(x => !x.IsDeleted && x.Id == id)
+ .Where(x => x.Id == id)
.ExecuteCommandAsync(cancellationToken);
}
@@ -115,16 +110,16 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
{
var db = await GetDbContextAsync(cancellationToken);
var oldPrices = await db.Queryable()
- .Where(x => !x.IsDeleted && x.ServiceChannelId == serviceChannelId)
+ .Where(x => x.ServiceChannelId == serviceChannelId)
.ToListAsync(cancellationToken);
var oldPriceIds = oldPrices.Select(x => x.Id).ToArray();
if (oldPriceIds.Length > 0)
{
// 批量保存时先整棵旧买价树软删,再写入新的快照数据。
- await db.Updateable().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.Id)).ExecuteCommandAsync(cancellationToken);
- await db.Updateable().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
- await db.Updateable().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
+ await db.Deleteable().Where(x => oldPriceIds.Contains(x.Id)).ExecuteCommandAsync(cancellationToken);
+ await db.Deleteable().Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
+ await db.Deleteable().Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
}
var priceList = prices.Select(x => new
@@ -159,7 +154,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && x.ServiceChannelId == serviceChannelId && x.OperatorType == operatorType)
+ .Where(x => x.ServiceChannelId == serviceChannelId && x.OperatorType == operatorType)
.OrderBy(x => x.PublishTime, SqlSugar.OrderByType.Desc)
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
}
@@ -168,7 +163,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && x.ServiceChannelId == serviceChannelId && x.OperatorType == operatorType)
+ .Where(x => x.ServiceChannelId == serviceChannelId && x.OperatorType == operatorType)
.CountAsync(cancellationToken);
}
@@ -181,7 +176,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository, I
public async Task GetPublishRecordByIdAsync(long id, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- return await db.Queryable().FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
+ return await db.Queryable().FirstAsync(x => x.Id == id, cancellationToken);
}
private static async Task InsertPriceChildrenAsync(
diff --git a/src/Oms.SqlSugarCore/Channels/WeightRoundingRepository.cs b/src/Oms.SqlSugarCore/Channels/WeightRoundingRepository.cs
index c933478..56df59b 100644
--- a/src/Oms.SqlSugarCore/Channels/WeightRoundingRepository.cs
+++ b/src/Oms.SqlSugarCore/Channels/WeightRoundingRepository.cs
@@ -9,19 +9,19 @@ public class WeightRoundingRepository : OmsSqlSugarRepository, I
{
public Task GetByAppKeyAndNameAsync(string appKey, string name, CancellationToken cancellationToken = default)
{
- return FirstOrDefaultAsync(x => !x.IsDeleted && x.AppKey == appKey && x.Name == name, cancellationToken);
+ return FirstOrDefaultAsync(x => x.AppKey == appKey && x.Name == name, cancellationToken);
}
public Task ExistsNameAsync(string appKey, string name, CancellationToken cancellationToken = default)
{
- return AnyAsync(x => !x.IsDeleted && x.AppKey == appKey && x.Name == name, cancellationToken);
+ return AnyAsync(x => x.AppKey == appKey && x.Name == name, cancellationToken);
}
public async Task> GetInfosAsync(long roundingId, int pageIndex, int pageSize, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
return await db.Queryable()
- .Where(x => !x.IsDeleted && x.RoundingId == roundingId)
+ .Where(x => x.RoundingId == roundingId)
.OrderBy(x => x.Id, SqlSugar.OrderByType.Desc)
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
}
@@ -29,7 +29,7 @@ public class WeightRoundingRepository : OmsSqlSugarRepository, I
public async Task CountInfosAsync(long roundingId, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
- return await db.Queryable().Where(x => !x.IsDeleted && x.RoundingId == roundingId).CountAsync(cancellationToken);
+ return await db.Queryable