Browse Source
- 路径 /inbound/InboundPlanQuery → /v1/inbound/getInboundPlanInfo - 入参只有 orderNo,入库单号与来源单号都能传 - 补齐 create 之后空着的能力:get() 返回完整详情,query() 按单号查一条 入库单模型按响应重写: - 新增 InboundStatus 枚举,把运去哪的 0/5/6/8/10/16/17/20/25/70/100 归一化;未知码归 UNKNOWN,不猜 - InboundOrder 补 estimatedArrivalAt / actualArrivalAt / shipper 四项 / totalWeightKg / totalVolumeCbm / inventoryType / lines - 新增 InboundOrderLine:计划 / 装箱 / 实收 / 可售 / 不可售五个数量分开存, 并给 quantityMatchesPlan() 供对账判断短少与溢装 两点保守处理: - createdAt 留 null:响应里只有 estimateArrive / actualArrive / firstReception,没有下单时间 - 状态码按精确匹配,不做包含判断:运去哪的码是整数枚举,模糊匹配会把 6(审核拒回) 误判成 16(收货中) Co-Authored-By: Claude <noreply@anthropic.com>feature/supplier-lingxing
7 changed files with 568 additions and 27 deletions
@ -0,0 +1,128 @@ |
|||||||
|
package common.ecommerce.warehouse.model; |
||||||
|
|
||||||
|
import java.time.Instant; |
||||||
|
|
||||||
|
/** |
||||||
|
* 入库商品行(计划 / 装箱 / 实收)。 |
||||||
|
* |
||||||
|
* <p>三个数量必须分开看:{@code plannedQuantity} 是预报,{@code packedQuantity} |
||||||
|
* 是装箱时实际装进去的,{@code receivedQuantity} 是仓签收上架的。 |
||||||
|
* 三者不一致就是短少 / 溢装的来源,对账时都要。</p> |
||||||
|
*/ |
||||||
|
public final class InboundOrderLine { |
||||||
|
|
||||||
|
private final String providerSku; |
||||||
|
private final int plannedQuantity; |
||||||
|
private final int packedQuantity; |
||||||
|
/** 上架数量。 */ |
||||||
|
private final int receivedQuantity; |
||||||
|
/** 上架中可售数量。 */ |
||||||
|
private final int receivedSaleableQuantity; |
||||||
|
/** 上架中不可售数量。 */ |
||||||
|
private final int receivedUnsaleableQuantity; |
||||||
|
/** 最近上架时间(备货完成时间)。 */ |
||||||
|
private final Instant receivedAt; |
||||||
|
|
||||||
|
private InboundOrderLine(Builder b) { |
||||||
|
this.providerSku = require(b.providerSku, "providerSku"); |
||||||
|
this.plannedQuantity = b.plannedQuantity; |
||||||
|
this.packedQuantity = b.packedQuantity; |
||||||
|
this.receivedQuantity = b.receivedQuantity; |
||||||
|
this.receivedSaleableQuantity = b.receivedSaleableQuantity; |
||||||
|
this.receivedUnsaleableQuantity = b.receivedUnsaleableQuantity; |
||||||
|
this.receivedAt = b.receivedAt; |
||||||
|
} |
||||||
|
|
||||||
|
public static Builder builder() { |
||||||
|
return new Builder(); |
||||||
|
} |
||||||
|
|
||||||
|
public String providerSku() { |
||||||
|
return providerSku; |
||||||
|
} |
||||||
|
|
||||||
|
public int plannedQuantity() { |
||||||
|
return plannedQuantity; |
||||||
|
} |
||||||
|
|
||||||
|
public int packedQuantity() { |
||||||
|
return packedQuantity; |
||||||
|
} |
||||||
|
|
||||||
|
public int receivedQuantity() { |
||||||
|
return receivedQuantity; |
||||||
|
} |
||||||
|
|
||||||
|
public int receivedSaleableQuantity() { |
||||||
|
return receivedSaleableQuantity; |
||||||
|
} |
||||||
|
|
||||||
|
public int receivedUnsaleableQuantity() { |
||||||
|
return receivedUnsaleableQuantity; |
||||||
|
} |
||||||
|
|
||||||
|
public Instant receivedAt() { |
||||||
|
return receivedAt; |
||||||
|
} |
||||||
|
|
||||||
|
/** 实收与计划是否一致;不一致说明短少或溢装,需要人工核对。 */ |
||||||
|
public boolean quantityMatchesPlan() { |
||||||
|
return receivedQuantity == plannedQuantity; |
||||||
|
} |
||||||
|
|
||||||
|
private static String require(String v, String n) { |
||||||
|
if (v == null || v.trim().isEmpty()) { |
||||||
|
throw new IllegalArgumentException(n + " must not be blank"); |
||||||
|
} |
||||||
|
return v.trim(); |
||||||
|
} |
||||||
|
|
||||||
|
public static final class Builder { |
||||||
|
private String providerSku; |
||||||
|
private int plannedQuantity; |
||||||
|
private int packedQuantity; |
||||||
|
private int receivedQuantity; |
||||||
|
private int receivedSaleableQuantity; |
||||||
|
private int receivedUnsaleableQuantity; |
||||||
|
private Instant receivedAt; |
||||||
|
|
||||||
|
public Builder providerSku(String v) { |
||||||
|
this.providerSku = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder plannedQuantity(int v) { |
||||||
|
this.plannedQuantity = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder packedQuantity(int v) { |
||||||
|
this.packedQuantity = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder receivedQuantity(int v) { |
||||||
|
this.receivedQuantity = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder receivedSaleableQuantity(int v) { |
||||||
|
this.receivedSaleableQuantity = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder receivedUnsaleableQuantity(int v) { |
||||||
|
this.receivedUnsaleableQuantity = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder receivedAt(Instant v) { |
||||||
|
this.receivedAt = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public InboundOrderLine build() { |
||||||
|
return new InboundOrderLine(this); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,32 @@ |
|||||||
|
package common.ecommerce.warehouse.model; |
||||||
|
|
||||||
|
/** 入库计划单状态,已归一化。仓方状态值在适配器内映射到这里。 */ |
||||||
|
public enum InboundStatus { |
||||||
|
|
||||||
|
/** 草稿 / 已创建。 */ |
||||||
|
DRAFT, |
||||||
|
/** 待审核。 */ |
||||||
|
PENDING_REVIEW, |
||||||
|
/** 审核拒绝。 */ |
||||||
|
REJECTED, |
||||||
|
/** 待装箱。 */ |
||||||
|
PENDING_PACKING, |
||||||
|
/** 待发货。 */ |
||||||
|
PENDING_SHIPMENT, |
||||||
|
/** 已发运 / 在途。 */ |
||||||
|
IN_TRANSIT, |
||||||
|
/** 收货中。 */ |
||||||
|
RECEIVING, |
||||||
|
/** 已收货。 */ |
||||||
|
RECEIVED, |
||||||
|
/** 待入库(上架)。 */ |
||||||
|
PENDING_STORAGE, |
||||||
|
/** 入库中(上架中)。 */ |
||||||
|
STORING, |
||||||
|
/** 已完成。 */ |
||||||
|
COMPLETED, |
||||||
|
/** 已取消。 */ |
||||||
|
CANCELLED, |
||||||
|
/** 无法识别的状态。 */ |
||||||
|
UNKNOWN |
||||||
|
} |
||||||
Loading…
Reference in new issue