feat(selfop): hide known zero inventory before turnover pagination
This commit is contained in:
+3
-2
@@ -10,12 +10,13 @@ public record InventoryTurnoverRequest(String sourceAccount, String warehouseCod
|
||||
@DateTimeFormat(iso=DateTimeFormat.ISO.DATE) LocalDate endDate, Integer baseWindowDays,
|
||||
String groupBy, String customerCode, String sku, String focus, Integer coverageDaysThreshold,
|
||||
String turnoverStatus, String sortBy, Integer current, Integer size, Boolean includeOverview,
|
||||
String snapshotContext) {
|
||||
String snapshotContext, Boolean hideZeroInventory) {
|
||||
private static final Set<String> PARAMETERS=Set.of("sourceAccount","warehouseCode","endDate","baseWindowDays",
|
||||
"groupBy","customerCode","sku","focus","coverageDaysThreshold","turnoverStatus","sortBy","current","size","includeOverview","snapshotContext");
|
||||
"groupBy","customerCode","sku","focus","coverageDaysThreshold","turnoverStatus","sortBy","current","size","includeOverview","snapshotContext","hideZeroInventory");
|
||||
public static void validateParameters(Set<String> keys) {
|
||||
if(!PARAMETERS.containsAll(keys)) throw new BizException("库存周转不接受其他视图的查询参数");
|
||||
}
|
||||
public boolean hideZero(){return !Boolean.FALSE.equals(hideZeroInventory);}
|
||||
public int days(){return baseWindowDays==null?30:baseWindowDays;}
|
||||
public java.util.List<Integer> windows(){return java.util.stream.Stream.of(7,15,30,days()).distinct().sorted().toList();}
|
||||
public String group(){return groupBy==null?"SKU":groupBy;}
|
||||
|
||||
+1
@@ -209,6 +209,7 @@ public final class InventoryTurnoverSql {
|
||||
case "UNASSESSABLE" -> "unassessable>0";
|
||||
default -> "1=1";
|
||||
};
|
||||
if(p.query.hideZero()) predicate+=" AND (physical IS NULL OR physical<>0)";
|
||||
if(p.query.turnoverStatus()!=null) predicate+=" AND sample_count<#{p.query.days}";
|
||||
if(!owner&&p.query.sku()!=null) predicate+=" AND sku_code=#{p.query.sku}";
|
||||
return " WHERE "+predicate;
|
||||
|
||||
@@ -19,7 +19,7 @@ paths:
|
||||
operationId: inventoryTurnover
|
||||
summary: 单仓SKU或货主三窗口库存周转
|
||||
description: >-
|
||||
精确customerCode限定列表与概览;sku、focus及turnoverStatus只筛列表。
|
||||
精确customerCode限定列表与概览;sku、focus、turnoverStatus及hideZeroInventory只筛列表。
|
||||
按完整候选计算依赖后排序分页,未知末尾,同值按SKU及货主或货主编码稳定排序。
|
||||
OWNER不计算整体可售天数;销售事实完整即可展示货主实际出库,不受单SKU观察期影响。
|
||||
SKU出库及无出库判断同样不受首次观察时间限制:可信完整覆盖的缺销量行可计零;实际异常单位或未覆盖日期保持未知。
|
||||
@@ -34,6 +34,7 @@ paths:
|
||||
- {name: groupBy, in: query, schema: {type: string, enum: [SKU, OWNER], default: SKU}}
|
||||
- {name: customerCode, in: query, schema: {type: string, minLength: 1, maxLength: 64}}
|
||||
- {name: sku, in: query, description: SKU分组的精确查询,OWNER禁止传入, schema: {type: string, minLength: 1, maxLength: 128}}
|
||||
- {name: hideZeroInventory, in: query, description: 默认隐藏当前全品质实物件数明确为0的SKU或货主汇总行,保留未知;全量筛选后分页,不改变概览及图表, schema: {type: boolean, default: true}}
|
||||
- name: focus
|
||||
in: query
|
||||
schema: {type: string, enum: [ALL, NO_OUTBOUND_IN_WINDOW, COVERAGE_GT, COVERAGE_LE, FROZEN, DEFECTIVE, UNASSESSABLE], default: ALL}
|
||||
|
||||
Reference in New Issue
Block a user