rev:手持入库仓位数限制

This commit is contained in:
2024-05-09 11:17:15 +08:00
parent 9f5baffd40
commit de4ef00659

View File

@@ -33,6 +33,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @author zhouz
@@ -251,12 +252,26 @@ public class ProductInstorServiceImpl implements ProductInstorService {
String download_attr_num = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("download_attr_num").getValue();
// 校验仓位数是否满足
JSONObject jsonAttr = attrList.stream()
.filter(row -> row.getDoubleValue("num") <= Double.parseDouble(download_attr_num))
.findFirst().orElse(null);
if(box_high <= Double.parseDouble(in_download_box_high)) {
JSONObject jsonOne = attrList.stream()
.filter(row -> row.getString("layer_num").equals("1"))
.findFirst().orElse(null);
if (ObjectUtil.isNotEmpty(jsonAttr)) {
throw new BadRequestException(jsonAttr.getString("layer_num") + "层主存区仓位数不足" + download_attr_num +"个,不允许入库!");
if (jsonOne.getDoubleValue("num") <= Double.parseDouble(download_attr_num)) {
throw new BadRequestException(jsonOne.getString("layer_num") + "层主存区仓位数不足" + download_attr_num +"个,不允许入库!");
}
} else {
List<JSONObject> layerList = attrList.stream()
.filter(row -> "2,3".contains(row.getString("layer_num")))
.collect(Collectors.toList());
JSONObject jsonAttr = layerList.stream()
.filter(row -> row.getDoubleValue("num") <= Double.parseDouble(download_attr_num))
.findFirst().orElse(null);
if (ObjectUtil.isNotEmpty(jsonAttr)) {
throw new BadRequestException(jsonAttr.getString("layer_num") + "层主存区仓位数不足" + download_attr_num +"个,不允许入库!");
}
}
JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);