Commit 20eced58 authored by hubaoshan's avatar hubaoshan

改bug

parent 3f33c7f8
...@@ -143,15 +143,16 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor ...@@ -143,15 +143,16 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
log.setGoodsName(box.getGoodsName()); log.setGoodsName(box.getGoodsName());
log.setGoodsCode(box.getGoodsCode()); log.setGoodsCode(box.getGoodsCode());
WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findById(box.getBusinessId()); WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findByIdOut(box.getBusinessId());
// WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findById(box.getBusinessId());
// 库存不存在 // 库存不存在
if (goodsStock == null) if (goodsStock == null)
throw new CyServiceException(1001, "库存数量不足"); throw new CyServiceException(1001, "库存数量不足");
// 库存不足 // 库存不足
if (box.getOutCounts() > goodsStock.getGoodsCounts()) { if (box.getOutCounts() > box.getGoodsCounts()) {
throw new CyServiceException(1001, "库存数量不足"); throw new CyServiceException(1001, "库存数量不足");
} }
goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() - box.getOutCounts()); goodsStock.setGoodsCounts(box.getGoodsCounts() - box.getOutCounts());
// 减库存 // 减库存
wmsGoodsStockRepositoryImpl.updateCounts(goodsStock); wmsGoodsStockRepositoryImpl.updateCounts(goodsStock);
// 日志 // 日志
......
...@@ -26,5 +26,7 @@ public interface WmsGoodsStockRepository extends CyBaseMapper<WmsGoodsStock> { ...@@ -26,5 +26,7 @@ public interface WmsGoodsStockRepository extends CyBaseMapper<WmsGoodsStock> {
* *
*/ */
IPage<WmsGoodsStockPageResultsDto> queryWmsGoodsStocksPaged(CyPageInfo cyPageInfo, @Param("entity") WmsGoodsStockPageResultsDto wmsGoodsStock); IPage<WmsGoodsStockPageResultsDto> queryWmsGoodsStocksPaged(CyPageInfo cyPageInfo, @Param("entity") WmsGoodsStockPageResultsDto wmsGoodsStock);
WmsGoodsStock selectByIdOut(int id);
} }
...@@ -51,6 +51,7 @@ public interface WmsGoodsStockService { ...@@ -51,6 +51,7 @@ public interface WmsGoodsStockService {
* @return * @return
*/ */
WmsGoodsStock findById(int id); WmsGoodsStock findById(int id);
WmsGoodsStock findByIdOut(int id);
/** /**
* 分页查询 库存管理表 * 分页查询 库存管理表
......
...@@ -107,7 +107,10 @@ public class WmsGoodsStockServiceImpl extends ServiceImpl<WmsGoodsStockRepositor ...@@ -107,7 +107,10 @@ public class WmsGoodsStockServiceImpl extends ServiceImpl<WmsGoodsStockRepositor
public WmsGoodsStock findById(int id){ public WmsGoodsStock findById(int id){
return baseMapper.selectById(id); return baseMapper.selectById(id);
} }
@Override
public WmsGoodsStock findByIdOut(int id){
return baseMapper.selectByIdOut(id);
}
/** /**
* 分页查询 库存管理表 * 分页查询 库存管理表
* @param wmsGoodsStock * @param wmsGoodsStock
......
...@@ -80,9 +80,11 @@ ...@@ -80,9 +80,11 @@
<select id="queryWmsGoodssPaged" resultMap="BaseResultMap"> <select id="queryWmsGoodssPaged" resultMap="BaseResultMap">
SELECT SELECT
wg.* wg.*,
wgs.goods_counts
FROM FROM
wms_goods wg wms_goods wg
LEFT JOIN wms_goods_stock wgs ON wg.business_id = wgs.goods_id
WHERE WHERE
wg.del_flag = '0' wg.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' "> <if test="entity.flag !=null and entity.flag != '' ">
......
...@@ -129,4 +129,8 @@ ...@@ -129,4 +129,8 @@
</if> </if>
ORDER BY wgs.business_id ASC ORDER BY wgs.business_id ASC
</select> </select>
<select id="selectByIdOut" resultMap="BaseResultMap">
select * from wms_goods_stock
where goods_id = #{businessId}
</select>
</mapper> </mapper>
Markdown is supported
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