提交 192f2b9d 作者: zhangqiliang

1.退货管理的时候确认退货,调用外联接口,对发货仓库进行库存恢复,对到货仓库进行库存扣减;

2.收货管理的时候确认收货,调用外联接口,对发货仓库进行库存扣减,对到货仓库进行库存增加;
3.提供安装报告接口,输入SN号,校验sn号,修改安装状态;新增发货的时候也校验sn号;
父级 0b2e0aa0
...@@ -69,12 +69,23 @@ public class DeliveryController { ...@@ -69,12 +69,23 @@ public class DeliveryController {
//String orderid= snowFlakeService.getNextId(0,0)+""; //String orderid= snowFlakeService.getNextId(0,0)+"";
return new BaseResponse(deliveryAddVoList.stream() return new BaseResponse(deliveryAddVoList.stream()
.map(da->{ .map(da->{
if (da.getArrivalWarehouseId().equals(da.getWarehouseId())){
throw new ServiceException("400","发货仓库和到货仓库请选择不同的仓库!");
}
List<String> list=new ArrayList<>(); List<String> list=new ArrayList<>();
if (list.contains(da.getInstallOrder())){ if (list.contains(da.getInstallOrder())){
throw new ServiceException("400","不能发重复的订单号!"); throw new ServiceException("400","不能发重复的订单号!");
}else { }else {
list.add(da.getInstallOrder()); list.add(da.getInstallOrder());
} }
//SN号不能重复
if (!StringUtils.isEmpty(da.getMaterialSn())){
Delivery delivery=this.deliveryMapper.selectByMaterialSn(da.getMaterialSn());
if (!StringUtils.isEmpty(delivery)){
throw new ServiceException("当前SN号已经录入使用");
}
}
da.setInstallStatus(0);
Delivery deliveryInstallOrder=deliveryMapper.selectByInstallOrder(da.getInstallOrder()); Delivery deliveryInstallOrder=deliveryMapper.selectByInstallOrder(da.getInstallOrder());
if (!StringUtils.isEmpty(deliveryInstallOrder)){ if (!StringUtils.isEmpty(deliveryInstallOrder)){
throw new ServiceException("400","订单号重复!"); throw new ServiceException("400","订单号重复!");
......
package com.starcharge.wios.controller; package com.starcharge.wios.controller;
import com.starcharge.wios.dao.entity.Delivery;
import com.starcharge.wios.dao.mappers.DeliveryMapper;
import com.starcharge.wios.dto.DeliveryUpdateDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -32,6 +35,8 @@ import io.swagger.annotations.ApiOperation; ...@@ -32,6 +35,8 @@ import io.swagger.annotations.ApiOperation;
public class OrderInstallController { public class OrderInstallController {
@Autowired @Autowired
private OrderInstallService orderInstallService; private OrderInstallService orderInstallService;
@Autowired
private DeliveryMapper deliveryMapper;
/** /**
* 添加安装订单 * 添加安装订单
...@@ -95,4 +100,23 @@ public class OrderInstallController { ...@@ -95,4 +100,23 @@ public class OrderInstallController {
OrderInstallVo orderInstall = orderInstallService.getByOrderId(orderId); OrderInstallVo orderInstall = orderInstallService.getByOrderId(orderId);
return new BaseResponse<OrderInstallVo>(orderInstall); return new BaseResponse<OrderInstallVo>(orderInstall);
} }
/**
* 填写安装报告
*
* @param materialSn
* @return
*/
@PostMapping(value = "orderInstall/instaallReport")
@ApiOperation(value = "填写安装报告")
public BaseResponse<Object> instaallReport(String materialSn) {
Delivery delivery=this.deliveryMapper.selectByMaterialSn(materialSn);
if (StringUtils.isEmpty(delivery)){
throw new ServiceException("没有当前SN号");
}
DeliveryUpdateDTO deliveryUpdateDTO=new DeliveryUpdateDTO();
deliveryUpdateDTO.setId(delivery.getId());
deliveryUpdateDTO.setInstallStatus(1);
this.deliveryMapper.updateByPrimaryKeySelective(deliveryUpdateDTO);
return new BaseResponse<>();
}
} }
package com.starcharge.wios.controller; package com.starcharge.wios.controller;
import com.alibaba.fastjson.JSONObject;
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.starcharge.wios.auth.service.TokenService; import com.starcharge.wios.auth.service.TokenService;
import com.starcharge.wios.convert.ReceivednoteConvert; import com.starcharge.wios.convert.ReceivednoteConvert;
import com.starcharge.wios.dao.entity.Delivery; import com.starcharge.wios.dao.entity.Delivery;
...@@ -19,9 +21,11 @@ import com.starcharge.wios.validation.ParamsValidate; ...@@ -19,9 +21,11 @@ import com.starcharge.wios.validation.ParamsValidate;
import com.starcharge.wios.validation.UpdateEntityGroup; import com.starcharge.wios.validation.UpdateEntityGroup;
import com.starcharge.wios.vo.ReceivednoteAddVo; import com.starcharge.wios.vo.ReceivednoteAddVo;
import com.starcharge.wios.vo.ReceivednoteExcelVo; import com.starcharge.wios.vo.ReceivednoteExcelVo;
import io.netty.util.internal.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -29,7 +33,9 @@ import org.springframework.web.bind.annotation.*; ...@@ -29,7 +33,9 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @projectName:xr-wios * @projectName:xr-wios
...@@ -52,6 +58,10 @@ public class ReceivedNoteController { ...@@ -52,6 +58,10 @@ public class ReceivedNoteController {
private SnowFlakeService snowFlakeService; private SnowFlakeService snowFlakeService;
@Autowired @Autowired
private DeliveryMapper deliveryMapper; private DeliveryMapper deliveryMapper;
@Value("${warehouseUrl.increaseUrl}")
private String increaseUrl;
@Value("${warehouseUrl.reduceUrl}")
private String reduceUrl;
/* @PostMapping("/add") /* @PostMapping("/add")
@ApiOperation(value = "新增收货",notes = "新增收货,返回成功条数") @ApiOperation(value = "新增收货",notes = "新增收货,返回成功条数")
...@@ -99,6 +109,29 @@ public class ReceivedNoteController { ...@@ -99,6 +109,29 @@ public class ReceivedNoteController {
@ApiOperation("确认收货接口") @ApiOperation("确认收货接口")
@ParamsValidate @ParamsValidate
public BaseResponse<DeliveryUpdateDTO> confirmReceipt(@RequestBody @Validated(UpdateEntityGroup.class) DeliveryUpdateDTO deliveryUpdateDTO, BindingResult bindingResult){ public BaseResponse<DeliveryUpdateDTO> confirmReceipt(@RequestBody @Validated(UpdateEntityGroup.class) DeliveryUpdateDTO deliveryUpdateDTO, BindingResult bindingResult){
Delivery before=this.deliveryMapper.selectByPrimaryKey(deliveryUpdateDTO.getId());
Map<String, String> params = new HashMap<String, String>();
params.put("warehouseId",before.getWarehouseId());
params.put("materialsCode",before.getMaterialCode());
if (ProductType.辅材.name().equals(before.getIsproduct())){
params.put("quantity",before.getQuantity().toString());
}else {
params.put("quantity","1");
//到货仓库库存增加
String jsonIncrease = HttpClientUtils.post(increaseUrl,params,"UTF-8", "UTF-8");
JSONObject jsonIncreaseObject=JSONObject.parseObject(jsonIncrease);
String codeIncrease=jsonIncreaseObject.getString("code");
if (StringUtil.isNullOrEmpty(codeIncrease)){
throw new ServiceException("到货仓库库存增加失败");
}
}
//发货仓库库存减少
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.setLogisticStatus(LogisticStatus.已收货.name()); deliveryUpdateDTO.setLogisticStatus(LogisticStatus.已收货.name());
this.commonUpdateService.UpdateColumns(deliveryUpdateDTO,false); this.commonUpdateService.UpdateColumns(deliveryUpdateDTO,false);
return new BaseResponse(this.deliveryMapper.updateByPrimaryKeySelective(deliveryUpdateDTO)); return new BaseResponse(this.deliveryMapper.updateByPrimaryKeySelective(deliveryUpdateDTO));
......
...@@ -70,8 +70,10 @@ public class RejectController { ...@@ -70,8 +70,10 @@ public class RejectController {
private SnowFlakeService snowFlakeService; private SnowFlakeService snowFlakeService;
@Autowired @Autowired
private DeliveryMapper deliveryMapper; private DeliveryMapper deliveryMapper;
@Value("${warehouseUrl.url}") @Value("${warehouseUrl.increaseUrl}")
private String url; private String increaseUrl;
@Value("${warehouseUrl.reduceUrl}")
private String reduceUrl;
/* @PostMapping("/add") /* @PostMapping("/add")
...@@ -135,13 +137,22 @@ public class RejectController { ...@@ -135,13 +137,22 @@ public class RejectController {
//String token = SpringContextUtil.getToken(); //String token = SpringContextUtil.getToken();
Delivery before=this.deliveryMapper.selectByPrimaryKey(deliveryUpdateDTO.getId()); Delivery before=this.deliveryMapper.selectByPrimaryKey(deliveryUpdateDTO.getId());
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("warehouseId",before.getArrivalWarehouseId()); params.put("warehouseId",before.getWarehouseId());
params.put("materialsCode",before.getMaterialCode()); params.put("materialsCode",before.getMaterialCode());
String jsonStr = HttpClientUtils.post(url,params,"UTF-8", "UTF-8"); params.put("quantity","1");
//发货仓库库存恢复
String jsonStr = HttpClientUtils.post(increaseUrl,params,"UTF-8", "UTF-8");
JSONObject jsonObject=JSONObject.parseObject(jsonStr); JSONObject jsonObject=JSONObject.parseObject(jsonStr);
String code=jsonObject.getString("code"); String code=jsonObject.getString("code");
if (StringUtil.isNullOrEmpty(code)){ if (StringUtil.isNullOrEmpty(code)){
throw new ServiceException("库存恢复失败"); throw new ServiceException("发货仓库库存恢复失败");
}
//到货仓库库存扣减
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.setLogisticStatus("退货已申请"); deliveryUpdateDTO.setLogisticStatus("退货已申请");
this.commonUpdateService.UpdateColumns(deliveryUpdateDTO,false); this.commonUpdateService.UpdateColumns(deliveryUpdateDTO,false);
......
...@@ -286,7 +286,20 @@ public class Delivery extends PageVo implements Serializable { ...@@ -286,7 +286,20 @@ public class Delivery extends PageVo implements Serializable {
*/ */
@ApiModelProperty(value = "物料的SN号") @ApiModelProperty(value = "物料的SN号")
private String materialSn; private String materialSn;
/**
* 安装状态,0-未安装,1-已安装
*
* @mbg.generated
*/
@ApiModelProperty(value = "安装状态,0-未安装,1-已安装")
private Integer installStatus;
/**
* 发货仓库id
*
* @mbg.generated
*/
@ApiModelProperty(value = "发货仓库id")
private String warehouseId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -34,4 +34,5 @@ public interface DeliveryMapper { ...@@ -34,4 +34,5 @@ public interface DeliveryMapper {
Delivery selectByLogisticOrder(String logisticOrder); Delivery selectByLogisticOrder(String logisticOrder);
Delivery selectByInstallOrder(String installOrder); Delivery selectByInstallOrder(String installOrder);
Delivery selectByMaterialSn(String materialSn);
} }
\ No newline at end of file
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<result column="auxiliary_id" jdbcType="VARCHAR" property="auxiliaryId" /> <result column="auxiliary_id" jdbcType="VARCHAR" property="auxiliaryId" />
<result column="file_url" jdbcType="VARCHAR" property="fileUrl" /> <result column="file_url" jdbcType="VARCHAR" property="fileUrl" />
<result column="material_sn" jdbcType="VARCHAR" property="materialSn" /> <result column="material_sn" jdbcType="VARCHAR" property="materialSn" />
<result column="warehouse_id" jdbcType="VARCHAR" property="warehouseId" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -144,6 +145,12 @@ ...@@ -144,6 +145,12 @@
from t_delivery from t_delivery
where install_order = #{installOrder,jdbcType=VARCHAR} where install_order = #{installOrder,jdbcType=VARCHAR}
</select> </select>
<select id="selectByMaterialSn" parameterType="string" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_delivery
where material_sn = #{materialSn,jdbcType=VARCHAR}
</select>
<select id="selectByExample" parameterType="com.starcharge.wios.dao.entity.DeliveryCriteria" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.starcharge.wios.dao.entity.DeliveryCriteria" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
...@@ -164,7 +171,7 @@ ...@@ -164,7 +171,7 @@
t.material_name, t.material_company, t.logistic_order, t.logistic_company, t.logistic_status, t.material_name, t.material_company, t.logistic_order, t.logistic_company, t.logistic_status,
t.team, t.isproduct, t.CREATED_BY, t.CREATED_TIME, t.UPDATED_BY, t.UPDATED_TIME, t.arrival_warehouse, t.team, t.isproduct, t.CREATED_BY, t.CREATED_TIME, t.UPDATED_BY, t.UPDATED_TIME, t.arrival_warehouse,
t.arrival_warehouse_id, t.receiver,t.remarks,t.reject_material,t.reason,t.check_time,t.check_user,t.check_user_name,t.check_suggestion, t.arrival_warehouse_id, t.receiver,t.remarks,t.reject_material,t.reason,t.check_time,t.check_user,t.check_user_name,t.check_suggestion,
e.out_order_id,t.reject_logistic_order,t.arrival_quantity,t.auxiliary_id,t.file_url,t.material_sn e.out_order_id,t.reject_logistic_order,t.arrival_quantity,t.auxiliary_id,t.file_url,t.material_sn,t.warehouse_id
from t_delivery t from t_delivery t
left join t_order e on e.id = t.install_order left join t_order e on e.id = t.install_order
where t.id = #{id,jdbcType=INTEGER} where t.id = #{id,jdbcType=INTEGER}
...@@ -267,6 +274,12 @@ ...@@ -267,6 +274,12 @@
<if test="materialSn != null"> <if test="materialSn != null">
material_sn, material_sn,
</if> </if>
<if test="warehouseId != null">
warehouse_id,
</if>
<if test="installStatus != null">
install_status,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deliveryOrder != null"> <if test="deliveryOrder != null">
...@@ -332,6 +345,12 @@ ...@@ -332,6 +345,12 @@
<if test="materialSn != null"> <if test="materialSn != null">
#{materialSn,jdbcType=VARCHAR}, #{materialSn,jdbcType=VARCHAR},
</if> </if>
<if test="warehouseId != null">
#{warehouseId,jdbcType=VARCHAR},
</if>
<if test="installStatus != null">
#{installStatus,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.starcharge.wios.dao.entity.DeliveryCriteria" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.starcharge.wios.dao.entity.DeliveryCriteria" resultType="java.lang.Long">
...@@ -534,6 +553,9 @@ ...@@ -534,6 +553,9 @@
<if test="fileUrl != null"> <if test="fileUrl != null">
file_url = #{fileUrl,jdbcType=VARCHAR}, file_url = #{fileUrl,jdbcType=VARCHAR},
</if> </if>
<if test="materialSn != null">
material_sn = #{materialSn,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
......
...@@ -271,6 +271,13 @@ public class DeliveryUpdateDTO{ ...@@ -271,6 +271,13 @@ public class DeliveryUpdateDTO{
*/ */
@ApiModelProperty(value = "文件地址") @ApiModelProperty(value = "文件地址")
private String fileUrl; private String fileUrl;
/**
* 安装状态,0-未安装,1-已安装
*
* @mbg.generated
*/
@ApiModelProperty(value = "安装状态,0-未安装,1-已安装")
private Integer installStatus;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -158,6 +158,13 @@ public class DeliveryAddVo { ...@@ -158,6 +158,13 @@ public class DeliveryAddVo {
*/ */
@ApiModelProperty(value = "到货仓库id") @ApiModelProperty(value = "到货仓库id")
private String arrivalWarehouseId; private String arrivalWarehouseId;
/**
* 发货仓库id
*
* @mbg.generated
*/
@ApiModelProperty(value = "发货仓库id")
private String warehouseId;
/** /**
* 收货人 * 收货人
...@@ -173,4 +180,11 @@ public class DeliveryAddVo { ...@@ -173,4 +180,11 @@ public class DeliveryAddVo {
*/ */
@ApiModelProperty(value = "物料的SN号") @ApiModelProperty(value = "物料的SN号")
private String materialSn; private String materialSn;
/**
* 安装状态,0-未安装,1-已安装
*
* @mbg.generated
*/
@ApiModelProperty(value = "安装状态,0-未安装,1-已安装")
private Integer installStatus;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论