Commit 19c7060e zshaohui

分配库位 A/B面 交叉分配

1 个父辈 ee86c62e
......@@ -41,7 +41,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds) throws ValidateException;
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 logotype) throws ValidateException;
List<StoragePos> findNotEmpty();
......
......@@ -7,6 +7,8 @@ import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.PointUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.bean.PlateSizeBean;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.storage.bean.InventoryItem;
......@@ -30,6 +32,7 @@ import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
@Service
@Slf4j
......@@ -373,7 +376,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
@Override
public StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds,String lastPosId) throws ValidateException {
public StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds,String lastPosId,String logotype) throws ValidateException {
Criteria c = Criteria.where("storageId").is(storage.getId());
......@@ -395,6 +398,12 @@ public class StoragePosManagerImpl implements IStoragePosManager {
if (excludePosIds != null && !excludePosIds.isEmpty()) {
c = c.and("id").nin(excludePosIds);
}
//分AB面
if (StringUtils.isNotBlank(logotype)){
c = c.and("posName").regex(Pattern.compile(QueryHelp.escapeExprSpecialWord(logotype),Pattern.CASE_INSENSITIVE));
}
Query query = new Query(c);
String msg = "";
......
......@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
* Created by sunke on 2021/7/13.
......@@ -56,6 +57,12 @@ public class TaskService {
private SmfApi smfApi;
/**
* key 为料仓id
* value 为A,B面
*/
private static Map<String,String> logotypeMap = new ConcurrentHashMap<>();
/**
* 任务队列,Key 为dataLog的ID,value 为本区域待执行的任务
*/
private static Map<String, DataLog> taskMap = Maps.newConcurrentMap();
......@@ -661,7 +668,34 @@ public class TaskService {
try {
Collection<String> operatingPosIds = excludePosIds();
log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId);
StoragePos pos = null;
if (!storage.isXLC()) {
//如果为空的话 先查询A面
String logotype = "";
if (logotypeMap.get(storage.getCid()) == null) {
logotype = "AA";
} else {
logotype = logotypeMap.get(storage.getCid());
}
if ("AA".equals(logotype)) {
logotype = "BB";
} else {
logotype = "AA";
}
pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId, logotype);
if (pos == null) {
if ("AA".equals(logotype)) {
logotype = "BB";
} else {
logotype = "AA";
}
}
pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId, logotype);
logotypeMap.put(storage.getCid(), logotype);
}
if (pos == null) {
pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId, null);
}
if (pos != null) {
return pos;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!