|
|
|
@ -99,7 +99,7 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
param.put("texture", excelVo.getTexture()); |
|
|
|
param.put("materialTypeId", excelVo.getTypeId()); |
|
|
|
param.put("id", excelVo.getId()); |
|
|
|
param.put("price",excelVo.getPrice() == null ? "0" : excelVo.getPrice()); |
|
|
|
param.put("price", excelVo.getPrice() == null ? "0" : excelVo.getPrice()); |
|
|
|
materialService.insertMaterial(param); |
|
|
|
success.add(excelVo); |
|
|
|
} |
|
|
|
@ -244,14 +244,16 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
// 获取当前库存明细规格
|
|
|
|
String version = excelInfoByInventory.getVersion(); |
|
|
|
// 用于查询当前物料中是否存在该记录
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
map.put("mname",mname); |
|
|
|
map.put("version",version); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("mname", mname); |
|
|
|
map.put("version", version); |
|
|
|
List<Material> materialPByCondition = materialService.findMaterialPByConditionForTable(map); |
|
|
|
if(materialPByCondition.size() == 0){ |
|
|
|
|
|
|
|
Material materialByCode = materialService.findMaterialByCode(excelInfoByInventory.getCode()); |
|
|
|
if(materialByCode == null){ |
|
|
|
if (materialPByCondition.size() == 0) { |
|
|
|
Material materialByCode = null; |
|
|
|
if (excelInfoByInventory.getCode() != null && !"".equals(excelInfoByInventory.getCode())) { |
|
|
|
materialByCode = materialService.findMaterialByCode(excelInfoByInventory.getCode()); |
|
|
|
} |
|
|
|
if (materialByCode == null) { |
|
|
|
// 如果没有当前物料
|
|
|
|
String s = dataIndex.get(i); |
|
|
|
String msg = s + "出现异常:" + excelInfoByInventory.getMname() + " 系统中并未存在该物料"; |
|
|
|
@ -273,7 +275,7 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
// 如果有库位
|
|
|
|
Place place = placeByCondition.get(0); |
|
|
|
// 如果库位有物料且该库位存放的物料为当前物料
|
|
|
|
int quantity = (int)(ObjectFormatUtil.toDouble(excelInfoByInventory.getQuantity()) * 100); |
|
|
|
int quantity = (int) (ObjectFormatUtil.toDouble(excelInfoByInventory.getQuantity()) * 100); |
|
|
|
if (quantity > place.getMax() - place.getQuantity()) { |
|
|
|
// 如果当前库位无法放下
|
|
|
|
String s = dataIndex.get(i); |
|
|
|
@ -307,13 +309,12 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
ExcelInfoByInventory excelInfoByInventory = excelVos.get(i); |
|
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
|
insert.put("mname", excelInfoByInventory.getMname()); |
|
|
|
insert.put("version",excelInfoByInventory.getVersion()); |
|
|
|
insert.put("version", excelInfoByInventory.getVersion()); |
|
|
|
|
|
|
|
|
|
|
|
Material material = materialService.findMaterialByMnameAndVersion(insert); |
|
|
|
if(material == null) |
|
|
|
{ |
|
|
|
material = materialService.findMaterialByCode(excelInfoByInventory.getCode()); |
|
|
|
if (material == null) { |
|
|
|
material = materialService.findMaterialByCode(excelInfoByInventory.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
// 添加库存记录
|
|
|
|
@ -334,7 +335,7 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
if (isNew) { |
|
|
|
SplitInfo baseSplitInfoForMid = splitUnitService.findBaseSplitInfoForMid(material.getId()); |
|
|
|
double quantity_residue = 0; |
|
|
|
if(baseSplitInfoForMid != null){ |
|
|
|
if (baseSplitInfoForMid != null) { |
|
|
|
quantity_residue = quantity - Math.floor(quantity); |
|
|
|
quantity = quantity - quantity_residue; |
|
|
|
} |
|
|
|
@ -345,12 +346,12 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
// 获取默认库位
|
|
|
|
Place placeById = placeService.findPlaceById(0); |
|
|
|
// 修改默认库位库存
|
|
|
|
placeById.setQuantity(placeById.getQuantity() + (int)(quantity * 100)); |
|
|
|
placeById.setQuantity(placeById.getQuantity() + (int) (quantity * 100)); |
|
|
|
placeService.UpdatePlace(placeById); |
|
|
|
// 添加库位与物料的映射
|
|
|
|
param.put("mid", insert.get("id")); |
|
|
|
param.put("pid", 0); |
|
|
|
param.put("quantity", (int)(quantity * 100)); |
|
|
|
param.put("quantity", (int) (quantity * 100)); |
|
|
|
placeService.addMaterialOnPlace(param); |
|
|
|
placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialById(ObjectFormatUtil.toInteger(param.get("id"))); |
|
|
|
} else { |
|
|
|
@ -362,19 +363,19 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
Place placeByCondition = placeService.findPlaceByCondition(param).get(0); |
|
|
|
// 修改库位物料数量
|
|
|
|
|
|
|
|
placeByCondition.setQuantity(placeByCondition.getQuantity() + (int)(quantity * 100)); |
|
|
|
placeByCondition.setQuantity(placeByCondition.getQuantity() + (int) (quantity * 100)); |
|
|
|
placeService.UpdatePlace(placeByCondition); |
|
|
|
|
|
|
|
// 如果没有对应关系
|
|
|
|
param.put("pid", placeByCondition.getId()); |
|
|
|
param.put("mid", insert.get("id")); |
|
|
|
param.put("quantity", (int)(quantity * 100)); |
|
|
|
param.put("quantity", (int) (quantity * 100)); |
|
|
|
// 添加对应关系
|
|
|
|
placeService.addMaterialOnPlace(param); |
|
|
|
placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialById(ObjectFormatUtil.toInteger(param.get("id"))); |
|
|
|
} |
|
|
|
|
|
|
|
if(baseSplitInfoForMid != null){ |
|
|
|
if (baseSplitInfoForMid != null) { |
|
|
|
Map<String, Object> insertForSplitInfoStringObjectMap = new HashMap<>(); |
|
|
|
insertForSplitInfoStringObjectMap.put("depositoryId", depositoryId); |
|
|
|
insertForSplitInfoStringObjectMap.put("quantity", quantity_residue); |
|
|
|
@ -382,7 +383,7 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
insertForSplitInfoStringObjectMap.put("mid", material.getId()); |
|
|
|
insertForSplitInfoStringObjectMap.put("unit", baseSplitInfoForMid.getNewUnit()); |
|
|
|
SplitInventory splitInventoryByIidAndSid = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), baseSplitInfoForMid.getId()); |
|
|
|
int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(baseSplitInfoForMid,-1); |
|
|
|
int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(baseSplitInfoForMid, -1); |
|
|
|
splitUnitService.realInInventoryToDepository(quantity_residue * splitInfoScaleQuantity, splitInventoryByIidAndSid, insertForSplitInfoStringObjectMap, baseSplitInfoForMid, placeAndMaterialByMidAndPid, true); |
|
|
|
if (insertForSplitInfoStringObjectMap.containsKey("applicationInId")) { |
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForSplitInfoStringObjectMap.get("applicationInId"))); |
|
|
|
|