29 lines
1.7 KiB
Java
29 lines
1.7 KiB
Java
package com.baiyue.lastleg.delivery;
|
|
|
|
import com.baiyue.lastleg.dispatch.port.DispatchContracts.*;
|
|
import com.baiyue.lastleg.dispatch.port.DispatchTypes.*;
|
|
import java.time.Instant;
|
|
import java.util.List;
|
|
|
|
/** 本任务测试独占fixture,所有业务号及客户均为离线合成值。 */
|
|
public final class DeliveryDispatchFixtures {
|
|
public static final Instant DEPARTED=Instant.parse("2026-10-19T01:00:00Z");
|
|
/** 工具类不允许实例化。 */
|
|
private DeliveryDispatchFixtures() { }
|
|
/** 构造一条真实拣货归属,允许同实物托盘有多个来源。 */
|
|
public static CargoLine cargo(long id,String customer,String destination,long pallet,long packages) {
|
|
return new CargoLine(id,customer,"客户"+customer,id,"LM-"+id,"SOURCE-"+id,"RECEIVED","LOCAL",null,"IN-"+id,
|
|
null,pallet,"PALLET-"+pallet,id,id,id,id,null,null,null,null,
|
|
new Destination("FBA:"+destination,"FBA",null,destination,destination,null,null,null,null),
|
|
packages,0,null,null,List.of());
|
|
}
|
|
/** 构造同仓完整拣货的整车上下文,发车后只改变业务计数。 */
|
|
public static Context context(List<CargoLine> cargo,boolean departed) {
|
|
long count=cargo.stream().mapToLong(CargoLine::packages).sum();
|
|
return new Context(10L,"DP-10",20L,"TRIP-20","1001","WH-1","测试仓",Status.ACTIVE,
|
|
departed?Stage.DELIVERING:Stage.AFTER_LOADING,3,1,"cargo-hash","loading-hash",DEPARTED.minusSeconds(60),
|
|
departed?DEPARTED:null,null,new Counts(cargo.size(),cargo.stream().map(CargoLine::warehousePalletId).distinct().count(),count,
|
|
departed?0:count,departed?count:0),null,true,cargo);
|
|
}
|
|
}
|