优化商品的sku库存

This commit is contained in:
季圣华 2021-09-22 00:18:42 +08:00
parent 69e4034457
commit efb1e828e0
3 changed files with 10 additions and 14 deletions

View File

@ -123,9 +123,8 @@ public class DepotItemController {
List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
if(list!=null && list.size()>0) {
MaterialVo4Unit materialVo4Unit = list.get(0);
BigDecimal skuStock = depotItemService.getSkuStockByParam(depotId,materialVo4Unit.getMeId(),null,null);
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
stock = skuStock;
if(StringUtil.isNotEmpty(materialVo4Unit.getSku())){
stock = depotItemService.getSkuStockByParam(depotId,materialVo4Unit.getMeId(),null,null);
} else {
stock = depotItemService.getStockByParam(depotId,materialVo4Unit.getId(),null,null);
String commodityUnit = materialVo4Unit.getCommodityUnit();
@ -179,9 +178,8 @@ public class DepotItemController {
item.put("materialOther", getOtherInfo(mpArr, diEx));
Integer ratio = diEx.getRatio();
BigDecimal stock;
BigDecimal skuStock = depotItemService.getSkuStockByParam(diEx.getDepotId(),diEx.getMaterialExtendId(),null,null);
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
stock = skuStock;
if(StringUtil.isNotEmpty(diEx.getSku())){
stock = depotItemService.getSkuStockByParam(diEx.getDepotId(),diEx.getMaterialExtendId(),null,null);
} else {
stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null);
if(ratio!=null){

View File

@ -200,9 +200,8 @@ public class MaterialController {
item.put("unit", material.getCommodityUnit() + ratio);
item.put("sku", material.getSku());
BigDecimal stock;
BigDecimal skuStock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
stock = skuStock;
if(StringUtil.isNotEmpty(material.getSku())){
stock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
} else {
stock = depotItemService.getStockByParam(depotId,material.getId(),null,null);
if (material.getUnitId()!=null){
@ -493,9 +492,8 @@ public class MaterialController {
mvo.setDepotId(depotId);
//库存
BigDecimal stock;
BigDecimal skuStock = depotItemService.getSkuStockByParam(depotId,mvo.getMeId(),null,null);
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
stock = skuStock;
if(StringUtil.isNotEmpty(mvo.getSku())){
stock = depotItemService.getSkuStockByParam(depotId,mvo.getMeId(),null,null);
} else {
stock = depotItemService.getStockByParam(depotId,mvo.getId(),null,null);
if (mvo.getUnitId()!=null){

View File

@ -155,7 +155,7 @@
<select id="findDetailByTypeAndMaterialIdCounts" resultType="java.lang.Long">
select count(1)
from jsh_depot_head dh
INNER JOIN jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
left JOIN jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
where ((dh.type!='其它' and dh.sub_type!='调拨')
or (dh.type='其它' and dh.sub_type='组装单')
or (dh.type='其它' and dh.sub_type='拆卸单')
@ -258,7 +258,7 @@
<select id="getStockCheckSum" resultType="java.math.BigDecimal">
select ifnull(sum(di.basic_number),0) stockCheckSum from jsh_depot_head dh
INNER JOIN jsh_depot_item di on dh.id=di.header_id
left JOIN jsh_depot_item di on dh.id=di.header_id
where 1=1
<if test="mId != null">
and di.material_id=#{mId}