优化库存查询逻辑,直接查库存表

This commit is contained in:
季圣华
2023-08-06 22:43:35 +08:00
parent 086a5d412b
commit 79c2e6dbd3
3 changed files with 11 additions and 6 deletions

View File

@@ -158,7 +158,7 @@ public class DepotItemController {
if(StringUtil.isNotEmpty(materialVo4Unit.getSku())){
stock = depotItemService.getSkuStockByParam(depotId,materialVo4Unit.getMeId(),null,null);
} else {
stock = depotItemService.getStockByParam(depotId,materialVo4Unit.getId(),null,null);
stock = depotItemService.getCurrentStockByParam(depotId, materialVo4Unit.getId());
if(materialVo4Unit.getUnitId()!=null) {
Unit unit = unitService.getUnit(materialVo4Unit.getUnitId());
String commodityUnit = materialVo4Unit.getCommodityUnit();
@@ -228,7 +228,7 @@ public class DepotItemController {
if(StringUtil.isNotEmpty(diEx.getSku())){
stock = depotItemService.getSkuStockByParam(diEx.getDepotId(),diEx.getMaterialExtendId(),null,null);
} else {
stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null);
stock = depotItemService.getCurrentStockByParam(diEx.getDepotId(),diEx.getMaterialId());
if (StringUtil.isNotEmpty(unitInfo.getName())) {
stock = unitService.parseStockByUnit(stock, unitInfo, materialUnit);
}

View File

@@ -258,7 +258,7 @@ public class MaterialController {
if(StringUtil.isNotEmpty(material.getSku())){
stock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
} else {
stock = depotItemService.getStockByParam(depotId,material.getId(),null,null);
stock = depotItemService.getCurrentStockByParam(depotId, material.getId());
if (material.getUnitId()!=null){
String commodityUnit = material.getCommodityUnit();
stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
@@ -546,7 +546,7 @@ public class MaterialController {
if (StringUtil.isNotEmpty(mvo.getSku())) {
stock = depotItemService.getSkuStockByParam(mvo.getDepotId(), mvo.getMeId(), null, null);
} else {
stock = depotItemService.getStockByParam(mvo.getDepotId(), mvo.getId(), null, null);
stock = depotItemService.getCurrentStockByParam(mvo.getDepotId(), mvo.getId());
if (mvo.getUnitId() != null) {
Unit unit = unitService.getUnit(mvo.getUnitId());
String commodityUnit = mvo.getCommodityUnit();