Browse Source

修改库存导入时可以根据单位进行导入

lwx_dev
erdanergou 2 years ago
parent
commit
ce9ebbc6b1
  1. 19
      src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java

19
src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java

@ -668,7 +668,22 @@ public class ExcelServiceImpl implements ExcelService {
if (remark != null) { if (remark != null) {
insert.put("remark", remark); insert.put("remark", remark);
} }
if (unit == null || "".equals(unit) || unit.equals(material.getUnit())) { Map<String, Object> 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 { } else {
// 插入库存记录 // 插入库存记录
insert.put("unit",unit); insert.put("unit", unit);
successCount += splitUnitService.insertInventoryForImport(insert); successCount += splitUnitService.insertInventoryForImport(insert);
} }

Loading…
Cancel
Save