Commit cb57bfe9 LN

扫码入库bug修改

1 个父辈 a696ee3f
...@@ -96,7 +96,7 @@ public class DeviceController { ...@@ -96,7 +96,7 @@ public class DeviceController {
* 流水线入库查找空的料格 * 流水线入库查找空的料格
*/ */
@ApiOperation("环行线扫码获取库位号") @ApiOperation("环行线扫码获取库位号")
@PostMapping(value = "/emptyPosForPutin") @PostMapping(value = "/service/store/emptyPosForPutin")
@ResponseBody @ResponseBody
@AnonymousAccess @AnonymousAccess
public Map<String,Object> emptyPosForPutin(HttpServletRequest request) { public Map<String,Object> emptyPosForPutin(HttpServletRequest request) {
......
...@@ -524,11 +524,11 @@ public class TaskService { ...@@ -524,11 +524,11 @@ public class TaskService {
* @param barcode * @param barcode
* @return * @return
*/ */
public StoragePos findEmptyPosForPutIn(List<Storage> storageList, Barcode barcode, String inRFID,String lastPosId) throws ValidateException{ public StoragePos findEmptyPosForPutIn(List<Storage> storageList, Barcode barcode, String inRFID,String lastPosId) throws ValidateException {
verifyBarcodePutIn(storageList ,barcode, inRFID); verifyBarcodePutIn(storageList, barcode, inRFID);
//查找任务数最少的料仓 //查找任务数最少的料仓
final Map<String,Integer> storageTaskCountMap = new HashMap<>(); final Map<String, Integer> storageTaskCountMap = new HashMap<>();
for (Storage storage : storageList) { for (Storage storage : storageList) {
storageTaskCountMap.put(storage.getId(), 0); storageTaskCountMap.put(storage.getId(), 0);
} }
...@@ -537,20 +537,20 @@ public class TaskService { ...@@ -537,20 +537,20 @@ public class TaskService {
//如果有正在执行的任务,把库位发过去 //如果有正在执行的任务,把库位发过去
Collection<DataLog> allTasks = taskMap.values(); Collection<DataLog> allTasks = taskMap.values();
for (DataLog task : allTasks) { for (DataLog task : allTasks) {
if(barcode.getBarcode().equals(task.getBarcode())){ if (barcode.getBarcode().equals(task.getBarcode())) {
String posId = task.getPosId(); String posId = task.getPosId();
log.info(barcode.getBarcode() + " 已有任务,返回任务中的库位:" + task.getPosName()); log.info(barcode.getBarcode() + " 已有任务,返回任务中的库位:" + task.getPosName());
return storagePosManager.get(posId); return storagePosManager.get(posId);
} }
String storageId = task.getStorageId(); String storageId = task.getStorageId();
if(!Strings.isNullOrEmpty(storageId)){ if (!Strings.isNullOrEmpty(storageId)) {
Integer taskCount = storageTaskCountMap.get(storageId); Integer taskCount = storageTaskCountMap.get(storageId);
if(taskCount != null){ if (taskCount != null) {
taskCount = taskCount + 1; taskCount = taskCount + 1;
storageTaskCountMap.put(storageId, taskCount); storageTaskCountMap.put(storageId, taskCount);
} }
if(task.isCheckOutTask()){ if (task.isCheckOutTask()) {
hasOutTaskStorageIds.add(storageId); hasOutTaskStorageIds.add(storageId);
} }
} }
...@@ -587,27 +587,26 @@ public class TaskService { ...@@ -587,27 +587,26 @@ public class TaskService {
//可用的料仓(在线,且可以放入) //可用的料仓(在线,且可以放入)
List<Storage> availbleStorageList = new ArrayList<>(); List<Storage> availbleStorageList = new ArrayList<>();
for(Storage storage : storageList){ for (Storage storage : storageList) {
if(storage.canPutIn(barcode.getPlateSize(),barcode.getHeight())){ if (storage.canPutIn(barcode.getPlateSize(), barcode.getHeight())) {
availbleStorageList.add(storage); availbleStorageList.add(storage);
} }
} }
if(availbleStorageList.isEmpty()){ if (availbleStorageList.isEmpty()) {
throw new ValidateException("smfcode.noValidStorage","料仓列表中未找到可用的料仓"); throw new ValidateException("smfcode.noValidStorage", "料仓列表中未找到可用的料仓");
} }
availbleStorageList.sort(new Comparator<Storage>() { availbleStorageList.sort(new Comparator<Storage>() {
@Override @Override
public int compare(Storage o1, Storage o2) { public int compare(Storage o1, Storage o2) {
Integer taskCount1 = storageTaskCountMap.get(o1.getId()); Integer taskCount1 = storageTaskCountMap.get(o1.getId());
Integer taskCount2 = storageTaskCountMap.get(o2.getId()); Integer taskCount2 = storageTaskCountMap.get(o2.getId());
return taskCount1.compareTo(taskCount2); return taskCount1.compareTo(taskCount2);
} }
}); });
// return findEmptyPosInStorages(barcode, availbleStorageList, storageTaskCountMap,lastPosId); return findEmptyPosInStorages(barcode, availbleStorageList, storageTaskCountMap, lastPosId);
return null;
} }
private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Map<String,Integer> executingTaskCountMap,String lastPosId){ private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Map<String,Integer> executingTaskCountMap,String lastPosId){
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!