From ce9ebbc6b18d9b21d6758ad15e46362565811571 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Tue, 20 Jun 2023 08:45:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=97=B6=E5=8F=AF=E4=BB=A5=E6=A0=B9=E6=8D=AE=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E8=BF=9B=E8=A1=8C=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ExcelServiceImpl.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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 961d5d72..4079bf41 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 @@ -668,7 +668,22 @@ public class ExcelServiceImpl implements ExcelService { if (remark != null) { insert.put("remark", remark); } - if (unit == null || "".equals(unit) || unit.equals(material.getUnit())) { + Map paramForSplitInfo = new HashMap<>(); + ; + paramForSplitInfo.put("mid", material.getId()); + + SplitInfo splitInfo = null; + // 设置标志用于标志当前导入是否使用基础单位 (默认基础单位) + boolean flagForUnit = true; + if (!(unit == null || "".equals(unit) || unit.equals(material.getUnit()))) { + paramForSplitInfo.put("newUnit", unit); + splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo); + if (splitInfo != null) { + // 如果存在当前单位 + flagForUnit = false; + } + } + if (flagForUnit) { // 如果没填写单位或者填写的为基础单位 // 插入库存记录 @@ -748,7 +763,7 @@ public class ExcelServiceImpl implements ExcelService { } } else { // 插入库存记录 - insert.put("unit",unit); + insert.put("unit", unit); successCount += splitUnitService.insertInventoryForImport(insert); }