提交 6c45831a 作者: zhangqiliang

提供库存扣减和库存增加接口

父级 846d8b17
...@@ -368,35 +368,37 @@ public class WarehouseController { ...@@ -368,35 +368,37 @@ public class WarehouseController {
} }
/** /**
* 确认退货之后恢复库存数量 * 库存增加
*@param warehouseId *@param warehouseId
* @param materialsCode * @param materialsCode
* @param quantity
* @return * @return
*/ */
@PostMapping(value = "reject/restoreInventoryQuantity") @PostMapping(value = "reject/increaseInventoryQuantity")
@ApiOperation(value = "确认退货之后更新库存数量") @ApiOperation(value = "确认退货之后更新库存数量")
public BaseResponse<Void> restoreInventoryQuantity(String warehouseId,String materialsCode) { public BaseResponse<Void> increaseInventoryQuantity(String warehouseId,String materialsCode,String quantity) {
MaterialsEx materials=materialsMapperEx.materialsByMaterialsCode(materialsCode); MaterialsEx materials=materialsMapperEx.materialsByMaterialsCode(materialsCode);
if (materials==null){ if (materials==null){
throw new ServiceException("物料不存在"); throw new ServiceException("物料不存在");
} }
materialsMapperEx.RestoreInventoryQuantity(warehouseId,materials.getId(), BigDecimal.valueOf(1)); materialsMapperEx.increaseInventoryQuantity(warehouseId,materials.getId(), new BigDecimal(quantity));
return new BaseResponse<>(); return new BaseResponse<>();
} }
/** /**
* 确认收货之后库存扣减 * 库存减少
*@param warehouseId *@param warehouseId
* @param materialsCode * @param materialsCode
* @param quantity
* @return * @return
*/ */
@PostMapping(value = "reject/reduceInventoryQuantity") @PostMapping(value = "reject/reduceInventoryQuantity")
@ApiOperation(value = "确认收货之后库存扣减") @ApiOperation(value = "确认收货之后发货库存扣减")
public BaseResponse<Void> reduceInventoryQuantity(String warehouseId,String materialsCode) { public BaseResponse<Void> reduceInventoryQuantity(String warehouseId,String materialsCode,String quantity) {
MaterialsEx materials=materialsMapperEx.materialsByMaterialsCode(materialsCode); MaterialsEx materials=materialsMapperEx.materialsByMaterialsCode(materialsCode);
if (materials==null){ if (materials==null){
throw new ServiceException("物料不存在"); throw new ServiceException("物料不存在");
} }
materialsMapperEx.reduceInventoryQuantity(warehouseId,materials.getId(), BigDecimal.valueOf(1)); materialsMapperEx.reduceInventoryQuantity(warehouseId,materials.getId(), new BigDecimal(quantity));
return new BaseResponse<>(); return new BaseResponse<>();
} }
} }
...@@ -98,15 +98,15 @@ public interface MaterialsMapperEx { ...@@ -98,15 +98,15 @@ public interface MaterialsMapperEx {
*/ */
int updateWarehouseMaterials(@Param("warhouseId") String warhouseId, @Param("materialsId")String materialsId, @Param("quantity")BigDecimal quantity,@Param("type") Integer type); int updateWarehouseMaterials(@Param("warhouseId") String warhouseId, @Param("materialsId")String materialsId, @Param("quantity")BigDecimal quantity,@Param("type") Integer type);
/** /**
* 确认退货之后恢复库存数量 * 库存增加
* @param warhouseId * @param warhouseId
* @param materialsId * @param materialsId
* @param quantity * @param quantity
* @return * @return
*/ */
int RestoreInventoryQuantity(@Param("warhouseId") String warhouseId, @Param("materialsId")String materialsId, @Param("quantity")BigDecimal quantity); int increaseInventoryQuantity(@Param("warhouseId") String warhouseId, @Param("materialsId")String materialsId, @Param("quantity")BigDecimal quantity);
/** /**
* 确认收货之后库存扣减 * 库存减少
* @param warhouseId * @param warhouseId
* @param materialsId * @param materialsId
* @param quantity * @param quantity
......
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
AND materials_id = #{materialsId} AND materials_id = #{materialsId}
</update> </update>
<update id="RestoreInventoryQuantity"> <update id="increaseInventoryQuantity">
UPDATE t_warehouse_materials UPDATE t_warehouse_materials
SET SET
total_number = total_number + #{quantity}, total_number = total_number + #{quantity},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论