diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java index a27ac0da..27fc3cc8 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java @@ -249,6 +249,10 @@ public class ExcelServiceImpl implements ExcelService { } List excelVos = new ArrayList<>(); + + // 用于保存当前库位下的存储数量 + Map 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(); @@ -451,7 +466,7 @@ public class ExcelServiceImpl implements ExcelService { } // 读取表格模板 - String templateFileName = "static/upload/PrintTemplate.xlsx"; + String templateFileName = "static/upload/PrintTemplate.xlsx"; // 待打印主数据列表 List data = ListUtils.newArrayList(); @@ -576,7 +591,7 @@ public class ExcelServiceImpl implements ExcelService { data.add(excelInfoByWrite); } // 生成的表格 - String fileName = System.getProperty("java.io.tmpdir") + File.separator+"PrintTemplate" + System.currentTimeMillis() + ".xlsx"; + String fileName = System.getProperty("java.io.tmpdir") + File.separator + "PrintTemplate" + System.currentTimeMillis() + ".xlsx"; ClassPathResource classPathResourceForTemplate = new ClassPathResource(templateFileName); File fileForTemplate = null; try { diff --git a/target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html b/target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html index 108348f4..4016c94c 100644 --- a/target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html +++ b/target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html @@ -63,7 +63,7 @@ } else { wxScan = wxScan.parent.wx; } - /*wxScan.scanQRCode({ + wxScan.scanQRCode({ desc: 'scanQRCode desc', needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 @@ -82,11 +82,7 @@ } - });*/ - var result = "1638361349087338496";//当needResult为1时返回处理结果 - var req = {}; - req.qrCode = result; - outboundLogic(req); + }); });