Commit da526fa8 authored by 季圣华's avatar 季圣华
Browse files

优化商品的库存展示和初始库存计算的逻辑

parent 0b1540a8
...@@ -132,7 +132,7 @@ public class MaterialService { ...@@ -132,7 +132,7 @@ public class MaterialService {
Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list); Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list);
for (MaterialVo4Unit m : list) { for (MaterialVo4Unit m : list) {
m.setMaterialOther(getMaterialOtherByParam(mpArr, m)); m.setMaterialOther(getMaterialOtherByParam(mpArr, m));
m.setStock(currentStockMap.get(m.getId())); m.setStock(currentStockMap.get(m.getId())!=null? currentStockMap.get(m.getId()): BigDecimal.ZERO);
resList.add(m); resList.add(m);
} }
} }
...@@ -182,7 +182,7 @@ public class MaterialService { ...@@ -182,7 +182,7 @@ public class MaterialService {
highSafeStock = jsonObj.getBigDecimal("highSafeStock"); highSafeStock = jsonObj.getBigDecimal("highSafeStock");
} }
Long depotId = jsonObj.getLong("id"); Long depotId = jsonObj.getLong("id");
if(StringUtil.isNotEmpty(number) && Double.valueOf(number)>0 || lowSafeStock!=null || highSafeStock!=null) { if(StringUtil.isNotEmpty(number) && Double.parseDouble(number)>0 || lowSafeStock!=null || highSafeStock!=null) {
insertInitialStockByMaterialAndDepot(depotId, mId, parseBigDecimalEx(number), lowSafeStock, highSafeStock); insertInitialStockByMaterialAndDepot(depotId, mId, parseBigDecimalEx(number), lowSafeStock, highSafeStock);
insertCurrentStockByMaterialAndDepot(depotId, mId, parseBigDecimalEx(number)); insertCurrentStockByMaterialAndDepot(depotId, mId, parseBigDecimalEx(number));
} }
...@@ -233,7 +233,7 @@ public class MaterialService { ...@@ -233,7 +233,7 @@ public class MaterialService {
MaterialInitialStockExample example = new MaterialInitialStockExample(); MaterialInitialStockExample example = new MaterialInitialStockExample();
example.createCriteria().andMaterialIdEqualTo(material.getId()).andDepotIdEqualTo(depotId); example.createCriteria().andMaterialIdEqualTo(material.getId()).andDepotIdEqualTo(depotId);
materialInitialStockMapper.deleteByExample(example); materialInitialStockMapper.deleteByExample(example);
if (StringUtil.isNotEmpty(number) && Double.parseDouble(number) != 0 || lowSafeStock!=null || highSafeStock!=null) { if (StringUtil.isNotEmpty(number) || lowSafeStock!=null || highSafeStock!=null) {
insertInitialStockByMaterialAndDepot(depotId, material.getId(), parseBigDecimalEx(number), lowSafeStock, highSafeStock); insertInitialStockByMaterialAndDepot(depotId, material.getId(), parseBigDecimalEx(number), lowSafeStock, highSafeStock);
} }
//更新当前库存 //更新当前库存
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment