Commit 0814fb99 zshaohui

按库别分库位

1 个父辈 e9775495
...@@ -447,7 +447,7 @@ public class LiteOrderCache { ...@@ -447,7 +447,7 @@ public class LiteOrderCache {
try { try {
String binCode = ""; String binCode = "";
Map<String, String> binCacheMap = BinCacheUtil.binCodeCacheMap(orderItem.getSrcWarehouse()); Map<String, String> binCacheMap = BinCacheUtil.binCodeCacheMap(orderItem.getSrcWarehouse(),"");
for (String code : binCacheMap.keySet()) { for (String code : binCacheMap.keySet()) {
binCode = code; binCode = code;
break; break;
......
...@@ -32,4 +32,9 @@ public class QueryBinRequest { ...@@ -32,4 +32,9 @@ public class QueryBinRequest {
* 储位库别 * 储位库别
*/ */
private String WAREHOUSE_CODE; private String WAREHOUSE_CODE;
/**
* 隔口信息
*/
private String BIN_CODE;
} }
...@@ -666,7 +666,7 @@ public class CDeviceController { ...@@ -666,7 +666,7 @@ public class CDeviceController {
barcodeManager.saveBarcode(barcode); barcodeManager.saveBarcode(barcode);
//更新料串缓存信息 //更新料串缓存信息
MaterialLocUtil.updateMaterialLoc(materialStr,"",barcode); MaterialLocUtil.updateMaterialLoc(materialStr,"",null);
Map<String,String> resultMap = new HashMap<>(); Map<String,String> resultMap = new HashMap<>();
resultMap.put("binCode",boxStr); resultMap.put("binCode",boxStr);
......
...@@ -38,50 +38,21 @@ public class BinCacheUtil { ...@@ -38,50 +38,21 @@ public class BinCacheUtil {
BinCacheUtil.taskService = service; BinCacheUtil.taskService = service;
} }
public static long time = 0l;
public static Map<String, String> cacheBinCodeMap = null;
public static boolean canPutInBinCode(String binCode, String warehouseCode) { public static boolean canPutInBinCode(String binCode, String warehouseCode) {
Map<String, String> binCodeMap = binCodeCacheMap(warehouseCode, binCode);
String code = binCodeMap.get(binCode);
if (cacheBinCodeMap == null || time == 0l || System.currentTimeMillis() - time > 1000*60*10){
cacheBinCodeMap = binCodeCacheMap(warehouseCode);
time = System.currentTimeMillis();
log.info("获取可用料箱,缓存可能为空,时间可能为空,当前时间与上一次时间相差10分钟:"+(System.currentTimeMillis() - time));
}
//判断code是否相同
String code = cacheBinCodeMap.get(binCode);
if (StringUtils.isEmpty(code)){
log.info(binCode+"未找到,重新调用接口,库别为:"+warehouseCode);
Map<String, String> map = binCodeCacheMap(warehouseCode);
cacheBinCodeMap.putAll(map);
}
code = cacheBinCodeMap.get(binCode);
if (StringUtils.isNotEmpty(code)) { if (StringUtils.isNotEmpty(code)) {
if (code.equals(warehouseCode)) { if (code.equals(warehouseCode)) {
//binCodeUpdateTime = System.currentTimeMillis();
return true; return true;
}/* else { }
LuxsanApi.updateBin(new UpdateBinRequest(CommonUtil.plantCode, binCode, warehouseCode, BinEnum.STORAGE_TYPE_C));
cacheMap.put(binCode, warehouseCode);
dataCache.updateCache(CacheNameUtil.CHCHE_QUERY_BIN, cacheMap);
binCodeUpdateTime = System.currentTimeMillis();
return true;
}*/
} }
return false; return false;
} }
public static List<String> getBoxList(String wareHouseCode) { public static List<String> getBoxList(String wareHouseCode,String binCodeStr) {
List<String> boxList = new ArrayList<>(); List<String> boxList = new ArrayList<>();
Map<String, String> cacheMap = binCodeCacheMap(wareHouseCode); Map<String, String> cacheMap = binCodeCacheMap(wareHouseCode,binCodeStr);
for (String bincode : cacheMap.keySet()) { for (String bincode : cacheMap.keySet()) {
String cacheWH = cacheMap.get(bincode); String cacheWH = cacheMap.get(bincode);
if (StringUtils.isNotEmpty(cacheWH) && cacheWH.equals(wareHouseCode)) { if (StringUtils.isNotEmpty(cacheWH) && cacheWH.equals(wareHouseCode)) {
...@@ -95,16 +66,16 @@ public class BinCacheUtil { ...@@ -95,16 +66,16 @@ public class BinCacheUtil {
} }
public static Map<String, String> binCodeCacheMap(String warehouseCode) { public static Map<String, String> binCodeCacheMap(String warehouseCode,String binCode) {
Map<String, String> cacheMap = new HashMap<>(); Map<String, String> cacheMap = new HashMap<>();
List<QueryBinResult> resultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_0, warehouseCode)); List<QueryBinResult> resultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_0, warehouseCode,binCode));
if (resultList != null && !resultList.isEmpty()) { if (resultList != null && !resultList.isEmpty()) {
for (QueryBinResult result : resultList) { for (QueryBinResult result : resultList) {
cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE()); cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE());
} }
} }
List<QueryBinResult> useBinResultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_1, warehouseCode)); List<QueryBinResult> useBinResultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_1, warehouseCode,binCode));
if (useBinResultList != null && !useBinResultList.isEmpty()) { if (useBinResultList != null && !useBinResultList.isEmpty()) {
for (QueryBinResult result : useBinResultList) { for (QueryBinResult result : useBinResultList) {
cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE()); cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE());
......
...@@ -20,6 +20,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos; ...@@ -20,6 +20,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType; import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.luxsan.api.LuxsanApi;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -182,7 +183,7 @@ public class BoxHandleUtil { ...@@ -182,7 +183,7 @@ public class BoxHandleUtil {
} }
//判断有没有可用的料箱 //判断有没有可用的料箱
List<String> boxList = BinCacheUtil.getBoxList(wareHouseCode); List<String> boxList = BinCacheUtil.getBoxList(wareHouseCode,"");
if (boxList == null || boxList.isEmpty()) { if (boxList == null || boxList.isEmpty()) {
log.info(wareHouseCode + "未找到可用料箱"); log.info(wareHouseCode + "未找到可用料箱");
return null; return null;
...@@ -354,10 +355,34 @@ public class BoxHandleUtil { ...@@ -354,10 +355,34 @@ public class BoxHandleUtil {
} }
public static StoragePos locOnePos(Barcode boxBarcode) { public static StoragePos locOnePos(Barcode boxBarcode) {
//默认只差第一个隔口
String barcode = boxBarcode.getBarcode();
String binCodeStr = barcode + "-01";
Map<String, String> cacheMap = BinCacheUtil.binCodeCacheMap("", binCodeStr);
String warehouseCode = cacheMap.get(binCodeStr);
log.info(binCodeStr+"查到的库别为:"+warehouseCode);
if (StringUtils.isEmpty(warehouseCode)){
return null;
}
boxBarcode.setWarehouseCode(warehouseCode);
//判断信息是否在已经在库位中(出入库只改变料箱位置状态,不从StoragePos表中清除) //判断信息是否在已经在库位中(出入库只改变料箱位置状态,不从StoragePos表中清除)
StoragePos pos = storagePosManager.getByBarcode(boxBarcode.getBarcode()); StoragePos pos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (pos != null) { if (pos != null) {
if (warehouseCode.equals(pos.getWareHouseCode())){
return pos; return pos;
} else {
log.info(barcode+"对应的库别为:"+warehouseCode+",与当前库位:"+pos.getPosName()+"的库别:"+pos.getWareHouseCode()+"不一致,清空原来库位");
pos.setBarcode(null);
pos.setUsed(false);
storagePosManager.save(pos);
}
} }
List<String> cidList = new ArrayList<>(); List<String> cidList = new ArrayList<>();
...@@ -370,6 +395,11 @@ public class BoxHandleUtil { ...@@ -370,6 +395,11 @@ public class BoxHandleUtil {
} }
pos = taskService.findEmptyPosForPutIn(storageList, boxBarcode, "", ""); pos = taskService.findEmptyPosForPutIn(storageList, boxBarcode, "", "");
if (pos == null){
boxBarcode.setWarehouseCode("");
pos = taskService.findEmptyPosForPutIn(storageList, boxBarcode, "", "");
}
if (pos == null) { if (pos == null) {
log.info(boxBarcode.getBarcode() + "未找到可用库位"); log.info(boxBarcode.getBarcode() + "未找到可用库位");
return null; return null;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!