优化商品的sku库存
This commit is contained in:
@@ -123,6 +123,10 @@ public class DepotItemController {
|
|||||||
List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
|
List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
|
||||||
if(list!=null && list.size()>0) {
|
if(list!=null && list.size()>0) {
|
||||||
MaterialVo4Unit materialVo4Unit = list.get(0);
|
MaterialVo4Unit materialVo4Unit = list.get(0);
|
||||||
|
BigDecimal skuStock = depotItemService.getSkuStockByParam(depotId,materialVo4Unit.getMeId(),null,null);
|
||||||
|
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
|
||||||
|
stock = skuStock;
|
||||||
|
} else {
|
||||||
stock = depotItemService.getStockByParam(depotId,materialVo4Unit.getId(),null,null);
|
stock = depotItemService.getStockByParam(depotId,materialVo4Unit.getId(),null,null);
|
||||||
String commodityUnit = materialVo4Unit.getCommodityUnit();
|
String commodityUnit = materialVo4Unit.getCommodityUnit();
|
||||||
Long unitId = materialVo4Unit.getUnitId();
|
Long unitId = materialVo4Unit.getUnitId();
|
||||||
@@ -137,6 +141,7 @@ public class DepotItemController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
map.put("stock", stock);
|
map.put("stock", stock);
|
||||||
res.code = 200;
|
res.code = 200;
|
||||||
res.data = map;
|
res.data = map;
|
||||||
@@ -173,7 +178,12 @@ public class DepotItemController {
|
|||||||
item.put("model", diEx.getMModel());
|
item.put("model", diEx.getMModel());
|
||||||
item.put("materialOther", getOtherInfo(mpArr, diEx));
|
item.put("materialOther", getOtherInfo(mpArr, diEx));
|
||||||
Integer ratio = diEx.getRatio();
|
Integer ratio = diEx.getRatio();
|
||||||
BigDecimal stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null);
|
BigDecimal stock;
|
||||||
|
BigDecimal skuStock = depotItemService.getSkuStockByParam(diEx.getDepotId(),diEx.getMaterialExtendId(),null,null);
|
||||||
|
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
|
||||||
|
stock = skuStock;
|
||||||
|
} else {
|
||||||
|
stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null);
|
||||||
if(ratio!=null){
|
if(ratio!=null){
|
||||||
BigDecimal ratioDecimal = new BigDecimal(ratio.toString());
|
BigDecimal ratioDecimal = new BigDecimal(ratio.toString());
|
||||||
if(ratioDecimal.compareTo(BigDecimal.ZERO)!=0){
|
if(ratioDecimal.compareTo(BigDecimal.ZERO)!=0){
|
||||||
@@ -183,6 +193,7 @@ public class DepotItemController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
item.put("stock", stock);
|
item.put("stock", stock);
|
||||||
item.put("unit", diEx.getMaterialUnit());
|
item.put("unit", diEx.getMaterialUnit());
|
||||||
item.put("sku", diEx.getSku());
|
item.put("sku", diEx.getSku());
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
||||||
|
<result column="meId" jdbcType="BIGINT" property="meId" />
|
||||||
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
|
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
|
||||||
<result column="sku" jdbcType="VARCHAR" property="sku" />
|
<result column="sku" jdbcType="VARCHAR" property="sku" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
@@ -303,7 +304,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getMaterialByBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
|
<select id="getMaterialByBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
|
||||||
select m.*,u.name unit_name,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
|
select m.*,u.name unit_name, me.id meId,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
|
||||||
me.wholesale_decimal, me.low_decimal, me.sku
|
me.wholesale_decimal, me.low_decimal, me.sku
|
||||||
from jsh_material m
|
from jsh_material m
|
||||||
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||||
|
|||||||
Reference in New Issue
Block a user