提交 d6d16e7e 作者: zhangqiliang

提供库存扣减和库存恢复的接口

父级 ba6acc81
...@@ -14,22 +14,27 @@ import com.boco.nbd.wios.manage.service.impl.WarehouseService; ...@@ -14,22 +14,27 @@ import com.boco.nbd.wios.manage.service.impl.WarehouseService;
import com.boco.nbd.wios.manage.util.NumberUtil; import com.boco.nbd.wios.manage.util.NumberUtil;
import com.ihidea.component.api.v2.BaseResponse; import com.ihidea.component.api.v2.BaseResponse;
import com.ihidea.core.support.exception.ServiceException; import com.ihidea.core.support.exception.ServiceException;
import com.ihidea.core.util.HttpClientUtils;
import com.ihidea.core.util.XMLUtilsEx;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.http.Header;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.crypto.spec.PSource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Base64; import java.util.Base64;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 仓库管理接口 * 仓库管理接口
...@@ -364,18 +369,35 @@ public class WarehouseController { ...@@ -364,18 +369,35 @@ public class WarehouseController {
/** /**
* 确认退货之后恢复库存数量 * 确认退货之后恢复库存数量
* *@param params
* @param materialsQuery * @param url
* @return * @return
*/ */
@PostMapping(value = "reject/restoreInventoryQuantity") @PostMapping(value = "reject/restoreInventoryQuantity")
@ApiOperation(value = "确认退货之后更新库存数量") @ApiOperation(value = "确认退货之后更新库存数量")
public BaseResponse<Void> restoreInventoryQuantity(MaterialsQuery materialsQuery) { public BaseResponse<Void> restoreInventoryQuantity(String url, Map<String, String> params) {
MaterialsEx materials=materialsMapperEx.materialsByMaterialsCode(materialsQuery.getMaterialsCode()); System.out.println("获取数据"+params);
MaterialsEx materials=materialsMapperEx.materialsByMaterialsCode(params.get("materialsCode"));
if (materials==null){
throw new ServiceException("物料不存在");
}
materialsMapperEx.RestoreInventoryQuantity(params.get("warehouseId"),materials.getId(), BigDecimal.valueOf(1));
return new BaseResponse<>();
}
/**
* 确认收货之后库存扣减
*@param params
* @param url
* @return
*/
@PostMapping(value = "reject/reduceInventoryQuantity")
@ApiOperation(value = "确认收货之后库存扣减")
public BaseResponse<Void> reduceInventoryQuantity(String url, Map<String, String> params) {
MaterialsEx materials=materialsMapperEx.materialsByMaterialsCode(params.get("materialsCode"));
if (materials==null){ if (materials==null){
throw new ServiceException("物料不存在"); throw new ServiceException("物料不存在");
} }
materialsMapperEx.RestoreInventoryQuantity(materialsQuery.getWarehouseId(),materials.getId(), BigDecimal.valueOf(1)); materialsMapperEx.reduceInventoryQuantity(params.get("warehouseId"),materials.getId(), BigDecimal.valueOf(1));
return new BaseResponse<>(); return new BaseResponse<>();
} }
} }
...@@ -105,6 +105,14 @@ public interface MaterialsMapperEx { ...@@ -105,6 +105,14 @@ public interface MaterialsMapperEx {
* @return * @return
*/ */
int RestoreInventoryQuantity(@Param("warhouseId") String warhouseId, @Param("materialsId")String materialsId, @Param("quantity")BigDecimal quantity); int RestoreInventoryQuantity(@Param("warhouseId") String warhouseId, @Param("materialsId")String materialsId, @Param("quantity")BigDecimal quantity);
/**
* 确认收货之后库存扣减
* @param warhouseId
* @param materialsId
* @param quantity
* @return
*/
int reduceInventoryQuantity(@Param("warhouseId") String warhouseId, @Param("materialsId")String materialsId, @Param("quantity")BigDecimal quantity);
/** /**
......
...@@ -194,6 +194,7 @@ ...@@ -194,6 +194,7 @@
<update id="RestoreInventoryQuantity"> <update id="RestoreInventoryQuantity">
UPDATE t_warehouse_materials UPDATE t_warehouse_materials
SET SET
total_number = total_number + #{quantity},
has_number = has_number - #{quantity}, has_number = has_number - #{quantity},
remaining_number = remaining_number + #{quantity}, remaining_number = remaining_number + #{quantity},
stay_with_number = stay_with_number + #{quantity} stay_with_number = stay_with_number + #{quantity}
...@@ -201,6 +202,17 @@ ...@@ -201,6 +202,17 @@
warehouse_id = #{warhouseId} warehouse_id = #{warhouseId}
AND materials_id = #{materialsId} AND materials_id = #{materialsId}
</update> </update>
<update id="reduceInventoryQuantity">
UPDATE t_warehouse_materials
SET
total_number = total_number - #{quantity},
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">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论