Commit 44962d89 zshaohui

Merge remote-tracking branch 'origin/master'

2 个父辈 abe3f12a ad711a87
...@@ -231,6 +231,17 @@ public class StatusBean { ...@@ -231,6 +231,17 @@ public class StatusBean {
return 0; return 0;
} }
public int getDuoSidePos() {
String duoSidePos = data.get("duoSidePos");
if (ObjectUtil.isNotEmpty(duoSidePos)) {
try {
return Integer.valueOf(duoSidePos);
} catch (Exception e) {
}
}
return 0;
}
/** /**
* 获取库位信息 * 获取库位信息
*/ */
......
...@@ -313,7 +313,8 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -313,7 +313,8 @@ public class SpBoxHandler extends BaseDeviceHandler {
storagePos = storagePosManager.get(lockPosId); storagePos = storagePosManager.get(lockPosId);
log.info(barcodeSave.getBarcode() + "入库时查找到锁定的库位["+storagePos.getPosName()+"]"); log.info(barcodeSave.getBarcode() + "入库时查找到锁定的库位["+storagePos.getPosName()+"]");
}else{ }else{
storagePos = findLineEmptyPosForPutIn(storage, barcodeSave); int isDuoSidePos=statusBean.getDuoSidePos();
storagePos = findSpEmptyPosForPutIn(storage, barcodeSave,isDuoSidePos);
} }
} }
...@@ -321,6 +322,55 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -321,6 +322,55 @@ public class SpBoxHandler extends BaseDeviceHandler {
return taskService.addPutInTaskToExecute(storage, barcodeSave, storagePos); return taskService.addPutInTaskToExecute(storage, barcodeSave, storagePos);
} }
} }
/**
* 为 barcode 查找流水线料仓中空闲的仓位
*/
protected StoragePos findSpEmptyPosForPutIn(Storage storage, Barcode barcode,int isDuoSidePos) throws ValidateException {
String storageCid = storage.getCid();
//先查找空闲 BOX同尺寸的,如果找不到,再查找可入库 BOX 同尺寸或比盘尺寸大的仓位
StatusBean statusBean = DevicesStatusUtil.getStatusBean(storageCid);
if (statusBean == null) {//当前料仓不可用
throw new ValidateException("smfcore.error.storage.offline", "料仓[{0}]离线", new String[]{storageCid});
}
//还需要排除掉正在队列里的仓位
StoragePos storagePos = null;
Collection<String> operatingPosIds = taskService.excludePosIds();
boolean hasOutTask = taskService.hasExecutingTask(storageCid, OP.CHECKOUT);
if (!hasOutTask) {
if (isDuoSidePos == 1) {
//先查找B结尾的,再查找F结尾的
log.info("从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位,先查找B结尾的库位");
storagePos = storagePosManager.getSpEmptyPosByStorage(storage, barcode, operatingPosIds, "B");
if (storagePos == null) {
log.info("从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位,未找到B结尾的库位,查找F结尾库位");
storagePos = storagePosManager.getSpEmptyPosByStorage(storage, barcode, operatingPosIds, "F");
}
if(storagePos==null){
log.info("从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位,查找所有库位");
storagePos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds);
}
} else {
log.info("从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位");
storagePos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds);
}
} else {
log.info("料仓" + storageCid + "有出库任务未完成,不允许入库");
throw new ValidateException("smfcore.error.storage.outNotEnd", "料仓{0}有出库任务未完成,不允许入库", new String[]{storageCid});
}
if (storagePos == null) {
throw new ValidateException("smfcore.error.storage.noPos", "{0}的料格[{1}]已满,无法继续放入", new String[]{storage.getName(), barcode.getPlateSize() + "x" + barcode.getHeight()});
}
log.info("[" + barcode.getBarcode() + "]寻找到" + storage.getName() + "的空仓位[" + storagePos.getPosName() + "]");
return storagePos;
}
/** /**
* 处理锡膏料仓相关信息 * 处理锡膏料仓相关信息
......
...@@ -104,4 +104,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> { ...@@ -104,4 +104,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
int getRemainPosCountByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId, String endStr) throws ValidateException; int getRemainPosCountByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId, String endStr) throws ValidateException;
StoragePos dualPosNameGetEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds,String lastPosId,String needMovePosName,String endStr,List<String> needExcludePosNameList) throws ValidateException; StoragePos dualPosNameGetEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds,String lastPosId,String needMovePosName,String endStr,List<String> needExcludePosNameList) throws ValidateException;
StoragePos getSpEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds,String endStr) throws ValidateException;
} }
...@@ -1129,4 +1129,51 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -1129,4 +1129,51 @@ public class StoragePosManagerImpl implements IStoragePosManager {
} }
return pos; return pos;
} }
@Override
public StoragePos getSpEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds,String endStr) throws ValidateException{
boolean warmPos=false;
Criteria c = Criteria.where("storageId").is(storage.getId());
COMPATIBLE_TYPE compatibleType = storage.getCompatibleType();
if(compatibleType == COMPATIBLE_TYPE.EXACT_MATCH){//完全匹配
c = c.and("w").is(barcode.getPlateSize()).and("h").is(barcode.getHeight());
}else if(compatibleType == COMPATIBLE_TYPE.FULLY_COMPATIBLE){//完全兼容
c = c.and("w").gte(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//宽度大于等于料盘宽度,高度大于等于料盘高度
}else if(compatibleType == COMPATIBLE_TYPE.SIZE_COMPATIBLE){//同尺寸兼容
c = c.and("w").is(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//宽度等于料盘宽度,高度大于等于料盘高度
}else if(compatibleType==COMPATIBLE_TYPE.W13_15_COMPATIBLE){
//13/15寸兼容,如果是13寸盘,可以放15寸,其他按照同尺寸兼容
if(barcode.getPlateSize()==13){
c = c.and("w").in(barcode.getPlateSize(),15).and("h").gte(barcode.getHeight());
}else{
c = c.and("w").is(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//宽度等于料盘宽度,高度大于等于料盘高度
}
}
c = c.and("enabled").is(true)//可用
.and("used").is(false);//未使用
if(storage.isSolderPaste()){
if(warmPos){
c = c.and("warmPos").is(true);//回温库位
}else{
c = c.and("warmPos").ne(true);//不是回温库位
}
}
//去除的仓位
if(excludePosIds != null && !excludePosIds.isEmpty()){
c = c.and("id").nin(excludePosIds);
}
if (StringUtils.isNotEmpty(endStr)) {
String regex = "" + endStr + "$";
c.and("posName").regex(Pattern.compile(regex));
}
Query query = new Query(c);
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
query.with(Sort.by(Sort.Direction.ASC, "w").and(Sort.by(Sort.Direction.ASC, "h")).and(Sort.by(Sort.Direction.DESC, "priority")));
StoragePos pos = storagePosDao.findOne(query);
return pos;
}
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!