|
|
@@ -10,9 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* WmspInboundDistribute服务实现:
|
|
|
@@ -34,6 +32,8 @@ public class WmspInboundDistributeServiceImpl extends BaseServiceImpl<WmspInboun
|
|
|
private WmspInboundDistributeMapper wmspInboundDistributeMapper;
|
|
|
@Autowired
|
|
|
private CommonServiceImpl commonService;
|
|
|
+ @Autowired
|
|
|
+ private WmspInboundDistributeServiceImpl wmspInboundDistributeService;
|
|
|
|
|
|
@Override
|
|
|
protected IBaseMapper<WmspInboundDistribute, Short> getMapper() {
|
|
|
@@ -71,7 +71,7 @@ public class WmspInboundDistributeServiceImpl extends BaseServiceImpl<WmspInboun
|
|
|
@Override
|
|
|
public List<Map<String,Object>> getNewDistribute(Integer personnelWorkshopid) {
|
|
|
List<Map<String,Object>> result= wmspInboundDistributeMapper.getNewDistribute(personnelWorkshopid);
|
|
|
- return result;
|
|
|
+ return wmspInboundDistributeService.getInboundList(result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -90,4 +90,62 @@ public class WmspInboundDistributeServiceImpl extends BaseServiceImpl<WmspInboun
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+// 根据获取到的带吊装list进行处理
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> getInboundList(List<Map<String, Object>> result) {
|
|
|
+ // 创建set集合用来存储唯一的number
|
|
|
+ HashSet<String> set =new HashSet<>();
|
|
|
+ List<Map<String ,Object>> result1=new ArrayList<>();
|
|
|
+// 遍历result
|
|
|
+ for(Map<String ,Object> map:result){
|
|
|
+// 判断number是否取值为空
|
|
|
+ if (map.get("gridSequenceNumber")!=null) {
|
|
|
+ // 取出map中的number值
|
|
|
+// 层序号
|
|
|
+ BigDecimal gridSequenceNumber = (BigDecimal) map.get("gridSequenceNumber");
|
|
|
+// 月台Id
|
|
|
+ BigDecimal platformId = (BigDecimal)map.get("platformId");
|
|
|
+// 层次号
|
|
|
+ BigDecimal gridGradationNumber = (BigDecimal)map.get("gridGradationNumber");
|
|
|
+// 仓库Id
|
|
|
+ BigDecimal warehouseId = (BigDecimal)map.get("warehouseId");
|
|
|
+// 垛位Id
|
|
|
+ BigDecimal stackingId = (BigDecimal)map.get("stackingId");
|
|
|
+// 拼接物资的存储位置
|
|
|
+ String number = warehouseId.toString()+platformId.toString()+stackingId.toString()+gridSequenceNumber.toString()+gridGradationNumber.toString();
|
|
|
+ // 判断这个number值在set集合中是否已经存在,如果不存在则进行存储
|
|
|
+ System.out.println(number);
|
|
|
+ if (!set.contains(number)){
|
|
|
+ set.add(number);
|
|
|
+ result1.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// 遍历list集合,对数据按照resultNumber从小到大排序
|
|
|
+// 方法1:
|
|
|
+// 遍历result1,获取关于resultNumber正确排序的集合
|
|
|
+ int [] array =new int[result1.size()];
|
|
|
+ int i=0;
|
|
|
+ for (Map<String ,Object> map:result1){
|
|
|
+ Integer num = Integer.valueOf(map.get("resultNumber").toString());
|
|
|
+ array[i] = num;
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+// 对list排序
|
|
|
+ Arrays.sort(array);
|
|
|
+// 根据排序好的array数组进行对list的重新排序
|
|
|
+ List<Map<String ,Object>> result2=new ArrayList<>();
|
|
|
+// 遍历result1和遍历数组
|
|
|
+ for(int j=0;j<array.length;j++){
|
|
|
+ for (Map<String ,Object> map:result1){
|
|
|
+ int a = Integer.valueOf(map.get("resultNumber").toString());
|
|
|
+ if (array[j]==a){
|
|
|
+ result2.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// 返回过滤之后的list
|
|
|
+ return result2;
|
|
|
+ }
|
|
|
}
|