优化商品的sku库存
This commit is contained in:
@@ -123,9 +123,8 @@ 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(StringUtil.isNotEmpty(materialVo4Unit.getSku())){
|
||||||
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
|
stock = depotItemService.getSkuStockByParam(depotId,materialVo4Unit.getMeId(),null,null);
|
||||||
stock = skuStock;
|
|
||||||
} else {
|
} 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();
|
||||||
@@ -179,9 +178,8 @@ public class DepotItemController {
|
|||||||
item.put("materialOther", getOtherInfo(mpArr, diEx));
|
item.put("materialOther", getOtherInfo(mpArr, diEx));
|
||||||
Integer ratio = diEx.getRatio();
|
Integer ratio = diEx.getRatio();
|
||||||
BigDecimal stock;
|
BigDecimal stock;
|
||||||
BigDecimal skuStock = depotItemService.getSkuStockByParam(diEx.getDepotId(),diEx.getMaterialExtendId(),null,null);
|
if(StringUtil.isNotEmpty(diEx.getSku())){
|
||||||
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
|
stock = depotItemService.getSkuStockByParam(diEx.getDepotId(),diEx.getMaterialExtendId(),null,null);
|
||||||
stock = skuStock;
|
|
||||||
} else {
|
} else {
|
||||||
stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null);
|
stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null);
|
||||||
if(ratio!=null){
|
if(ratio!=null){
|
||||||
|
|||||||
@@ -200,9 +200,8 @@ public class MaterialController {
|
|||||||
item.put("unit", material.getCommodityUnit() + ratio);
|
item.put("unit", material.getCommodityUnit() + ratio);
|
||||||
item.put("sku", material.getSku());
|
item.put("sku", material.getSku());
|
||||||
BigDecimal stock;
|
BigDecimal stock;
|
||||||
BigDecimal skuStock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
|
if(StringUtil.isNotEmpty(material.getSku())){
|
||||||
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
|
stock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
|
||||||
stock = skuStock;
|
|
||||||
} else {
|
} else {
|
||||||
stock = depotItemService.getStockByParam(depotId,material.getId(),null,null);
|
stock = depotItemService.getStockByParam(depotId,material.getId(),null,null);
|
||||||
if (material.getUnitId()!=null){
|
if (material.getUnitId()!=null){
|
||||||
@@ -493,9 +492,8 @@ public class MaterialController {
|
|||||||
mvo.setDepotId(depotId);
|
mvo.setDepotId(depotId);
|
||||||
//库存
|
//库存
|
||||||
BigDecimal stock;
|
BigDecimal stock;
|
||||||
BigDecimal skuStock = depotItemService.getSkuStockByParam(depotId,mvo.getMeId(),null,null);
|
if(StringUtil.isNotEmpty(mvo.getSku())){
|
||||||
if(skuStock.compareTo(BigDecimal.ZERO)!=0){
|
stock = depotItemService.getSkuStockByParam(depotId,mvo.getMeId(),null,null);
|
||||||
stock = skuStock;
|
|
||||||
} else {
|
} else {
|
||||||
stock = depotItemService.getStockByParam(depotId,mvo.getId(),null,null);
|
stock = depotItemService.getStockByParam(depotId,mvo.getId(),null,null);
|
||||||
if (mvo.getUnitId()!=null){
|
if (mvo.getUnitId()!=null){
|
||||||
|
|||||||
@@ -155,7 +155,7 @@
|
|||||||
<select id="findDetailByTypeAndMaterialIdCounts" resultType="java.lang.Long">
|
<select id="findDetailByTypeAndMaterialIdCounts" resultType="java.lang.Long">
|
||||||
select count(1)
|
select count(1)
|
||||||
from jsh_depot_head dh
|
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!='调拨')
|
where ((dh.type!='其它' and dh.sub_type!='调拨')
|
||||||
or (dh.type='其它' and dh.sub_type='组装单')
|
or (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 id="getStockCheckSum" resultType="java.math.BigDecimal">
|
||||||
select ifnull(sum(di.basic_number),0) stockCheckSum from jsh_depot_head dh
|
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
|
where 1=1
|
||||||
<if test="mId != null">
|
<if test="mId != null">
|
||||||
and di.material_id=#{mId}
|
and di.material_id=#{mId}
|
||||||
|
|||||||
Reference in New Issue
Block a user