Commit 87b62c8d zshaohui

1.中英文返回问题

2.获取库位,排除外侧有料,里侧没有料的库位
1 个父辈 b5b93d76
......@@ -90,7 +90,7 @@ public class MessageUtils {
public static final String smfcore="smfcore";
private static String defLanguage = "";
@Value("${app.defLanguage: en}")
@Value("${app.defLanguage:en}")
public void setDefLanguage(String defLanguage) {
MessageUtils.defLanguage = defLanguage;
}
......
......@@ -973,12 +973,20 @@ public class LiteOrderCache {
int countTask = 0;
if (remainNum > 0 || remainReelCount > 0) {
Collection<String> excludePosIds = excludeOutPosIds();
//查询
List<StoragePos> allPosList = storagePosManager.findAllPartNumberInStorages(availableStorageIds, orderItem.getPn(), excludePosIds, checkoutType);
if (allPosList == null || allPosList.isEmpty()){
continue;
}
//已经分配的数量和料盘
int assignNum = 0;
int assignReelCount = 0;
while (assignNum < remainNum || assignReelCount < remainReelCount) {
Collection<String> excludePosIds = excludeOutPosIds();
//Collection<String> excludePosIds = excludeOutPosIds();
String partNumber = orderItem.getPn();
//根据站位号,分配到不同出料口
......@@ -992,6 +1000,7 @@ public class LiteOrderCache {
for (String storageId : availableStorageIds) {
taskPosIdMap.put(storageId,0);
}
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog task : allTasks) {
if (!task.isFinished() && !task.isCancel() && task.isCheckOutTask()){
......@@ -1018,46 +1027,44 @@ public class LiteOrderCache {
));
StoragePos pos = null;
for (String storageId : taskPosIdMap.keySet()) {
try {
log.info("休眠200毫秒");
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
//判断当前库存中,有没有可用的料盘信息,没有直接跳过
Map<String, InventoryItem> allInventory = dataCache.getAllInventory(Arrays.asList(storageId), null);
if (allInventory == null || allInventory.isEmpty()){
log.info(storageId+"没有可用的库存,跳过");
continue;
} else {
InventoryItem inventoryItem = allInventory.get(partNumber);
if (inventoryItem == null){
log.info(storageId+"没有可用的库存,跳过,对应的PartNumber为:"+partNumber);
continue;
for (StoragePos storagePos : allPosList) {
if (pos != null) {
break;
}
}
pos = storagePosManager.findPartNumberInStorages(Arrays.asList(storageId), partNumber, excludePosIds, checkoutType);
if (pos != null){
Barcode barcode = pos.getBarcode();
if (barcode != null){
if (storagePos.getStorageId().equals(storageId)) {
Barcode barcode = storagePos.getBarcode();
if (barcode == null){
continue;
}
if (!storagePos.isEnabled()){
continue;
}
Collection<String> excludeOutPosIds = excludeOutPosIds();
if (excludeOutPosIds.contains(storagePos.getId())){
continue;
}
boolean hasTask = false;
String barcodeStr = barcode.getBarcode();
List<DataLog> dataLogList = taskService.getAllTasks();
for (DataLog dataLog : dataLogList) {
if (barcodeStr.equals(dataLog.getBarcode())){
if (!dataLog.isFinished() && !dataLog.isCancel()){
//判断有没有任务
for (DataLog dataLog : taskService.getAllTasks()) {
if (!dataLog.isFinished() && !dataLog.isCancel()){
if (barcode.getBarcode().equals(dataLog.getBarcode())){
hasTask = true;
break;
}
if (storagePos.getId().equals(dataLog.getPosId())){
hasTask = true;
break;
}
}
}
if (hasTask){
pos = null;
continue;
}
pos = storagePos;
}
}
if (pos != null){
if (pos != null) {
break;
}
}
......
......@@ -50,7 +50,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId) throws ValidateException;
StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId, String needMovePosName, String endStr) throws ValidateException;
StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId, String needMovePosName, String endStr,List<String> needExcludePosNameList) throws ValidateException;
StoragePos getEmptyPosByStorage(Storage storage, int size, int height, Collection<String> excludePosIds) throws ValidateException;
......@@ -103,4 +103,6 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
Sort getSortByCheckOutType(CHECKOUT_TYPE checkoutType);
int getRemainPosCountByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId, String endStr) throws ValidateException;
List<StoragePos> findAllPartNumberInStorages(List<String> availableStorageIds, String pn, Collection<String> excludePosIds, CHECKOUT_TYPE checkoutType);
}
......@@ -465,11 +465,14 @@ public class StoragePosManagerImpl implements IStoragePosManager {
@Override
public StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds,String lastPosId) throws ValidateException {
return getEmptyPosByStorage(storage,barcode,excludePosIds,lastPosId,"","");
return getEmptyPosByStorage(storage,barcode,excludePosIds,lastPosId,"","",new ArrayList<>());
}
private static boolean max = true;
@Override
public StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds,String lastPosId,String needMovePosName,String endStr) throws ValidateException {
public StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds,String lastPosId,String needMovePosName,String endStr,List<String> needExcludePosNameList) throws ValidateException {
Criteria c = Criteria.where("storageId").is(storage.getId());
......@@ -499,13 +502,24 @@ public class StoragePosManagerImpl implements IStoragePosManager {
c.andOperator(posNameCriteria);
}
if (needExcludePosNameList != null && !needExcludePosNameList.isEmpty()){
c.and("posName").nin(needExcludePosNameList);
}
Query query = new Query(c);
String msg = "";
// if (lastPosId == null || lastPosId.equals("")) {
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
if (max){
query.with(Sort.by(Sort.Direction.ASC, "w").and(Sort.by(Sort.Direction.ASC, "h")).and(Sort.by(Sort.Direction.DESC, "priority")));
max = true;
} else {
query.with(Sort.by(Sort.Direction.ASC, "w").and(Sort.by(Sort.Direction.ASC, "h")).and(Sort.by(Sort.Direction.ASC, "priority")));
max = false;
}
// } else {
// Point point = PointUtil.getPosPoint(lastPosId, false);
// query.addCriteria(Criteria.where("coordinate").nearSphere(point));
......@@ -920,4 +934,23 @@ public class StoragePosManagerImpl implements IStoragePosManager {
query.with(Sort.by(Sort.Direction.ASC, "w").and(Sort.by(Sort.Direction.ASC, "h")).and(Sort.by(Sort.Direction.DESC, "priority")));
return storagePosDao.countByQuery(query);
}
@Override
public List<StoragePos> findAllPartNumberInStorages(List<String> storageIdList, String pn, Collection<String> excludePosIds, CHECKOUT_TYPE checkOutType) {
Criteria c = Criteria.where("barcode.partNumber").is(pn)
.and("id").nin(excludePosIds)
.and("enabled").is(true)//可用
.and("barcode.lockId").is(null);//没有被锁定的仓位;
if (storageIdList != null) {
c = c.and("storageId").in(storageIdList);
}
Query q = new Query(c);
Sort sort = getSortByCheckOutType(checkOutType);
q.with(sort);
List<StoragePos> list = storagePosDao.findByQuery(q);
if (list == null || list.isEmpty()) {
log.info("使用" + checkOutType + " 策略出库 partNumber=" + pn + ",未找到可以出库的物料 ");
}
return list;
}
}
......@@ -959,6 +959,34 @@ public class TaskService {
private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Set<String> hasOutTaskStorageIds, String lastPosId,String needMovePosName,String endStr) {
List<String> needExcludePosName = new ArrayList<>();
//新增外侧有料,里侧没料,排除里侧的库位信息
List<StoragePos> allUsePosList = new ArrayList<>();
List<Map<String, StoragePos>> allUsedPosMapList = dataCache.getAllUsedPosMap();
for (Map<String, StoragePos> map : allUsedPosMapList) {
for (StoragePos pos : map.values()) {
allUsePosList.add(pos);
}
}
for (StoragePos pos : allUsePosList) {
String posName = pos.getPosName();
if (posName.endsWith("_F")) {
boolean hasEndBPos = false;
String posName_B = posName.substring(0, posName.length() - 1) + "B";
for (StoragePos usePos : allUsePosList) {
if (usePos.getPosName().equals(posName_B)){
hasEndBPos = true;
break;
}
}
if (!hasEndBPos){
needExcludePosName.add(posName_B);
}
}
}
//第一遍查找,先不查找有出库任务的料仓
for (Storage storage : availbleStorageList) {
if(!storage.isSmdDuo()){//DUO料仓无论是否有出库任务,都可以查找空库位
......@@ -969,7 +997,7 @@ public class TaskService {
try {
Collection<String> operatingPosIds = excludePosIds();
log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId,needMovePosName,endStr);
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId,needMovePosName,endStr,needExcludePosName);
if (pos != null) {
return pos;
}
......@@ -982,7 +1010,7 @@ public class TaskService {
try {
Collection<String> operatingPosIds = excludePosIds();
log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId,needMovePosName,endStr);
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId,needMovePosName,endStr,needExcludePosName);
if (pos != null) {
return pos;
}
......
......@@ -414,9 +414,10 @@ public class JkemController {
}
} catch (ValidateException ve) {
errorMsg = ve.getMessage();
errorMsg= MessageUtils.getText(ve.getMsgKey(),ve.getMsgParam(),MessageUtils.getDefaultLocal(),ve.getDefaultMsg());
log.info("查找空库位失败:" + errorMsg);
resultMap.put("result", "105");
resultMap.put("msg", MessageUtils.getText(ve.getMsgKey(), ve.getMsgParam(), request.getLocale(), ve.getDefaultMsg()));
resultMap.put("msg", errorMsg);
} catch (Exception e) {
errorMsg = e.getMessage();
log.info("查找空库位失败,", e);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!