优化库存查询逻辑,直接查库存表
This commit is contained in:
@@ -158,7 +158,7 @@ public class DepotItemController {
|
|||||||
if(StringUtil.isNotEmpty(materialVo4Unit.getSku())){
|
if(StringUtil.isNotEmpty(materialVo4Unit.getSku())){
|
||||||
stock = depotItemService.getSkuStockByParam(depotId,materialVo4Unit.getMeId(),null,null);
|
stock = depotItemService.getSkuStockByParam(depotId,materialVo4Unit.getMeId(),null,null);
|
||||||
} else {
|
} else {
|
||||||
stock = depotItemService.getStockByParam(depotId,materialVo4Unit.getId(),null,null);
|
stock = depotItemService.getCurrentStockByParam(depotId, materialVo4Unit.getId());
|
||||||
if(materialVo4Unit.getUnitId()!=null) {
|
if(materialVo4Unit.getUnitId()!=null) {
|
||||||
Unit unit = unitService.getUnit(materialVo4Unit.getUnitId());
|
Unit unit = unitService.getUnit(materialVo4Unit.getUnitId());
|
||||||
String commodityUnit = materialVo4Unit.getCommodityUnit();
|
String commodityUnit = materialVo4Unit.getCommodityUnit();
|
||||||
@@ -228,7 +228,7 @@ public class DepotItemController {
|
|||||||
if(StringUtil.isNotEmpty(diEx.getSku())){
|
if(StringUtil.isNotEmpty(diEx.getSku())){
|
||||||
stock = depotItemService.getSkuStockByParam(diEx.getDepotId(),diEx.getMaterialExtendId(),null,null);
|
stock = depotItemService.getSkuStockByParam(diEx.getDepotId(),diEx.getMaterialExtendId(),null,null);
|
||||||
} else {
|
} else {
|
||||||
stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null);
|
stock = depotItemService.getCurrentStockByParam(diEx.getDepotId(),diEx.getMaterialId());
|
||||||
if (StringUtil.isNotEmpty(unitInfo.getName())) {
|
if (StringUtil.isNotEmpty(unitInfo.getName())) {
|
||||||
stock = unitService.parseStockByUnit(stock, unitInfo, materialUnit);
|
stock = unitService.parseStockByUnit(stock, unitInfo, materialUnit);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ public class MaterialController {
|
|||||||
if(StringUtil.isNotEmpty(material.getSku())){
|
if(StringUtil.isNotEmpty(material.getSku())){
|
||||||
stock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
|
stock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
|
||||||
} else {
|
} else {
|
||||||
stock = depotItemService.getStockByParam(depotId,material.getId(),null,null);
|
stock = depotItemService.getCurrentStockByParam(depotId, material.getId());
|
||||||
if (material.getUnitId()!=null){
|
if (material.getUnitId()!=null){
|
||||||
String commodityUnit = material.getCommodityUnit();
|
String commodityUnit = material.getCommodityUnit();
|
||||||
stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
|
stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
|
||||||
@@ -546,7 +546,7 @@ public class MaterialController {
|
|||||||
if (StringUtil.isNotEmpty(mvo.getSku())) {
|
if (StringUtil.isNotEmpty(mvo.getSku())) {
|
||||||
stock = depotItemService.getSkuStockByParam(mvo.getDepotId(), mvo.getMeId(), null, null);
|
stock = depotItemService.getSkuStockByParam(mvo.getDepotId(), mvo.getMeId(), null, null);
|
||||||
} else {
|
} else {
|
||||||
stock = depotItemService.getStockByParam(mvo.getDepotId(), mvo.getId(), null, null);
|
stock = depotItemService.getCurrentStockByParam(mvo.getDepotId(), mvo.getId());
|
||||||
if (mvo.getUnitId() != null) {
|
if (mvo.getUnitId() != null) {
|
||||||
Unit unit = unitService.getUnit(mvo.getUnitId());
|
Unit unit = unitService.getUnit(mvo.getUnitId());
|
||||||
String commodityUnit = mvo.getCommodityUnit();
|
String commodityUnit = mvo.getCommodityUnit();
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ public class DepotItemService {
|
|||||||
}
|
}
|
||||||
//出库时判断库存是否充足
|
//出库时判断库存是否充足
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||||
BigDecimal stock = getStockByParam(depotItem.getDepotId(),depotItem.getMaterialId(),null,null);
|
BigDecimal stock = getCurrentStockByParam(depotItem.getDepotId(),depotItem.getMaterialId());
|
||||||
if(StringUtil.isNotEmpty(depotItem.getSku())) {
|
if(StringUtil.isNotEmpty(depotItem.getSku())) {
|
||||||
//对于sku商品要换个方式计算库存
|
//对于sku商品要换个方式计算库存
|
||||||
stock = getSkuStockByParam(depotItem.getDepotId(),depotItem.getMaterialExtendId(),null,null);
|
stock = getSkuStockByParam(depotItem.getDepotId(),depotItem.getMaterialExtendId(),null,null);
|
||||||
@@ -1146,7 +1146,7 @@ public class DepotItemService {
|
|||||||
if(StringUtil.isNotEmpty(m.getSku())){
|
if(StringUtil.isNotEmpty(m.getSku())){
|
||||||
stock = getSkuStockByParam(null, m.getMeId(),null,null);
|
stock = getSkuStockByParam(null, m.getMeId(),null,null);
|
||||||
} else {
|
} else {
|
||||||
stock = depotItemMapperEx.getCurrentStockByParam(null, m.getId());
|
stock = getCurrentStockByParam(null, m.getId());
|
||||||
}
|
}
|
||||||
item.put("stock", stock);
|
item.put("stock", stock);
|
||||||
item.put("unit", m.getCommodityUnit());
|
item.put("unit", m.getCommodityUnit());
|
||||||
@@ -1214,4 +1214,9 @@ public class DepotItemService {
|
|||||||
}
|
}
|
||||||
return depotItemMapperEx.getLastUnitPriceByParam(organId, meId, type, subType);
|
return depotItemMapperEx.getLastUnitPriceByParam(organId, meId, type, subType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCurrentStockByParam(Long depotId, Long mId) {
|
||||||
|
return depotItemMapperEx.getCurrentStockByParam(depotId, mId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user