Commit aea41fc3 LN

NLM料架扫码入库功能。合并库位可配置。

1 个父辈 8d8ec34d
......@@ -217,8 +217,8 @@ public class DataInitManager {
materialBox.setHidden(true);
outSet.setHidden(true);
posOut.setHidden(true);
// zhuanruMenu.setHidden(true);
// singleMenu.setHidden(true);
zhuanruMenu.setHidden(true);
singleMenu.setHidden(true);
// orderSet.setHidden(true);
menus.addAll(createMenus(poutOut, menuOrder, out,posOut,groupOut,materialBox,outSet,inOrderMenu,putinMenu,zhuanruMenu,singleMenu));
......@@ -257,6 +257,7 @@ public class DataInitManager {
Menu menuLog = new Menu(new ArrayList<Menu>(), 1, "taskLog", "物料日志", 1, "taskLog", "neolight/taskLog/index", "", 0, "education");
Menu msgLog = new Menu(new ArrayList<Menu>(), 1, "message", "消息查询", 1, "message", "neolight/message/index", "", 0, "messagefind");
Menu exceptionLog = new Menu(new ArrayList<Menu>(), 1, "interfaceException", "接口异常", 1, "interfaceException", "neolight/interfaceException/index", "", 0, "messagefind");
exceptionLog.setHidden(true);
menus.addAll(createMenus(pMenuLog, menuLog,msgLog,exceptionLog));
//报表:出入库、库存
......
......@@ -60,4 +60,8 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
public void updateBarcodeMsd(String pn,String msl,String thickness);
void download(List<StoragePos> storagePos, HttpServletResponse response, Locale locale) throws IOException;
List<StoragePos> findPosList(String storageId, List<String> posNames);
List<StoragePos> getSameSizeContinuityEmptyPosList(Storage storage, Barcode barcode) throws ValidateException;
}
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.storage.service.manager.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException;
......@@ -37,6 +38,7 @@ import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@Service
@Slf4j
......@@ -179,8 +181,34 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
@Override
public StoragePos save(StoragePos object) throws ValidateException {
return storagePosDao.save(object);
public List<StoragePos> findPosList(String storageId, List<String> posNames){
if(posNames == null || posNames.isEmpty()){
return Lists.newArrayList();
}
Criteria c = Criteria.where("storageId").is(storageId)
.and("posName").in(posNames);
Query q = new Query(c);
return storagePosDao.findByQuery(q);
}
@Override
public StoragePos save(StoragePos storagePos) throws ValidateException {
if(!storagePos.isUsed()){
//出库
List<String> mergePosNames = storagePos.getMergePosList();
List<StoragePos> mergePosList = findPosList(storagePos.getStorageId(), mergePosNames);
//解除相关合并库位的占用状态
for(StoragePos mergePos : mergePosList){
mergePos.setUsed(false);
mergePos.setMergePosList(null);
storagePosDao.save(mergePos);
log.info("设置合并的关联库位["+mergePos.getPosName()+"]使用状态为:false");
}
storagePos.setMergePosList(null);
}
storagePos = storagePosDao.save(storagePos);
//reSortStoragePosList(storage.getId());
log.debug("Storage " + storagePos.getId() + " was added new slot with id: " + storagePos.getId());
return storagePos;
}
@Override
......@@ -499,5 +527,84 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
FileUtil.downloadExcel(list, response);
}
/**
* 查找同尺寸连续的库位,合并库位放置料盘,仅用于智能料架
* @param storage
* @param barcode
* @return
*/
@Override
public List<StoragePos> getSameSizeContinuityEmptyPosList(Storage storage, Barcode barcode) throws ValidateException {
if(storage == null||(!storage.isNLMShelf())){
//只适合移动料架NLM
throw new ValidateException( "smfcore.shelf.nlm.notFound", "未找到移动料架{0}",new String[]{storage.getId()});
}
if(!storage.isMergePos()){
return new ArrayList<>();
}
Criteria c = Criteria.where("storageId").is(storage.getId());
if(barcode.getPlateSize() > 7){
c = c.and("w").gte(barcode.getPlateSize());
}else{
c = c.and("w").is(barcode.getPlateSize());
}
c = c.and("h").gte(0);//宽度大于等于料盘宽度,高度大于等于料盘高度
c = c.and("enabled").is(true)//可用
.and("used").is(false);//未使用
Query query = new Query(c);
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
query.with(Sort.by(Sort.Direction.ASC, "posName"));
List<StoragePos> posList = storagePosDao.findByQuery(query);
//把不连续的过滤掉
Map<String,StoragePos> posMap = new ConcurrentHashMap<>();
for(StoragePos pos : posList){
posMap.put(pos.getPosName(),pos);
}
Set<String> posNames = posMap.keySet();
for (String posName : posNames) {
StoragePos currentPos = posMap.get(posName);
int totalHeight = currentPos.getH();
List<StoragePos> emptyPosList = new ArrayList<>();
emptyPosList.add(currentPos);
String nextPosName = posName;
while (true){
if(totalHeight >= barcode.getHeight()){
return emptyPosList;
}
nextPosName = getNextPosName(nextPosName);
StoragePos nextPos = posMap.get(nextPosName);
if(nextPos == null){
break;
}
emptyPosList.add(nextPos);
totalHeight = totalHeight + currentPos.getH();
}
}
return new ArrayList<>();
}
/**
* 获取下一库位的库位名(后缀数字+1)
*/
private String getNextPosName(String posName){
String posIndexStr = "";
String prefixStr = "";
for(int i=1;i<=posName.length();i++){
char c = posName.charAt(posName.length() - i);
if(!Character.isDigit(c)){
prefixStr = posName.substring(0, posName.length() - i + 1);
break;
}
posIndexStr = c + posIndexStr;
}
if(posIndexStr.isEmpty()){
return "";
}
int posIndex = Integer.valueOf(posIndexStr);
int nextPosIndex = posIndex + 1;
return prefixStr +String.format("%0"+posIndexStr.length()+"d",nextPosIndex);
}
}
......@@ -17,3 +17,13 @@
2.库位页面调整。
3.登录页面增加语言切换。
4.共享文件夹页面调整。
20220304:
个人中心增加进入调试模式功能。
20220307:
启用禁用库位增加操作日志。
20220314:
增加移动料架:NLM,入库时自动推荐库位,无合适库位时自动合并库位。
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!