|
|
@ -283,7 +283,7 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
if (placeCode != null && !placeCode.isEmpty()) { |
|
|
if (placeCode != null && !placeCode.isEmpty()) { |
|
|
Map<String, Object> placeMap = new HashMap<>(); |
|
|
Map<String, Object> placeMap = new HashMap<>(); |
|
|
placeMap.put("did", depositoryId); |
|
|
placeMap.put("did", depositoryId); |
|
|
placeMap.put("code", placeCode); |
|
|
placeMap.put("kingdeecode", placeCode); |
|
|
// 根据仓库及库位码获取库位
|
|
|
// 根据仓库及库位码获取库位
|
|
|
List<Place> placeByCondition = placeService.findPlaceByCondition(placeMap); |
|
|
List<Place> placeByCondition = placeService.findPlaceByCondition(placeMap); |
|
|
if (placeByCondition.size() > 0) { |
|
|
if (placeByCondition.size() > 0) { |
|
|
@ -298,7 +298,6 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
errMsg.add(msg); |
|
|
errMsg.add(msg); |
|
|
continue; |
|
|
continue; |
|
|
} else { |
|
|
} else { |
|
|
excelInfoByInventory.setDepositoryCode(place.getCode()); |
|
|
|
|
|
excelVos.add(excelInfoByInventory); |
|
|
excelVos.add(excelInfoByInventory); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
@ -320,8 +319,7 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
Future<Object> objectFuture = taskCenterUtil.submitTask(() -> { |
|
|
Future<Object> objectFuture = taskCenterUtil.submitTask(() -> { |
|
|
List<Object> success = new ArrayList<>(); |
|
|
List<Object> success = new ArrayList<>(); |
|
|
Map<String, Object> returnResult = new HashMap<>(); |
|
|
Map<String, Object> returnResult = new HashMap<>(); |
|
|
for (int i = 0; i < excelVos.size(); i++) { |
|
|
for (ExcelInfoByInventory excelInfoByInventory : excelVos) { |
|
|
ExcelInfoByInventory excelInfoByInventory = excelVos.get(i); |
|
|
|
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
insert.put("mname", excelInfoByInventory.getMname()); |
|
|
insert.put("mname", excelInfoByInventory.getMname()); |
|
|
insert.put("version", excelInfoByInventory.getVersion()); |
|
|
insert.put("version", excelInfoByInventory.getVersion()); |
|
|
@ -350,7 +348,8 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
materialService.insertInventoryForImport(insert); |
|
|
materialService.insertInventoryForImport(insert); |
|
|
|
|
|
|
|
|
// 将该物料同时放入默认库位中
|
|
|
// 将该物料同时放入默认库位中
|
|
|
String placeCode = excelInfoByInventories.get(i).getDepositoryCode(); |
|
|
String placeCode = excelInfoByInventory.getDepositoryCode(); |
|
|
|
|
|
Place placeById = null; |
|
|
Boolean isNew = (Boolean) insert.get("isNew"); |
|
|
Boolean isNew = (Boolean) insert.get("isNew"); |
|
|
if (isNew) { |
|
|
if (isNew) { |
|
|
SplitInfo baseSplitInfoForMid = splitUnitService.findBaseSplitInfoForMid(material.getId()); |
|
|
SplitInfo baseSplitInfoForMid = splitUnitService.findBaseSplitInfoForMid(material.getId()); |
|
|
@ -361,10 +360,10 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
} |
|
|
} |
|
|
MaterialAndPlace placeAndMaterialByMidAndPid = null; |
|
|
MaterialAndPlace placeAndMaterialByMidAndPid = null; |
|
|
// 如果是新插入物料
|
|
|
// 如果是新插入物料
|
|
|
if (placeCode == null || placeCode.isEmpty() || "0".equals(placeCode)) { // 如果没有输入库位
|
|
|
if (placeCode == null || placeCode.isEmpty() || "0".equals(placeCode) || "0000".equals(placeCode) || "000000".equals(placeCode)) { // 如果没有输入库位
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
// 获取默认库位
|
|
|
// 获取默认库位
|
|
|
Place placeById = placeService.findPlaceById(0); |
|
|
placeById = placeService.findPlaceById(0); |
|
|
// 修改默认库位库存
|
|
|
// 修改默认库位库存
|
|
|
placeById.setQuantity(placeById.getQuantity() + (int) (quantity * 100)); |
|
|
placeById.setQuantity(placeById.getQuantity() + (int) (quantity * 100)); |
|
|
placeService.UpdatePlace(placeById); |
|
|
placeService.UpdatePlace(placeById); |
|
|
@ -378,16 +377,16 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
// 如果输入的库位不是默认库位
|
|
|
// 如果输入的库位不是默认库位
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("did", depositoryId); |
|
|
param.put("did", depositoryId); |
|
|
param.put("code", placeCode); |
|
|
param.put("kingdeecode", placeCode); |
|
|
// 获取要导入的库位
|
|
|
// 获取要导入的库位
|
|
|
Place placeByCondition = placeService.findPlaceByCondition(param).get(0); |
|
|
placeById = placeService.findPlaceByCondition(param).get(0); |
|
|
// 修改库位物料数量
|
|
|
// 修改库位物料数量
|
|
|
|
|
|
|
|
|
placeByCondition.setQuantity(placeByCondition.getQuantity() + (int) (quantity * 100)); |
|
|
placeById.setQuantity(placeById.getQuantity() + (int) (quantity * 100)); |
|
|
placeService.UpdatePlace(placeByCondition); |
|
|
placeService.UpdatePlace(placeById); |
|
|
|
|
|
|
|
|
// 如果没有对应关系
|
|
|
// 如果没有对应关系
|
|
|
param.put("pid", placeByCondition.getId()); |
|
|
param.put("pid", placeById.getId()); |
|
|
param.put("mid", insert.get("id")); |
|
|
param.put("mid", insert.get("id")); |
|
|
param.put("quantity", (int) (quantity * 100)); |
|
|
param.put("quantity", (int) (quantity * 100)); |
|
|
// 添加对应关系
|
|
|
// 添加对应关系
|
|
|
@ -399,7 +398,7 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
Map<String, Object> insertForSplitInfoStringObjectMap = new HashMap<>(); |
|
|
Map<String, Object> insertForSplitInfoStringObjectMap = new HashMap<>(); |
|
|
insertForSplitInfoStringObjectMap.put("depositoryId", depositoryId); |
|
|
insertForSplitInfoStringObjectMap.put("depositoryId", depositoryId); |
|
|
insertForSplitInfoStringObjectMap.put("quantity", quantity_residue); |
|
|
insertForSplitInfoStringObjectMap.put("quantity", quantity_residue); |
|
|
insertForSplitInfoStringObjectMap.put("placeId", "0"); |
|
|
insertForSplitInfoStringObjectMap.put("placeId", placeById.getId().toString()); |
|
|
insertForSplitInfoStringObjectMap.put("mid", material.getId()); |
|
|
insertForSplitInfoStringObjectMap.put("mid", material.getId()); |
|
|
insertForSplitInfoStringObjectMap.put("unit", baseSplitInfoForMid.getNewUnit()); |
|
|
insertForSplitInfoStringObjectMap.put("unit", baseSplitInfoForMid.getNewUnit()); |
|
|
SplitInventory splitInventoryByIidAndSid = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), baseSplitInfoForMid.getId()); |
|
|
SplitInventory splitInventoryByIidAndSid = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), baseSplitInfoForMid.getId()); |
|
|
|