#
Junjie
2024-01-05 69cfd1cfd760e6af3f0c5353eacdf38c7af8b56a
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
package com.zy.asrs.common.domain.dto;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.common.wms.entity.LocDetl;
import com.zy.asrs.common.wms.service.LocDetlService;
import com.zy.asrs.framework.common.SpringUtils;
import lombok.Data;
 
import java.util.List;
 
/**
 * Created by vincent on 2021/3/25
 */
@Data
public class SafeStoDo {
 
    private Long id;
 
    private String locNo;
 
    private String matnr;
 
    private String maktx;
 
    private Double safeQua;
 
    private Long hostId;
 
    public String getLocNo$() {
        if (this.locNo == null) {
            return "全部";
        }
        return this.locNo;
    }
 
    public Double getAmount() {
        Double sum = 0.0;
        LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class);
        LambdaQueryWrapper<LocDetl> wrapper = new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getMatnr, this.matnr).eq(LocDetl::getHostId, this.hostId);
        if (this.locNo != null) {
            wrapper.eq(LocDetl::getLocNo, this.locNo);
        }
        List<LocDetl> list = locDetlService.list(wrapper);
        for (LocDetl locDetl : list) {
            sum += locDetl.getAnfme();
        }
        return sum;
    }
 
    public Integer getStatus() {
        Integer status = 1;
        Double amount = getAmount();
        double percent = amount / safeQua;
        if (percent >= 1) {
            status = 1;//满仓
        } else if (percent >= 0.75) {
            status = 2;//安全
        }else {
            status = 3;//危险
        }
        return status;
    }
 
    public String getProgress() {
        Double amount = getAmount();
        double percent = (amount / safeQua) * 100;
        return String.valueOf(percent) + "%";
    }
 
}