admin/src/Oms.Application/Shared/PublishSnapshotSlimmer.cs
zzh e5c9364434
All checks were successful
Build and Deploy / deploy (push) Successful in 1m49s
feat: 排货规则支持判断条件公式并完善失败溯源
用 MatchCondition 中文公式筛选可用渠道后再按方案选渠;失败时落完整排货过程(阶段、公式摘要、池汇总),并兼容旧 CustomerIds。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 19:43:05 +08:00

110 lines
3.7 KiB
C#

using Oms.Application.Dtos.Channels;
using Oms.Application.Dtos.Orders;
using Oms.Domain.ChannelsAggregate.Entities;
namespace Oms.Application.Shared;
/// <summary>
/// 发布快照瘦身:去掉审计时间等计费无用字段。
/// </summary>
public static class PublishSnapshotSlimmer
{
public static SalesProductPriceSnapshotItemDto SlimPrice(SalesProductPriceListOutput price) =>
new()
{
Id = price.Id,
SerialNumber = price.SerialNumber,
Status = price.Status,
PriceName = price.PriceName,
CostItem = price.CostItem,
CostUnit = price.CostUnit,
Currency = price.Currency,
ChargingCondition = price.ChargingCondition,
Factors = price.Factors,
Details = price.Details
};
public static ServiceChannelPriceSnapshotItemDto SlimChannelPrice(ServiceChannelPriceListOutput price) =>
new()
{
Id = price.Id,
ServiceChannelId = price.ServiceChannelId,
SerialNumber = price.SerialNumber,
Status = price.Status,
PriceName = price.PriceName,
CostItem = price.CostItem,
CostUnit = price.CostUnit,
Currency = price.Currency,
ChargingCondition = price.ChargingCondition,
Factors = price.Factors,
Details = price.Details
};
public static ServiceChannelPriceListOutput ToChannelPriceListOutput(ServiceChannelPriceSnapshotItemDto price) =>
new()
{
Id = price.Id,
ServiceChannelId = price.ServiceChannelId,
SerialNumber = price.SerialNumber,
Status = price.Status,
PriceName = price.PriceName,
CostItem = price.CostItem,
CostUnit = price.CostUnit,
Currency = price.Currency,
ChargingCondition = price.ChargingCondition,
Factors = price.Factors,
Details = price.Details
};
public static SalesProductAllocationProviderSnapshotDto SlimAllocationProvider(
SalesProductAllocationProviderOutput provider) =>
new()
{
Id = provider.Id,
SalesProductId = provider.SalesProductId,
SerialNumber = provider.SerialNumber,
ProviderName = provider.ProviderName,
ServiceChannelId = provider.ServiceChannelId,
ServiceChannelName = provider.ServiceChannelName,
Weight = provider.Weight,
CustomerIds = provider.CustomerIds,
MatchCondition = provider.MatchCondition
};
public static WeightRuleSnapshotRuleDto SlimWeightRule(WeightRuleInfo entity) =>
new()
{
Id = entity.Id,
Condition = entity.Condition,
BillableWeight = entity.BillableWeight,
VolumetricFactor = entity.VolumetricFactor
};
public static WeightRoundingSnapshotRangeDto SlimWeightRounding(WeightRoundingInfo entity) =>
new()
{
Id = entity.Id,
Start = entity.StartValue,
End = entity.EndValue,
Public = entity.Public
};
public static WeightRuleInfo ToWeightRuleEntity(WeightRuleSnapshotRuleDto rule) =>
new()
{
Id = rule.Id,
Condition = rule.Condition,
BillableWeight = rule.BillableWeight,
VolumetricFactor = rule.VolumetricFactor
};
public static WeightRoundingInfo ToWeightRoundingEntity(WeightRoundingSnapshotRangeDto range) =>
new()
{
Id = range.Id,
StartValue = range.Start,
EndValue = range.End,
Public = range.Public
};
}