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

优化商品的sku库存

parent 69e40344
......@@ -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){
......
......@@ -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){
......
......@@ -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}
......
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