自动化立体仓库 - WMS系统
#
lty
5 天以前 6fb055d07a4b1e3e4daa53db29addf015fb8e669
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
package com.zy.asrs.entity.param;
 
import com.core.common.Cools;
import lombok.Data;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * Created by vincent on 2020/6/18
 */
@Data
public class LocDetlAdjustParam {
 
    // 库位号
    private String locNo;
 
    // 调整库存明细集合
    private List<LocDetlAdjust> list;
 
    @Data
    public static class LocDetlAdjust {
 
        // 商品编号
        private String matnr;
 
        // 序列码
        private String batch;
 
        // 变更数量
        private Double count;
 
        public LocDetlAdjust(String matnr, String batch, Double count) {
            this.matnr = matnr;
            this.batch = batch;
            this.count = count;
        }
    }
 
    public void integrate() {
        if (Cools.isEmpty(list)) {
            return;
        }
        List<LocDetlAdjust> copyList = new ArrayList<>();
        for (LocDetlAdjust adjust : list) {
            boolean exit = false;
            for (LocDetlAdjust copy : copyList) {
                if (adjust.getMatnr().equals(copy.getMatnr()) && Cools.eq(adjust.getBatch(), copy.getBatch())) {
                    copy.setCount(copy.getCount() + adjust.getCount());
                    exit = true;
                    break;
                }
            }
            if (!exit) {
                copyList.add(new LocDetlAdjustParam.LocDetlAdjust(adjust.getMatnr(), adjust.getBatch(), adjust.getCount()));
            }
        }
        list = copyList;
    }
 
 
}