diff --git a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InboundOrder.java b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InboundOrder.java index 04e8808..7972226 100644 --- a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InboundOrder.java +++ b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InboundOrder.java @@ -47,6 +47,65 @@ public final class InboundOrder { private final String remark; private final List lines; + // ==================== 仓方原始字段(信仓预报详情提供)==================== + + /** 仓方内部预报单 id;信仓 {@code id}。 */ + private final String providerId; + /** 中文名称 / 联系人;信仓 {@code chn_name}。 */ + private final String chnName; + /** 客户 id;信仓 {@code customer_id}。 */ + private final String customerId; + /** 客户代码;信仓 {@code customer_name}。 */ + private final String customerNo; + /** 目的仓 id(仓方内部);信仓 {@code dest_warehouse},与 {@link #warehouseCode()}(仓代码)不同。 */ + private final String destWarehouseId; + /** 仓方状态原文(可读名);信仓 {@code state_name},如「预报完成」。 */ + private final String rawStatusName; + /** 出运类型;信仓 {@code shipment_type}(1 空运 / 2 海运)。 */ + private final String shipmentType; + /** 柜型;信仓 {@code cabinet_type}(0 20GP / 1 40GP / 2 40HQ / 3 45HQ / 4 纸箱入库 / 5 托盘入库)。 */ + private final String cabinetType; + /** 柜号;信仓 {@code cabinet_no}。 */ + private final String cabinetNo; + /** 预计发货时间(UTC);信仓 {@code rfc_etd}。 */ + private final Instant estimatedShipAt; + /** 实际发货时间(UTC);信仓 {@code etd}。 */ + private final Instant shippedAt; + /** 是否超 120cm;信仓 {@code is_oversize}({@code "1"} / {@code "0"})。 */ + private final String isOversize; + /** 超尺寸备注;信仓 {@code oversize_val}。 */ + private final String oversizeNote; + /** 发货需求;信仓 {@code delivery_requirements}(1 一件代发 / 2 FBA 中转)。 */ + private final String deliveryRequirements; + /** 预报时间(UTC);信仓 {@code forecast_time}。 */ + private final Instant forecastAt; + /** 参考 SKU 种类数;信仓 {@code rfc_sku_count}。 */ + private final Integer referenceSkuCount; + /** 预报托盘数;信仓 {@code forecast_pallet_qty}(柜型为托盘入库时才有)。 */ + private final Integer forecastPalletQty; + /** 实收托盘数;信仓 {@code receive_pallet_qty}。 */ + private final Integer receivedPalletQty; + /** 上架托盘数;信仓 {@code shelf_pallet_qty}。 */ + private final Integer storedPalletQty; + /** 计费托盘数;信仓 {@code bill_pallet_qty}。 */ + private final Integer billedPalletQty; + /** 卸柜清点时间(UTC);信仓 {@code unlade_time}。 */ + private final Instant unladeAt; + /** 清点完成时间(UTC);信仓 {@code check_time}。 */ + private final Instant checkedAt; + /** 上架时间(UTC);信仓 {@code putaway_time}。 */ + private final Instant putawayAt; + /** 还柜时间(UTC);信仓 {@code leave_time}。 */ + private final Instant leftAt; + /** 是否需要内箱贴;信仓 {@code is_inner_box_sticker}({@code "1"} / {@code "0"})。 */ + private final String isInnerBoxSticker; + /** 是否需要外箱贴;信仓 {@code is_outer_box_sticker}。 */ + private final String isOuterBoxSticker; + /** 其他需求(仓方原值,逗号分隔);信仓 {@code other_need},如「内箱贴,外箱贴」。 */ + private final String otherNeed; + /** 最后修改时间(UTC);信仓 {@code gmt_modify}。 */ + private final Instant modifiedAt; + private InboundOrder(Builder b) { this.inboundRequestNo = require(b.inboundRequestNo, "inboundRequestNo"); this.providerInboundId = b.providerInboundId; @@ -69,6 +128,34 @@ public final class InboundOrder { this.remark = b.remark; this.lines = b.lines == null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList(b.lines)); + this.providerId = b.providerId; + this.chnName = b.chnName; + this.customerId = b.customerId; + this.customerNo = b.customerNo; + this.destWarehouseId = b.destWarehouseId; + this.rawStatusName = b.rawStatusName; + this.shipmentType = b.shipmentType; + this.cabinetType = b.cabinetType; + this.cabinetNo = b.cabinetNo; + this.estimatedShipAt = b.estimatedShipAt; + this.shippedAt = b.shippedAt; + this.isOversize = b.isOversize; + this.oversizeNote = b.oversizeNote; + this.deliveryRequirements = b.deliveryRequirements; + this.forecastAt = b.forecastAt; + this.referenceSkuCount = b.referenceSkuCount; + this.forecastPalletQty = b.forecastPalletQty; + this.receivedPalletQty = b.receivedPalletQty; + this.storedPalletQty = b.storedPalletQty; + this.billedPalletQty = b.billedPalletQty; + this.unladeAt = b.unladeAt; + this.checkedAt = b.checkedAt; + this.putawayAt = b.putawayAt; + this.leftAt = b.leftAt; + this.isInnerBoxSticker = b.isInnerBoxSticker; + this.isOuterBoxSticker = b.isOuterBoxSticker; + this.otherNeed = b.otherNeed; + this.modifiedAt = b.modifiedAt; } public static Builder builder() { @@ -154,6 +241,146 @@ public final class InboundOrder { return lines; } + /** 仓方内部预报单 id。 */ + public String providerId() { + return providerId; + } + + /** 中文名称 / 联系人。 */ + public String chnName() { + return chnName; + } + + /** 客户 id。 */ + public String customerId() { + return customerId; + } + + /** 客户代码。 */ + public String customerNo() { + return customerNo; + } + + /** 目的仓 id(仓方内部)。 */ + public String destWarehouseId() { + return destWarehouseId; + } + + /** 仓方状态原文(可读名)。 */ + public String rawStatusName() { + return rawStatusName; + } + + /** 出运类型(1 空运 / 2 海运)。 */ + public String shipmentType() { + return shipmentType; + } + + /** 柜型。 */ + public String cabinetType() { + return cabinetType; + } + + /** 柜号。 */ + public String cabinetNo() { + return cabinetNo; + } + + /** 预计发货时间(UTC)。 */ + public Instant estimatedShipAt() { + return estimatedShipAt; + } + + /** 实际发货时间(UTC)。 */ + public Instant shippedAt() { + return shippedAt; + } + + /** 是否超 120cm(仓方原值)。 */ + public String isOversize() { + return isOversize; + } + + /** 超尺寸备注。 */ + public String oversizeNote() { + return oversizeNote; + } + + /** 发货需求(1 一件代发 / 2 FBA 中转)。 */ + public String deliveryRequirements() { + return deliveryRequirements; + } + + /** 预报时间(UTC)。 */ + public Instant forecastAt() { + return forecastAt; + } + + /** 参考 SKU 种类数。 */ + public Integer referenceSkuCount() { + return referenceSkuCount; + } + + /** 预报托盘数。 */ + public Integer forecastPalletQty() { + return forecastPalletQty; + } + + /** 实收托盘数。 */ + public Integer receivedPalletQty() { + return receivedPalletQty; + } + + /** 上架托盘数。 */ + public Integer storedPalletQty() { + return storedPalletQty; + } + + /** 计费托盘数。 */ + public Integer billedPalletQty() { + return billedPalletQty; + } + + /** 卸柜清点时间(UTC)。 */ + public Instant unladeAt() { + return unladeAt; + } + + /** 清点完成时间(UTC)。 */ + public Instant checkedAt() { + return checkedAt; + } + + /** 上架时间(UTC)。 */ + public Instant putawayAt() { + return putawayAt; + } + + /** 还柜时间(UTC)。 */ + public Instant leftAt() { + return leftAt; + } + + /** 是否需要内箱贴(仓方原值)。 */ + public String isInnerBoxSticker() { + return isInnerBoxSticker; + } + + /** 是否需要外箱贴(仓方原值)。 */ + public String isOuterBoxSticker() { + return isOuterBoxSticker; + } + + /** 其他需求(仓方原值)。 */ + public String otherNeed() { + return otherNeed; + } + + /** 最后修改时间(UTC)。 */ + public Instant modifiedAt() { + return modifiedAt; + } + /** 是否整体完成入库。 */ public boolean completed() { return status == InboundStatus.COMPLETED; @@ -192,6 +419,34 @@ public final class InboundOrder { private Double totalVolumeCbm; private String remark; private List lines; + private String providerId; + private String chnName; + private String customerId; + private String customerNo; + private String destWarehouseId; + private String rawStatusName; + private String shipmentType; + private String cabinetType; + private String cabinetNo; + private Instant estimatedShipAt; + private Instant shippedAt; + private String isOversize; + private String oversizeNote; + private String deliveryRequirements; + private Instant forecastAt; + private Integer referenceSkuCount; + private Integer forecastPalletQty; + private Integer receivedPalletQty; + private Integer storedPalletQty; + private Integer billedPalletQty; + private Instant unladeAt; + private Instant checkedAt; + private Instant putawayAt; + private Instant leftAt; + private String isInnerBoxSticker; + private String isOuterBoxSticker; + private String otherNeed; + private Instant modifiedAt; public Builder inboundRequestNo(String v) { this.inboundRequestNo = v; @@ -293,6 +548,174 @@ public final class InboundOrder { return this; } + /** 仓方内部预报单 id(信仓 {@code id})。 */ + public Builder providerId(String v) { + this.providerId = v; + return this; + } + + /** 中文名称 / 联系人(信仓 {@code chn_name})。 */ + public Builder chnName(String v) { + this.chnName = v; + return this; + } + + /** 客户 id(信仓 {@code customer_id})。 */ + public Builder customerId(String v) { + this.customerId = v; + return this; + } + + /** 客户代码(信仓 {@code customer_name})。 */ + public Builder customerNo(String v) { + this.customerNo = v; + return this; + } + + /** 目的仓 id(信仓 {@code dest_warehouse})。 */ + public Builder destWarehouseId(String v) { + this.destWarehouseId = v; + return this; + } + + /** 仓方状态原文(信仓 {@code state_name})。 */ + public Builder rawStatusName(String v) { + this.rawStatusName = v; + return this; + } + + /** 出运类型(信仓 {@code shipment_type})。 */ + public Builder shipmentType(String v) { + this.shipmentType = v; + return this; + } + + /** 柜型(信仓 {@code cabinet_type})。 */ + public Builder cabinetType(String v) { + this.cabinetType = v; + return this; + } + + /** 柜号(信仓 {@code cabinet_no})。 */ + public Builder cabinetNo(String v) { + this.cabinetNo = v; + return this; + } + + /** 预计发货时间(信仓 {@code rfc_etd})。 */ + public Builder estimatedShipAt(Instant v) { + this.estimatedShipAt = v; + return this; + } + + /** 实际发货时间(信仓 {@code etd})。 */ + public Builder shippedAt(Instant v) { + this.shippedAt = v; + return this; + } + + /** 是否超 120cm(信仓 {@code is_oversize})。 */ + public Builder isOversize(String v) { + this.isOversize = v; + return this; + } + + /** 超尺寸备注(信仓 {@code oversize_val})。 */ + public Builder oversizeNote(String v) { + this.oversizeNote = v; + return this; + } + + /** 发货需求(信仓 {@code delivery_requirements})。 */ + public Builder deliveryRequirements(String v) { + this.deliveryRequirements = v; + return this; + } + + /** 预报时间(信仓 {@code forecast_time})。 */ + public Builder forecastAt(Instant v) { + this.forecastAt = v; + return this; + } + + /** 参考 SKU 种类数(信仓 {@code rfc_sku_count})。 */ + public Builder referenceSkuCount(Integer v) { + this.referenceSkuCount = v; + return this; + } + + /** 预报托盘数(信仓 {@code forecast_pallet_qty})。 */ + public Builder forecastPalletQty(Integer v) { + this.forecastPalletQty = v; + return this; + } + + /** 实收托盘数(信仓 {@code receive_pallet_qty})。 */ + public Builder receivedPalletQty(Integer v) { + this.receivedPalletQty = v; + return this; + } + + /** 上架托盘数(信仓 {@code shelf_pallet_qty})。 */ + public Builder storedPalletQty(Integer v) { + this.storedPalletQty = v; + return this; + } + + /** 计费托盘数(信仓 {@code bill_pallet_qty})。 */ + public Builder billedPalletQty(Integer v) { + this.billedPalletQty = v; + return this; + } + + /** 卸柜清点时间(信仓 {@code unlade_time})。 */ + public Builder unladeAt(Instant v) { + this.unladeAt = v; + return this; + } + + /** 清点完成时间(信仓 {@code check_time})。 */ + public Builder checkedAt(Instant v) { + this.checkedAt = v; + return this; + } + + /** 上架时间(信仓 {@code putaway_time})。 */ + public Builder putawayAt(Instant v) { + this.putawayAt = v; + return this; + } + + /** 还柜时间(信仓 {@code leave_time})。 */ + public Builder leftAt(Instant v) { + this.leftAt = v; + return this; + } + + /** 是否需要内箱贴(信仓 {@code is_inner_box_sticker})。 */ + public Builder isInnerBoxSticker(String v) { + this.isInnerBoxSticker = v; + return this; + } + + /** 是否需要外箱贴(信仓 {@code is_outer_box_sticker})。 */ + public Builder isOuterBoxSticker(String v) { + this.isOuterBoxSticker = v; + return this; + } + + /** 其他需求(信仓 {@code other_need})。 */ + public Builder otherNeed(String v) { + this.otherNeed = v; + return this; + } + + /** 最后修改时间(信仓 {@code gmt_modify})。 */ + public Builder modifiedAt(Instant v) { + this.modifiedAt = v; + return this; + } + public InboundOrder build() { return new InboundOrder(this); } diff --git a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InboundOrderLine.java b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InboundOrderLine.java index 5e22717..7b00770 100644 --- a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InboundOrderLine.java +++ b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InboundOrderLine.java @@ -23,6 +23,25 @@ public final class InboundOrderLine { /** 最近上架时间(备货完成时间)。 */ private final Instant receivedAt; + // ==================== 仓方原始字段(信仓预报详情提供)==================== + + /** 产品名;信仓 {@code product_name}。 */ + private final String productName; + /** 中文名;信仓 {@code chn_name}。 */ + private final String productNameCn; + /** + * 清点箱数;信仓 {@code check_box_qty}。 + * + *

与 {@link #packedQuantity()}(预报箱数)不同:这个是仓方清点后实际确认的箱数。

+ */ + private final int checkedBoxCount; + /** 打托件数;信仓 {@code pallet_sku_count}。 */ + private final int palletizedQuantity; + /** 装箱率;信仓 {@code packing_rate}。 */ + private final String packingRate; + /** 体积(立方厘米);信仓 {@code volume_cm}。 */ + private final String volumeCm; + private InboundOrderLine(Builder b) { this.providerSku = require(b.providerSku, "providerSku"); this.plannedQuantity = b.plannedQuantity; @@ -31,6 +50,12 @@ public final class InboundOrderLine { this.receivedSaleableQuantity = b.receivedSaleableQuantity; this.receivedUnsaleableQuantity = b.receivedUnsaleableQuantity; this.receivedAt = b.receivedAt; + this.productName = b.productName; + this.productNameCn = b.productNameCn; + this.checkedBoxCount = b.checkedBoxCount; + this.palletizedQuantity = b.palletizedQuantity; + this.packingRate = b.packingRate; + this.volumeCm = b.volumeCm; } public static Builder builder() { @@ -65,6 +90,36 @@ public final class InboundOrderLine { return receivedAt; } + /** 产品名。 */ + public String productName() { + return productName; + } + + /** 中文名。 */ + public String productNameCn() { + return productNameCn; + } + + /** 清点箱数;与 {@link #packedQuantity()}(预报箱数)不同。 */ + public int checkedBoxCount() { + return checkedBoxCount; + } + + /** 打托件数。 */ + public int palletizedQuantity() { + return palletizedQuantity; + } + + /** 装箱率(仓方原值)。 */ + public String packingRate() { + return packingRate; + } + + /** 体积(立方厘米,仓方原值)。 */ + public String volumeCm() { + return volumeCm; + } + /** 实收与计划是否一致;不一致说明短少或溢装,需要人工核对。 */ public boolean quantityMatchesPlan() { return receivedQuantity == plannedQuantity; @@ -85,6 +140,12 @@ public final class InboundOrderLine { private int receivedSaleableQuantity; private int receivedUnsaleableQuantity; private Instant receivedAt; + private String productName; + private String productNameCn; + private int checkedBoxCount; + private int palletizedQuantity; + private String packingRate; + private String volumeCm; public Builder providerSku(String v) { this.providerSku = v; @@ -121,6 +182,42 @@ public final class InboundOrderLine { return this; } + /** 产品名(信仓 {@code product_name})。 */ + public Builder productName(String v) { + this.productName = v; + return this; + } + + /** 中文名(信仓 {@code chn_name})。 */ + public Builder productNameCn(String v) { + this.productNameCn = v; + return this; + } + + /** 清点箱数(信仓 {@code check_box_qty})。 */ + public Builder checkedBoxCount(int v) { + this.checkedBoxCount = v; + return this; + } + + /** 打托件数(信仓 {@code pallet_sku_count})。 */ + public Builder palletizedQuantity(int v) { + this.palletizedQuantity = v; + return this; + } + + /** 装箱率(信仓 {@code packing_rate})。 */ + public Builder packingRate(String v) { + this.packingRate = v; + return this; + } + + /** 体积(信仓 {@code volume_cm})。 */ + public Builder volumeCm(String v) { + this.volumeCm = v; + return this; + } + public InboundOrderLine build() { return new InboundOrderLine(this); } diff --git a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InventoryQuery.java b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InventoryQuery.java index a53cbc5..1d74310 100644 --- a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InventoryQuery.java +++ b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/InventoryQuery.java @@ -15,6 +15,13 @@ public final class InventoryQuery { private final Instant updatedAfter; private final int pageSize; private final String cursor; + /** + * 是否包含零库存的 SKU;null 表示不传,由仓方按默认处理。 + * + *

部分仓(信仓 {@code is_show_zero})默认只返回库存大于 0 的数据; + * 需要做全量对账时显式传 {@code true}。不支持的仓忽略该字段。

+ */ + private final Boolean includeZeroStock; private InventoryQuery(Builder b) { this.providerSkus = Collections.unmodifiableList(new ArrayList(b.providerSkus)); @@ -23,6 +30,7 @@ public final class InventoryQuery { this.updatedAfter = b.updatedAfter; this.pageSize = b.pageSize; this.cursor = b.cursor; + this.includeZeroStock = b.includeZeroStock; } public static Builder builder() { @@ -56,6 +64,11 @@ public final class InventoryQuery { return cursor; } + /** 是否包含零库存 SKU;null 表示不传。 */ + public Boolean includeZeroStock() { + return includeZeroStock; + } + public static final class Builder { private final List providerSkus = new ArrayList(); private final List warehouseCodes = new ArrayList(); @@ -63,6 +76,7 @@ public final class InventoryQuery { private Instant updatedAfter; private int pageSize = 100; private String cursor; + private Boolean includeZeroStock; public Builder sku(String sku) { if (sku != null) { @@ -113,6 +127,16 @@ public final class InventoryQuery { return this; } + /** + * 是否包含零库存 SKU;null 表示不传(仓方默认)。 + * + *

信仓对应 {@code is_show_zero}:默认只返回库存大于 0 的产品。

+ */ + public Builder includeZeroStock(Boolean v) { + this.includeZeroStock = v; + return this; + } + public InventoryQuery build() { return new InventoryQuery(this); } diff --git a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/OutboundOrder.java b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/OutboundOrder.java index 6639f28..0ab4dcb 100644 --- a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/OutboundOrder.java +++ b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/OutboundOrder.java @@ -58,6 +58,66 @@ public final class OutboundOrder { /** 下单币种。 */ private final String currency; + // ==================== 仓方原始字段(部分是某家仓特有,见每项说明)==================== + + /** 仓方内部订单 id;信仓 {@code id}。其他仓未提供时为 null。 */ + private final String providerId; + /** 仓方状态原文(可读名);信仓 {@code state_name},如「已发货」。其他仓未提供时为 null。 */ + private final String rawStatusName; + /** + * 物流面单下载地址。 + * + *

信仓 {@code face_url}(OSS 签名 URL,有时效);运去哪通过 packages 返回。可能为 null。

+ */ + private final String labelUrl; + /** 店铺名;信仓 {@code shop_name},如 {@code XC001-shop}。其他仓未提供时为 null。 */ + private final String shopName; + /** 订单件数合计;信仓 {@code sku_count}。其他仓未提供时为 null。 */ + private final Integer skuCount; + /** 产品 SKU(单件订单的便捷字段);信仓 {@code product_sku}。多件订单请看 {@link #lines()}。 */ + private final String productSku; + /** 产品名(单件订单的便捷字段);信仓 {@code product_name}。 */ + private final String productName; + /** 来源 SKU;信仓 {@code source_sku}。与 {@link #productSku()} 在信仓通常相同。 */ + private final String sourceSku; + /** 仓方内部仓库 id;信仓 {@code warehouse_id}。与 {@link #warehouseCode()}(仓代码)不同。 */ + private final String providerWarehouseId; + /** 是否需要签名签收;信仓 {@code is_sign}({@code "1"} / {@code "0"})。 */ + private final String isSign; + /** 计费分区;信仓 {@code zone},承运商分区号。 */ + private final String zone; + /** 包裹长(英寸,仓方原值);信仓 {@code dim_length}。 */ + private final String dimLength; + /** 包裹宽(英寸,仓方原值);信仓 {@code dim_width}。 */ + private final String dimWidth; + /** 包裹高(英寸,仓方原值);信仓 {@code dim_height}。 */ + private final String dimHeight; + /** 计抛系数;信仓 {@code dim_divisor}。 */ + private final String dimDivisor; + /** 实重(磅,字符串原值);信仓 {@code weight_lbs}。 */ + private final String weightLbs; + /** 计费重(磅,字符串原值);信仓 {@code billing_weight_lbs}。 */ + private final String billingWeightLbs; + /** 体积重(磅,字符串原值);信仓 {@code volume_weight_lbs}。 */ + private final String volumeWeightLbs; + /** + * 订单总费用(仓方原值字符串)。 + * + *

信仓 {@code total_amount}:总费用,含运费与操作费等,不等于 + * {@link #estimatedShippingFee()}(预估运费)。两者不互相覆盖。

+ */ + private final Money totalAmount; + /** 修复 / 补收金额;信仓 {@code repair_amount}。 */ + private final Money repairAmount; + /** 审核时间(UTC);信仓 {@code approve_time}。 */ + private final Instant approvedAt; + /** 最后修改时间(UTC);信仓 {@code gmt_modify}。 */ + private final Instant modifiedAt; + /** 取消时间(UTC);信仓 {@code gmt_cancel},未取消为 null。 */ + private final Instant cancelledAt; + /** 截单时间(UTC);信仓 {@code intercept_time}。 */ + private final Instant interceptedAt; + private OutboundOrder(Builder b) { this.warehouseCode = requireText(b.warehouseCode, "warehouseCode"); this.outboundRequestNo = requireText(b.outboundRequestNo, "outboundRequestNo"); @@ -79,6 +139,30 @@ public final class OutboundOrder { this.paidAt = b.paidAt; this.carrierCode = b.carrierCode; this.currency = b.currency; + this.providerId = b.providerId; + this.rawStatusName = b.rawStatusName; + this.labelUrl = b.labelUrl; + this.shopName = b.shopName; + this.skuCount = b.skuCount; + this.productSku = b.productSku; + this.productName = b.productName; + this.sourceSku = b.sourceSku; + this.providerWarehouseId = b.providerWarehouseId; + this.isSign = b.isSign; + this.zone = b.zone; + this.dimLength = b.dimLength; + this.dimWidth = b.dimWidth; + this.dimHeight = b.dimHeight; + this.dimDivisor = b.dimDivisor; + this.weightLbs = b.weightLbs; + this.billingWeightLbs = b.billingWeightLbs; + this.volumeWeightLbs = b.volumeWeightLbs; + this.totalAmount = b.totalAmount; + this.repairAmount = b.repairAmount; + this.approvedAt = b.approvedAt; + this.modifiedAt = b.modifiedAt; + this.cancelledAt = b.cancelledAt; + this.interceptedAt = b.interceptedAt; } public static Builder builder() { @@ -168,6 +252,126 @@ public final class OutboundOrder { return currency; } + /** 仓方内部订单 id。 */ + public String providerId() { + return providerId; + } + + /** 仓方状态原文(可读名)。 */ + public String rawStatusName() { + return rawStatusName; + } + + /** 物流面单下载地址;可能为 null。 */ + public String labelUrl() { + return labelUrl; + } + + /** 店铺名。 */ + public String shopName() { + return shopName; + } + + /** 订单件数合计。 */ + public Integer skuCount() { + return skuCount; + } + + /** 单件订单的便捷字段:产品 SKU。 */ + public String productSku() { + return productSku; + } + + /** 单件订单的便捷字段:产品名。 */ + public String productName() { + return productName; + } + + /** 来源 SKU。 */ + public String sourceSku() { + return sourceSku; + } + + /** 仓方内部仓库 id。 */ + public String providerWarehouseId() { + return providerWarehouseId; + } + + /** 是否需要签名签收(仓方原值)。 */ + public String isSign() { + return isSign; + } + + /** 计费分区。 */ + public String zone() { + return zone; + } + + /** 包裹长(英寸,仓方原值)。 */ + public String dimLength() { + return dimLength; + } + + /** 包裹宽(英寸,仓方原值)。 */ + public String dimWidth() { + return dimWidth; + } + + /** 包裹高(英寸,仓方原值)。 */ + public String dimHeight() { + return dimHeight; + } + + /** 计抛系数。 */ + public String dimDivisor() { + return dimDivisor; + } + + /** 实重(磅,仓方原值)。 */ + public String weightLbs() { + return weightLbs; + } + + /** 计费重(磅,仓方原值)。 */ + public String billingWeightLbs() { + return billingWeightLbs; + } + + /** 体积重(磅,仓方原值)。 */ + public String volumeWeightLbs() { + return volumeWeightLbs; + } + + /** 订单总费用;与 {@link #estimatedShippingFee()} 不同,不要互相覆盖。 */ + public Money totalAmount() { + return totalAmount; + } + + /** 修复 / 补收金额。 */ + public Money repairAmount() { + return repairAmount; + } + + /** 审核时间(UTC)。 */ + public Instant approvedAt() { + return approvedAt; + } + + /** 最后修改时间(UTC)。 */ + public Instant modifiedAt() { + return modifiedAt; + } + + /** 取消时间(UTC);未取消为 null。 */ + public Instant cancelledAt() { + return cancelledAt; + } + + /** 截单时间(UTC)。 */ + public Instant interceptedAt() { + return interceptedAt; + } + /** 是否带仓方异常。 */ public boolean hasException() { return exceptionCode != null && !exceptionCode.trim().isEmpty(); @@ -201,6 +405,30 @@ public final class OutboundOrder { private Instant paidAt; private String carrierCode; private String currency; + private String providerId; + private String rawStatusName; + private String labelUrl; + private String shopName; + private Integer skuCount; + private String productSku; + private String productName; + private String sourceSku; + private String providerWarehouseId; + private String isSign; + private String zone; + private String dimLength; + private String dimWidth; + private String dimHeight; + private String dimDivisor; + private String weightLbs; + private String billingWeightLbs; + private String volumeWeightLbs; + private Money totalAmount; + private Money repairAmount; + private Instant approvedAt; + private Instant modifiedAt; + private Instant cancelledAt; + private Instant interceptedAt; public Builder warehouseCode(String warehouseCode) { this.warehouseCode = warehouseCode; @@ -297,6 +525,150 @@ public final class OutboundOrder { return this; } + /** 仓方内部订单 id(信仓 {@code id})。 */ + public Builder providerId(String v) { + this.providerId = v; + return this; + } + + /** 仓方状态原文(信仓 {@code state_name})。 */ + public Builder rawStatusName(String v) { + this.rawStatusName = v; + return this; + } + + /** 物流面单下载地址(信仓 {@code face_url})。 */ + public Builder labelUrl(String v) { + this.labelUrl = v; + return this; + } + + /** 店铺名(信仓 {@code shop_name})。 */ + public Builder shopName(String v) { + this.shopName = v; + return this; + } + + /** 订单件数合计(信仓 {@code sku_count})。 */ + public Builder skuCount(Integer v) { + this.skuCount = v; + return this; + } + + /** 单件订单的产品 SKU(信仓 {@code product_sku})。 */ + public Builder productSku(String v) { + this.productSku = v; + return this; + } + + /** 单件订单的产品名(信仓 {@code product_name})。 */ + public Builder productName(String v) { + this.productName = v; + return this; + } + + /** 来源 SKU(信仓 {@code source_sku})。 */ + public Builder sourceSku(String v) { + this.sourceSku = v; + return this; + } + + /** 仓方内部仓库 id(信仓 {@code warehouse_id})。 */ + public Builder providerWarehouseId(String v) { + this.providerWarehouseId = v; + return this; + } + + /** 是否需要签名签收(信仓 {@code is_sign})。 */ + public Builder isSign(String v) { + this.isSign = v; + return this; + } + + /** 计费分区(信仓 {@code zone})。 */ + public Builder zone(String v) { + this.zone = v; + return this; + } + + /** 包裹长(信仓 {@code dim_length})。 */ + public Builder dimLength(String v) { + this.dimLength = v; + return this; + } + + /** 包裹宽(信仓 {@code dim_width})。 */ + public Builder dimWidth(String v) { + this.dimWidth = v; + return this; + } + + /** 包裹高(信仓 {@code dim_height})。 */ + public Builder dimHeight(String v) { + this.dimHeight = v; + return this; + } + + /** 计抛系数(信仓 {@code dim_divisor})。 */ + public Builder dimDivisor(String v) { + this.dimDivisor = v; + return this; + } + + /** 实重(信仓 {@code weight_lbs})。 */ + public Builder weightLbs(String v) { + this.weightLbs = v; + return this; + } + + /** 计费重(信仓 {@code billing_weight_lbs})。 */ + public Builder billingWeightLbs(String v) { + this.billingWeightLbs = v; + return this; + } + + /** 体积重(信仓 {@code volume_weight_lbs})。 */ + public Builder volumeWeightLbs(String v) { + this.volumeWeightLbs = v; + return this; + } + + /** 订单总费用(信仓 {@code total_amount})。 */ + public Builder totalAmount(Money v) { + this.totalAmount = v; + return this; + } + + /** 修复 / 补收金额(信仓 {@code repair_amount})。 */ + public Builder repairAmount(Money v) { + this.repairAmount = v; + return this; + } + + /** 审核时间(信仓 {@code approve_time})。 */ + public Builder approvedAt(Instant v) { + this.approvedAt = v; + return this; + } + + /** 最后修改时间(信仓 {@code gmt_modify})。 */ + public Builder modifiedAt(Instant v) { + this.modifiedAt = v; + return this; + } + + /** 取消时间(信仓 {@code gmt_cancel})。 */ + public Builder cancelledAt(Instant v) { + this.cancelledAt = v; + return this; + } + + /** 截单时间(信仓 {@code intercept_time})。 */ + public Builder interceptedAt(Instant v) { + this.interceptedAt = v; + return this; + } + public OutboundOrder build() { return new OutboundOrder(this); } diff --git a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/TransferOrder.java b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/TransferOrder.java index 7bc8a9d..4c54876 100644 --- a/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/TransferOrder.java +++ b/warehouse-sdk-core/src/main/java/common/ecommerce/warehouse/model/TransferOrder.java @@ -1,10 +1,12 @@ package common.ecommerce.warehouse.model; +import common.ecommerce.shared.support.Money; import common.ecommerce.warehouse.enums.TransferStatus; import common.ecommerce.warehouse.enums.WarehouseProvider; import common.ecommerce.warehouse.enums.TransferType; import java.time.Instant; +import java.util.List; /** * 调拨单(查询 / 创建结果)。 @@ -30,6 +32,66 @@ public final class TransferOrder { private final String trackingNumber; private final String remark; + // ==================== 仓方原始字段(信仓转运详情提供)==================== + + /** 仓方内部转运单 id;信仓 {@code id}。 */ + private final String providerId; + /** 采购 / 调拨单号;信仓 {@code po}。{@link #transferRequestNo()} 是来源单号,两者不同。 */ + private final String po; + /** 客户 id;信仓 {@code customer_id}。 */ + private final String customerId; + /** 客户代码;信仓 {@code customer_no}。 */ + private final String customerNo; + /** 发货仓 id(仓方内部);信仓 {@code from_warehouse},与 {@link #fromWarehouseCode()}(仓代码)不同。 */ + private final String fromWarehouseId; + /** 目的仓 id(仓方内部);信仓 {@code dest_warehouse}。 */ + private final String destWarehouseId; + /** 仓方状态原文(可读名);信仓 {@code state_name},如「待审核」。 */ + private final String rawStatusName; + /** 转运类型(仓方字典值);信仓 {@code delivery_mode},取值见「转运类型」字典接口。 */ + private final String deliveryMode; + /** 转运方式 / 配送方式(仓方字典值);信仓 {@code delivery_way}。 */ + private final String deliveryWay; + /** + * 订单类型(仓方字典值);信仓 {@code order_type}。 + * + *

注意与下单接口的 {@code order_type}(common / wayfair)语义不同, + * 这里取的是「订单类型」字典(FBA / LTL 等)。

+ */ + private final String orderType; + /** 目的仓不在字典里时的自填仓库名;信仓 {@code other_warehouse}。 */ + private final String otherWarehouse; + /** 标签需求(仓方原值,逗号分隔);信仓 {@code label_requirement},如「产品贴,外箱标签」。 */ + private final String labelRequirement; + /** 是否需要产品贴;信仓 {@code is_product_label}({@code "1"} / {@code "0"})。 */ + private final String isProductLabel; + /** 是否需要外箱贴;信仓 {@code is_ctn_label}。 */ + private final String isCtnLabel; + /** 是否需要托盘贴;信仓 {@code is_pallet_label}。 */ + private final String isPalletLabel; + /** 是否打托(仓方原值);信仓 {@code is_pallet}。 */ + private final String isPallet; + /** 拣货开始时间(UTC);信仓 {@code picking_time}。 */ + private final Instant pickingStartedAt; + /** 拣货结束时间(UTC);信仓 {@code picked_time}。 */ + private final Instant pickedAt; + /** 打托时间(UTC);信仓 {@code palleted_time}。 */ + private final Instant palletizedAt; + /** 发货时间(UTC);信仓 {@code send_time}。 */ + private final Instant sentAt; + /** 审核时间(UTC);信仓 {@code approve_time}。 */ + private final Instant approvedAt; + /** 仓方运输 / 发货单 id;信仓 {@code shipping_id}。 */ + private final String shippingId; + /** 订单总费用(仓方原值);信仓 {@code total_amount}。 */ + private final Money totalAmount; + /** 创建时间(UTC);信仓 {@code gmt_create}。 */ + private final Instant createdAt; + /** 最后修改时间(UTC);信仓 {@code gmt_modify}。 */ + private final Instant modifiedAt; + /** 商品明细;查询详情时回填,创建返回时通常为空。 */ + private final List lines; + private TransferOrder(Builder b) { this.transferRequestNo = require(b.transferRequestNo, "transferRequestNo"); this.providerTransferNo = b.providerTransferNo; @@ -44,6 +106,33 @@ public final class TransferOrder { this.estimatedInboundAt = b.estimatedInboundAt; this.trackingNumber = b.trackingNumber; this.remark = b.remark; + this.providerId = b.providerId; + this.po = b.po; + this.customerId = b.customerId; + this.customerNo = b.customerNo; + this.fromWarehouseId = b.fromWarehouseId; + this.destWarehouseId = b.destWarehouseId; + this.rawStatusName = b.rawStatusName; + this.deliveryMode = b.deliveryMode; + this.deliveryWay = b.deliveryWay; + this.orderType = b.orderType; + this.otherWarehouse = b.otherWarehouse; + this.labelRequirement = b.labelRequirement; + this.isProductLabel = b.isProductLabel; + this.isCtnLabel = b.isCtnLabel; + this.isPalletLabel = b.isPalletLabel; + this.isPallet = b.isPallet; + this.pickingStartedAt = b.pickingStartedAt; + this.pickedAt = b.pickedAt; + this.palletizedAt = b.palletizedAt; + this.sentAt = b.sentAt; + this.approvedAt = b.approvedAt; + this.shippingId = b.shippingId; + this.totalAmount = b.totalAmount; + this.createdAt = b.createdAt; + this.modifiedAt = b.modifiedAt; + this.lines = b.lines == null ? java.util.Collections.emptyList() + : java.util.Collections.unmodifiableList(new java.util.ArrayList(b.lines)); } public static Builder builder() { @@ -110,6 +199,305 @@ public final class TransferOrder { return sourceProvider; } + /** 仓方内部转运单 id。 */ + public String providerId() { + return providerId; + } + + /** 采购 / 调拨单号;与 {@link #transferRequestNo()} 不是一回事。 */ + public String po() { + return po; + } + + /** 客户 id。 */ + public String customerId() { + return customerId; + } + + /** 客户代码。 */ + public String customerNo() { + return customerNo; + } + + /** 发货仓 id(仓方内部)。 */ + public String fromWarehouseId() { + return fromWarehouseId; + } + + /** 目的仓 id(仓方内部)。 */ + public String destWarehouseId() { + return destWarehouseId; + } + + /** 仓方状态原文(可读名)。 */ + public String rawStatusName() { + return rawStatusName; + } + + /** 转运类型(仓方字典值)。 */ + public String deliveryMode() { + return deliveryMode; + } + + /** 转运方式 / 配送方式(仓方字典值)。 */ + public String deliveryWay() { + return deliveryWay; + } + + /** 订单类型(仓方字典值,FBA / LTL 等);与下单接口的 common / wayfair 无关。 */ + public String orderType() { + return orderType; + } + + /** 目的仓不在字典里时的自填仓库名。 */ + public String otherWarehouse() { + return otherWarehouse; + } + + /** 标签需求(仓方原值,逗号分隔)。 */ + public String labelRequirement() { + return labelRequirement; + } + + /** 是否需要产品贴(仓方原值)。 */ + public String isProductLabel() { + return isProductLabel; + } + + /** 是否需要外箱贴(仓方原值)。 */ + public String isCtnLabel() { + return isCtnLabel; + } + + /** 是否需要托盘贴(仓方原值)。 */ + public String isPalletLabel() { + return isPalletLabel; + } + + /** 是否打托(仓方原值)。 */ + public String isPallet() { + return isPallet; + } + + /** 拣货开始时间(UTC)。 */ + public Instant pickingStartedAt() { + return pickingStartedAt; + } + + /** 拣货结束时间(UTC)。 */ + public Instant pickedAt() { + return pickedAt; + } + + /** 打托时间(UTC)。 */ + public Instant palletizedAt() { + return palletizedAt; + } + + /** 发货时间(UTC)。 */ + public Instant sentAt() { + return sentAt; + } + + /** 审核时间(UTC)。 */ + public Instant approvedAt() { + return approvedAt; + } + + /** 仓方运输 / 发货单 id。 */ + public String shippingId() { + return shippingId; + } + + /** 订单总费用。 */ + public Money totalAmount() { + return totalAmount; + } + + /** 创建时间(UTC)。 */ + public Instant createdAt() { + return createdAt; + } + + /** 最后修改时间(UTC)。 */ + public Instant modifiedAt() { + return modifiedAt; + } + + /** 商品明细;未查询详情时为空列表。 */ + public List lines() { + return lines; + } + + /** + * 转运商品明细(查询详情时回填)。 + * + *

数量分三层:预报件数、清点箱数、上架件数。对账时要一起看。

+ */ + public static final class TransferLine { + + /** 产品 SKU;信仓 {@code product_no}。 */ + private final String providerSku; + /** 产品名;信仓 {@code product_name}。 */ + private final String productName; + /** 中文名;信仓 {@code chn_name}。 */ + private final String productNameCn; + /** 预报件数;信仓 {@code sku_count}。 */ + private final int plannedQuantity; + /** 预报箱数;信仓 {@code box_count}。 */ + private final int boxCount; + /** 清点箱数;信仓 {@code check_box_qty}。 */ + private final int checkedBoxCount; + /** 打托件数;信仓 {@code pallet_sku_count}。 */ + private final int palletizedQuantity; + /** 上架件数;信仓 {@code put_on_sku_count}。 */ + private final int storedQuantity; + /** 装箱率;信仓 {@code packing_rate}。 */ + private final String packingRate; + /** 备注;信仓 {@code remark}。 */ + private final String remark; + + private TransferLine(Builder b) { + this.providerSku = require(b.providerSku, "providerSku"); + this.productName = b.productName; + this.productNameCn = b.productNameCn; + this.plannedQuantity = b.plannedQuantity; + this.boxCount = b.boxCount; + this.checkedBoxCount = b.checkedBoxCount; + this.palletizedQuantity = b.palletizedQuantity; + this.storedQuantity = b.storedQuantity; + this.packingRate = b.packingRate; + this.remark = b.remark; + } + + public static Builder builder() { + return new Builder(); + } + + public String providerSku() { + return providerSku; + } + + public String productName() { + return productName; + } + + public String productNameCn() { + return productNameCn; + } + + /** 预报件数。 */ + public int plannedQuantity() { + return plannedQuantity; + } + + /** 预报箱数。 */ + public int boxCount() { + return boxCount; + } + + /** 清点箱数。 */ + public int checkedBoxCount() { + return checkedBoxCount; + } + + /** 打托件数。 */ + public int palletizedQuantity() { + return palletizedQuantity; + } + + /** 上架件数。 */ + public int storedQuantity() { + return storedQuantity; + } + + /** 装箱率(仓方原值)。 */ + public String packingRate() { + return packingRate; + } + + public String remark() { + return remark; + } + + public static final class Builder { + private String providerSku; + private String productName; + private String productNameCn; + private int plannedQuantity; + private int boxCount; + private int checkedBoxCount; + private int palletizedQuantity; + private int storedQuantity; + private String packingRate; + private String remark; + + /** 产品 SKU(信仓 {@code product_no});必填。 */ + public Builder providerSku(String v) { + this.providerSku = v; + return this; + } + + /** 产品名(信仓 {@code product_name})。 */ + public Builder productName(String v) { + this.productName = v; + return this; + } + + /** 中文名(信仓 {@code chn_name})。 */ + public Builder productNameCn(String v) { + this.productNameCn = v; + return this; + } + + /** 预报件数(信仓 {@code sku_count})。 */ + public Builder plannedQuantity(int v) { + this.plannedQuantity = v; + return this; + } + + /** 预报箱数(信仓 {@code box_count})。 */ + public Builder boxCount(int v) { + this.boxCount = v; + return this; + } + + /** 清点箱数(信仓 {@code check_box_qty})。 */ + public Builder checkedBoxCount(int v) { + this.checkedBoxCount = v; + return this; + } + + /** 打托件数(信仓 {@code pallet_sku_count})。 */ + public Builder palletizedQuantity(int v) { + this.palletizedQuantity = v; + return this; + } + + /** 上架件数(信仓 {@code put_on_sku_count})。 */ + public Builder storedQuantity(int v) { + this.storedQuantity = v; + return this; + } + + /** 装箱率(信仓 {@code packing_rate})。 */ + public Builder packingRate(String v) { + this.packingRate = v; + return this; + } + + /** 备注(信仓 {@code remark})。 */ + public Builder remark(String v) { + this.remark = v; + return this; + } + + public TransferLine build() { + return new TransferLine(this); + } + } + } + private static String require(String v, String n) { if (v == null || v.trim().isEmpty()) { throw new IllegalArgumentException(n + " must not be blank"); @@ -131,6 +519,32 @@ public final class TransferOrder { private Instant estimatedInboundAt; private String trackingNumber; private String remark; + private String providerId; + private String po; + private String customerId; + private String customerNo; + private String fromWarehouseId; + private String destWarehouseId; + private String rawStatusName; + private String deliveryMode; + private String deliveryWay; + private String orderType; + private String otherWarehouse; + private String labelRequirement; + private String isProductLabel; + private String isCtnLabel; + private String isPalletLabel; + private String isPallet; + private Instant pickingStartedAt; + private Instant pickedAt; + private Instant palletizedAt; + private Instant sentAt; + private Instant approvedAt; + private String shippingId; + private Money totalAmount; + private Instant createdAt; + private Instant modifiedAt; + private List lines; public Builder transferRequestNo(String v) { this.transferRequestNo = v; @@ -197,6 +611,171 @@ public final class TransferOrder { return this; } + /** 仓方内部转运单 id(信仓 {@code id})。 */ + public Builder providerId(String v) { + this.providerId = v; + return this; + } + + /** 采购 / 调拨单号(信仓 {@code po})。 */ + public Builder po(String v) { + this.po = v; + return this; + } + + /** 客户 id(信仓 {@code customer_id})。 */ + public Builder customerId(String v) { + this.customerId = v; + return this; + } + + /** 客户代码(信仓 {@code customer_no})。 */ + public Builder customerNo(String v) { + this.customerNo = v; + return this; + } + + /** 发货仓 id(信仓 {@code from_warehouse})。 */ + public Builder fromWarehouseId(String v) { + this.fromWarehouseId = v; + return this; + } + + /** 目的仓 id(信仓 {@code dest_warehouse})。 */ + public Builder destWarehouseId(String v) { + this.destWarehouseId = v; + return this; + } + + /** 仓方状态原文(信仓 {@code state_name})。 */ + public Builder rawStatusName(String v) { + this.rawStatusName = v; + return this; + } + + /** 转运类型(信仓 {@code delivery_mode})。 */ + public Builder deliveryMode(String v) { + this.deliveryMode = v; + return this; + } + + /** 转运方式 / 配送方式(信仓 {@code delivery_way})。 */ + public Builder deliveryWay(String v) { + this.deliveryWay = v; + return this; + } + + /** 订单类型(信仓 {@code order_type})。 */ + public Builder orderType(String v) { + this.orderType = v; + return this; + } + + /** 目的仓不在字典里时的自填仓库名(信仓 {@code other_warehouse})。 */ + public Builder otherWarehouse(String v) { + this.otherWarehouse = v; + return this; + } + + /** 标签需求(信仓 {@code label_requirement})。 */ + public Builder labelRequirement(String v) { + this.labelRequirement = v; + return this; + } + + /** 是否需要产品贴(信仓 {@code is_product_label})。 */ + public Builder isProductLabel(String v) { + this.isProductLabel = v; + return this; + } + + /** 是否需要外箱贴(信仓 {@code is_ctn_label})。 */ + public Builder isCtnLabel(String v) { + this.isCtnLabel = v; + return this; + } + + /** 是否需要托盘贴(信仓 {@code is_pallet_label})。 */ + public Builder isPalletLabel(String v) { + this.isPalletLabel = v; + return this; + } + + /** 是否打托(信仓 {@code is_pallet})。 */ + public Builder isPallet(String v) { + this.isPallet = v; + return this; + } + + /** 拣货开始时间(信仓 {@code picking_time})。 */ + public Builder pickingStartedAt(Instant v) { + this.pickingStartedAt = v; + return this; + } + + /** 拣货结束时间(信仓 {@code picked_time})。 */ + public Builder pickedAt(Instant v) { + this.pickedAt = v; + return this; + } + + /** 打托时间(信仓 {@code palleted_time})。 */ + public Builder palletizedAt(Instant v) { + this.palletizedAt = v; + return this; + } + + /** 发货时间(信仓 {@code send_time})。 */ + public Builder sentAt(Instant v) { + this.sentAt = v; + return this; + } + + /** 审核时间(信仓 {@code approve_time})。 */ + public Builder approvedAt(Instant v) { + this.approvedAt = v; + return this; + } + + /** 仓方运输 / 发货单 id(信仓 {@code shipping_id})。 */ + public Builder shippingId(String v) { + this.shippingId = v; + return this; + } + + /** 订单总费用(信仓 {@code total_amount})。 */ + public Builder totalAmount(Money v) { + this.totalAmount = v; + return this; + } + + /** 创建时间(信仓 {@code gmt_create})。 */ + public Builder createdAt(Instant v) { + this.createdAt = v; + return this; + } + + /** 最后修改时间(信仓 {@code gmt_modify})。 */ + public Builder modifiedAt(Instant v) { + this.modifiedAt = v; + return this; + } + + /** 商品明细(查询详情时回填)。 */ + public Builder lines(List v) { + this.lines = v; + return this; + } + + /** 追加一条商品明细。 */ + public Builder line(TransferLine v) { + if (this.lines == null) { + this.lines = new java.util.ArrayList(); + } + this.lines.add(v); + return this; + } + public TransferOrder build() { return new TransferOrder(this); } diff --git a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangForecastMapper.java b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangForecastMapper.java index c96754f..2d9af8a 100644 --- a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangForecastMapper.java +++ b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangForecastMapper.java @@ -128,11 +128,19 @@ public final class XincangForecastMapper { if (product == null || blank(product.productNo)) { continue; } + // 歧义说明:信仓的 box_count 是「预报箱数」,而统一模型 + // packedQuantity 的语义是「装箱时实际装进去的件数」,两者不是一回事, + // 所以 box_count 不映射到 packedQuantity,只放仓方原始字段。 lines.add(InboundOrderLine.builder() .providerSku(product.productNo.trim()) .plannedQuantity(intOf(product.skuCount)) - .packedQuantity(intOf(product.boxCount)) .receivedQuantity(intOf(product.putOnSkuCount)) + .productName(blankToNull(product.productName)) + .productNameCn(blankToNull(product.chnName)) + .checkedBoxCount(intOf(product.checkBoxQty)) + .palletizedQuantity(intOf(product.palletSkuCount)) + .packingRate(blankToNull(product.packingRate)) + .volumeCm(blankToNull(product.volumeCm)) .build()); } } @@ -150,6 +158,35 @@ public final class XincangForecastMapper { .actualArrivalAt(parseTime(detail.eta)) .remark(blankToNull(detail.remark)) .lines(lines) + // ---- 仓方原始字段 ---- + .providerId(blankToNull(detail.id)) + .chnName(blankToNull(detail.chnName)) + .customerId(blankToNull(detail.customerId)) + .customerNo(blankToNull(detail.customerName)) + .destWarehouseId(blankToNull(detail.destWarehouseId)) + .rawStatusName(blankToNull(detail.stateName)) + .shipmentType(blankToNull(detail.shipmentType)) + .cabinetType(blankToNull(detail.cabinetType)) + .cabinetNo(blankToNull(detail.cabinetNo)) + .estimatedShipAt(parseTime(detail.rfcEtd)) + .shippedAt(parseTime(detail.etd)) + .isOversize(blankToNull(detail.isOversize)) + .oversizeNote(blankToNull(detail.oversizeVal)) + .deliveryRequirements(blankToNull(detail.deliveryRequirements)) + .forecastAt(parseTime(detail.forecastTime)) + .referenceSkuCount(parseInteger(detail.rfcSkuCount)) + .forecastPalletQty(parseInteger(detail.forecastPalletQty)) + .receivedPalletQty(parseInteger(detail.receivePalletQty)) + .storedPalletQty(parseInteger(detail.shelfPalletQty)) + .billedPalletQty(parseInteger(detail.billPalletQty)) + .unladeAt(parseTime(detail.unladeTime)) + .checkedAt(parseTime(detail.checkTime)) + .putawayAt(parseTime(detail.putawayTime)) + .leftAt(parseTime(detail.leaveTime)) + .isInnerBoxSticker(blankToNull(detail.isInnerBoxSticker)) + .isOuterBoxSticker(blankToNull(detail.isOuterBoxSticker)) + .otherNeed(blankToNull(detail.otherNeed)) + .modifiedAt(parseTime(detail.gmtModify)) .build(); } @@ -171,6 +208,11 @@ public final class XincangForecastMapper { return XincangOrderDetailMapper.parseTime(raw); } + /** 整数原值:空值 / 非法返回 null(与 {@link #intOf} 的区别是保留「仓方没给」)。 */ + static Integer parseInteger(String raw) { + return XincangOrderDetailMapper.parseInteger(raw); + } + static int intOf(String raw) { return XincangOrderDetailMapper.parsePositiveInt(raw); } diff --git a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangInventoryMapper.java b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangInventoryMapper.java index 10c6bd4..d6c54d7 100644 --- a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangInventoryMapper.java +++ b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangInventoryMapper.java @@ -71,6 +71,10 @@ public final class XincangInventoryMapper { } params.put("page", pageNumber(query.cursor())); params.put("limit", pageSize(query.pageSize())); + // 信仓默认只返回库存 > 0 的产品;需要零库存数据时显式传 1 + if (query.includeZeroStock() != null) { + params.put("is_show_zero", query.includeZeroStock() ? 1 : 0); + } return params; } diff --git a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangOrderDetailMapper.java b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangOrderDetailMapper.java index 6583e83..a48dd37 100644 --- a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangOrderDetailMapper.java +++ b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangOrderDetailMapper.java @@ -64,6 +64,31 @@ public final class XincangOrderDetailMapper { .exceptionCode(blankToNull(detail.apiError)) .estimatedShippingFee(parseMoney(detail.totalAmount)) .currency(CURRENCY_USD) + // ---- 仓方原始字段 ---- + .providerId(blankToNull(detail.id)) + .rawStatusName(blankToNull(detail.stateName)) + .labelUrl(blankToNull(detail.faceUrl)) + .shopName(blankToNull(detail.shopName)) + .skuCount(parseInteger(detail.skuCount)) + .productSku(blankToNull(detail.productSku)) + .productName(blankToNull(detail.productName)) + .sourceSku(blankToNull(detail.sourceSku)) + .providerWarehouseId(blankToNull(detail.warehouseId)) + .isSign(blankToNull(detail.isSign)) + .zone(blankToNull(detail.zone)) + .dimLength(blankToNull(detail.dimLength)) + .dimWidth(blankToNull(detail.dimWidth)) + .dimHeight(blankToNull(detail.dimHeight)) + .dimDivisor(blankToNull(detail.dimDivisor)) + .weightLbs(blankToNull(detail.weightLbs)) + .billingWeightLbs(blankToNull(detail.billingWeightLbs)) + .volumeWeightLbs(blankToNull(detail.volumeWeightLbs)) + .totalAmount(parseMoney(detail.totalAmount)) + .repairAmount(parseMoney(detail.repairAmount)) + .approvedAt(parseTime(detail.approveTime)) + .modifiedAt(parseTime(detail.gmtModify)) + .cancelledAt(parseTime(detail.gmtCancel)) + .interceptedAt(parseTime(detail.interceptTime)) .build(); } @@ -174,6 +199,23 @@ public final class XincangOrderDetailMapper { } } + /** + * 整数原值:空值 / 非法返回 null。 + * + *

与 {@link #parsePositiveInt} 的区别:这个把 null 与 0 区分开, + * 用于「仓方没给」与「仓方给了 0」要分开的字段(如件数合计)。

+ */ + static Integer parseInteger(String raw) { + if (blank(raw)) { + return null; + } + try { + return Integer.valueOf(raw.trim()); + } catch (NumberFormatException e) { + return null; + } + } + static int parsePositiveInt(String raw) { if (blank(raw)) { return 0; diff --git a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangTransferDetailMapper.java b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangTransferDetailMapper.java index 1347435..bc67f3e 100644 --- a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangTransferDetailMapper.java +++ b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangTransferDetailMapper.java @@ -38,9 +38,63 @@ public final class XincangTransferDetailMapper { .totalQuantity(totalQuantityOf(detail)) .estimatedOutboundAt(XincangOrderDetailMapper.parseDate(detail.preSendTime)) .remark(XincangOrderDetailMapper.blankToNull(detail.remark)) + // ---- 仓方原始字段 ---- + .providerId(XincangOrderDetailMapper.blankToNull(detail.id)) + .po(XincangOrderDetailMapper.blankToNull(detail.po)) + .customerId(XincangOrderDetailMapper.blankToNull(detail.customerId)) + .customerNo(XincangOrderDetailMapper.blankToNull(detail.customerNo)) + .fromWarehouseId(XincangOrderDetailMapper.blankToNull(detail.fromWarehouseId)) + .destWarehouseId(XincangOrderDetailMapper.blankToNull(detail.destWarehouseId)) + .rawStatusName(XincangOrderDetailMapper.blankToNull(detail.stateName)) + .deliveryMode(XincangOrderDetailMapper.blankToNull(detail.deliveryMode)) + .deliveryWay(XincangOrderDetailMapper.blankToNull(detail.deliveryWay)) + .orderType(XincangOrderDetailMapper.blankToNull(detail.orderType)) + .otherWarehouse(XincangOrderDetailMapper.blankToNull(detail.otherWarehouse)) + .labelRequirement(XincangOrderDetailMapper.blankToNull(detail.labelRequirement)) + .isProductLabel(XincangOrderDetailMapper.blankToNull(detail.isProductLabel)) + .isCtnLabel(XincangOrderDetailMapper.blankToNull(detail.isCtnLabel)) + .isPalletLabel(XincangOrderDetailMapper.blankToNull(detail.isPalletLabel)) + .isPallet(XincangOrderDetailMapper.blankToNull(detail.isPallet)) + .pickingStartedAt(XincangOrderDetailMapper.parseTime(detail.pickingTime)) + .pickedAt(XincangOrderDetailMapper.parseTime(detail.pickedTime)) + .palletizedAt(XincangOrderDetailMapper.parseTime(detail.palletedTime)) + .sentAt(XincangOrderDetailMapper.parseTime(detail.sendTime)) + .approvedAt(XincangOrderDetailMapper.parseTime(detail.approveTime)) + .shippingId(XincangOrderDetailMapper.blankToNull(detail.shippingId)) + .totalAmount(XincangOrderDetailMapper.parseMoney(detail.totalAmount)) + .createdAt(XincangOrderDetailMapper.parseTime(detail.gmtCreate)) + .modifiedAt(XincangOrderDetailMapper.parseTime(detail.gmtModify)) + .lines(toLines(detail)) .build(); } + /** 转运明细行 → 统一模型。 */ + static java.util.List toLines(XincangDtos.TransferDetail detail) { + if (detail.products == null || detail.products.isEmpty()) { + return java.util.Collections.emptyList(); + } + java.util.List out = + new java.util.ArrayList(detail.products.size()); + for (XincangDtos.TransferDetailProduct product : detail.products) { + if (product == null || XincangOrderDetailMapper.blank(product.productNo)) { + continue; + } + out.add(TransferOrder.TransferLine.builder() + .providerSku(product.productNo.trim()) + .productName(XincangOrderDetailMapper.blankToNull(product.productName)) + .productNameCn(XincangOrderDetailMapper.blankToNull(product.chnName)) + .plannedQuantity(XincangOrderDetailMapper.parsePositiveInt(product.skuCount)) + .boxCount(XincangOrderDetailMapper.parsePositiveInt(product.boxCount)) + .checkedBoxCount(XincangOrderDetailMapper.parsePositiveInt(product.checkBoxQty)) + .palletizedQuantity(XincangOrderDetailMapper.parsePositiveInt(product.palletSkuCount)) + .storedQuantity(XincangOrderDetailMapper.parsePositiveInt(product.putOnSkuCount)) + .packingRate(XincangOrderDetailMapper.blankToNull(product.packingRate)) + .remark(XincangOrderDetailMapper.blankToNull(product.remark)) + .build()); + } + return out; + } + /** 明细件数合计;明细缺失时返回 0(未知,不猜)。 */ static int totalQuantityOf(XincangDtos.TransferDetail detail) { if (detail.products == null || detail.products.isEmpty()) { diff --git a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/dto/XincangDtos.java b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/dto/XincangDtos.java index 2439a53..36850fc 100644 --- a/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/dto/XincangDtos.java +++ b/warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/dto/XincangDtos.java @@ -141,6 +141,34 @@ public final class XincangDtos { /** 产品图片;需先调 {@code upload.files}。统一模型暂不承载图片,通常为 null。 */ @JsonProperty("product_image") public ProductImage productImage; + + /** + * AHS 计费重量。 + * + *

文档标注已废弃:具体值由各服务商参数自动计算。SDK 不填, + * 保留占位只为与文档字段表对齐。

+ */ + @JsonProperty("ahs_weight") + @Deprecated + public String ahsWeight; + + /** + * AHS 计费尺寸。 + * + *

文档标注已废弃:具体值由各服务商参数自动计算。SDK 不填。

+ */ + @JsonProperty("ahs_dimensions") + @Deprecated + public String ahsDimensions; + + /** + * 是否超尺寸。 + * + *

文档标注已废弃:具体值由各服务商参数自动计算。SDK 不填。

+ */ + @JsonProperty("oversize") + @Deprecated + public String oversize; } /** 产品图片(OSS 元数据)。 */ @@ -428,6 +456,14 @@ public final class XincangDtos { @JsonProperty("po") public String po; + /** 客户 id。 */ + @JsonProperty("customer_id") + public String customerId; + + /** 客户代码。 */ + @JsonProperty("customer_no") + public String customerNo; + /** 发货仓 id / 代码。 */ @JsonProperty("from_warehouse") public String fromWarehouseId; @@ -558,6 +594,22 @@ public final class XincangDtos { public String weightLbs; @JsonProperty("weight_kg") public String weightKg; + + /** 产品中文名(文档字段 {@code chn_name} 的语义;与 {@link #chnName} 同值来源)。 */ + @JsonProperty("product_name") + public String productName; + + /** 清点箱数。 */ + @JsonProperty("check_box_qty") + public String checkBoxQty; + + /** 打托件数。 */ + @JsonProperty("pallet_sku_count") + public String palletSkuCount; + + /** 上架件数。 */ + @JsonProperty("put_on_sku_count") + public String putOnSkuCount; } /** 转运详情响应外层。 */ @@ -1017,6 +1069,15 @@ public final class XincangDtos { @JsonInclude(JsonInclude.Include.NON_NULL) public static final class ForecastCreateRequest { + /** + * 客户 id。 + * + *

文档标注已舍弃,SDK 不填;保留占位以与文档字段表对齐。

+ */ + @JsonProperty("customer_id") + @Deprecated + public String customerId; + /** 目的地仓。 */ @JsonProperty("dest_warehouse") public String destWarehouse; @@ -1081,6 +1142,24 @@ public final class XincangDtos { @JsonInclude(JsonInclude.Include.NON_NULL) public static final class ForecastImproveRequest { + /** + * 预报单 id。 + * + *

文档标注已舍弃,SDK 不填;保留占位以与文档字段表对齐。

+ */ + @JsonProperty("id") + @Deprecated + public String id; + + /** + * 客户 id。 + * + *

文档标注已舍弃,SDK 不填。

+ */ + @JsonProperty("customer_id") + @Deprecated + public String customerId; + @JsonProperty("forecast_no") public String forecastNo; @@ -1094,9 +1173,20 @@ public final class XincangDtos { @JsonProperty("ref_no") public String refNo; + /** + * 新增预报柜号。 + * + *

文档标注已舍弃,SDK 不填。

+ */ + @JsonProperty("old_cabinet_no") + @Deprecated + public String oldCabinetNo; + + /** 柜型:0 20GP / 1 40GP / 2 40HQ / 3 45HQ / 4 纸箱入库 / 5 托盘入库。 */ @JsonProperty("cabinet_type") public String cabinetType; + /** 柜号。 */ @JsonProperty("cabinet_no") public String cabinetNo; @@ -1108,6 +1198,15 @@ public final class XincangDtos { @JsonProperty("eta") public String eta; + /** + * 最晚免费时间(提柜)。 + * + *

文档标注已舍弃,SDK 不填。

+ */ + @JsonProperty("lfd") + @Deprecated + public String lfd; + @JsonProperty("delivery_requirements") public String deliveryRequirements; @@ -1118,13 +1217,33 @@ public final class XincangDtos { @JsonProperty("other_need") public String otherNeed; + /** + * 总件数。 + * + *

文档标注已舍弃(由 {@code products} 汇总),SDK 不填。

+ */ + @JsonProperty("sku_count_sum") + @Deprecated + public String skuCountSum; + + /** + * 总箱数。 + * + *

文档标注已舍弃(由 {@code products} 汇总),SDK 不填。

+ */ + @JsonProperty("box_count_sum") + @Deprecated + public String boxCountSum; + /** 产品明细 JSON 字符串。 */ @JsonProperty("products") public String products; + /** 船务公司 id;通过【获取船务公司】接口取得。 */ @JsonProperty("shipping_company_id") public String shippingCompanyId; + /** 预报托盘数;柜型为托盘入库时填写。 */ @JsonProperty("forecast_pallet_qty") public String forecastPalletQty; } @@ -1160,6 +1279,10 @@ public final class XincangDtos { @JsonIgnoreProperties(ignoreUnknown = true) public static final class ForecastDetail { + /** 预报单 id。 */ + @JsonProperty("id") + public String id; + @JsonProperty("forecast_no") public String forecastNo; @@ -1167,6 +1290,14 @@ public final class XincangDtos { @JsonProperty("chn_name") public String chnName; + /** 客户 id。 */ + @JsonProperty("customer_id") + public String customerId; + + /** 客户代码。 */ + @JsonProperty("customer_name") + public String customerName; + /** 目的仓 id / 代码。 */ @JsonProperty("dest_warehouse") public String destWarehouseId; @@ -1300,6 +1431,44 @@ public final class XincangDtos { /** 体积(立方厘米)。 */ @JsonProperty("volume_cm") public String volumeCm; + + /** 中文名。 */ + @JsonProperty("chn_name") + public String chnName; + + /** 英文名。 */ + @JsonProperty("en_name") + public String enName; + + /** 体积(立方英寸)。 */ + @JsonProperty("volume_ln") + public String volumeLn; + + /** 长(厘米)。 */ + @JsonProperty("size_l_cm") + public String sizeLCm; + /** 宽(厘米)。 */ + @JsonProperty("size_w_cm") + public String sizeWCm; + /** 高(厘米)。 */ + @JsonProperty("size_h_cm") + public String sizeHCm; + /** 长(英寸)。 */ + @JsonProperty("size_l_ln") + public String sizeLLn; + /** 宽(英寸)。 */ + @JsonProperty("size_w_ln") + public String sizeWLn; + /** 高(英寸)。 */ + @JsonProperty("size_h_ln") + public String sizeHLn; + + /** 预报产品创建时间。 */ + @JsonProperty("gmt_create") + public String gmtCreate; + /** 预报产品最后修改时间。 */ + @JsonProperty("gmt_modify") + public String gmtModify; } /** 预报详情响应外层。 */ diff --git a/warehouse-sdk-xincang/src/test/java/common/ecommerce/xincang/adapter/XincangForecastTest.java b/warehouse-sdk-xincang/src/test/java/common/ecommerce/xincang/adapter/XincangForecastTest.java index bb47f38..4fa8817 100644 --- a/warehouse-sdk-xincang/src/test/java/common/ecommerce/xincang/adapter/XincangForecastTest.java +++ b/warehouse-sdk-xincang/src/test/java/common/ecommerce/xincang/adapter/XincangForecastTest.java @@ -223,7 +223,9 @@ class XincangForecastTest { assertEquals(1, order.lines().size()); assertEquals("HB-B2060-RED", order.lines().get(0).providerSku()); assertEquals(100, order.lines().get(0).plannedQuantity()); - assertEquals(100, order.lines().get(0).packedQuantity()); + // box_count(预报箱数)语义不同于 packedQuantity(实际装箱件数),不再互相映射 + assertEquals(0, order.lines().get(0).packedQuantity(), + "box_count 不再冒充 packedQuantity"); assertEquals(80, order.lines().get(0).receivedQuantity()); } diff --git a/warehouse-sdk-xincang/src/test/java/common/ecommerce/xincang/adapter/XincangInventoryTest.java b/warehouse-sdk-xincang/src/test/java/common/ecommerce/xincang/adapter/XincangInventoryTest.java index 3f295f9..8fd887d 100644 --- a/warehouse-sdk-xincang/src/test/java/common/ecommerce/xincang/adapter/XincangInventoryTest.java +++ b/warehouse-sdk-xincang/src/test/java/common/ecommerce/xincang/adapter/XincangInventoryTest.java @@ -131,6 +131,26 @@ class XincangInventoryTest { } @Test + void stockSendsShowZeroWhenRequested() { + transport.route(XincangConstants.PATH_STOCK_LIST, req -> Responses.ok(STOCK_BODY)); + + adapter.query(ctx(), InventoryQuery.builder().includeZeroStock(true).build()); + + assertTrue(transport.lastDataRequest().url().contains("is_show_zero=1"), + transport.lastDataRequest().url()); + } + + @Test + void stockOmitsShowZeroWhenUnset() { + transport.route(XincangConstants.PATH_STOCK_LIST, req -> Responses.ok(STOCK_BODY)); + + adapter.query(ctx(), InventoryQuery.builder().build()); + + assertFalse(transport.lastDataRequest().url().contains("is_show_zero"), + "未指定时不传,交给仓方默认"); + } + + @Test void ageQuerySendsBillDateRangeAndMapsRecord() { transport.route(XincangConstants.PATH_STOCK_AGE_LIST, req -> Responses.ok(AGE_BODY));