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) + "%";
|
}
|
|
}
|