|
|
|
@ -249,6 +249,10 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
} |
|
|
|
|
|
|
|
List<ExcelInfoByInventory> excelVos = new ArrayList<>(); |
|
|
|
|
|
|
|
// 用于保存当前库位下的存储数量
|
|
|
|
Map<Integer, Integer> placeToQuantity = new HashMap<>(); |
|
|
|
|
|
|
|
// 判断当前库位码是否正确,并存入库位中
|
|
|
|
for (int i = 0; i < excelInfoByInventories.size(); i++) { |
|
|
|
// 获取当前库存记录
|
|
|
|
@ -291,7 +295,12 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
Place place = placeByCondition.get(0); |
|
|
|
// 如果库位有物料且该库位存放的物料为当前物料
|
|
|
|
int quantity = (int) (ObjectFormatUtil.toDouble(excelInfoByInventory.getQuantity()) * 100); |
|
|
|
if (quantity > place.getMax() - place.getQuantity()) { |
|
|
|
// 获取当前库位的剩余存储量
|
|
|
|
Integer pQuantity = placeToQuantity.get(place.getId()); |
|
|
|
if (pQuantity == null) { |
|
|
|
pQuantity = place.getMax() - place.getQuantity(); |
|
|
|
} |
|
|
|
if (quantity > pQuantity) { |
|
|
|
// 如果当前库位无法放下
|
|
|
|
String s = dataIndex.get(i); |
|
|
|
String msg = s + "出现异常:" + excelInfoByInventory.getDepositoryCode() + " 该库位无法存放当前数目的物料"; |
|
|
|
@ -299,7 +308,10 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
excelVos.add(excelInfoByInventory); |
|
|
|
pQuantity -= quantity; |
|
|
|
placeToQuantity.put(place.getId(), pQuantity); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
String s = dataIndex.get(i); |
|
|
|
String msg = s + "出现异常:" + excelInfoByInventory.getDepositoryCode() + " 该仓库没有该库位"; |
|
|
|
@ -345,7 +357,10 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
insert.put("mid", material.getId()); |
|
|
|
|
|
|
|
// 插入库存记录
|
|
|
|
materialService.insertInventoryForImport(insert); |
|
|
|
Integer integer = materialService.insertInventoryForImport(insert); |
|
|
|
System.out.println("~~~~~~~~"); |
|
|
|
System.out.println(integer); |
|
|
|
System.out.println(insert); |
|
|
|
|
|
|
|
// 将该物料同时放入默认库位中
|
|
|
|
String placeCode = excelInfoByInventory.getDepositoryCode(); |
|
|
|
|