提交 09c69fd0 作者: zhangqiliang

发货管理的时候添加一个发货仓库名称字段;

校验SN号的时候,扣到货仓库的库存;
父级 4673a92c
package com.starcharge.wios.controller;
import com.alibaba.fastjson.JSONObject;
import com.ihidea.core.util.HttpClientUtils;
import com.starcharge.wios.dao.entity.Delivery;
import com.starcharge.wios.dao.mappers.DeliveryMapper;
import com.starcharge.wios.dto.DeliveryUpdateDTO;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -23,6 +27,9 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.HashMap;
import java.util.Map;
/**
* 安装订单管理接口
*
......@@ -37,6 +44,8 @@ public class OrderInstallController {
private OrderInstallService orderInstallService;
@Autowired
private DeliveryMapper deliveryMapper;
@Value("${warehouseUrl.reduceUrl}")
private String reduceUrl;
/**
* 添加安装订单
......@@ -111,7 +120,22 @@ public class OrderInstallController {
public BaseResponse<Object> instaallReport(String materialSn) {
Delivery delivery=this.deliveryMapper.selectByMaterialSn(materialSn);
if (StringUtils.isEmpty(delivery)){
throw new ServiceException("没有当前SN号");
throw new ServiceException(200,"没有当前SN号");
}
if (delivery.getInstallStatus()!=0){
throw new ServiceException(200,"当前状态不是未安装状态");
}
//到货仓库的库存减少
Delivery before=this.deliveryMapper.selectByPrimaryKey(delivery.getId());
Map<String, String> params = new HashMap<String, String>();
params.put("warehouseId",before.getWarehouseId());
params.put("materialsCode",before.getMaterialCode());
params.put("quantity","1");
String jsonReduce = HttpClientUtils.post(reduceUrl,params,"UTF-8", "UTF-8");
JSONObject jsonReduceObject=JSONObject.parseObject(jsonReduce);
String codeReduce=jsonReduceObject.getString("code");
if (StringUtil.isNullOrEmpty(codeReduce)){
throw new ServiceException("到货仓库库存扣减失败");
}
DeliveryUpdateDTO deliveryUpdateDTO=new DeliveryUpdateDTO();
deliveryUpdateDTO.setId(delivery.getId());
......
......@@ -300,6 +300,13 @@ public class Delivery extends PageVo implements Serializable {
*/
@ApiModelProperty(value = "发货仓库id")
private String warehouseId;
/**
* 发货仓库
*
* @mbg.generated
*/
@ApiModelProperty(value = "发货仓库")
private String warehouseName;
private static final long serialVersionUID = 1L;
......
......@@ -277,6 +277,9 @@
<if test="warehouseId != null">
warehouse_id,
</if>
<if test="warehouseName != null">
warehouse_name,
</if>
<if test="installStatus != null">
install_status,
</if>
......@@ -348,6 +351,9 @@
<if test="warehouseId != null">
#{warehouseId,jdbcType=VARCHAR},
</if>
<if test="warehouseName != null">
#{warehouseName,jdbcType=VARCHAR},
</if>
<if test="installStatus != null">
#{installStatus,jdbcType=INTEGER},
</if>
......
......@@ -165,6 +165,13 @@ public class DeliveryAddVo {
*/
@ApiModelProperty(value = "发货仓库id")
private String warehouseId;
/**
* 发货仓库
*
* @mbg.generated
*/
@ApiModelProperty(value = "发货仓库")
private String warehouseName;
/**
* 收货人
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论