|
@@ -2,10 +2,12 @@ package com.steerinfo.dil.service.impl;
|
|
import com.steerinfo.dil.mapper.RmsPwarehouseGridMapper;
|
|
import com.steerinfo.dil.mapper.RmsPwarehouseGridMapper;
|
|
import com.steerinfo.dil.model.RmsPwarehouseGrid;
|
|
import com.steerinfo.dil.model.RmsPwarehouseGrid;
|
|
import com.steerinfo.dil.service.IRmsPwarehouseGridService;
|
|
import com.steerinfo.dil.service.IRmsPwarehouseGridService;
|
|
|
|
+import com.steerinfo.dil.util.DataChange;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -56,6 +58,72 @@ public class RmsPwarehouseGridServiceImpl implements IRmsPwarehouseGridService
|
|
return rmsPwarehouseGridMapper.selectGridId(map);
|
|
return rmsPwarehouseGridMapper.selectGridId(map);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //根据优先级和启用状态以及垛位上的物资ID来确定物资即将入库哪个垛位
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String,Object> getStackingId(Map<String, Object> map){
|
|
|
|
+ //获取入库的物资数量,物资编码
|
|
|
|
+ Integer materialNum = DataChange.dataToBigDecimal(map.get("materialNum")).intValue();
|
|
|
|
+ String materialCode = (String)map.get("materialCode");
|
|
|
|
+ Integer inboundSize = DataChange.dataToBigDecimal(map.get("materialSize")).intValue();
|
|
|
|
+ //获取入库的仓库
|
|
|
|
+ BigDecimal warehouseId = DataChange.dataToBigDecimal(map.get("warehouseId"));
|
|
|
|
+ //根据仓库ID和物资编码查询垛位,以及垛位的启用状态及优先级排序--->查询出垛位
|
|
|
|
+ List<Map<String,Object>> mapStackList = rmsPwarehouseGridMapper.getStackingId(map);
|
|
|
|
+ if(mapStackList.size() != 0){
|
|
|
|
+ int i = 0 ;
|
|
|
|
+ for (Map<String,Object>stackMap:mapStackList
|
|
|
|
+ ) {
|
|
|
|
+ //获取垛位ID
|
|
|
|
+ BigDecimal stackingId = DataChange.dataToBigDecimal(stackMap.get("stackingId"));
|
|
|
|
+ //判断待入库的物资数量是否能放入该垛位-->根据实时库存判断该垛位装了多少物资,根据最大层数判断该垛位最大物资数
|
|
|
|
+ //已装物资数
|
|
|
|
+ Integer countMaterial = rmsPwarehouseGridMapper.getCountMaterial(stackingId);
|
|
|
|
+ //垛位最大层数
|
|
|
|
+ Integer maxStackingLayer = rmsPwarehouseGridMapper.getMaxStackingLayers(stackingId);
|
|
|
|
+ //待入库物资数与垛位已存在物资数比较,如果大于则跳出循环继续下一个
|
|
|
|
+ if((countMaterial + inboundSize)>(maxStackingLayer*24)){
|
|
|
|
+ i++;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> mapStack = new HashMap<>();
|
|
|
|
+ mapStack.put("stackingId",stackingId);
|
|
|
|
+ return mapStack;
|
|
|
|
+ }
|
|
|
|
+ //如果i不等于0,则表明没有符合条件的垛位,则去寻找空垛位
|
|
|
|
+ if(i!=0){
|
|
|
|
+ return nullStackingId(map);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ nullStackingId(map);
|
|
|
|
+ }
|
|
|
|
+ return nullStackingId(map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //查找空垛位
|
|
|
|
+ public Map<String,Object> nullStackingId(Map<String,Object>map){
|
|
|
|
+ //查找空垛位ID-->物资数量为0的垛位,根据实时库存来查找符合条件的
|
|
|
|
+ //查找这个仓库的所有垛位
|
|
|
|
+ List<Map<String,Object>>mapList = rmsPwarehouseGridMapper.getNullStackingId(map);
|
|
|
|
+ for (Map<String,Object>stackingMap:mapList
|
|
|
|
+ ) {
|
|
|
|
+ BigDecimal stackingId = DataChange.dataToBigDecimal(stackingMap.get("stackingId"));
|
|
|
|
+ //已装物资数
|
|
|
|
+ Integer countMaterial = rmsPwarehouseGridMapper.getCountMaterial(stackingId);
|
|
|
|
+ if(countMaterial!=0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> mapStack = new HashMap<>();
|
|
|
|
+ mapStack.put("stackingId",stackingId);
|
|
|
|
+ return mapStack;
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> nullMap = new HashMap<>();
|
|
|
|
+ nullMap.put("warn","没有符合条件的垛位");
|
|
|
|
+ return nullMap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public BigDecimal selectGrid(Integer size,BigDecimal warehouseId) {
|
|
public BigDecimal selectGrid(Integer size,BigDecimal warehouseId) {
|
|
|
|
|
|
@@ -91,4 +159,5 @@ public class RmsPwarehouseGridServiceImpl implements IRmsPwarehouseGridService
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|