using Oms.Domain.OrdersAggregate.Consts;
namespace Oms.Application.Dtos.Orders;
///
/// 开放接口创建订单包裹入参:与单票字段对齐(不含上门揽收)。
/// 鉴权凭证放请求头 appKey / appSecret,勿放入 Body。
///
public class OpenApiParcelCreateInput
{
/// 请求标识(幂等,可选)。
public string? RequestId { get; set; }
/// 客户单号。
public string? ClientNo { get; set; }
/// 跟踪号(可选,系统通常忽略由下游回写)。
public string? TrackNo { get; set; }
/// 服务单号(可选,不传时系统自动生成)。
public string? ServiceNo { get; set; }
/// 产品编码(运输方式)。
public string? ProductCode { get; set; }
/// 渠道编码(可选)。
public string? ChannelCode { get; set; }
/// 货物属性(字典 cargo_attribute:general / electronics / sensitive)。
public string? CargoAttribute { get; set; }
/// 出口报关方式(字典 export_customs_mode)。
public string? ExportCustomsMode { get; set; }
/// 出口资质备案 Id(9610 汇总申报时)。
public int? ExportQualificationId { get; set; }
/// 电商平台(9610 汇总申报时)。
public string? PlatformCode { get; set; }
/// 仓库主键。
public int? WarehouseId { get; set; }
/// 长(cm)。
public decimal? Length { get; set; }
/// 宽(cm)。
public decimal? Width { get; set; }
/// 高(cm)。
public decimal? Height { get; set; }
/// 实重(kg)。
public decimal? ActualWeight { get; set; }
/// 体积重(kg,可选)。
public decimal? VolumetricWeight { get; set; }
/// 计费重(kg,可选)。
public decimal? ChargeableWeight { get; set; }
/// 体积(cm³,可选)。
public decimal? Cubic { get; set; }
/// 是否 COD。
public bool IsCod { get; set; }
/// COD 币种。
public string? CodCurrency { get; set; }
/// COD 金额。
public decimal? CodSum { get; set; }
/// 申报币种(字典 currency)。
public string? DeclaredCurrency { get; set; }
/// 申报总金额(可选,不填可由明细汇总)。
public decimal? DeclaredSum { get; set; }
/// 附加服务字典 code 列表。
public List? AdditionalServices { get; set; }
/// 是否偏远(可选预传)。
public byte? IsRemote { get; set; }
/// 包裹数量。
public int? Quantity { get; set; }
/// 收件人。
public OrderParcelReceiverInput? Receiver { get; set; }
/// 寄件人。
public OrderParcelSenderInput? Sender { get; set; }
/// 申报明细。
public List Items { get; set; } = [];
/// 优惠券实例 Id(可选)。
public int? CouponInstanceId { get; set; }
/// 仅保存草稿,不预报计费。
public bool SaveAsDraft { get; set; }
///
/// 映射为内部单票创建入参。开放接口固定自发货(selfShip),客户 Id 由凭证解析后写入。
///
public OrderParcelCreateInput ToOrderParcelCreateInput(int customerId) =>
new()
{
RequestId = RequestId,
ClientNo = ClientNo,
TrackNo = TrackNo,
ServiceNo = ServiceNo,
ProductCode = ProductCode,
ChannelCode = ChannelCode,
CargoAttribute = CargoAttribute,
ExportCustomsMode = ExportCustomsMode,
ExportQualificationId = ExportQualificationId,
PlatformCode = PlatformCode,
WarehouseId = WarehouseId,
CustomerId = customerId,
Length = Length,
Width = Width,
Height = Height,
ActualWeight = ActualWeight,
VolumetricWeight = VolumetricWeight,
ChargeableWeight = ChargeableWeight,
Cubic = Cubic,
IsCod = IsCod,
CodCurrency = CodCurrency,
CodSum = CodSum,
DeclaredCurrency = DeclaredCurrency,
DeclaredSum = DeclaredSum,
AdditionalServices = AdditionalServices,
IsRemote = IsRemote,
Quantity = Quantity,
Receiver = Receiver,
Sender = Sender,
Items = Items ?? [],
CouponInstanceId = CouponInstanceId,
SaveAsDraft = SaveAsDraft,
InboundMethod = OrderInboundMethodCodes.SelfShip,
SenderAddressId = null,
ExpectPickupTime = null,
PickupDirection = null,
CarrierCode = null,
CarrierService = null
};
}