提交 192f2b9d 作者: zhangqiliang

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

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