using Oms.Domain.Shared;
using SqlSugar;
namespace Oms.Domain.OrdersAggregate.Entities;
[SugarTable("t_order")]
public class Order : OmsAuditedAggregateRoot
{
public string? RequestId { get; set; }
public string ServiceNo { get; set; } = string.Empty;
public string? ClientNo { get; set; }
public string? TrackNo { get; set; }
///
/// 服务商单号(下游 createOrderOne 返回 Data.serviceNo)。
///
[SugarColumn(Length = 64, IsNullable = true)]
public string? DownstreamServiceNo { get; set; }
public string? ProductCode { get; set; }
public string? ChannelCode { get; set; }
///
/// 下游 API 服务商编码(itfx supplierCode)。
///
public string? DownstreamSupplierCode { get; set; }
///
/// 下游 API 服务商名称(itfx service provider name)。
///
[SugarColumn(Length = 128, IsNullable = true)]
public string? DownstreamSupplierName { get; set; }
///
/// 下游 itfx 应用 AppKey。
///
public string? DownstreamAppKey { get; set; }
///
/// 下游 itfx 应用 Id。
///
public int? DownstreamAppId { get; set; }
///
/// 渠道预报编码(ForecastCode / ApiCode)。
///
public string? ChannelForecastCode { get; set; }
public string? ConsigneeCountry { get; set; }
public string? ConsigneeCountryName { get; set; }
public string? CargoAttribute { get; set; }
public string? ExportCustomsMode { get; set; }
///
/// 出口资质备案 Id(9610 汇总申报选用)。
///
[SugarColumn(IsNullable = true)]
public int? ExportQualificationId { get; set; }
public string? PredeclareFailReason { get; set; }
///
/// 待排货原因:入库等环节排货或渠道买价未成功时写入,重算应付成功后清空。
///
[SugarColumn(Length = 512, IsNullable = true)]
public string? AllocationPendingReason { get; set; }
///
/// 最近一次排货方案:costLowest / timeFastest / overallBest / designated。
///
[SugarColumn(Length = 32, IsNullable = true)]
public string? AllocationScheme { get; set; }
///
/// 最近一次排货过程快照 JSON。
///
[SugarColumn(ColumnDataType = "json", IsNullable = true)]
public string? AllocationTraceJson { get; set; }
///
/// 排货快照写入时间。
///
[SugarColumn(IsNullable = true)]
public DateTime? AllocationTraceTime { get; set; }
public string? SalesProductRulesVersion { get; set; }
public string? SalesProductPriceVersion { get; set; }
public string OrderStatus { get; set; } = string.Empty;
///
/// 问题件/已理赔子状态:pending-待处理,processed-已处理。
///
public string? HandleStatus { get; set; }
public string? IssueType { get; set; }
public string? IssueTitle { get; set; }
public string? IssueContent { get; set; }
public int? IssueTemplateId { get; set; }
public string? IssueRemark { get; set; }
public DateTime? IssueTime { get; set; }
public string? ClaimType { get; set; }
public decimal? ClaimAmount { get; set; }
public string? ClaimCurrency { get; set; }
public string? ClaimReason { get; set; }
public DateTime? ClaimTime { get; set; }
public string? PreviousOrderStatus { get; set; }
public int? WarehouseId { get; set; }
public int? CustomerId { get; set; }
public int? MemberLevelId { get; set; }
public string? PriceTierKey { get; set; }
public decimal? ReceivableSubtotal { get; set; }
///
/// 预报应收快照(创建预报计费后固化;入库重算不覆盖,用于预报→入库差额)。
///
public decimal? ForecastReceivableAmount { get; set; }
///
/// 预报应付快照(创建预报计费后固化;入库重算不覆盖,用于预报→入库差额)。
///
public decimal? ForecastPayableAmount { get; set; }
public decimal LevelDiscountAmount { get; set; }
public int? CouponInstanceId { get; set; }
public decimal CouponDiscountAmount { get; set; }
public decimal? PayableAmount { get; set; }
///
/// 订单来源:manual / pickup / upload / batch / platform。
///
public string? OrderSource { get; set; }
///
/// 预约揽收时间(OrderSource=pickup)。
///
public DateTime? PickupTime { get; set; }
///
/// 创建时选用的发件地址簿 Id。
///
public int? CustomerSenderAddressId { get; set; }
///
/// 到仓方式:selfShip / doorPickup。
///
[SugarColumn(Length = 16, IsNullable = true)]
public string? InboundMethod { get; set; }
///
/// 关联揽收单 Id(冗余,真源为 t_pickup_order_line)。
///
[SugarColumn(IsNullable = true)]
public int? PickupOrderId { get; set; }
public string? OrganizationId { get; set; }
public int SecretLevel { get; set; } = 2;
public int? SenderId { get; set; }
public int? RecipientId { get; set; }
public int? DeclarationId { get; set; }
public DateTime? ReceiveTime { get; set; }
public DateTime? ShipTime { get; set; }
public DateTime? PayTime { get; set; }
///
/// 是否已支付:0-否,1-是。
///
public byte IsPaid { get; set; }
public DateTime? SignTime { get; set; }
public byte IsCod { get; set; }
public string? CodCurrency { get; set; }
public decimal? CodSum { get; set; }
public string? DeclaredCurrency { get; set; }
public decimal? DeclaredSum { get; set; }
public int? Quantity { get; set; }
public byte IsIntercept { get; set; }
public byte IsRemote { get; set; }
///
/// 客户勾选附加服务字典 code JSON 数组,如 ["insurance"]。
///
public string? AdditionalServices { get; set; }
///
/// 履约类型:direct 直发物流 / warehouse 仓内代发。
///
[SugarColumn(Length = 16, IsNullable = true)]
public string? FulfillmentType { get; set; }
///
/// 代发来源:storeFulfill 店铺代发 / postBind 事后绑定转代发。
///
[SugarColumn(Length = 32, IsNullable = true)]
public string? FulfillmentSource { get; set; }
///
/// 出单时实际使用的标签模板 Id(面单文件见 t_order_file.systemLabel)。
///
public int? LabelTemplateId { get; set; }
public byte IsRefunded { get; set; }
}