fix:联调出入库问题处理
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
package org.nl.wms.decision_manage.handler.decisioner.impl.diy;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.ListOf;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.wms.decision_manage.handler.decisioner.Decisioner;
|
||||
import org.nl.wms.stor_manage.struct.service.dao.StIvtStructattr;
|
||||
import org.nl.wms.stor_manage.struct.service.dao.StIvtStructattr2;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 手动过滤XYZ排信息
|
||||
* {"y":[1,2,3,104,103,102]}
|
||||
*/
|
||||
//@Service("passRCL")
|
||||
@Slf4j
|
||||
public class PassRCLHandler extends Decisioner<StIvtStructattr, JSONObject> {
|
||||
//现场1/4排深位
|
||||
@Override
|
||||
public List<StIvtStructattr> handler(List<StIvtStructattr> list, JSONObject param) {
|
||||
String configParam = this.strategyConfig.getParam();
|
||||
JSONObject jsonP = JSONObject.parseObject(configParam);
|
||||
List x = jsonP.getObject("x", List.class);
|
||||
List y = jsonP.getObject("y", List.class);
|
||||
List z = jsonP.getObject("z", List.class);
|
||||
Stream<StIvtStructattr> stream = list.stream();
|
||||
if (!CollectionUtils.isEmpty(x)){
|
||||
stream = stream.filter(stIvtStructattr -> !x.contains(stIvtStructattr.getRow_num()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(y)){
|
||||
stream = stream.filter(stIvtStructattr -> !y.contains(stIvtStructattr.getCol_num()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(z)){
|
||||
stream = stream.filter(stIvtStructattr -> !z.contains(stIvtStructattr.getLayer_num()));
|
||||
}
|
||||
List<StIvtStructattr> collect = stream.collect(Collectors.toList());
|
||||
log.info("手动过滤XYZ排信息策略过滤数量:"+(list.size()-collect.size()));
|
||||
return collect;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
List<StIvtStructattr2> list = new ArrayList<>();
|
||||
for (int i =0;i<10;i++){
|
||||
StIvtStructattr2 structattr = new StIvtStructattr2();
|
||||
structattr.setRow_num(new Random().nextInt(2)+1);
|
||||
structattr.setCol_num(new Random().nextInt(10)+1);
|
||||
structattr.setLayer_num(new Random().nextInt(2)+1);
|
||||
list.add(structattr);
|
||||
}
|
||||
System.out.println(list);
|
||||
String configParam = "{\"z\":[2]}";
|
||||
JSONObject jsonP = JSONObject.parseObject(configParam);
|
||||
List x = jsonP.getObject("x", List.class);
|
||||
List y = jsonP.getObject("y", List.class);
|
||||
List z = jsonP.getObject("z", List.class);
|
||||
Stream<StIvtStructattr2> stream = list.stream();
|
||||
if (!CollectionUtils.isEmpty(x)){
|
||||
stream = stream.filter(stIvtStructattr -> !x.contains(stIvtStructattr.getRow_num()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(y)){
|
||||
stream = stream.filter(stIvtStructattr -> !y.contains(stIvtStructattr.getCol_num()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(z)){
|
||||
stream = stream.filter(stIvtStructattr -> !z.contains(stIvtStructattr.getLayer_num()));
|
||||
}
|
||||
List<StIvtStructattr2> collect = stream.collect(Collectors.toList());
|
||||
System.out.println(collect);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.nl.wms.stor_manage.struct.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓位属性表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2024-04-08
|
||||
*/
|
||||
@Data
|
||||
public class StIvtStructattr2 implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 排
|
||||
*/
|
||||
private Integer row_num;
|
||||
|
||||
/**
|
||||
* 列
|
||||
*/
|
||||
private Integer col_num;
|
||||
|
||||
/**
|
||||
* 层
|
||||
*/
|
||||
private Integer layer_num;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "位{" +
|
||||
"排=" + row_num +
|
||||
", 层=" + layer_num +
|
||||
", 列=" + col_num +
|
||||
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user