自动化立体仓库 - WMS系统
#
lty
11 小时以前 a1db2ea6ccdafdffdf2ed4e52844179e72dc77a5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.zy.asrs.entity.param;
 
import com.zy.asrs.entity.LocMast;
import lombok.Data;
 
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
 
/**
 * 空板出库阻塞检查结果
 */
@Data
public class LockingCheckResultParam {
 
    /** 是否通过校验 */
    private boolean success;
 
    /** 出库方向: "ASC"(正序)或 "DESC"(倒序) */
    private String direction;
 
    /** 按出库方向排序后的选中库位列表 */
    private List<LocMast> sortedSelected;
 
    /** 失败时的错误信息 */
    private String message;
 
    /**
     * 成功时的构造方法
     */
    public LockingCheckResultParam(boolean success, String direction, List<LocMast> sortedSelected) {
        this.success = success;
        this.direction = direction;
        // 防御性拷贝,防止外部修改
        this.sortedSelected = sortedSelected != null
                ? new ArrayList<>(sortedSelected)
                : Collections.emptyList();
    }
 
    /**
     * 失败时的构造方法
     */
    public LockingCheckResultParam(String message) {
        this.success = false;
        this.direction = null;
        this.sortedSelected = Collections.emptyList();
        this.message = message;
    }
 
    /**
     * 快速创建成功结果(默认 ASC 方向)
     */
    public static LockingCheckResultParam success(List<LocMast> sortedSelected) {
        return new LockingCheckResultParam(true, "DEC", sortedSelected);
    }
 
    /**
     * 快速创建成功结果(指定方向)
     */
    public static LockingCheckResultParam success(String direction, List<LocMast> sortedSelected) {
        return new LockingCheckResultParam(true, direction, sortedSelected);
    }
 
    /**
     * 快速创建失败结果
     */
    public static LockingCheckResultParam fail(String message) {
        return new LockingCheckResultParam(message);
    }
 
    /**
     * 判断是否成功(方便链式调用)
     */
    public boolean isSuccess() {
        return success;
    }
 
    /**
     * 获取错误信息,如果成功则返回 null
     */
    public String getErrorMessage() {
        return success ? null : message;
    }
}