Commit 0ee4aae6 LN

入库时查找最匹配的库位

1 个父辈 82db65f6
...@@ -915,6 +915,7 @@ public class TaskService { ...@@ -915,6 +915,7 @@ public class TaskService {
private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Set<String> hasOutTaskStorageIds, String lastPosId) { private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Set<String> hasOutTaskStorageIds, String lastPosId) {
StoragePos findPos=null;
//第一遍查找,先不查找有出库任务的料仓 //第一遍查找,先不查找有出库任务的料仓
for (Storage storage : availbleStorageList) { for (Storage storage : availbleStorageList) {
if(!storage.isSmdDuo()){//DUO料仓无论是否有出库任务,都可以查找空库位 if(!storage.isSmdDuo()){//DUO料仓无论是否有出库任务,都可以查找空库位
...@@ -927,7 +928,17 @@ public class TaskService { ...@@ -927,7 +928,17 @@ public class TaskService {
log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位"); log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId); StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId);
if (pos != null) { if (pos != null) {
return pos; //判断尺寸是否一致
if(isSameSize(barcode,pos)){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],尺寸与条码一致,直接返回");
return pos;
}else if(findPos==null){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],尺寸不一致,先暂存库位");
findPos=pos;
}else if(findPos.getW()> pos.getW()||findPos.getH()>pos.getH()){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],比暂存库位["+findPos.getPosName()+"]跟匹配,替换为暂存库位");
findPos=pos;
}
} }
} catch (Exception e) { } catch (Exception e) {
log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage()); log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage());
...@@ -940,12 +951,25 @@ public class TaskService { ...@@ -940,12 +951,25 @@ public class TaskService {
log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位"); log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId); StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId);
if (pos != null) { if (pos != null) {
return pos; if(isSameSize(barcode,pos)){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],尺寸与条码一致,直接返回");
return pos;
}else if(findPos==null){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],尺寸不一致,先暂存库位");
findPos=pos;
}else if(findPos.getW()> pos.getW()||findPos.getH()>pos.getH()){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],比暂存库位["+findPos.getPosName()+"]跟匹配,替换为暂存库位");
findPos=pos;
}
} }
} catch (Exception e) { } catch (Exception e) {
log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage()); log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage());
} }
} }
if(findPos!=null){
log.info("为[" + barcode.getBarcode() + "]未查找到尺寸一直的库位,返回暂存的库位["+findPos.getPosName()+"]");
return findPos;
}
try { try {
String cids = ""; String cids = "";
for (Storage storage : availbleStorageList) { for (Storage storage : availbleStorageList) {
...@@ -959,6 +983,12 @@ public class TaskService { ...@@ -959,6 +983,12 @@ public class TaskService {
return null; return null;
} }
private boolean isSameSize(Barcode barcode,StoragePos pos){
if(barcode.getPlateSize()==pos.getW()&&barcode.getHeight()==pos.getH()){
return true;
}
return false;
}
/** /**
* 检查二维码是否合法并且可以入库,没问题的话存入到数据库 * 检查二维码是否合法并且可以入库,没问题的话存入到数据库
......
...@@ -44,6 +44,11 @@ import java.util.concurrent.atomic.AtomicLong; ...@@ -44,6 +44,11 @@ import java.util.concurrent.atomic.AtomicLong;
@Controller @Controller
@RequestMapping("/rest/api") @RequestMapping("/rest/api")
public class PanaApiController extends BaseSmfApiListener { public class PanaApiController extends BaseSmfApiListener {
// api:
// name: PanaCIM
// codeResolveUrl: PanaCIM
// outNotifyUrl: PanaCIM
// inNotifyUrl: PanaCIM
@Autowired @Autowired
protected TaskService taskService; protected TaskService taskService;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!