提交 2c447f73 作者: zhangqiliang

退货管理中用于库存恢复的接口

父级 cd21952d
...@@ -363,20 +363,19 @@ public class WarehouseController { ...@@ -363,20 +363,19 @@ public class WarehouseController {
} }
/** /**
* 确认退货之后更新库存数量 * 确认退货之后恢复库存数量
* *
* @param materialsQuery * @param materialsQuery
* @return * @return
*/ */
@PostMapping(value = "reject/updateNumber") @PostMapping(value = "reject/RestoreInventoryQuantity")
@ApiOperation(value = "确认退货之后更新库存数量") @ApiOperation(value = "确认退货之后更新库存数量")
public BaseResponse<Void> updateNumber(MaterialsQuery materialsQuery) { public BaseResponse<Void> RestoreInventoryQuantity(MaterialsQuery materialsQuery) {
Assert.notNull(materialsQuery.getId(), MessageConstant.MISSING_PARAM);
MaterialsEx materials=materialsMapperEx.materialsByMaterialsCode(materialsQuery.getMaterialsCode()); MaterialsEx materials=materialsMapperEx.materialsByMaterialsCode(materialsQuery.getMaterialsCode());
if (materials==null){ if (materials==null){
throw new ServiceException("物料不存在"); throw new ServiceException("物料不存在");
} }
materialsMapperEx.updateWarehouseMaterials(materialsQuery.getWarehouseId(),materials.getId(), BigDecimal.valueOf(1),3); materialsMapperEx.RestoreInventoryQuantity(materialsQuery.getWarehouseId(),materials.getId(), BigDecimal.valueOf(1));
return new BaseResponse<>(); return new BaseResponse<>();
} }
......
...@@ -97,6 +97,14 @@ public interface MaterialsMapperEx { ...@@ -97,6 +97,14 @@ public interface MaterialsMapperEx {
* @return * @return
*/ */
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 materialsId
* @param quantity
* @return
*/
int RestoreInventoryQuantity(@Param("warhouseId") String warhouseId, @Param("materialsId")String materialsId, @Param("quantity")BigDecimal quantity);
/** /**
......
...@@ -191,6 +191,17 @@ ...@@ -191,6 +191,17 @@
AND materials_id = #{materialsId} AND materials_id = #{materialsId}
</update> </update>
<update id="RestoreInventoryQuantity">
UPDATE t_warehouse_materials
SET
has_number = has_number - #{quantity},
remaining_number = remaining_number + #{quantity},
stay_with_number = stay_with_number + #{quantity}
WHERE
warehouse_id = #{warhouseId}
AND materials_id = #{materialsId}
</update>
<insert id="insertWarehouseMaterials"> <insert id="insertWarehouseMaterials">
insert into t_warehouse_materials insert into t_warehouse_materials
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论