ai-fix
This commit is contained in:
parent
4fa45b6944
commit
22bb8ab425
@ -1,5 +1,7 @@
|
|||||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AClient_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fc7d66b24252bb52da52d1262d99fd654ffc18aedde818f147c3daf6aee3e63_003FClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AClient_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fc7d66b24252bb52da52d1262d99fd654ffc18aedde818f147c3daf6aee3e63_003FClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIAggregateRoot_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6015bad29db142679ead208ae4ecd55c7800_003F0e_003F66feb813_003FIAggregateRoot_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIAggregateRoot_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6015bad29db142679ead208ae4ecd55c7800_003F0e_003F66feb813_003FIAggregateRoot_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIAggregateRoot_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa1494e50f25d476db4fff59a546c2b857800_003F4e_003Fb27c424d_003FIAggregateRoot_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIAggregateRoot_00601_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6015bad29db142679ead208ae4ecd55c7800_003F9a_003Fea4337c7_003FIAggregateRoot_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIAggregateRoot_00601_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6015bad29db142679ead208ae4ecd55c7800_003F9a_003Fea4337c7_003FIAggregateRoot_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIRepository_00601_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6015bad29db142679ead208ae4ecd55c7800_003F85_003Fa6db724e_003FIRepository_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIRepository_00601_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6015bad29db142679ead208ae4ecd55c7800_003F85_003Fa6db724e_003FIRepository_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIRepository_00601_002Ecs_002Fl_003AC_0021_003FUsers_003FBSI_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa1494e50f25d476db4fff59a546c2b857800_003Fcc_003F73f30804_003FIRepository_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
||||||
@ -55,7 +55,6 @@ public class AutoTriggerService : ApplicationService
|
|||||||
[HttpPost("/channel/auto-trigger/create")]
|
[HttpPost("/channel/auto-trigger/create")]
|
||||||
public async Task CreateAsync(AutoTriggerSaveInput input)
|
public async Task CreateAsync(AutoTriggerSaveInput input)
|
||||||
{
|
{
|
||||||
var now = DateTime.Now;
|
|
||||||
var entity = new AutoTrigger
|
var entity = new AutoTrigger
|
||||||
{
|
{
|
||||||
Status = input.Status,
|
Status = input.Status,
|
||||||
@ -63,10 +62,7 @@ public class AutoTriggerService : ApplicationService
|
|||||||
TriggerTiming = input.TriggerTiming,
|
TriggerTiming = input.TriggerTiming,
|
||||||
TriggerCondition = input.TriggerCondition,
|
TriggerCondition = input.TriggerCondition,
|
||||||
PromptMessage = input.PromptMessage,
|
PromptMessage = input.PromptMessage,
|
||||||
Notifier = input.Notifier,
|
Notifier = input.Notifier
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
};
|
};
|
||||||
await AutoTriggerRepository.InsertAsync(entity);
|
await AutoTriggerRepository.InsertAsync(entity);
|
||||||
}
|
}
|
||||||
@ -92,8 +88,6 @@ public class AutoTriggerService : ApplicationService
|
|||||||
entity.TriggerCondition = input.TriggerCondition;
|
entity.TriggerCondition = input.TriggerCondition;
|
||||||
entity.PromptMessage = input.PromptMessage;
|
entity.PromptMessage = input.PromptMessage;
|
||||||
entity.Notifier = input.Notifier;
|
entity.Notifier = input.Notifier;
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await AutoTriggerRepository.UpdateAsync(entity);
|
await AutoTriggerRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,10 +106,7 @@ public class AutoTriggerService : ApplicationService
|
|||||||
public async Task DeleteAsync(IdInput input)
|
public async Task DeleteAsync(IdInput input)
|
||||||
{
|
{
|
||||||
var entity = await GetEntityOrThrowAsync(input.Id);
|
var entity = await GetEntityOrThrowAsync(input.Id);
|
||||||
entity.IsDeleted = true;
|
await AutoTriggerRepository.DeleteAsync(entity);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await AutoTriggerRepository.UpdateAsync(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -134,8 +125,6 @@ public class AutoTriggerService : ApplicationService
|
|||||||
{
|
{
|
||||||
var entity = await GetEntityOrThrowAsync(input.Id);
|
var entity = await GetEntityOrThrowAsync(input.Id);
|
||||||
entity.Status = input.Status;
|
entity.Status = input.Status;
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await AutoTriggerRepository.UpdateAsync(entity);
|
await AutoTriggerRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +133,6 @@ public class AutoTriggerService : ApplicationService
|
|||||||
var operation = input.Operation?.Trim();
|
var operation = input.Operation?.Trim();
|
||||||
var triggerTiming = input.TriggerTiming?.Trim();
|
var triggerTiming = input.TriggerTiming?.Trim();
|
||||||
return entity =>
|
return entity =>
|
||||||
!entity.IsDeleted &&
|
|
||||||
(string.IsNullOrWhiteSpace(operation) || entity.Operation == operation) &&
|
(string.IsNullOrWhiteSpace(operation) || entity.Operation == operation) &&
|
||||||
(string.IsNullOrWhiteSpace(triggerTiming) || entity.TriggerTiming == triggerTiming);
|
(string.IsNullOrWhiteSpace(triggerTiming) || entity.TriggerTiming == triggerTiming);
|
||||||
}
|
}
|
||||||
@ -156,7 +144,7 @@ public class AutoTriggerService : ApplicationService
|
|||||||
throw new BusinessException("自动触发不存在");
|
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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("自动触发不存在");
|
throw new BusinessException("自动触发不存在");
|
||||||
|
|||||||
@ -59,16 +59,12 @@ public class KpiAreaService : ApplicationService
|
|||||||
public async Task CreateAsync(KpiAreaSaveInput input)
|
public async Task CreateAsync(KpiAreaSaveInput input)
|
||||||
{
|
{
|
||||||
await ValidateAreaNameAsync(input.AppKey, input.AreaType, input.Name, null);
|
await ValidateAreaNameAsync(input.AppKey, input.AreaType, input.Name, null);
|
||||||
var now = DateTime.Now;
|
|
||||||
var entity = new KpiArea
|
var entity = new KpiArea
|
||||||
{
|
{
|
||||||
AppKey = input.AppKey,
|
AppKey = input.AppKey,
|
||||||
AreaType = input.AreaType,
|
AreaType = input.AreaType,
|
||||||
Name = input.Name,
|
Name = input.Name,
|
||||||
SystemName = input.SystemName,
|
SystemName = input.SystemName
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
};
|
};
|
||||||
await KpiAreaRepository.InsertAsync(entity);
|
await KpiAreaRepository.InsertAsync(entity);
|
||||||
}
|
}
|
||||||
@ -93,8 +89,6 @@ public class KpiAreaService : ApplicationService
|
|||||||
entity.AreaType = input.AreaType;
|
entity.AreaType = input.AreaType;
|
||||||
entity.Name = input.Name;
|
entity.Name = input.Name;
|
||||||
entity.SystemName = input.SystemName;
|
entity.SystemName = input.SystemName;
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await KpiAreaRepository.UpdateAsync(entity);
|
await KpiAreaRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,10 +107,7 @@ public class KpiAreaService : ApplicationService
|
|||||||
public async Task DeleteAsync(IdInput input)
|
public async Task DeleteAsync(IdInput input)
|
||||||
{
|
{
|
||||||
var entity = await GetAreaOrThrowAsync(input.Id);
|
var entity = await GetAreaOrThrowAsync(input.Id);
|
||||||
entity.IsDeleted = true;
|
await KpiAreaRepository.DeleteAsync(entity);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await KpiAreaRepository.UpdateAsync(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -160,7 +151,6 @@ public class KpiAreaService : ApplicationService
|
|||||||
public async Task AddInfoAsync(KpiAreaInfoSaveInput input)
|
public async Task AddInfoAsync(KpiAreaInfoSaveInput input)
|
||||||
{
|
{
|
||||||
await GetAreaOrThrowAsync(input.AreaId);
|
await GetAreaOrThrowAsync(input.AreaId);
|
||||||
var now = DateTime.Now;
|
|
||||||
await KpiAreaRepository.InsertInfoAsync(new KpiAreaInfo
|
await KpiAreaRepository.InsertInfoAsync(new KpiAreaInfo
|
||||||
{
|
{
|
||||||
AreaId = input.AreaId,
|
AreaId = input.AreaId,
|
||||||
@ -169,10 +159,7 @@ public class KpiAreaService : ApplicationService
|
|||||||
Province = input.Province,
|
Province = input.Province,
|
||||||
City = input.City,
|
City = input.City,
|
||||||
LeftPostcode = input.LeftPostcode,
|
LeftPostcode = input.LeftPostcode,
|
||||||
RightPostcode = input.RightPostcode,
|
RightPostcode = input.RightPostcode
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,8 +186,6 @@ public class KpiAreaService : ApplicationService
|
|||||||
entity.City = input.City;
|
entity.City = input.City;
|
||||||
entity.LeftPostcode = input.LeftPostcode;
|
entity.LeftPostcode = input.LeftPostcode;
|
||||||
entity.RightPostcode = input.RightPostcode;
|
entity.RightPostcode = input.RightPostcode;
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await KpiAreaRepository.UpdateInfoAsync(entity);
|
await KpiAreaRepository.UpdateInfoAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +212,6 @@ public class KpiAreaService : ApplicationService
|
|||||||
var appKey = input.AppKey?.Trim();
|
var appKey = input.AppKey?.Trim();
|
||||||
var areaType = input.AreaType?.Trim();
|
var areaType = input.AreaType?.Trim();
|
||||||
return entity =>
|
return entity =>
|
||||||
!entity.IsDeleted &&
|
|
||||||
(string.IsNullOrWhiteSpace(appKey) || entity.AppKey == appKey) &&
|
(string.IsNullOrWhiteSpace(appKey) || entity.AppKey == appKey) &&
|
||||||
(string.IsNullOrWhiteSpace(areaType) || entity.AreaType == areaType);
|
(string.IsNullOrWhiteSpace(areaType) || entity.AreaType == areaType);
|
||||||
}
|
}
|
||||||
@ -248,7 +232,7 @@ public class KpiAreaService : ApplicationService
|
|||||||
throw new BusinessException("分区不存在");
|
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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("分区不存在");
|
throw new BusinessException("分区不存在");
|
||||||
|
|||||||
@ -34,8 +34,6 @@ public class LabelTemplateService : ApplicationService
|
|||||||
entity.Name = input.Name;
|
entity.Name = input.Name;
|
||||||
entity.TemplateType = input.TemplateType;
|
entity.TemplateType = input.TemplateType;
|
||||||
entity.TemplateJson = OmsDocHelper.SerializeJson(input.TemplateJson);
|
entity.TemplateJson = OmsDocHelper.SerializeJson(input.TemplateJson);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await LabelTemplateRepository.UpdateAsync(entity);
|
await LabelTemplateRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -45,10 +43,7 @@ public class LabelTemplateService : ApplicationService
|
|||||||
{
|
{
|
||||||
Name = input.Name,
|
Name = input.Name,
|
||||||
TemplateType = input.TemplateType,
|
TemplateType = input.TemplateType,
|
||||||
TemplateJson = OmsDocHelper.SerializeJson(input.TemplateJson),
|
TemplateJson = OmsDocHelper.SerializeJson(input.TemplateJson)
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
};
|
};
|
||||||
entity = await LabelTemplateRepository.InsertAsync(entity);
|
entity = await LabelTemplateRepository.InsertAsync(entity);
|
||||||
}
|
}
|
||||||
@ -67,7 +62,7 @@ public class LabelTemplateService : ApplicationService
|
|||||||
|
|
||||||
private async Task<LabelTemplate> GetEntityOrThrowAsync(long id)
|
private async Task<LabelTemplate> 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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("标签模板不存在");
|
throw new BusinessException("标签模板不存在");
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public partial class SalesProductService
|
|||||||
throw new Fake.Application.BusinessException("销售产品不存在");
|
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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new Fake.Application.BusinessException("销售产品不存在");
|
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 channelIds = providers.Where(x => x.ServiceChannelId.HasValue).Select(x => x.ServiceChannelId!.Value).Distinct().ToArray();
|
||||||
var channels = channelIds.Length == 0
|
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);
|
var channelMap = channels.ToDictionary(x => x.Id, x => x.ChannelName);
|
||||||
|
|
||||||
return new SalesProductAllocationOutput
|
return new SalesProductAllocationOutput
|
||||||
@ -199,10 +199,7 @@ public partial class SalesProductService
|
|||||||
PublishUser = string.IsNullOrWhiteSpace(CurrentUser.UserName) ? CurrentUser.GetId<int>().ToString() : CurrentUser.UserName!,
|
PublishUser = string.IsNullOrWhiteSpace(CurrentUser.UserName) ? CurrentUser.GetId<int>().ToString() : CurrentUser.UserName!,
|
||||||
PublishTime = DateTime.Now,
|
PublishTime = DateTime.Now,
|
||||||
Description = description,
|
Description = description,
|
||||||
Content = OmsDocHelper.SerializeJson(snapshot),
|
Content = OmsDocHelper.SerializeJson(snapshot)
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,12 +242,8 @@ public partial class SalesProductService
|
|||||||
// 规则回滚既恢复产品配置,也恢复排货服务商列表。
|
// 规则回滚既恢复产品配置,也恢复排货服务商列表。
|
||||||
var product = await GetProductOrThrowAsync(input.SalesProductId);
|
var product = await GetProductOrThrowAsync(input.SalesProductId);
|
||||||
ApplyProductInput(product, rulesSnapshot.Product);
|
ApplyProductInput(product, rulesSnapshot.Product);
|
||||||
product.UpdateTime = DateTime.Now;
|
|
||||||
product.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await SalesProductRepository.UpdateAsync(product);
|
await SalesProductRepository.UpdateAsync(product);
|
||||||
|
|
||||||
var now = DateTime.Now;
|
|
||||||
var userId = CurrentUser.GetId<int>();
|
|
||||||
var providers = rulesSnapshot.Providers.Select(provider => new SalesProductAllocationProvider
|
var providers = rulesSnapshot.Providers.Select(provider => new SalesProductAllocationProvider
|
||||||
{
|
{
|
||||||
SalesProductId = input.SalesProductId,
|
SalesProductId = input.SalesProductId,
|
||||||
@ -258,10 +251,7 @@ public partial class SalesProductService
|
|||||||
ProviderName = provider.ProviderName,
|
ProviderName = provider.ProviderName,
|
||||||
ServiceChannelId = provider.ServiceChannelId,
|
ServiceChannelId = provider.ServiceChannelId,
|
||||||
Weight = provider.Weight,
|
Weight = provider.Weight,
|
||||||
CustomerIds = OmsDocHelper.SerializeJson(provider.CustomerIds),
|
CustomerIds = OmsDocHelper.SerializeJson(provider.CustomerIds)
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
await SalesProductRepository.ReplaceAllocationProvidersAsync(input.SalesProductId, providers);
|
await SalesProductRepository.ReplaceAllocationProvidersAsync(input.SalesProductId, providers);
|
||||||
}
|
}
|
||||||
@ -361,21 +351,18 @@ public partial class SalesProductService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<SalesProductPriceFactor> BuildSalesProductPriceFactors(IEnumerable<ChannelPriceFactorInput> inputs, DateTime now, int userId, long? priceId = null)
|
private static List<SalesProductPriceFactor> BuildSalesProductPriceFactors(IEnumerable<ChannelPriceFactorInput> inputs, long? priceId = null)
|
||||||
{
|
{
|
||||||
return inputs.Select(input => new SalesProductPriceFactor
|
return inputs.Select(input => new SalesProductPriceFactor
|
||||||
{
|
{
|
||||||
PriceId = priceId ?? 0,
|
PriceId = priceId ?? 0,
|
||||||
SerialNumber = input.SerialNumber,
|
SerialNumber = input.SerialNumber,
|
||||||
Factor = input.Factor,
|
Factor = input.Factor,
|
||||||
FactorValues = OmsDocHelper.SerializeJson(input.FactorValues),
|
FactorValues = OmsDocHelper.SerializeJson(input.FactorValues)
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<SalesProductPriceDetail> BuildSalesProductPriceDetails(IEnumerable<ChannelPriceDetailInput> inputs, DateTime now, int userId, long? priceId = null)
|
private static List<SalesProductPriceDetail> BuildSalesProductPriceDetails(IEnumerable<ChannelPriceDetailInput> inputs, long? priceId = null)
|
||||||
{
|
{
|
||||||
return inputs.Select(input => new SalesProductPriceDetail
|
return inputs.Select(input => new SalesProductPriceDetail
|
||||||
{
|
{
|
||||||
@ -383,10 +370,7 @@ public partial class SalesProductService
|
|||||||
FactorValuesJson = OmsDocHelper.SerializeJson(input.FactorValuesJson),
|
FactorValuesJson = OmsDocHelper.SerializeJson(input.FactorValuesJson),
|
||||||
CalculationFormula = input.CalculationFormula,
|
CalculationFormula = input.CalculationFormula,
|
||||||
CalculatedValue = input.CalculatedValue,
|
CalculatedValue = input.CalculatedValue,
|
||||||
CustomerGroupValues = OmsDocHelper.SerializeJson(input.CustomerGroupValues),
|
CustomerGroupValues = OmsDocHelper.SerializeJson(input.CustomerGroupValues)
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,12 +81,7 @@ public partial class SalesProductService : ApplicationService
|
|||||||
public async Task CreateAsync(SalesProductSaveInput input)
|
public async Task CreateAsync(SalesProductSaveInput input)
|
||||||
{
|
{
|
||||||
await ValidateProductCodeAsync(input.ProductCode, null);
|
await ValidateProductCodeAsync(input.ProductCode, null);
|
||||||
var entity = new SalesProduct
|
var entity = new SalesProduct();
|
||||||
{
|
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
};
|
|
||||||
ApplyProductInput(entity, input);
|
ApplyProductInput(entity, input);
|
||||||
await SalesProductRepository.InsertAsync(entity);
|
await SalesProductRepository.InsertAsync(entity);
|
||||||
}
|
}
|
||||||
@ -108,8 +103,6 @@ public partial class SalesProductService : ApplicationService
|
|||||||
var entity = await GetProductOrThrowAsync(input.Id);
|
var entity = await GetProductOrThrowAsync(input.Id);
|
||||||
await ValidateProductCodeAsync(input.ProductCode, entity.Id);
|
await ValidateProductCodeAsync(input.ProductCode, entity.Id);
|
||||||
ApplyProductInput(entity, input);
|
ApplyProductInput(entity, input);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await SalesProductRepository.UpdateAsync(entity);
|
await SalesProductRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +121,7 @@ public partial class SalesProductService : ApplicationService
|
|||||||
public async Task DeleteAsync(IdInput input)
|
public async Task DeleteAsync(IdInput input)
|
||||||
{
|
{
|
||||||
var entity = await GetProductOrThrowAsync(input.Id);
|
var entity = await GetProductOrThrowAsync(input.Id);
|
||||||
entity.IsDeleted = true;
|
await SalesProductRepository.DeleteAsync(entity);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await SalesProductRepository.UpdateAsync(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -151,8 +141,6 @@ public partial class SalesProductService : ApplicationService
|
|||||||
var entity = await GetProductOrThrowAsync(input.Id);
|
var entity = await GetProductOrThrowAsync(input.Id);
|
||||||
await ValidateProductCodeAsync(input.ProductCode, entity.Id);
|
await ValidateProductCodeAsync(input.ProductCode, entity.Id);
|
||||||
ApplyProductInput(entity, input);
|
ApplyProductInput(entity, input);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await SalesProductRepository.UpdateAsync(entity);
|
await SalesProductRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,8 +180,6 @@ public partial class SalesProductService : ApplicationService
|
|||||||
public async Task CreatePriceAsync(SalesProductPriceSaveInput input)
|
public async Task CreatePriceAsync(SalesProductPriceSaveInput input)
|
||||||
{
|
{
|
||||||
await GetProductOrThrowAsync(input.SalesProductId);
|
await GetProductOrThrowAsync(input.SalesProductId);
|
||||||
var now = DateTime.Now;
|
|
||||||
var userId = CurrentUser.GetId<int>();
|
|
||||||
await SalesProductRepository.InsertPriceAsync(
|
await SalesProductRepository.InsertPriceAsync(
|
||||||
new SalesProductPrice
|
new SalesProductPrice
|
||||||
{
|
{
|
||||||
@ -205,13 +191,10 @@ public partial class SalesProductService : ApplicationService
|
|||||||
CostUnit = input.CostUnit,
|
CostUnit = input.CostUnit,
|
||||||
Currency = input.Currency,
|
Currency = input.Currency,
|
||||||
ChargingTime = input.ChargingTime,
|
ChargingTime = input.ChargingTime,
|
||||||
ChargingCondition = input.ChargingCondition,
|
ChargingCondition = input.ChargingCondition
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
},
|
},
|
||||||
BuildSalesProductPriceFactors(input.Factors, now, userId),
|
BuildSalesProductPriceFactors(input.Factors),
|
||||||
BuildSalesProductPriceDetails(input.Details, now, userId));
|
BuildSalesProductPriceDetails(input.Details));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -242,12 +225,10 @@ public partial class SalesProductService : ApplicationService
|
|||||||
price.Currency = input.Currency;
|
price.Currency = input.Currency;
|
||||||
price.ChargingTime = input.ChargingTime;
|
price.ChargingTime = input.ChargingTime;
|
||||||
price.ChargingCondition = input.ChargingCondition;
|
price.ChargingCondition = input.ChargingCondition;
|
||||||
price.UpdateTime = DateTime.Now;
|
|
||||||
price.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await SalesProductRepository.UpdatePriceAsync(
|
await SalesProductRepository.UpdatePriceAsync(
|
||||||
price,
|
price,
|
||||||
BuildSalesProductPriceFactors(input.Factors, DateTime.Now, CurrentUser.GetId<int>()),
|
BuildSalesProductPriceFactors(input.Factors),
|
||||||
BuildSalesProductPriceDetails(input.Details, DateTime.Now, CurrentUser.GetId<int>()));
|
BuildSalesProductPriceDetails(input.Details));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -301,8 +282,6 @@ public partial class SalesProductService : ApplicationService
|
|||||||
public async Task SavePriceAsync(SalesProductPriceSaveAllInput input)
|
public async Task SavePriceAsync(SalesProductPriceSaveAllInput input)
|
||||||
{
|
{
|
||||||
await GetProductOrThrowAsync(input.SalesProductId);
|
await GetProductOrThrowAsync(input.SalesProductId);
|
||||||
var now = DateTime.Now;
|
|
||||||
var userId = CurrentUser.GetId<int>();
|
|
||||||
var prices = new List<SalesProductPrice>();
|
var prices = new List<SalesProductPrice>();
|
||||||
var factors = new List<SalesProductPriceFactor>();
|
var factors = new List<SalesProductPriceFactor>();
|
||||||
var details = new List<SalesProductPriceDetail>();
|
var details = new List<SalesProductPriceDetail>();
|
||||||
@ -323,13 +302,10 @@ public partial class SalesProductService : ApplicationService
|
|||||||
CostUnit = priceInput.CostUnit,
|
CostUnit = priceInput.CostUnit,
|
||||||
Currency = priceInput.Currency,
|
Currency = priceInput.Currency,
|
||||||
ChargingTime = priceInput.ChargingTime,
|
ChargingTime = priceInput.ChargingTime,
|
||||||
ChargingCondition = priceInput.ChargingCondition,
|
ChargingCondition = priceInput.ChargingCondition
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
});
|
});
|
||||||
factors.AddRange(BuildSalesProductPriceFactors(priceInput.Factors, now, userId, currentTempId));
|
factors.AddRange(BuildSalesProductPriceFactors(priceInput.Factors, currentTempId));
|
||||||
details.AddRange(BuildSalesProductPriceDetails(priceInput.Details, now, userId, currentTempId));
|
details.AddRange(BuildSalesProductPriceDetails(priceInput.Details, currentTempId));
|
||||||
}
|
}
|
||||||
|
|
||||||
await SalesProductRepository.ReplacePricesAsync(input.SalesProductId, prices, factors, details);
|
await SalesProductRepository.ReplacePricesAsync(input.SalesProductId, prices, factors, details);
|
||||||
@ -372,12 +348,8 @@ public partial class SalesProductService : ApplicationService
|
|||||||
{
|
{
|
||||||
var product = await GetProductOrThrowAsync(input.SalesProductId);
|
var product = await GetProductOrThrowAsync(input.SalesProductId);
|
||||||
product.Scheme = input.Scheme;
|
product.Scheme = input.Scheme;
|
||||||
product.UpdateTime = DateTime.Now;
|
|
||||||
product.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await SalesProductRepository.UpdateAsync(product);
|
await SalesProductRepository.UpdateAsync(product);
|
||||||
|
|
||||||
var now = DateTime.Now;
|
|
||||||
var userId = CurrentUser.GetId<int>();
|
|
||||||
var providers = input.Providers.Select(provider => new SalesProductAllocationProvider
|
var providers = input.Providers.Select(provider => new SalesProductAllocationProvider
|
||||||
{
|
{
|
||||||
SalesProductId = input.SalesProductId,
|
SalesProductId = input.SalesProductId,
|
||||||
@ -385,10 +357,7 @@ public partial class SalesProductService : ApplicationService
|
|||||||
ProviderName = provider.ProviderName,
|
ProviderName = provider.ProviderName,
|
||||||
ServiceChannelId = provider.ServiceChannelId,
|
ServiceChannelId = provider.ServiceChannelId,
|
||||||
Weight = provider.Weight,
|
Weight = provider.Weight,
|
||||||
CustomerIds = OmsDocHelper.SerializeJson(provider.CustomerIds),
|
CustomerIds = OmsDocHelper.SerializeJson(provider.CustomerIds)
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
await SalesProductRepository.ReplaceAllocationProvidersAsync(input.SalesProductId, providers);
|
await SalesProductRepository.ReplaceAllocationProvidersAsync(input.SalesProductId, providers);
|
||||||
|
|
||||||
@ -470,10 +439,11 @@ public partial class SalesProductService : ApplicationService
|
|||||||
{
|
{
|
||||||
var productGroup = input.ProductGroup?.Trim();
|
var productGroup = input.ProductGroup?.Trim();
|
||||||
var keyword = input.Keyword?.Trim();
|
var keyword = input.Keyword?.Trim();
|
||||||
|
var hasIsActiveFilter = input.IsActive.HasValue;
|
||||||
|
var isActiveValue = input.IsActive.GetValueOrDefault();
|
||||||
return entity =>
|
return entity =>
|
||||||
!entity.IsDeleted &&
|
|
||||||
(string.IsNullOrWhiteSpace(productGroup) || entity.ProductGroup == productGroup) &&
|
(string.IsNullOrWhiteSpace(productGroup) || entity.ProductGroup == productGroup) &&
|
||||||
(string.IsNullOrWhiteSpace(keyword) || entity.ProductCode.Contains(keyword) || entity.ProductName.Contains(keyword)) &&
|
(string.IsNullOrWhiteSpace(keyword) || entity.ProductCode.Contains(keyword) || entity.ProductName.Contains(keyword)) &&
|
||||||
(!input.IsActive.HasValue || entity.IsActive == input.IsActive.Value);
|
(!hasIsActiveFilter || entity.IsActive == isActiveValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public partial class ServiceChannelService
|
|||||||
throw new Fake.Application.BusinessException("服务渠道不存在");
|
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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new Fake.Application.BusinessException("服务渠道不存在");
|
throw new Fake.Application.BusinessException("服务渠道不存在");
|
||||||
@ -168,10 +168,7 @@ public partial class ServiceChannelService
|
|||||||
PublishUser = string.IsNullOrWhiteSpace(CurrentUser.UserName) ? CurrentUser.GetId<int>().ToString() : CurrentUser.UserName!,
|
PublishUser = string.IsNullOrWhiteSpace(CurrentUser.UserName) ? CurrentUser.GetId<int>().ToString() : CurrentUser.UserName!,
|
||||||
PublishTime = DateTime.Now,
|
PublishTime = DateTime.Now,
|
||||||
Description = description,
|
Description = description,
|
||||||
Content = OmsDocHelper.SerializeJson(snapshot),
|
Content = OmsDocHelper.SerializeJson(snapshot)
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,8 +210,6 @@ public partial class ServiceChannelService
|
|||||||
|
|
||||||
var entity = await GetEntityOrThrowAsync(input.ServiceChannelId);
|
var entity = await GetEntityOrThrowAsync(input.ServiceChannelId);
|
||||||
ApplyInput(entity, rulesSnapshot.Channel);
|
ApplyInput(entity, rulesSnapshot.Channel);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await ServiceChannelRepository.UpdateAsync(entity);
|
await ServiceChannelRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,21 +298,18 @@ public partial class ServiceChannelService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ServiceChannelPriceFactor> BuildPriceFactors(IEnumerable<ChannelPriceFactorInput> inputs, DateTime now, int userId, long? priceId = null)
|
private static List<ServiceChannelPriceFactor> BuildPriceFactors(IEnumerable<ChannelPriceFactorInput> inputs, long? priceId = null)
|
||||||
{
|
{
|
||||||
return inputs.Select(input => new ServiceChannelPriceFactor
|
return inputs.Select(input => new ServiceChannelPriceFactor
|
||||||
{
|
{
|
||||||
PriceId = priceId ?? 0,
|
PriceId = priceId ?? 0,
|
||||||
SerialNumber = input.SerialNumber,
|
SerialNumber = input.SerialNumber,
|
||||||
Factor = input.Factor,
|
Factor = input.Factor,
|
||||||
FactorValues = OmsDocHelper.SerializeJson(input.FactorValues),
|
FactorValues = OmsDocHelper.SerializeJson(input.FactorValues)
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ServiceChannelPriceDetail> BuildPriceDetails(IEnumerable<ChannelPriceDetailInput> inputs, DateTime now, int userId, long? priceId = null)
|
private static List<ServiceChannelPriceDetail> BuildPriceDetails(IEnumerable<ChannelPriceDetailInput> inputs, long? priceId = null)
|
||||||
{
|
{
|
||||||
return inputs.Select(input => new ServiceChannelPriceDetail
|
return inputs.Select(input => new ServiceChannelPriceDetail
|
||||||
{
|
{
|
||||||
@ -325,10 +317,7 @@ public partial class ServiceChannelService
|
|||||||
FactorValuesJson = OmsDocHelper.SerializeJson(input.FactorValuesJson),
|
FactorValuesJson = OmsDocHelper.SerializeJson(input.FactorValuesJson),
|
||||||
CalculationFormula = input.CalculationFormula,
|
CalculationFormula = input.CalculationFormula,
|
||||||
CalculatedValue = input.CalculatedValue,
|
CalculatedValue = input.CalculatedValue,
|
||||||
CustomerGroupValues = OmsDocHelper.SerializeJson(input.CustomerGroupValues),
|
CustomerGroupValues = OmsDocHelper.SerializeJson(input.CustomerGroupValues)
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,12 +81,7 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
public async Task CreateAsync(ServiceChannelSaveInput input)
|
public async Task CreateAsync(ServiceChannelSaveInput input)
|
||||||
{
|
{
|
||||||
await ValidateChannelCodeAsync(input.ChannelCode, null);
|
await ValidateChannelCodeAsync(input.ChannelCode, null);
|
||||||
var entity = new ServiceChannel
|
var entity = new ServiceChannel();
|
||||||
{
|
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
};
|
|
||||||
ApplyInput(entity, input);
|
ApplyInput(entity, input);
|
||||||
await ServiceChannelRepository.InsertAsync(entity);
|
await ServiceChannelRepository.InsertAsync(entity);
|
||||||
}
|
}
|
||||||
@ -108,8 +103,6 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
var entity = await GetEntityOrThrowAsync(input.Id);
|
var entity = await GetEntityOrThrowAsync(input.Id);
|
||||||
await ValidateChannelCodeAsync(input.ChannelCode, entity.Id);
|
await ValidateChannelCodeAsync(input.ChannelCode, entity.Id);
|
||||||
ApplyInput(entity, input);
|
ApplyInput(entity, input);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await ServiceChannelRepository.UpdateAsync(entity);
|
await ServiceChannelRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +121,7 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
public async Task DeleteAsync(IdInput input)
|
public async Task DeleteAsync(IdInput input)
|
||||||
{
|
{
|
||||||
var entity = await GetEntityOrThrowAsync(input.Id);
|
var entity = await GetEntityOrThrowAsync(input.Id);
|
||||||
entity.IsDeleted = true;
|
await ServiceChannelRepository.DeleteAsync(entity);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await ServiceChannelRepository.UpdateAsync(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -151,8 +141,6 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
var entity = await GetEntityOrThrowAsync(input.Id);
|
var entity = await GetEntityOrThrowAsync(input.Id);
|
||||||
await ValidateChannelCodeAsync(input.ChannelCode, entity.Id);
|
await ValidateChannelCodeAsync(input.ChannelCode, entity.Id);
|
||||||
ApplyInput(entity, input);
|
ApplyInput(entity, input);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await ServiceChannelRepository.UpdateAsync(entity);
|
await ServiceChannelRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,8 +180,6 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
public async Task CreatePriceAsync(ServiceChannelPriceSaveInput input)
|
public async Task CreatePriceAsync(ServiceChannelPriceSaveInput input)
|
||||||
{
|
{
|
||||||
await GetEntityOrThrowAsync(input.ServiceChannelId);
|
await GetEntityOrThrowAsync(input.ServiceChannelId);
|
||||||
var now = DateTime.Now;
|
|
||||||
var userId = CurrentUser.GetId<int>();
|
|
||||||
await ServiceChannelRepository.InsertPriceAsync(
|
await ServiceChannelRepository.InsertPriceAsync(
|
||||||
new ServiceChannelPrice
|
new ServiceChannelPrice
|
||||||
{
|
{
|
||||||
@ -205,13 +191,10 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
CostUnit = input.CostUnit,
|
CostUnit = input.CostUnit,
|
||||||
Currency = input.Currency,
|
Currency = input.Currency,
|
||||||
ChargingTime = input.ChargingTime,
|
ChargingTime = input.ChargingTime,
|
||||||
ChargingCondition = input.ChargingCondition,
|
ChargingCondition = input.ChargingCondition
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
},
|
},
|
||||||
BuildPriceFactors(input.Factors, now, userId),
|
BuildPriceFactors(input.Factors),
|
||||||
BuildPriceDetails(input.Details, now, userId));
|
BuildPriceDetails(input.Details));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -242,12 +225,10 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
price.Currency = input.Currency;
|
price.Currency = input.Currency;
|
||||||
price.ChargingTime = input.ChargingTime;
|
price.ChargingTime = input.ChargingTime;
|
||||||
price.ChargingCondition = input.ChargingCondition;
|
price.ChargingCondition = input.ChargingCondition;
|
||||||
price.UpdateTime = DateTime.Now;
|
|
||||||
price.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await ServiceChannelRepository.UpdatePriceAsync(
|
await ServiceChannelRepository.UpdatePriceAsync(
|
||||||
price,
|
price,
|
||||||
BuildPriceFactors(input.Factors, DateTime.Now, CurrentUser.GetId<int>()),
|
BuildPriceFactors(input.Factors),
|
||||||
BuildPriceDetails(input.Details, DateTime.Now, CurrentUser.GetId<int>()));
|
BuildPriceDetails(input.Details));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -301,8 +282,6 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
public async Task SavePriceAsync(ServiceChannelPriceSaveAllInput input)
|
public async Task SavePriceAsync(ServiceChannelPriceSaveAllInput input)
|
||||||
{
|
{
|
||||||
await GetEntityOrThrowAsync(input.ServiceChannelId);
|
await GetEntityOrThrowAsync(input.ServiceChannelId);
|
||||||
var now = DateTime.Now;
|
|
||||||
var userId = CurrentUser.GetId<int>();
|
|
||||||
var prices = new List<ServiceChannelPrice>();
|
var prices = new List<ServiceChannelPrice>();
|
||||||
var factors = new List<ServiceChannelPriceFactor>();
|
var factors = new List<ServiceChannelPriceFactor>();
|
||||||
var details = new List<ServiceChannelPriceDetail>();
|
var details = new List<ServiceChannelPriceDetail>();
|
||||||
@ -323,13 +302,10 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
CostUnit = priceInput.CostUnit,
|
CostUnit = priceInput.CostUnit,
|
||||||
Currency = priceInput.Currency,
|
Currency = priceInput.Currency,
|
||||||
ChargingTime = priceInput.ChargingTime,
|
ChargingTime = priceInput.ChargingTime,
|
||||||
ChargingCondition = priceInput.ChargingCondition,
|
ChargingCondition = priceInput.ChargingCondition
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = now,
|
|
||||||
CreateUserId = userId
|
|
||||||
});
|
});
|
||||||
factors.AddRange(BuildPriceFactors(priceInput.Factors, now, userId, currentTempId));
|
factors.AddRange(BuildPriceFactors(priceInput.Factors, currentTempId));
|
||||||
details.AddRange(BuildPriceDetails(priceInput.Details, now, userId, currentTempId));
|
details.AddRange(BuildPriceDetails(priceInput.Details, currentTempId));
|
||||||
}
|
}
|
||||||
|
|
||||||
await ServiceChannelRepository.ReplacePricesAsync(input.ServiceChannelId, prices, factors, details);
|
await ServiceChannelRepository.ReplacePricesAsync(input.ServiceChannelId, prices, factors, details);
|
||||||
@ -410,10 +386,13 @@ public partial class ServiceChannelService : ApplicationService
|
|||||||
private static Expression<Func<ServiceChannel, bool>> BuildListPredicate(ServiceChannelListInput input)
|
private static Expression<Func<ServiceChannel, bool>> BuildListPredicate(ServiceChannelListInput input)
|
||||||
{
|
{
|
||||||
var keyword = input.Keyword?.Trim();
|
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 =>
|
return entity =>
|
||||||
!entity.IsDeleted &&
|
(!hasGroupFilter || entity.GroupId == groupIdValue) &&
|
||||||
(!input.GroupId.HasValue || entity.GroupId == input.GroupId.Value) &&
|
|
||||||
(string.IsNullOrWhiteSpace(keyword) || entity.ChannelCode.Contains(keyword) || entity.ChannelName.Contains(keyword)) &&
|
(string.IsNullOrWhiteSpace(keyword) || entity.ChannelCode.Contains(keyword) || entity.ChannelName.Contains(keyword)) &&
|
||||||
(!input.IsActive.HasValue || entity.IsActive == input.IsActive.Value);
|
(!hasIsActiveFilter || entity.IsActive == isActiveValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,10 +62,7 @@ public class WeightRoundingService : ApplicationService
|
|||||||
await WeightRoundingRepository.InsertAsync(new WeightRounding
|
await WeightRoundingRepository.InsertAsync(new WeightRounding
|
||||||
{
|
{
|
||||||
AppKey = input.AppKey,
|
AppKey = input.AppKey,
|
||||||
Name = input.Name,
|
Name = input.Name
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +84,6 @@ public class WeightRoundingService : ApplicationService
|
|||||||
await ValidateNameAsync(input.AppKey, input.Name, entity.Id);
|
await ValidateNameAsync(input.AppKey, input.Name, entity.Id);
|
||||||
entity.AppKey = input.AppKey;
|
entity.AppKey = input.AppKey;
|
||||||
entity.Name = input.Name;
|
entity.Name = input.Name;
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await WeightRoundingRepository.UpdateAsync(entity);
|
await WeightRoundingRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,10 +102,7 @@ public class WeightRoundingService : ApplicationService
|
|||||||
public async Task DeleteAsync(IdInput input)
|
public async Task DeleteAsync(IdInput input)
|
||||||
{
|
{
|
||||||
var entity = await GetEntityOrThrowAsync(input.Id);
|
var entity = await GetEntityOrThrowAsync(input.Id);
|
||||||
entity.IsDeleted = true;
|
await WeightRoundingRepository.DeleteAsync(entity);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await WeightRoundingRepository.UpdateAsync(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -161,10 +153,7 @@ public class WeightRoundingService : ApplicationService
|
|||||||
EndValue = input.EndValue,
|
EndValue = input.EndValue,
|
||||||
Public = input.Public,
|
Public = input.Public,
|
||||||
CustomerGroup1 = input.CustomerGroup1,
|
CustomerGroup1 = input.CustomerGroup1,
|
||||||
CustomerGroup2 = input.CustomerGroup2,
|
CustomerGroup2 = input.CustomerGroup2
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,8 +179,6 @@ public class WeightRoundingService : ApplicationService
|
|||||||
entity.Public = input.Public;
|
entity.Public = input.Public;
|
||||||
entity.CustomerGroup1 = input.CustomerGroup1;
|
entity.CustomerGroup1 = input.CustomerGroup1;
|
||||||
entity.CustomerGroup2 = input.CustomerGroup2;
|
entity.CustomerGroup2 = input.CustomerGroup2;
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await WeightRoundingRepository.UpdateInfoAsync(entity);
|
await WeightRoundingRepository.UpdateInfoAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +203,7 @@ public class WeightRoundingService : ApplicationService
|
|||||||
private static Expression<Func<WeightRounding, bool>> BuildPredicate(WeightRoundingListInput input)
|
private static Expression<Func<WeightRounding, bool>> BuildPredicate(WeightRoundingListInput input)
|
||||||
{
|
{
|
||||||
var appKey = input.AppKey?.Trim();
|
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)
|
private async Task ValidateNameAsync(string appKey, string name, long? id)
|
||||||
@ -235,7 +222,7 @@ public class WeightRoundingService : ApplicationService
|
|||||||
throw new BusinessException("计重进位不存在");
|
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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("计重进位不存在");
|
throw new BusinessException("计重进位不存在");
|
||||||
|
|||||||
@ -62,10 +62,7 @@ public class WeightRuleService : ApplicationService
|
|||||||
await WeightRuleRepository.InsertAsync(new WeightRule
|
await WeightRuleRepository.InsertAsync(new WeightRule
|
||||||
{
|
{
|
||||||
AppKey = input.AppKey,
|
AppKey = input.AppKey,
|
||||||
Name = input.Name,
|
Name = input.Name
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +84,6 @@ public class WeightRuleService : ApplicationService
|
|||||||
await ValidateNameAsync(input.AppKey, input.Name, entity.Id);
|
await ValidateNameAsync(input.AppKey, input.Name, entity.Id);
|
||||||
entity.AppKey = input.AppKey;
|
entity.AppKey = input.AppKey;
|
||||||
entity.Name = input.Name;
|
entity.Name = input.Name;
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await WeightRuleRepository.UpdateAsync(entity);
|
await WeightRuleRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,10 +102,7 @@ public class WeightRuleService : ApplicationService
|
|||||||
public async Task DeleteAsync(IdInput input)
|
public async Task DeleteAsync(IdInput input)
|
||||||
{
|
{
|
||||||
var entity = await GetEntityOrThrowAsync(input.Id);
|
var entity = await GetEntityOrThrowAsync(input.Id);
|
||||||
entity.IsDeleted = true;
|
await WeightRuleRepository.DeleteAsync(entity);
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await WeightRuleRepository.UpdateAsync(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -160,10 +152,7 @@ public class WeightRuleService : ApplicationService
|
|||||||
Client = input.Client,
|
Client = input.Client,
|
||||||
Condition = input.Condition,
|
Condition = input.Condition,
|
||||||
BillableWeight = input.BillableWeight,
|
BillableWeight = input.BillableWeight,
|
||||||
VolumetricFactor = input.VolumetricFactor,
|
VolumetricFactor = input.VolumetricFactor
|
||||||
IsDeleted = false,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,8 +177,6 @@ public class WeightRuleService : ApplicationService
|
|||||||
entity.Condition = input.Condition;
|
entity.Condition = input.Condition;
|
||||||
entity.BillableWeight = input.BillableWeight;
|
entity.BillableWeight = input.BillableWeight;
|
||||||
entity.VolumetricFactor = input.VolumetricFactor;
|
entity.VolumetricFactor = input.VolumetricFactor;
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
await WeightRuleRepository.UpdateInfoAsync(entity);
|
await WeightRuleRepository.UpdateInfoAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +201,7 @@ public class WeightRuleService : ApplicationService
|
|||||||
private static Expression<Func<WeightRule, bool>> BuildPredicate(WeightRuleListInput input)
|
private static Expression<Func<WeightRule, bool>> BuildPredicate(WeightRuleListInput input)
|
||||||
{
|
{
|
||||||
var appKey = input.AppKey?.Trim();
|
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)
|
private async Task ValidateNameAsync(string appKey, string name, long? id)
|
||||||
@ -233,7 +220,7 @@ public class WeightRuleService : ApplicationService
|
|||||||
throw new BusinessException("计重规则不存在");
|
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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("计重规则不存在");
|
throw new BusinessException("计重规则不存在");
|
||||||
|
|||||||
@ -92,15 +92,12 @@ public class CustomerService : ApplicationService
|
|||||||
if (!string.IsNullOrWhiteSpace(input.Email))
|
if (!string.IsNullOrWhiteSpace(input.Email))
|
||||||
{
|
{
|
||||||
var duplicatedEmail = await CustomerRepository.GetByEmailAsync(input.Email);
|
var duplicatedEmail = await CustomerRepository.GetByEmailAsync(input.Email);
|
||||||
if (duplicatedEmail != null && !duplicatedEmail.IsDeleted)
|
if (duplicatedEmail != null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("邮箱已存在");
|
throw new BusinessException("邮箱已存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var now = DateTime.Now;
|
|
||||||
var userId = CurrentUser.GetId<int>();
|
|
||||||
|
|
||||||
var entity = new Customer
|
var entity = new Customer
|
||||||
{
|
{
|
||||||
CustomerCode = await GenerateCustomerCodeAsync(),
|
CustomerCode = await GenerateCustomerCodeAsync(),
|
||||||
@ -114,10 +111,7 @@ public class CustomerService : ApplicationService
|
|||||||
Remark = input.Remark,
|
Remark = input.Remark,
|
||||||
Salesman = input.Salesman,
|
Salesman = input.Salesman,
|
||||||
CustomerService = input.CustomerService,
|
CustomerService = input.CustomerService,
|
||||||
CustomerGroup = input.CustomerGroup,
|
CustomerGroup = input.CustomerGroup
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = userId,
|
|
||||||
CreateTime = now
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await CustomerRepository.InsertAsync(entity);
|
await CustomerRepository.InsertAsync(entity);
|
||||||
@ -142,7 +136,7 @@ public class CustomerService : ApplicationService
|
|||||||
if (!string.IsNullOrWhiteSpace(input.Email))
|
if (!string.IsNullOrWhiteSpace(input.Email))
|
||||||
{
|
{
|
||||||
var duplicatedEmail = await CustomerRepository.GetByEmailAsync(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("邮箱已存在");
|
throw new BusinessException("邮箱已存在");
|
||||||
}
|
}
|
||||||
@ -155,8 +149,6 @@ public class CustomerService : ApplicationService
|
|||||||
entity.Salesman = input.Salesman;
|
entity.Salesman = input.Salesman;
|
||||||
entity.CustomerService = input.CustomerService;
|
entity.CustomerService = input.CustomerService;
|
||||||
entity.CustomerGroup = input.CustomerGroup;
|
entity.CustomerGroup = input.CustomerGroup;
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
|
|
||||||
await CustomerRepository.UpdateAsync(entity);
|
await CustomerRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
@ -176,10 +168,7 @@ public class CustomerService : ApplicationService
|
|||||||
public async Task DeleteAsync(IdInput input)
|
public async Task DeleteAsync(IdInput input)
|
||||||
{
|
{
|
||||||
var entity = await GetCustomerOrThrowAsync(input.Id);
|
var entity = await GetCustomerOrThrowAsync(input.Id);
|
||||||
entity.IsDeleted = true;
|
await CustomerRepository.DeleteAsync(entity);
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
await CustomerRepository.UpdateAsync(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -198,8 +187,6 @@ public class CustomerService : ApplicationService
|
|||||||
{
|
{
|
||||||
var entity = await GetCustomerOrThrowAsync(input.Id);
|
var entity = await GetCustomerOrThrowAsync(input.Id);
|
||||||
entity.Password = OmsPasswordHelper.ToMd5(input.NewPassword);
|
entity.Password = OmsPasswordHelper.ToMd5(input.NewPassword);
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
await CustomerRepository.UpdateAsync(entity);
|
await CustomerRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,22 +195,25 @@ public class CustomerService : ApplicationService
|
|||||||
var keyword = input.Keyword?.Trim();
|
var keyword = input.Keyword?.Trim();
|
||||||
var salesman = input.Salesman?.Trim();
|
var salesman = input.Salesman?.Trim();
|
||||||
var customerService = input.CustomerService?.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 =>
|
return customer =>
|
||||||
!customer.IsDeleted &&
|
|
||||||
(string.IsNullOrWhiteSpace(keyword) ||
|
(string.IsNullOrWhiteSpace(keyword) ||
|
||||||
customer.CustomerCode.Contains(keyword) ||
|
customer.CustomerCode.Contains(keyword) ||
|
||||||
customer.Phone.Contains(keyword) ||
|
customer.Phone.Contains(keyword) ||
|
||||||
(customer.Email ?? string.Empty).Contains(keyword)) &&
|
(customer.Email ?? string.Empty).Contains(keyword)) &&
|
||||||
(!input.Status.HasValue || customer.Status == input.Status.Value) &&
|
(!hasStatusFilter || customer.Status == statusValue) &&
|
||||||
(!input.CustomerGroup.HasValue || customer.CustomerGroup == input.CustomerGroup.Value) &&
|
(!hasCustomerGroupFilter || customer.CustomerGroup == customerGroupValue) &&
|
||||||
(string.IsNullOrWhiteSpace(salesman) || customer.Salesman == salesman) &&
|
(string.IsNullOrWhiteSpace(salesman) || customer.Salesman == salesman) &&
|
||||||
(string.IsNullOrWhiteSpace(customerService) || customer.CustomerService == customerService);
|
(string.IsNullOrWhiteSpace(customerService) || customer.CustomerService == customerService);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Customer> GetCustomerOrThrowAsync(long id)
|
private async Task<Customer> 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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("客户不存在");
|
throw new BusinessException("客户不存在");
|
||||||
@ -238,7 +228,7 @@ public class CustomerService : ApplicationService
|
|||||||
{
|
{
|
||||||
var code = $"W{DateTime.Now:yyMMddHHmmss}{Random.Shared.Next(10, 99)}";
|
var code = $"W{DateTime.Now:yyMMddHHmmss}{Random.Shared.Next(10, 99)}";
|
||||||
var exists = await CustomerRepository.GetByCustomerCodeAsync(code);
|
var exists = await CustomerRepository.GetByCustomerCodeAsync(code);
|
||||||
if (exists == null || exists.IsDeleted)
|
if (exists == null)
|
||||||
{
|
{
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,10 +43,7 @@ public class InboundRecordService : ApplicationService
|
|||||||
DestinationCountry = input.DestinationCountry,
|
DestinationCountry = input.DestinationCountry,
|
||||||
WarehouseId = input.WarehouseId,
|
WarehouseId = input.WarehouseId,
|
||||||
OperateTime = now,
|
OperateTime = now,
|
||||||
OperatorId = operatorId,
|
OperatorId = operatorId
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = now
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var savedEntity = await InboundRecordRepository.InsertAsync(entity);
|
var savedEntity = await InboundRecordRepository.InsertAsync(entity);
|
||||||
@ -68,8 +65,10 @@ public class InboundRecordService : ApplicationService
|
|||||||
[HttpGet("/operation/inbound/recent-list")]
|
[HttpGet("/operation/inbound/recent-list")]
|
||||||
public async Task<OmsItemsResult<InboundRecordOutput>> GetRecentListAsync([FromQuery] int limit = 20, [FromQuery] long? warehouseId = null)
|
public async Task<OmsItemsResult<InboundRecordOutput>> GetRecentListAsync([FromQuery] int limit = 20, [FromQuery] long? warehouseId = null)
|
||||||
{
|
{
|
||||||
|
var hasWarehouseFilter = warehouseId.HasValue;
|
||||||
|
var warehouseIdValue = warehouseId.GetValueOrDefault();
|
||||||
var entities = await InboundRecordRepository.GetPagedListAsync(
|
var entities = await InboundRecordRepository.GetPagedListAsync(
|
||||||
x => !x.IsDeleted && (!warehouseId.HasValue || x.WarehouseId == warehouseId),
|
x => !hasWarehouseFilter || x.WarehouseId == warehouseIdValue,
|
||||||
1,
|
1,
|
||||||
limit <= 0 ? 20 : limit,
|
limit <= 0 ? 20 : limit,
|
||||||
new Dictionary<string, bool> { [nameof(InboundRecord.OperateTime)] = false, [nameof(InboundRecord.Id)] = false });
|
new Dictionary<string, bool> { [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 warehouseIds = entities.Where(x => x.WarehouseId.HasValue).Select(x => x.WarehouseId!.Value).Distinct().ToArray();
|
||||||
var products = salesProductIds.Length == 0
|
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
|
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 productMap = products.ToDictionary(x => x.Id);
|
||||||
var warehouseMap = warehouses.ToDictionary(x => x.Id);
|
var warehouseMap = warehouses.ToDictionary(x => x.Id);
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ public class LabelPrintService : ApplicationService
|
|||||||
LabelTemplate? labelTemplate = null;
|
LabelTemplate? labelTemplate = null;
|
||||||
if (input.LabelTemplateId.HasValue)
|
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)
|
if (labelTemplate == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("标签模板不存在");
|
throw new BusinessException("标签模板不存在");
|
||||||
@ -42,7 +42,7 @@ public class LabelPrintService : ApplicationService
|
|||||||
else if (!string.IsNullOrWhiteSpace(input.TemplateType))
|
else if (!string.IsNullOrWhiteSpace(input.TemplateType))
|
||||||
{
|
{
|
||||||
var list = await LabelTemplateRepository.GetListAsync(
|
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();
|
labelTemplate = list.OrderByDescending(x => x.UpdateTime).ThenByDescending(x => x.Id).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,10 +79,7 @@ public class LabelPrintService : ApplicationService
|
|||||||
LabelTemplateId = labelTemplate?.Id ?? input.LabelTemplateId,
|
LabelTemplateId = labelTemplate?.Id ?? input.LabelTemplateId,
|
||||||
PrintSuccess = EnableStatus.Enabled,
|
PrintSuccess = EnableStatus.Enabled,
|
||||||
PrintTime = now,
|
PrintTime = now,
|
||||||
OperatorId = operatorId,
|
OperatorId = operatorId
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = now
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var savedEntity = await LabelPrintRecordRepository.InsertAsync(entity);
|
var savedEntity = await LabelPrintRecordRepository.InsertAsync(entity);
|
||||||
@ -107,8 +104,10 @@ public class LabelPrintService : ApplicationService
|
|||||||
[HttpGet("/operation/print-label/recent-list")]
|
[HttpGet("/operation/print-label/recent-list")]
|
||||||
public async Task<OmsItemsResult<LabelPrintRecordOutput>> GetRecentListAsync([FromQuery] int limit = 20, [FromQuery] long? labelTemplateId = null)
|
public async Task<OmsItemsResult<LabelPrintRecordOutput>> GetRecentListAsync([FromQuery] int limit = 20, [FromQuery] long? labelTemplateId = null)
|
||||||
{
|
{
|
||||||
|
var hasTemplateFilter = labelTemplateId.HasValue;
|
||||||
|
var labelTemplateIdValue = labelTemplateId.GetValueOrDefault();
|
||||||
var entities = await LabelPrintRecordRepository.GetPagedListAsync(
|
var entities = await LabelPrintRecordRepository.GetPagedListAsync(
|
||||||
x => !x.IsDeleted && (!labelTemplateId.HasValue || x.LabelTemplateId == labelTemplateId),
|
x => !hasTemplateFilter || x.LabelTemplateId == labelTemplateIdValue,
|
||||||
1,
|
1,
|
||||||
limit <= 0 ? 20 : limit,
|
limit <= 0 ? 20 : limit,
|
||||||
new Dictionary<string, bool> { [nameof(LabelPrintRecord.PrintTime)] = false, [nameof(LabelPrintRecord.Id)] = false });
|
new Dictionary<string, bool> { [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 templateIds = entities.Where(x => x.LabelTemplateId.HasValue).Select(x => x.LabelTemplateId!.Value).Distinct().ToArray();
|
||||||
var templates = templateIds.Length == 0
|
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 templateMap = templates.ToDictionary(x => x.Id);
|
||||||
var items = new List<LabelPrintRecordOutput>(entities.Count);
|
var items = new List<LabelPrintRecordOutput>(entities.Count);
|
||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
@ -149,7 +148,7 @@ public class LabelPrintService : ApplicationService
|
|||||||
public async Task<OmsItemsResult<LabelTemplateDropdownOutput>> GetTemplateDropdownListAsync([FromQuery] string? templateType = null)
|
public async Task<OmsItemsResult<LabelTemplateDropdownOutput>> GetTemplateDropdownListAsync([FromQuery] string? templateType = null)
|
||||||
{
|
{
|
||||||
var entities = await LabelTemplateRepository.GetListAsync(
|
var entities = await LabelTemplateRepository.GetListAsync(
|
||||||
x => !x.IsDeleted && (string.IsNullOrWhiteSpace(templateType) || x.TemplateType == templateType));
|
x => string.IsNullOrWhiteSpace(templateType) || x.TemplateType == templateType);
|
||||||
|
|
||||||
var items = entities
|
var items = entities
|
||||||
.Select(entity => ObjectMapper.Map<LabelTemplate, LabelTemplateDropdownOutput>(entity))
|
.Select(entity => ObjectMapper.Map<LabelTemplate, LabelTemplateDropdownOutput>(entity))
|
||||||
|
|||||||
@ -35,10 +35,7 @@ public class OutboundRecordService : ApplicationService
|
|||||||
WaybillNo = input.WaybillNo,
|
WaybillNo = input.WaybillNo,
|
||||||
WarehouseId = input.WarehouseId,
|
WarehouseId = input.WarehouseId,
|
||||||
OperateTime = now,
|
OperateTime = now,
|
||||||
OperatorId = operatorId,
|
OperatorId = operatorId
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = now
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var savedEntity = await OutboundRecordRepository.InsertAsync(entity);
|
var savedEntity = await OutboundRecordRepository.InsertAsync(entity);
|
||||||
@ -60,8 +57,10 @@ public class OutboundRecordService : ApplicationService
|
|||||||
[HttpGet("/operation/outbound/recent-list")]
|
[HttpGet("/operation/outbound/recent-list")]
|
||||||
public async Task<OmsItemsResult<OutboundRecordOutput>> GetRecentListAsync([FromQuery] int limit = 20, [FromQuery] long? warehouseId = null)
|
public async Task<OmsItemsResult<OutboundRecordOutput>> GetRecentListAsync([FromQuery] int limit = 20, [FromQuery] long? warehouseId = null)
|
||||||
{
|
{
|
||||||
|
var hasWarehouseFilter = warehouseId.HasValue;
|
||||||
|
var warehouseIdValue = warehouseId.GetValueOrDefault();
|
||||||
var entities = await OutboundRecordRepository.GetPagedListAsync(
|
var entities = await OutboundRecordRepository.GetPagedListAsync(
|
||||||
x => !x.IsDeleted && (!warehouseId.HasValue || x.WarehouseId == warehouseId),
|
x => !hasWarehouseFilter || x.WarehouseId == warehouseIdValue,
|
||||||
1,
|
1,
|
||||||
limit <= 0 ? 20 : limit,
|
limit <= 0 ? 20 : limit,
|
||||||
new Dictionary<string, bool> { [nameof(OutboundRecord.OperateTime)] = false, [nameof(OutboundRecord.Id)] = false });
|
new Dictionary<string, bool> { [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 warehouseIds = entities.Where(x => x.WarehouseId.HasValue).Select(x => x.WarehouseId!.Value).Distinct().ToArray();
|
||||||
var warehouses = warehouseIds.Length == 0
|
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 warehouseMap = warehouses.ToDictionary(x => x.Id);
|
||||||
|
|
||||||
var items = entities.Select(entity =>
|
var items = entities.Select(entity =>
|
||||||
|
|||||||
@ -29,7 +29,7 @@ public partial class OrderService
|
|||||||
var weights = await OrderRepository.GetWeightsByOrderIdsAsync(orderIds);
|
var weights = await OrderRepository.GetWeightsByOrderIdsAsync(orderIds);
|
||||||
var warehouses = warehouseIds.Length == 0
|
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 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());
|
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<List<OrderPriceCheckOutput>> BuildPriceCheckOutputsAsync(OrderPriceCheckInput input)
|
private async Task<List<OrderPriceCheckOutput>> BuildPriceCheckOutputsAsync(OrderPriceCheckInput input)
|
||||||
{
|
{
|
||||||
var products = await SalesProductRepository.GetListAsync(
|
var products = await SalesProductRepository.GetListAsync(
|
||||||
x => !x.IsDeleted &&
|
x => x.IsActive == Oms.Domain.Shared.Enums.EnableStatus.Enabled &&
|
||||||
x.IsActive == Oms.Domain.Shared.Enums.EnableStatus.Enabled &&
|
|
||||||
(string.IsNullOrWhiteSpace(input.ShippingMethod) || x.ProductName.Contains(input.ShippingMethod) || x.ProductCode.Contains(input.ShippingMethod)));
|
(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 warehouse = warehouses.OrderBy(x => x.Id).FirstOrDefault();
|
||||||
var volumetricWeight = input.Length.HasValue && input.Width.HasValue && input.Height.HasValue
|
var volumetricWeight = input.Length.HasValue && input.Width.HasValue && input.Height.HasValue
|
||||||
? Math.Round((input.Length.Value * input.Width.Value * input.Height.Value) / 6000M, 3)
|
? 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 pageSize = OmsDocHelper.NormalizePageSize(input.PageSize);
|
||||||
var keyword = input.Keyword?.Trim();
|
var keyword = input.Keyword?.Trim();
|
||||||
var predicate = (Expression<Func<OrderTemplate, bool>>)(x =>
|
var predicate = (Expression<Func<OrderTemplate, bool>>)(x =>
|
||||||
!x.IsDeleted &&
|
|
||||||
(string.IsNullOrWhiteSpace(input.Type) || x.Type == input.Type) &&
|
(string.IsNullOrWhiteSpace(input.Type) || x.Type == input.Type) &&
|
||||||
(string.IsNullOrWhiteSpace(keyword) || x.Name.Contains(keyword) || (x.TemplateKey ?? string.Empty).Contains(keyword)));
|
(string.IsNullOrWhiteSpace(keyword) || x.Name.Contains(keyword) || (x.TemplateKey ?? string.Empty).Contains(keyword)));
|
||||||
|
|
||||||
@ -182,7 +180,7 @@ public partial class OrderService
|
|||||||
|
|
||||||
private async Task<FileContentResult> BuildTemplateDownloadAsync(long templateId)
|
private async Task<FileContentResult> 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)
|
if (template == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("模板不存在");
|
throw new BusinessException("模板不存在");
|
||||||
@ -233,7 +231,7 @@ public partial class OrderService
|
|||||||
throw new BusinessException("上传文件不能为空");
|
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)
|
if (template == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("模板不存在");
|
throw new BusinessException("模板不存在");
|
||||||
@ -247,10 +245,7 @@ public partial class OrderService
|
|||||||
FailCount = 0,
|
FailCount = 0,
|
||||||
Status = "processing",
|
Status = "processing",
|
||||||
TemplateId = template.Id,
|
TemplateId = template.Id,
|
||||||
CustomerId = template.CustomerId,
|
CustomerId = template.CustomerId
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = DateTime.Now
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var quantity = 0;
|
var quantity = 0;
|
||||||
@ -292,8 +287,6 @@ public partial class OrderService
|
|||||||
task.SuccessCount = successCount;
|
task.SuccessCount = successCount;
|
||||||
task.FailCount = failCount;
|
task.FailCount = failCount;
|
||||||
task.Status = "completed";
|
task.Status = "completed";
|
||||||
task.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
task.UpdateTime = DateTime.Now;
|
|
||||||
await OrderTaskRepository.UpdateAsync(task);
|
await OrderTaskRepository.UpdateAsync(task);
|
||||||
return new OrderUploadOutput { TaskId = task.Id };
|
return new OrderUploadOutput { TaskId = task.Id };
|
||||||
}
|
}
|
||||||
@ -329,10 +322,7 @@ public partial class OrderService
|
|||||||
IsCod = GetBoolCell(rowDict, "IsCod") ? (byte)1 : (byte)0,
|
IsCod = GetBoolCell(rowDict, "IsCod") ? (byte)1 : (byte)0,
|
||||||
IsIntercept = 0,
|
IsIntercept = 0,
|
||||||
IsRemote = 0,
|
IsRemote = 0,
|
||||||
OrderStatus = OrderStatusCodes.PendingPayment,
|
OrderStatus = OrderStatusCodes.PendingPayment
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = DateTime.Now
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var weight = BuildForecastWeight(order.Id, rowDict);
|
var weight = BuildForecastWeight(order.Id, rowDict);
|
||||||
@ -348,7 +338,6 @@ public partial class OrderService
|
|||||||
var pageSize = OmsDocHelper.NormalizePageSize(input.PageSize);
|
var pageSize = OmsDocHelper.NormalizePageSize(input.PageSize);
|
||||||
var keyword = input.Keyword?.Trim();
|
var keyword = input.Keyword?.Trim();
|
||||||
var predicate = (Expression<Func<OrderTask, bool>>)(x =>
|
var predicate = (Expression<Func<OrderTask, bool>>)(x =>
|
||||||
!x.IsDeleted &&
|
|
||||||
(string.IsNullOrWhiteSpace(input.Status) || x.Status == input.Status) &&
|
(string.IsNullOrWhiteSpace(input.Status) || x.Status == input.Status) &&
|
||||||
(string.IsNullOrWhiteSpace(keyword) || x.TaskName.Contains(keyword)));
|
(string.IsNullOrWhiteSpace(keyword) || x.TaskName.Contains(keyword)));
|
||||||
var tasks = await OrderTaskRepository.GetPagedListAsync(
|
var tasks = await OrderTaskRepository.GetPagedListAsync(
|
||||||
@ -376,7 +365,7 @@ public partial class OrderService
|
|||||||
|
|
||||||
private async Task<OrderTaskDetailOutput> GetTaskDetailCoreAsync(long taskId)
|
private async Task<OrderTaskDetailOutput> 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)
|
if (task == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("任务不存在");
|
throw new BusinessException("任务不存在");
|
||||||
@ -465,10 +454,7 @@ public partial class OrderService
|
|||||||
Quantity = input.Quantity,
|
Quantity = input.Quantity,
|
||||||
IsIntercept = 0,
|
IsIntercept = 0,
|
||||||
IsRemote = 0,
|
IsRemote = 0,
|
||||||
OrderStatus = OrderStatusCodes.PendingPayment,
|
OrderStatus = OrderStatusCodes.PendingPayment
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = DateTime.Now
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,10 +479,7 @@ public partial class OrderService
|
|||||||
Phone = input.Sender.Phone,
|
Phone = input.Sender.Phone,
|
||||||
TelePhone = input.Sender.TelePhone,
|
TelePhone = input.Sender.TelePhone,
|
||||||
Email = input.Sender.Email,
|
Email = input.Sender.Email,
|
||||||
IsDefault = 0,
|
IsDefault = 0
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = now
|
|
||||||
});
|
});
|
||||||
order.SenderId = sender.Id;
|
order.SenderId = sender.Id;
|
||||||
}
|
}
|
||||||
@ -524,10 +507,7 @@ public partial class OrderService
|
|||||||
CertificateType = input.Receiver.CertificateType,
|
CertificateType = input.Receiver.CertificateType,
|
||||||
CertificateNo = input.Receiver.CertificateNo,
|
CertificateNo = input.Receiver.CertificateNo,
|
||||||
Eori = input.Receiver.Eori,
|
Eori = input.Receiver.Eori,
|
||||||
Vat = input.Receiver.Vat,
|
Vat = input.Receiver.Vat
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = now
|
|
||||||
});
|
});
|
||||||
order.RecipientId = recipient.Id;
|
order.RecipientId = recipient.Id;
|
||||||
}
|
}
|
||||||
@ -563,10 +543,7 @@ public partial class OrderService
|
|||||||
SalesLink = x.SalesLink,
|
SalesLink = x.SalesLink,
|
||||||
Model = x.Model,
|
Model = x.Model,
|
||||||
Specifications = x.Specifications,
|
Specifications = x.Specifications,
|
||||||
Comment = x.Comment,
|
Comment = x.Comment
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = now
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,15 +558,10 @@ public partial class OrderService
|
|||||||
ActualWeight = input.ActualWeight,
|
ActualWeight = input.ActualWeight,
|
||||||
VolumetricWeight = input.VolumetricWeight,
|
VolumetricWeight = input.VolumetricWeight,
|
||||||
ChargeableWeight = input.ChargeableWeight,
|
ChargeableWeight = input.ChargeableWeight,
|
||||||
Cubic = input.Cubic,
|
Cubic = input.Cubic
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = now
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
order.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
order.UpdateTime = now;
|
|
||||||
await OrderRepository.UpdateAsync(order);
|
await OrderRepository.UpdateAsync(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,7 +722,6 @@ public partial class OrderService
|
|||||||
RowNumber = rowNumber,
|
RowNumber = rowNumber,
|
||||||
Reason = reason,
|
Reason = reason,
|
||||||
RawDataJson = JsonSerializer.Serialize(rawData),
|
RawDataJson = JsonSerializer.Serialize(rawData),
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = 0,
|
CreateUserId = 0,
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
@ -786,10 +757,7 @@ public partial class OrderService
|
|||||||
ActualWeight = actualWeight,
|
ActualWeight = actualWeight,
|
||||||
VolumetricWeight = volumetricWeight,
|
VolumetricWeight = volumetricWeight,
|
||||||
ChargeableWeight = chargeableWeight,
|
ChargeableWeight = chargeableWeight,
|
||||||
Cubic = cubic,
|
Cubic = cubic
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = DateTime.Now
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,9 +161,9 @@ public partial class OrderService : ApplicationService
|
|||||||
public async Task DeleteAsync(OrderActionInput input)
|
public async Task DeleteAsync(OrderActionInput input)
|
||||||
{
|
{
|
||||||
var order = await GetOrderOrThrowAsync(input.Id);
|
var order = await GetOrderOrThrowAsync(input.Id);
|
||||||
order.IsDeleted = true;
|
|
||||||
order.OrderStatus = OrderStatusCodes.Deleted;
|
order.OrderStatus = OrderStatusCodes.Deleted;
|
||||||
await UpdateOrderAsync(order);
|
await OrderRepository.UpdateAsync(order);
|
||||||
|
await OrderRepository.DeleteAsync(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -387,7 +387,6 @@ public partial class OrderService : ApplicationService
|
|||||||
var start = createTimeStart.Value;
|
var start = createTimeStart.Value;
|
||||||
var end = createTimeEnd.Value;
|
var end = createTimeEnd.Value;
|
||||||
return order =>
|
return order =>
|
||||||
!order.IsDeleted &&
|
|
||||||
(!hasStatusFilter || order.OrderStatus == status) &&
|
(!hasStatusFilter || order.OrderStatus == status) &&
|
||||||
(!hasKeywordFilter ||
|
(!hasKeywordFilter ||
|
||||||
order.ServiceNo.Contains(keyword!) ||
|
order.ServiceNo.Contains(keyword!) ||
|
||||||
@ -401,7 +400,6 @@ public partial class OrderService : ApplicationService
|
|||||||
{
|
{
|
||||||
var start = createTimeStart.Value;
|
var start = createTimeStart.Value;
|
||||||
return order =>
|
return order =>
|
||||||
!order.IsDeleted &&
|
|
||||||
(!hasStatusFilter || order.OrderStatus == status) &&
|
(!hasStatusFilter || order.OrderStatus == status) &&
|
||||||
(!hasKeywordFilter ||
|
(!hasKeywordFilter ||
|
||||||
order.ServiceNo.Contains(keyword!) ||
|
order.ServiceNo.Contains(keyword!) ||
|
||||||
@ -414,7 +412,6 @@ public partial class OrderService : ApplicationService
|
|||||||
{
|
{
|
||||||
var end = createTimeEnd.Value;
|
var end = createTimeEnd.Value;
|
||||||
return order =>
|
return order =>
|
||||||
!order.IsDeleted &&
|
|
||||||
(!hasStatusFilter || order.OrderStatus == status) &&
|
(!hasStatusFilter || order.OrderStatus == status) &&
|
||||||
(!hasKeywordFilter ||
|
(!hasKeywordFilter ||
|
||||||
order.ServiceNo.Contains(keyword!) ||
|
order.ServiceNo.Contains(keyword!) ||
|
||||||
@ -424,7 +421,6 @@ public partial class OrderService : ApplicationService
|
|||||||
}
|
}
|
||||||
|
|
||||||
return order =>
|
return order =>
|
||||||
!order.IsDeleted &&
|
|
||||||
(!hasStatusFilter || order.OrderStatus == status) &&
|
(!hasStatusFilter || order.OrderStatus == status) &&
|
||||||
(!hasKeywordFilter ||
|
(!hasKeywordFilter ||
|
||||||
order.ServiceNo.Contains(keyword!) ||
|
order.ServiceNo.Contains(keyword!) ||
|
||||||
@ -434,7 +430,7 @@ public partial class OrderService : ApplicationService
|
|||||||
|
|
||||||
private async Task<Order> GetOrderOrThrowAsync(long id)
|
private async Task<Order> 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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("订单不存在");
|
throw new BusinessException("订单不存在");
|
||||||
@ -445,8 +441,6 @@ public partial class OrderService : ApplicationService
|
|||||||
|
|
||||||
private async Task UpdateOrderAsync(Order entity)
|
private async Task UpdateOrderAsync(Order entity)
|
||||||
{
|
{
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
await OrderRepository.UpdateAsync(entity);
|
await OrderRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,27 +38,22 @@ public class RechargeService : ApplicationService
|
|||||||
throw new BusinessException("客户ID不能为空");
|
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)
|
if (customer == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("客户不存在");
|
throw new BusinessException("客户不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
var now = DateTime.Now;
|
|
||||||
var userId = CurrentUser.GetId<int>();
|
|
||||||
var entity = new RechargeRecord
|
var entity = new RechargeRecord
|
||||||
{
|
{
|
||||||
CustomerId = customer.Id,
|
CustomerId = customer.Id,
|
||||||
SerialNumber = await GenerateSerialNumberAsync(),
|
SerialNumber = await GenerateSerialNumberAsync(),
|
||||||
RechargeTime = now,
|
RechargeTime = DateTime.Now,
|
||||||
PayType = input.PayType,
|
PayType = input.PayType,
|
||||||
RechargeAmount = input.RechargeAmount,
|
RechargeAmount = input.RechargeAmount,
|
||||||
RechargeScreenshot = input.RechargeScreenshot,
|
RechargeScreenshot = input.RechargeScreenshot,
|
||||||
RechargeStatus = RechargeStatus.Pending,
|
RechargeStatus = RechargeStatus.Pending,
|
||||||
Remark = input.Remark,
|
Remark = input.Remark
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = userId,
|
|
||||||
CreateTime = now
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var savedEntity = await RechargeRecordRepository.InsertAsync(entity);
|
var savedEntity = await RechargeRecordRepository.InsertAsync(entity);
|
||||||
@ -85,25 +80,20 @@ public class RechargeService : ApplicationService
|
|||||||
throw new BusinessException("只有待审核记录才能审核通过");
|
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)
|
if (customer == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("客户不存在");
|
throw new BusinessException("客户不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
var userId = CurrentUser.GetId<int>();
|
|
||||||
|
|
||||||
record.RechargeStatus = RechargeStatus.Approved;
|
record.RechargeStatus = RechargeStatus.Approved;
|
||||||
record.Remark = input.Remark;
|
record.Remark = input.Remark;
|
||||||
record.AuditTime = now;
|
record.AuditTime = now;
|
||||||
record.AuditBy = CurrentUser.UserName;
|
record.AuditBy = CurrentUser.UserName;
|
||||||
record.UpdateUserId = userId;
|
|
||||||
record.UpdateTime = now;
|
|
||||||
|
|
||||||
customer.Balance += record.RechargeAmount;
|
customer.Balance += record.RechargeAmount;
|
||||||
customer.UpdateUserId = userId;
|
|
||||||
customer.UpdateTime = now;
|
|
||||||
|
|
||||||
await RechargeRecordRepository.UpdateAsync(record);
|
await RechargeRecordRepository.UpdateAsync(record);
|
||||||
await CustomerRepository.UpdateAsync(customer);
|
await CustomerRepository.UpdateAsync(customer);
|
||||||
@ -133,8 +123,6 @@ public class RechargeService : ApplicationService
|
|||||||
record.Remark = input.Remark;
|
record.Remark = input.Remark;
|
||||||
record.AuditTime = DateTime.Now;
|
record.AuditTime = DateTime.Now;
|
||||||
record.AuditBy = CurrentUser.UserName;
|
record.AuditBy = CurrentUser.UserName;
|
||||||
record.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
record.UpdateTime = DateTime.Now;
|
|
||||||
|
|
||||||
await RechargeRecordRepository.UpdateAsync(record);
|
await RechargeRecordRepository.UpdateAsync(record);
|
||||||
}
|
}
|
||||||
@ -168,7 +156,7 @@ public class RechargeService : ApplicationService
|
|||||||
var customerIds = entities.Select(x => x.CustomerId).Distinct().ToArray();
|
var customerIds = entities.Select(x => x.CustomerId).Distinct().ToArray();
|
||||||
var customers = customerIds.Length == 0
|
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 customerMap = customers.ToDictionary(x => x.Id);
|
||||||
|
|
||||||
// 列表返回时补齐客户信息,避免前端为了展示字段额外发起关联查询。
|
// 列表返回时补齐客户信息,避免前端为了展示字段额外发起关联查询。
|
||||||
@ -212,7 +200,7 @@ public class RechargeService : ApplicationService
|
|||||||
var customerIds = records.Select(x => x.CustomerId).Distinct().ToArray();
|
var customerIds = records.Select(x => x.CustomerId).Distinct().ToArray();
|
||||||
var customers = customerIds.Length == 0
|
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 customerMap = customers.ToDictionary(x => x.Id);
|
||||||
|
|
||||||
var exportRows = records.Select(record => new
|
var exportRows = records.Select(record => new
|
||||||
@ -258,7 +246,7 @@ public class RechargeService : ApplicationService
|
|||||||
|
|
||||||
private async Task<RechargeRecord> GetRechargeRecordOrThrowAsync(long id)
|
private async Task<RechargeRecord> 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)
|
if (record == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("充值记录不存在");
|
throw new BusinessException("充值记录不存在");
|
||||||
@ -346,7 +334,6 @@ public class RechargeService : ApplicationService
|
|||||||
var start = startTime.Value;
|
var start = startTime.Value;
|
||||||
var end = endTime.Value;
|
var end = endTime.Value;
|
||||||
return record =>
|
return record =>
|
||||||
!record.IsDeleted &&
|
|
||||||
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
|
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
|
||||||
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
|
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
|
||||||
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!)) &&
|
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!)) &&
|
||||||
@ -358,7 +345,6 @@ public class RechargeService : ApplicationService
|
|||||||
{
|
{
|
||||||
var start = startTime.Value;
|
var start = startTime.Value;
|
||||||
return record =>
|
return record =>
|
||||||
!record.IsDeleted &&
|
|
||||||
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
|
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
|
||||||
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
|
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
|
||||||
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!)) &&
|
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!)) &&
|
||||||
@ -369,7 +355,6 @@ public class RechargeService : ApplicationService
|
|||||||
{
|
{
|
||||||
var end = endTime.Value;
|
var end = endTime.Value;
|
||||||
return record =>
|
return record =>
|
||||||
!record.IsDeleted &&
|
|
||||||
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
|
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
|
||||||
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
|
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
|
||||||
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!)) &&
|
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!)) &&
|
||||||
@ -377,7 +362,6 @@ public class RechargeService : ApplicationService
|
|||||||
}
|
}
|
||||||
|
|
||||||
return record =>
|
return record =>
|
||||||
!record.IsDeleted &&
|
|
||||||
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
|
(!hasCustomerFilter || record.CustomerId == customerIdValue) &&
|
||||||
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
|
(!hasStatusFilter || record.RechargeStatus == rechargeStatusValue) &&
|
||||||
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!));
|
(!hasSerialNumberFilter || record.SerialNumber.Contains(serialNumber!));
|
||||||
|
|||||||
@ -92,7 +92,7 @@ public class WarehouseService : ApplicationService
|
|||||||
public async Task CreateAsync(CreateWarehouseInput input)
|
public async Task CreateAsync(CreateWarehouseInput input)
|
||||||
{
|
{
|
||||||
var duplicatedWarehouse = await WarehouseAddressRepository.GetByWarehouseNameAsync(input.WarehouseName);
|
var duplicatedWarehouse = await WarehouseAddressRepository.GetByWarehouseNameAsync(input.WarehouseName);
|
||||||
if (duplicatedWarehouse != null && !duplicatedWarehouse.IsDeleted)
|
if (duplicatedWarehouse != null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("仓库名称已存在");
|
throw new BusinessException("仓库名称已存在");
|
||||||
}
|
}
|
||||||
@ -106,10 +106,7 @@ public class WarehouseService : ApplicationService
|
|||||||
ShippingAddress = input.ShippingAddress,
|
ShippingAddress = input.ShippingAddress,
|
||||||
ServicePhone = input.ServicePhone,
|
ServicePhone = input.ServicePhone,
|
||||||
ServiceWechat = input.ServiceWechat,
|
ServiceWechat = input.ServiceWechat,
|
||||||
ServiceWechatFiles = JsonStringArrayHelper.Serialize(input.ServiceWechatFiles),
|
ServiceWechatFiles = JsonStringArrayHelper.Serialize(input.ServiceWechatFiles)
|
||||||
IsDeleted = false,
|
|
||||||
CreateUserId = CurrentUser.GetId<int>(),
|
|
||||||
CreateTime = DateTime.Now
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await WarehouseAddressRepository.InsertAsync(entity);
|
await WarehouseAddressRepository.InsertAsync(entity);
|
||||||
@ -131,7 +128,7 @@ public class WarehouseService : ApplicationService
|
|||||||
{
|
{
|
||||||
var entity = await GetWarehouseOrThrowAsync(input.Id);
|
var entity = await GetWarehouseOrThrowAsync(input.Id);
|
||||||
var duplicatedWarehouse = await WarehouseAddressRepository.GetByWarehouseNameAsync(input.WarehouseName);
|
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("仓库名称已存在");
|
throw new BusinessException("仓库名称已存在");
|
||||||
}
|
}
|
||||||
@ -144,8 +141,6 @@ public class WarehouseService : ApplicationService
|
|||||||
entity.ServicePhone = input.ServicePhone;
|
entity.ServicePhone = input.ServicePhone;
|
||||||
entity.ServiceWechat = input.ServiceWechat;
|
entity.ServiceWechat = input.ServiceWechat;
|
||||||
entity.ServiceWechatFiles = JsonStringArrayHelper.Serialize(input.ServiceWechatFiles);
|
entity.ServiceWechatFiles = JsonStringArrayHelper.Serialize(input.ServiceWechatFiles);
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
|
|
||||||
await WarehouseAddressRepository.UpdateAsync(entity);
|
await WarehouseAddressRepository.UpdateAsync(entity);
|
||||||
}
|
}
|
||||||
@ -165,10 +160,7 @@ public class WarehouseService : ApplicationService
|
|||||||
public async Task DeleteAsync(IdInput input)
|
public async Task DeleteAsync(IdInput input)
|
||||||
{
|
{
|
||||||
var entity = await GetWarehouseOrThrowAsync(input.Id);
|
var entity = await GetWarehouseOrThrowAsync(input.Id);
|
||||||
entity.IsDeleted = true;
|
await WarehouseAddressRepository.DeleteAsync(entity);
|
||||||
entity.UpdateUserId = CurrentUser.GetId<int>();
|
|
||||||
entity.UpdateTime = DateTime.Now;
|
|
||||||
await WarehouseAddressRepository.UpdateAsync(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Expression<Func<WarehouseAddress, bool>> BuildPaginatedPredicate(WarehousePaginatedInput input)
|
private Expression<Func<WarehouseAddress, bool>> BuildPaginatedPredicate(WarehousePaginatedInput input)
|
||||||
@ -177,7 +169,6 @@ public class WarehouseService : ApplicationService
|
|||||||
var warehouseType = input.WarehouseType?.Trim();
|
var warehouseType = input.WarehouseType?.Trim();
|
||||||
|
|
||||||
return warehouse =>
|
return warehouse =>
|
||||||
!warehouse.IsDeleted &&
|
|
||||||
(string.IsNullOrWhiteSpace(warehouseType) || warehouse.WarehouseType == warehouseType) &&
|
(string.IsNullOrWhiteSpace(warehouseType) || warehouse.WarehouseType == warehouseType) &&
|
||||||
(string.IsNullOrWhiteSpace(keyword) ||
|
(string.IsNullOrWhiteSpace(keyword) ||
|
||||||
warehouse.WarehouseName.Contains(keyword) ||
|
warehouse.WarehouseName.Contains(keyword) ||
|
||||||
@ -187,7 +178,7 @@ public class WarehouseService : ApplicationService
|
|||||||
|
|
||||||
private async Task<WarehouseAddress> GetWarehouseOrThrowAsync(long id)
|
private async Task<WarehouseAddress> 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)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException("仓库不存在");
|
throw new BusinessException("仓库不存在");
|
||||||
|
|||||||
@ -10,7 +10,7 @@ public class AutoTriggerRepository : OmsSqlSugarRepository<AutoTrigger>, IAutoTr
|
|||||||
{
|
{
|
||||||
public async Task<IReadOnlyCollection<AutoTrigger>> GetEnabledListAsync(CancellationToken cancellationToken = default)
|
public async Task<IReadOnlyCollection<AutoTrigger>> 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;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,19 +9,19 @@ public class KpiAreaRepository : OmsSqlSugarRepository<KpiArea>, IKpiAreaReposit
|
|||||||
{
|
{
|
||||||
public Task<KpiArea?> GetByAppKeyTypeAndNameAsync(string appKey, string areaType, string name, CancellationToken cancellationToken = default)
|
public Task<KpiArea?> 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<bool> ExistsNameAsync(string appKey, string areaType, string name, CancellationToken cancellationToken = default)
|
public Task<bool> 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<List<KpiAreaInfo>> GetInfosAsync(long areaId, int pageIndex, int pageSize, CancellationToken cancellationToken = default)
|
public async Task<List<KpiAreaInfo>> GetInfosAsync(long areaId, int pageIndex, int pageSize, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<KpiAreaInfo>()
|
return await db.Queryable<KpiAreaInfo>()
|
||||||
.Where(x => !x.IsDeleted && x.AreaId == areaId)
|
.Where(x => x.AreaId == areaId)
|
||||||
.OrderBy(x => x.Id, SqlSugar.OrderByType.Desc)
|
.OrderBy(x => x.Id, SqlSugar.OrderByType.Desc)
|
||||||
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ public class KpiAreaRepository : OmsSqlSugarRepository<KpiArea>, IKpiAreaReposit
|
|||||||
public async Task<long> CountInfosAsync(long areaId, CancellationToken cancellationToken = default)
|
public async Task<long> CountInfosAsync(long areaId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<KpiAreaInfo>().Where(x => !x.IsDeleted && x.AreaId == areaId).CountAsync(cancellationToken);
|
return await db.Queryable<KpiAreaInfo>().Where(x => x.AreaId == areaId).CountAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<KpiAreaInfo> InsertInfoAsync(KpiAreaInfo info, CancellationToken cancellationToken = default)
|
public async Task<KpiAreaInfo> InsertInfoAsync(KpiAreaInfo info, CancellationToken cancellationToken = default)
|
||||||
@ -41,7 +41,7 @@ public class KpiAreaRepository : OmsSqlSugarRepository<KpiArea>, IKpiAreaReposit
|
|||||||
public async Task<KpiAreaInfo?> GetInfoByIdAsync(long id, CancellationToken cancellationToken = default)
|
public async Task<KpiAreaInfo?> GetInfoByIdAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<KpiAreaInfo>().FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
|
return await db.Queryable<KpiAreaInfo>().FirstAsync(x => x.Id == id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateInfoAsync(KpiAreaInfo info, CancellationToken cancellationToken = default)
|
public async Task UpdateInfoAsync(KpiAreaInfo info, CancellationToken cancellationToken = default)
|
||||||
@ -53,6 +53,6 @@ public class KpiAreaRepository : OmsSqlSugarRepository<KpiArea>, IKpiAreaReposit
|
|||||||
public async Task DeleteInfoAsync(long id, CancellationToken cancellationToken = default)
|
public async Task DeleteInfoAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable<KpiAreaInfo>().SetColumns(x => x.IsDeleted, true).Where(x => x.Id == id).ExecuteCommandAsync(cancellationToken);
|
await db.Deleteable<KpiAreaInfo>().Where(x => x.Id == id).ExecuteCommandAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,12 +10,12 @@ public class LabelTemplateRepository : OmsSqlSugarRepository<LabelTemplate>, ILa
|
|||||||
public Task<LabelTemplate?> GetByNameAndTypeAsync(string name, string? templateType, CancellationToken cancellationToken = default)
|
public Task<LabelTemplate?> GetByNameAndTypeAsync(string name, string? templateType, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(
|
return FirstOrDefaultAsync(
|
||||||
x => !x.IsDeleted && x.Name == name && x.TemplateType == templateType,
|
x => x.Name == name && x.TemplateType == templateType,
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> ExistsNameAsync(string name, string? templateType, CancellationToken cancellationToken = default)
|
public Task<bool> 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,19 +10,19 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
{
|
{
|
||||||
public Task<SalesProduct?> GetByProductCodeAsync(string productCode, CancellationToken cancellationToken = default)
|
public Task<SalesProduct?> GetByProductCodeAsync(string productCode, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.ProductCode == productCode, cancellationToken);
|
return FirstOrDefaultAsync(x => x.ProductCode == productCode, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> HasProductCodeAsync(string productCode, CancellationToken cancellationToken = default)
|
public Task<bool> 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<List<SalesProductPrice>> GetPricesAsync(long salesProductId, CancellationToken cancellationToken = default)
|
public async Task<List<SalesProductPrice>> GetPricesAsync(long salesProductId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<SalesProductPrice>()
|
return await db.Queryable<SalesProductPrice>()
|
||||||
.Where(x => !x.IsDeleted && x.SalesProductId == salesProductId)
|
.Where(x => x.SalesProductId == salesProductId)
|
||||||
.OrderBy(x => x.SerialNumber)
|
.OrderBy(x => x.SerialNumber)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<SalesProductPrice>()
|
return await db.Queryable<SalesProductPrice>()
|
||||||
.FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
|
.FirstAsync(x => x.Id == id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<SalesProductPriceFactor>> GetPriceFactorsAsync(IEnumerable<long> priceIds, CancellationToken cancellationToken = default)
|
public async Task<List<SalesProductPriceFactor>> GetPriceFactorsAsync(IEnumerable<long> priceIds, CancellationToken cancellationToken = default)
|
||||||
@ -40,7 +40,7 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
if (ids.Length == 0) return [];
|
if (ids.Length == 0) return [];
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<SalesProductPriceFactor>()
|
return await db.Queryable<SalesProductPriceFactor>()
|
||||||
.Where(x => !x.IsDeleted && ids.Contains(x.PriceId))
|
.Where(x => ids.Contains(x.PriceId))
|
||||||
.OrderBy(x => x.SerialNumber)
|
.OrderBy(x => x.SerialNumber)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
if (ids.Length == 0) return [];
|
if (ids.Length == 0) return [];
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<SalesProductPriceDetail>()
|
return await db.Queryable<SalesProductPriceDetail>()
|
||||||
.Where(x => !x.IsDeleted && ids.Contains(x.PriceId))
|
.Where(x => ids.Contains(x.PriceId))
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,13 +68,11 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable(price).ExecuteCommandAsync(cancellationToken);
|
await db.Updateable(price).ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<SalesProductPriceFactor>()
|
await db.Deleteable<SalesProductPriceFactor>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
.Where(x => x.PriceId == price.Id)
|
||||||
.Where(x => !x.IsDeleted && x.PriceId == price.Id)
|
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<SalesProductPriceDetail>()
|
await db.Deleteable<SalesProductPriceDetail>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
.Where(x => x.PriceId == price.Id)
|
||||||
.Where(x => !x.IsDeleted && x.PriceId == price.Id)
|
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
await InsertPriceChildrenAsync(db, price.Id, factors, details, cancellationToken);
|
await InsertPriceChildrenAsync(db, price.Id, factors, details, cancellationToken);
|
||||||
}
|
}
|
||||||
@ -82,16 +80,13 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
public async Task DeletePriceAsync(long id, CancellationToken cancellationToken = default)
|
public async Task DeletePriceAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable<SalesProductPrice>()
|
await db.Deleteable<SalesProductPrice>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<SalesProductPriceFactor>()
|
await db.Deleteable<SalesProductPriceFactor>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
|
||||||
.Where(x => x.PriceId == id)
|
.Where(x => x.PriceId == id)
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<SalesProductPriceDetail>()
|
await db.Deleteable<SalesProductPriceDetail>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
|
||||||
.Where(x => x.PriceId == id)
|
.Where(x => x.PriceId == id)
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
@ -101,7 +96,7 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable<SalesProductPrice>()
|
await db.Updateable<SalesProductPrice>()
|
||||||
.SetColumns(x => x.Status, status)
|
.SetColumns(x => x.Status, status)
|
||||||
.Where(x => !x.IsDeleted && x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,16 +104,16 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
var oldPrices = await db.Queryable<SalesProductPrice>()
|
var oldPrices = await db.Queryable<SalesProductPrice>()
|
||||||
.Where(x => !x.IsDeleted && x.SalesProductId == salesProductId)
|
.Where(x => x.SalesProductId == salesProductId)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
var oldPriceIds = oldPrices.Select(x => x.Id).ToArray();
|
var oldPriceIds = oldPrices.Select(x => x.Id).ToArray();
|
||||||
|
|
||||||
if (oldPriceIds.Length > 0)
|
if (oldPriceIds.Length > 0)
|
||||||
{
|
{
|
||||||
// 批量保存采用全量替换策略,旧价格树先统一软删,避免残留旧明细。
|
// 批量保存采用全量替换策略,旧价格树先统一软删,避免残留旧明细。
|
||||||
await db.Updateable<SalesProductPrice>().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.Id)).ExecuteCommandAsync(cancellationToken);
|
await db.Deleteable<SalesProductPrice>().Where(x => oldPriceIds.Contains(x.Id)).ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<SalesProductPriceFactor>().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
|
await db.Deleteable<SalesProductPriceFactor>().Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<SalesProductPriceDetail>().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
|
await db.Deleteable<SalesProductPriceDetail>().Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
var priceList = prices.Select(x => new
|
var priceList = prices.Select(x => new
|
||||||
@ -153,7 +148,7 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<SalesProductAllocationProvider>()
|
return await db.Queryable<SalesProductAllocationProvider>()
|
||||||
.Where(x => !x.IsDeleted && x.SalesProductId == salesProductId)
|
.Where(x => x.SalesProductId == salesProductId)
|
||||||
.OrderBy(x => x.SerialNumber)
|
.OrderBy(x => x.SerialNumber)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
@ -161,8 +156,8 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
public async Task ReplaceAllocationProvidersAsync(long salesProductId, IEnumerable<SalesProductAllocationProvider> providers, CancellationToken cancellationToken = default)
|
public async Task ReplaceAllocationProvidersAsync(long salesProductId, IEnumerable<SalesProductAllocationProvider> providers, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable<SalesProductAllocationProvider>().SetColumns(x => x.IsDeleted, true)
|
await db.Deleteable<SalesProductAllocationProvider>()
|
||||||
.Where(x => !x.IsDeleted && x.SalesProductId == salesProductId)
|
.Where(x => x.SalesProductId == salesProductId)
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
var items = providers.Select(x => { x.Id = 0; x.SalesProductId = salesProductId; return x; }).ToArray();
|
var items = providers.Select(x => { x.Id = 0; x.SalesProductId = salesProductId; return x; }).ToArray();
|
||||||
if (items.Length > 0)
|
if (items.Length > 0)
|
||||||
@ -175,7 +170,7 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<SalesProductPublishRecord>()
|
return await db.Queryable<SalesProductPublishRecord>()
|
||||||
.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)
|
.OrderBy(x => x.PublishTime, SqlSugar.OrderByType.Desc)
|
||||||
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
||||||
}
|
}
|
||||||
@ -184,7 +179,7 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<SalesProductPublishRecord>()
|
return await db.Queryable<SalesProductPublishRecord>()
|
||||||
.Where(x => !x.IsDeleted && x.SalesProductId == salesProductId && x.OperatorType == operatorType)
|
.Where(x => x.SalesProductId == salesProductId && x.OperatorType == operatorType)
|
||||||
.CountAsync(cancellationToken);
|
.CountAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +192,7 @@ public class SalesProductRepository : OmsSqlSugarRepository<SalesProduct>, ISale
|
|||||||
public async Task<SalesProductPublishRecord?> GetPublishRecordByIdAsync(long id, CancellationToken cancellationToken = default)
|
public async Task<SalesProductPublishRecord?> GetPublishRecordByIdAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<SalesProductPublishRecord>().FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
|
return await db.Queryable<SalesProductPublishRecord>().FirstAsync(x => x.Id == id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task InsertPriceChildrenAsync(
|
private static async Task InsertPriceChildrenAsync(
|
||||||
|
|||||||
@ -10,25 +10,25 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
{
|
{
|
||||||
public Task<ServiceChannel?> GetByChannelCodeAsync(string channelCode, CancellationToken cancellationToken = default)
|
public Task<ServiceChannel?> GetByChannelCodeAsync(string channelCode, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.ChannelCode == channelCode, cancellationToken);
|
return FirstOrDefaultAsync(x => x.ChannelCode == channelCode, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> HasChannelCodeAsync(string channelCode, CancellationToken cancellationToken = default)
|
public Task<bool> 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<List<ServiceChannelGroup>> GetGroupsAsync(CancellationToken cancellationToken = default)
|
public async Task<List<ServiceChannelGroup>> GetGroupsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<ServiceChannelGroup>().Where(x => !x.IsDeleted).ToListAsync(cancellationToken);
|
return await db.Queryable<ServiceChannelGroup>().ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<ServiceChannelPrice>> GetPricesAsync(long serviceChannelId, CancellationToken cancellationToken = default)
|
public async Task<List<ServiceChannelPrice>> GetPricesAsync(long serviceChannelId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<ServiceChannelPrice>()
|
return await db.Queryable<ServiceChannelPrice>()
|
||||||
.Where(x => !x.IsDeleted && x.ServiceChannelId == serviceChannelId)
|
.Where(x => x.ServiceChannelId == serviceChannelId)
|
||||||
.OrderBy(x => x.SerialNumber)
|
.OrderBy(x => x.SerialNumber)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<ServiceChannelPrice>()
|
return await db.Queryable<ServiceChannelPrice>()
|
||||||
.FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
|
.FirstAsync(x => x.Id == id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<ServiceChannelPriceFactor>> GetPriceFactorsAsync(IEnumerable<long> priceIds, CancellationToken cancellationToken = default)
|
public async Task<List<ServiceChannelPriceFactor>> GetPriceFactorsAsync(IEnumerable<long> priceIds, CancellationToken cancellationToken = default)
|
||||||
@ -46,7 +46,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
if (ids.Length == 0) return [];
|
if (ids.Length == 0) return [];
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<ServiceChannelPriceFactor>()
|
return await db.Queryable<ServiceChannelPriceFactor>()
|
||||||
.Where(x => !x.IsDeleted && ids.Contains(x.PriceId))
|
.Where(x => ids.Contains(x.PriceId))
|
||||||
.OrderBy(x => x.SerialNumber)
|
.OrderBy(x => x.SerialNumber)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
if (ids.Length == 0) return [];
|
if (ids.Length == 0) return [];
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<ServiceChannelPriceDetail>()
|
return await db.Queryable<ServiceChannelPriceDetail>()
|
||||||
.Where(x => !x.IsDeleted && ids.Contains(x.PriceId))
|
.Where(x => ids.Contains(x.PriceId))
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,13 +74,11 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable(price).ExecuteCommandAsync(cancellationToken);
|
await db.Updateable(price).ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<ServiceChannelPriceFactor>()
|
await db.Deleteable<ServiceChannelPriceFactor>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
.Where(x => x.PriceId == price.Id)
|
||||||
.Where(x => !x.IsDeleted && x.PriceId == price.Id)
|
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<ServiceChannelPriceDetail>()
|
await db.Deleteable<ServiceChannelPriceDetail>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
.Where(x => x.PriceId == price.Id)
|
||||||
.Where(x => !x.IsDeleted && x.PriceId == price.Id)
|
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
await InsertPriceChildrenAsync(db, price.Id, factors, details, cancellationToken);
|
await InsertPriceChildrenAsync(db, price.Id, factors, details, cancellationToken);
|
||||||
}
|
}
|
||||||
@ -88,16 +86,13 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
public async Task DeletePriceAsync(long id, CancellationToken cancellationToken = default)
|
public async Task DeletePriceAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable<ServiceChannelPrice>()
|
await db.Deleteable<ServiceChannelPrice>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<ServiceChannelPriceFactor>()
|
await db.Deleteable<ServiceChannelPriceFactor>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
|
||||||
.Where(x => x.PriceId == id)
|
.Where(x => x.PriceId == id)
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<ServiceChannelPriceDetail>()
|
await db.Deleteable<ServiceChannelPriceDetail>()
|
||||||
.SetColumns(x => x.IsDeleted, true)
|
|
||||||
.Where(x => x.PriceId == id)
|
.Where(x => x.PriceId == id)
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
@ -107,7 +102,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable<ServiceChannelPrice>()
|
await db.Updateable<ServiceChannelPrice>()
|
||||||
.SetColumns(x => x.Status, status)
|
.SetColumns(x => x.Status, status)
|
||||||
.Where(x => !x.IsDeleted && x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.ExecuteCommandAsync(cancellationToken);
|
.ExecuteCommandAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,16 +110,16 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
var oldPrices = await db.Queryable<ServiceChannelPrice>()
|
var oldPrices = await db.Queryable<ServiceChannelPrice>()
|
||||||
.Where(x => !x.IsDeleted && x.ServiceChannelId == serviceChannelId)
|
.Where(x => x.ServiceChannelId == serviceChannelId)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
var oldPriceIds = oldPrices.Select(x => x.Id).ToArray();
|
var oldPriceIds = oldPrices.Select(x => x.Id).ToArray();
|
||||||
|
|
||||||
if (oldPriceIds.Length > 0)
|
if (oldPriceIds.Length > 0)
|
||||||
{
|
{
|
||||||
// 批量保存时先整棵旧买价树软删,再写入新的快照数据。
|
// 批量保存时先整棵旧买价树软删,再写入新的快照数据。
|
||||||
await db.Updateable<ServiceChannelPrice>().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.Id)).ExecuteCommandAsync(cancellationToken);
|
await db.Deleteable<ServiceChannelPrice>().Where(x => oldPriceIds.Contains(x.Id)).ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<ServiceChannelPriceFactor>().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
|
await db.Deleteable<ServiceChannelPriceFactor>().Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
|
||||||
await db.Updateable<ServiceChannelPriceDetail>().SetColumns(x => x.IsDeleted, true).Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
|
await db.Deleteable<ServiceChannelPriceDetail>().Where(x => oldPriceIds.Contains(x.PriceId)).ExecuteCommandAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
var priceList = prices.Select(x => new
|
var priceList = prices.Select(x => new
|
||||||
@ -159,7 +154,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<ServiceChannelPublishRecord>()
|
return await db.Queryable<ServiceChannelPublishRecord>()
|
||||||
.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)
|
.OrderBy(x => x.PublishTime, SqlSugar.OrderByType.Desc)
|
||||||
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
||||||
}
|
}
|
||||||
@ -168,7 +163,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<ServiceChannelPublishRecord>()
|
return await db.Queryable<ServiceChannelPublishRecord>()
|
||||||
.Where(x => !x.IsDeleted && x.ServiceChannelId == serviceChannelId && x.OperatorType == operatorType)
|
.Where(x => x.ServiceChannelId == serviceChannelId && x.OperatorType == operatorType)
|
||||||
.CountAsync(cancellationToken);
|
.CountAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +176,7 @@ public class ServiceChannelRepository : OmsSqlSugarRepository<ServiceChannel>, I
|
|||||||
public async Task<ServiceChannelPublishRecord?> GetPublishRecordByIdAsync(long id, CancellationToken cancellationToken = default)
|
public async Task<ServiceChannelPublishRecord?> GetPublishRecordByIdAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<ServiceChannelPublishRecord>().FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
|
return await db.Queryable<ServiceChannelPublishRecord>().FirstAsync(x => x.Id == id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task InsertPriceChildrenAsync(
|
private static async Task InsertPriceChildrenAsync(
|
||||||
|
|||||||
@ -9,19 +9,19 @@ public class WeightRoundingRepository : OmsSqlSugarRepository<WeightRounding>, I
|
|||||||
{
|
{
|
||||||
public Task<WeightRounding?> GetByAppKeyAndNameAsync(string appKey, string name, CancellationToken cancellationToken = default)
|
public Task<WeightRounding?> 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<bool> ExistsNameAsync(string appKey, string name, CancellationToken cancellationToken = default)
|
public Task<bool> 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<List<WeightRoundingInfo>> GetInfosAsync(long roundingId, int pageIndex, int pageSize, CancellationToken cancellationToken = default)
|
public async Task<List<WeightRoundingInfo>> GetInfosAsync(long roundingId, int pageIndex, int pageSize, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<WeightRoundingInfo>()
|
return await db.Queryable<WeightRoundingInfo>()
|
||||||
.Where(x => !x.IsDeleted && x.RoundingId == roundingId)
|
.Where(x => x.RoundingId == roundingId)
|
||||||
.OrderBy(x => x.Id, SqlSugar.OrderByType.Desc)
|
.OrderBy(x => x.Id, SqlSugar.OrderByType.Desc)
|
||||||
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ public class WeightRoundingRepository : OmsSqlSugarRepository<WeightRounding>, I
|
|||||||
public async Task<long> CountInfosAsync(long roundingId, CancellationToken cancellationToken = default)
|
public async Task<long> CountInfosAsync(long roundingId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<WeightRoundingInfo>().Where(x => !x.IsDeleted && x.RoundingId == roundingId).CountAsync(cancellationToken);
|
return await db.Queryable<WeightRoundingInfo>().Where(x => x.RoundingId == roundingId).CountAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<WeightRoundingInfo> InsertInfoAsync(WeightRoundingInfo info, CancellationToken cancellationToken = default)
|
public async Task<WeightRoundingInfo> InsertInfoAsync(WeightRoundingInfo info, CancellationToken cancellationToken = default)
|
||||||
@ -41,7 +41,7 @@ public class WeightRoundingRepository : OmsSqlSugarRepository<WeightRounding>, I
|
|||||||
public async Task<WeightRoundingInfo?> GetInfoByIdAsync(long id, CancellationToken cancellationToken = default)
|
public async Task<WeightRoundingInfo?> GetInfoByIdAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<WeightRoundingInfo>().FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
|
return await db.Queryable<WeightRoundingInfo>().FirstAsync(x => x.Id == id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateInfoAsync(WeightRoundingInfo info, CancellationToken cancellationToken = default)
|
public async Task UpdateInfoAsync(WeightRoundingInfo info, CancellationToken cancellationToken = default)
|
||||||
@ -53,6 +53,6 @@ public class WeightRoundingRepository : OmsSqlSugarRepository<WeightRounding>, I
|
|||||||
public async Task DeleteInfoAsync(long id, CancellationToken cancellationToken = default)
|
public async Task DeleteInfoAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable<WeightRoundingInfo>().SetColumns(x => x.IsDeleted, true).Where(x => x.Id == id).ExecuteCommandAsync(cancellationToken);
|
await db.Deleteable<WeightRoundingInfo>().Where(x => x.Id == id).ExecuteCommandAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,19 +9,19 @@ public class WeightRuleRepository : OmsSqlSugarRepository<WeightRule>, IWeightRu
|
|||||||
{
|
{
|
||||||
public Task<WeightRule?> GetByAppKeyAndNameAsync(string appKey, string name, CancellationToken cancellationToken = default)
|
public Task<WeightRule?> 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<bool> ExistsNameAsync(string appKey, string name, CancellationToken cancellationToken = default)
|
public Task<bool> 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<List<WeightRuleInfo>> GetInfosAsync(long ruleId, int pageIndex, int pageSize, CancellationToken cancellationToken = default)
|
public async Task<List<WeightRuleInfo>> GetInfosAsync(long ruleId, int pageIndex, int pageSize, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<WeightRuleInfo>()
|
return await db.Queryable<WeightRuleInfo>()
|
||||||
.Where(x => !x.IsDeleted && x.RuleId == ruleId)
|
.Where(x => x.RuleId == ruleId)
|
||||||
.OrderBy(x => x.Id, SqlSugar.OrderByType.Desc)
|
.OrderBy(x => x.Id, SqlSugar.OrderByType.Desc)
|
||||||
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
.ToPageListAsync(pageIndex, pageSize, cancellationToken);
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ public class WeightRuleRepository : OmsSqlSugarRepository<WeightRule>, IWeightRu
|
|||||||
public async Task<long> CountInfosAsync(long ruleId, CancellationToken cancellationToken = default)
|
public async Task<long> CountInfosAsync(long ruleId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<WeightRuleInfo>().Where(x => !x.IsDeleted && x.RuleId == ruleId).CountAsync(cancellationToken);
|
return await db.Queryable<WeightRuleInfo>().Where(x => x.RuleId == ruleId).CountAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<WeightRuleInfo> InsertInfoAsync(WeightRuleInfo info, CancellationToken cancellationToken = default)
|
public async Task<WeightRuleInfo> InsertInfoAsync(WeightRuleInfo info, CancellationToken cancellationToken = default)
|
||||||
@ -41,7 +41,7 @@ public class WeightRuleRepository : OmsSqlSugarRepository<WeightRule>, IWeightRu
|
|||||||
public async Task<WeightRuleInfo?> GetInfoByIdAsync(long id, CancellationToken cancellationToken = default)
|
public async Task<WeightRuleInfo?> GetInfoByIdAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<WeightRuleInfo>().FirstAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
|
return await db.Queryable<WeightRuleInfo>().FirstAsync(x => x.Id == id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateInfoAsync(WeightRuleInfo info, CancellationToken cancellationToken = default)
|
public async Task UpdateInfoAsync(WeightRuleInfo info, CancellationToken cancellationToken = default)
|
||||||
@ -53,6 +53,6 @@ public class WeightRuleRepository : OmsSqlSugarRepository<WeightRule>, IWeightRu
|
|||||||
public async Task DeleteInfoAsync(long id, CancellationToken cancellationToken = default)
|
public async Task DeleteInfoAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
await db.Updateable<WeightRuleInfo>().SetColumns(x => x.IsDeleted, true).Where(x => x.Id == id).ExecuteCommandAsync(cancellationToken);
|
await db.Deleteable<WeightRuleInfo>().Where(x => x.Id == id).ExecuteCommandAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,26 +9,26 @@ public class CustomerRepository : OmsSqlSugarRepository<Customer>, ICustomerRepo
|
|||||||
{
|
{
|
||||||
public Task<Customer?> GetByCustomerCodeAsync(string customerCode, CancellationToken cancellationToken = default)
|
public Task<Customer?> GetByCustomerCodeAsync(string customerCode, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.CustomerCode == customerCode, cancellationToken);
|
return FirstOrDefaultAsync(x => x.CustomerCode == customerCode, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Customer?> GetByPhoneAsync(string phone, CancellationToken cancellationToken = default)
|
public Task<Customer?> GetByPhoneAsync(string phone, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.Phone == phone, cancellationToken);
|
return FirstOrDefaultAsync(x => x.Phone == phone, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Customer?> GetByEmailAsync(string email, CancellationToken cancellationToken = default)
|
public Task<Customer?> GetByEmailAsync(string email, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.Email == email, cancellationToken);
|
return FirstOrDefaultAsync(x => x.Email == email, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Customer?> GetByWechatOpenidAsync(string wechatOpenid, CancellationToken cancellationToken = default)
|
public Task<Customer?> GetByWechatOpenidAsync(string wechatOpenid, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.WechatOpenid == wechatOpenid, cancellationToken);
|
return FirstOrDefaultAsync(x => x.WechatOpenid == wechatOpenid, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> ExistsPhoneAsync(string phone, CancellationToken cancellationToken = default)
|
public Task<bool> ExistsPhoneAsync(string phone, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return AnyAsync(x => !x.IsDeleted && x.Phone == phone, cancellationToken);
|
return AnyAsync(x => x.Phone == phone, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,16 +9,16 @@ public class CustomerSubAccountRepository : OmsSqlSugarRepository<CustomerSubAcc
|
|||||||
{
|
{
|
||||||
public Task<CustomerSubAccount?> GetBySubAccountCodeAsync(string subAccountCode, CancellationToken cancellationToken = default)
|
public Task<CustomerSubAccount?> GetBySubAccountCodeAsync(string subAccountCode, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.SubAccountCode == subAccountCode, cancellationToken);
|
return FirstOrDefaultAsync(x => x.SubAccountCode == subAccountCode, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<CustomerSubAccount?> GetBySubPhoneAsync(string subPhone, CancellationToken cancellationToken = default)
|
public Task<CustomerSubAccount?> GetBySubPhoneAsync(string subPhone, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.SubPhone == subPhone, cancellationToken);
|
return FirstOrDefaultAsync(x => x.SubPhone == subPhone, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> ExistsSubPhoneAsync(string subPhone, CancellationToken cancellationToken = default)
|
public Task<bool> ExistsSubPhoneAsync(string subPhone, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return AnyAsync(x => !x.IsDeleted && x.SubPhone == subPhone, cancellationToken);
|
return AnyAsync(x => x.SubPhone == subPhone, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ public class InboundRecordRepository : OmsSqlSugarRepository<InboundRecord>, IIn
|
|||||||
public async Task<InboundRecord?> GetLatestByWaybillNoAsync(string waybillNo, CancellationToken cancellationToken = default)
|
public async Task<InboundRecord?> GetLatestByWaybillNoAsync(string waybillNo, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var list = await GetPagedListAsync(
|
var list = await GetPagedListAsync(
|
||||||
x => !x.IsDeleted && x.WaybillNo == waybillNo,
|
x => x.WaybillNo == waybillNo,
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
new Dictionary<string, bool> { [nameof(InboundRecord.OperateTime)] = false, [nameof(InboundRecord.Id)] = false },
|
new Dictionary<string, bool> { [nameof(InboundRecord.OperateTime)] = false, [nameof(InboundRecord.Id)] = false },
|
||||||
|
|||||||
@ -10,7 +10,7 @@ public class LabelPrintRecordRepository : OmsSqlSugarRepository<LabelPrintRecord
|
|||||||
public async Task<LabelPrintRecord?> GetLatestByWaybillNoAsync(string waybillNo, CancellationToken cancellationToken = default)
|
public async Task<LabelPrintRecord?> GetLatestByWaybillNoAsync(string waybillNo, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var list = await GetPagedListAsync(
|
var list = await GetPagedListAsync(
|
||||||
x => !x.IsDeleted && x.WaybillNo == waybillNo,
|
x => x.WaybillNo == waybillNo,
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
new Dictionary<string, bool> { [nameof(LabelPrintRecord.PrintTime)] = false, [nameof(LabelPrintRecord.Id)] = false },
|
new Dictionary<string, bool> { [nameof(LabelPrintRecord.PrintTime)] = false, [nameof(LabelPrintRecord.Id)] = false },
|
||||||
|
|||||||
@ -10,7 +10,7 @@ public class OutboundRecordRepository : OmsSqlSugarRepository<OutboundRecord>, I
|
|||||||
public async Task<OutboundRecord?> GetLatestByWaybillNoAsync(string waybillNo, CancellationToken cancellationToken = default)
|
public async Task<OutboundRecord?> GetLatestByWaybillNoAsync(string waybillNo, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var list = await GetPagedListAsync(
|
var list = await GetPagedListAsync(
|
||||||
x => !x.IsDeleted && x.WaybillNo == waybillNo,
|
x => x.WaybillNo == waybillNo,
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
new Dictionary<string, bool> { [nameof(OutboundRecord.OperateTime)] = false, [nameof(OutboundRecord.Id)] = false },
|
new Dictionary<string, bool> { [nameof(OutboundRecord.OperateTime)] = false, [nameof(OutboundRecord.Id)] = false },
|
||||||
|
|||||||
@ -9,27 +9,27 @@ public class OrderRepository : OmsSqlSugarRepository<Order>, IOrderRepository, I
|
|||||||
{
|
{
|
||||||
public Task<Order?> GetByServiceNoAsync(string serviceNo, CancellationToken cancellationToken = default)
|
public Task<Order?> GetByServiceNoAsync(string serviceNo, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.ServiceNo == serviceNo, cancellationToken);
|
return FirstOrDefaultAsync(x => x.ServiceNo == serviceNo, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> HasServiceNoAsync(string serviceNo, CancellationToken cancellationToken = default)
|
public Task<bool> HasServiceNoAsync(string serviceNo, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return AnyAsync(x => !x.IsDeleted && x.ServiceNo == serviceNo, cancellationToken);
|
return AnyAsync(x => x.ServiceNo == serviceNo, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Order?> GetByTrackNoAsync(string trackNo, CancellationToken cancellationToken = default)
|
public Task<Order?> GetByTrackNoAsync(string trackNo, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.TrackNo == trackNo, cancellationToken);
|
return FirstOrDefaultAsync(x => x.TrackNo == trackNo, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Order?> GetByCustomerAndClientNoAsync(long customerId, string clientNo, CancellationToken cancellationToken = default)
|
public Task<Order?> GetByCustomerAndClientNoAsync(long customerId, string clientNo, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.CustomerId == customerId && x.ClientNo == clientNo, cancellationToken);
|
return FirstOrDefaultAsync(x => x.CustomerId == customerId && x.ClientNo == clientNo, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Order?> GetByRequestIdAsync(string requestId, CancellationToken cancellationToken = default)
|
public Task<Order?> GetByRequestIdAsync(string requestId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.RequestId == requestId, cancellationToken);
|
return FirstOrDefaultAsync(x => x.RequestId == requestId, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<OrderSender>> GetSendersByOrderIdsAsync(IEnumerable<long> orderIds, CancellationToken cancellationToken = default)
|
public async Task<List<OrderSender>> GetSendersByOrderIdsAsync(IEnumerable<long> orderIds, CancellationToken cancellationToken = default)
|
||||||
@ -42,7 +42,7 @@ public class OrderRepository : OmsSqlSugarRepository<Order>, IOrderRepository, I
|
|||||||
|
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<OrderSender>()
|
return await db.Queryable<OrderSender>()
|
||||||
.Where(x => !x.IsDeleted && ids.Contains(x.OrderId))
|
.Where(x => ids.Contains(x.OrderId))
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class OrderRepository : OmsSqlSugarRepository<Order>, IOrderRepository, I
|
|||||||
|
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<OrderRecipient>()
|
return await db.Queryable<OrderRecipient>()
|
||||||
.Where(x => !x.IsDeleted && ids.Contains(x.OrderId))
|
.Where(x => ids.Contains(x.OrderId))
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ public class OrderRepository : OmsSqlSugarRepository<Order>, IOrderRepository, I
|
|||||||
|
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<OrderDeclaration>()
|
return await db.Queryable<OrderDeclaration>()
|
||||||
.Where(x => !x.IsDeleted && ids.Contains(x.OrderId))
|
.Where(x => ids.Contains(x.OrderId))
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public class OrderRepository : OmsSqlSugarRepository<Order>, IOrderRepository, I
|
|||||||
|
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<OrderWeight>()
|
return await db.Queryable<OrderWeight>()
|
||||||
.Where(x => !x.IsDeleted && ids.Contains(x.OrderId))
|
.Where(x => ids.Contains(x.OrderId))
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,19 +9,19 @@ public class OrderTaskRepository : OmsSqlSugarRepository<OrderTask>, IOrderTaskR
|
|||||||
{
|
{
|
||||||
public Task<OrderTask?> GetByCustomerAndIdAsync(long customerId, long id, CancellationToken cancellationToken = default)
|
public Task<OrderTask?> GetByCustomerAndIdAsync(long customerId, long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.CustomerId == customerId && x.Id == id, cancellationToken);
|
return FirstOrDefaultAsync(x => x.CustomerId == customerId && x.Id == id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> ExistsAsync(long id, CancellationToken cancellationToken = default)
|
public Task<bool> ExistsAsync(long id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return AnyAsync(x => !x.IsDeleted && x.Id == id, cancellationToken);
|
return AnyAsync(x => x.Id == id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<OrderTaskFail>> GetFailListAsync(long taskId, CancellationToken cancellationToken = default)
|
public async Task<List<OrderTaskFail>> GetFailListAsync(long taskId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var db = await GetDbContextAsync(cancellationToken);
|
var db = await GetDbContextAsync(cancellationToken);
|
||||||
return await db.Queryable<OrderTaskFail>()
|
return await db.Queryable<OrderTaskFail>()
|
||||||
.Where(x => !x.IsDeleted && x.TaskId == taskId)
|
.Where(x => x.TaskId == taskId)
|
||||||
.OrderBy(x => x.RowNumber)
|
.OrderBy(x => x.RowNumber)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,11 +9,11 @@ public class OrderTemplateRepository : OmsSqlSugarRepository<OrderTemplate>, IOr
|
|||||||
{
|
{
|
||||||
public Task<OrderTemplate?> GetByTypeAndTemplateKeyAsync(string type, string templateKey, CancellationToken cancellationToken = default)
|
public Task<OrderTemplate?> GetByTypeAndTemplateKeyAsync(string type, string templateKey, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.Type == type && x.TemplateKey == templateKey, cancellationToken);
|
return FirstOrDefaultAsync(x => x.Type == type && x.TemplateKey == templateKey, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<OrderTemplate?> GetByCustomerAndNameAsync(long customerId, string name, CancellationToken cancellationToken = default)
|
public Task<OrderTemplate?> GetByCustomerAndNameAsync(long customerId, string name, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.CustomerId == customerId && x.Name == name, cancellationToken);
|
return FirstOrDefaultAsync(x => x.CustomerId == customerId && x.Name == name, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,11 +9,11 @@ public class RechargeRecordRepository : OmsSqlSugarRepository<RechargeRecord>, I
|
|||||||
{
|
{
|
||||||
public Task<RechargeRecord?> GetBySerialNumberAsync(string serialNumber, CancellationToken cancellationToken = default)
|
public Task<RechargeRecord?> GetBySerialNumberAsync(string serialNumber, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.SerialNumber == serialNumber, cancellationToken);
|
return FirstOrDefaultAsync(x => x.SerialNumber == serialNumber, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> ExistsSerialNumberAsync(string serialNumber, CancellationToken cancellationToken = default)
|
public Task<bool> ExistsSerialNumberAsync(string serialNumber, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return AnyAsync(x => !x.IsDeleted && x.SerialNumber == serialNumber, cancellationToken);
|
return AnyAsync(x => x.SerialNumber == serialNumber, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,11 +9,11 @@ public class WarehouseAddressRepository : OmsSqlSugarRepository<WarehouseAddress
|
|||||||
{
|
{
|
||||||
public Task<WarehouseAddress?> GetByWarehouseNameAsync(string warehouseName, CancellationToken cancellationToken = default)
|
public Task<WarehouseAddress?> GetByWarehouseNameAsync(string warehouseName, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return FirstOrDefaultAsync(x => !x.IsDeleted && x.WarehouseName == warehouseName, cancellationToken);
|
return FirstOrDefaultAsync(x => x.WarehouseName == warehouseName, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> ExistsWarehouseNameAsync(string warehouseName, CancellationToken cancellationToken = default)
|
public Task<bool> ExistsWarehouseNameAsync(string warehouseName, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return AnyAsync(x => !x.IsDeleted && x.WarehouseName == warehouseName, cancellationToken);
|
return AnyAsync(x => x.WarehouseName == warehouseName, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user