1.调整摆放功能代码,添加上架记录
parent
4b0c1170f8
commit
90340e2607
@ -0,0 +1,31 @@
|
|||||||
|
package com.glxp.api.controller.inv;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.req.inv.FilterInvPlaceOrderRequest;
|
||||||
|
import com.glxp.api.res.inv.InvPlaceOrderResponse;
|
||||||
|
import com.glxp.api.service.inv.InvPlaceOrderService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物资上架记录接口
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class InvPlaceOrderController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InvPlaceOrderService invPlaceOrderService;
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/inv/place/order/filter")
|
||||||
|
public BaseResponse filterList(FilterInvPlaceOrderRequest filterInvPlaceOrderRequest) {
|
||||||
|
List<InvPlaceOrderResponse> list = invPlaceOrderService.filterList(filterInvPlaceOrderRequest);
|
||||||
|
PageInfo<InvPlaceOrderResponse> pageInfo = new PageInfo<>(list);
|
||||||
|
return ResultVOUtils.page(pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.glxp.api.dao.inv;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.glxp.api.entity.inv.InvPlaceOrderEntity;
|
||||||
|
import com.glxp.api.req.inv.FilterInvPlaceOrderRequest;
|
||||||
|
import com.glxp.api.res.inv.InvPlaceOrderResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface InvPlaceOrderDao extends BaseMapper<InvPlaceOrderEntity> {
|
||||||
|
|
||||||
|
List<InvPlaceOrderResponse> filterList(FilterInvPlaceOrderRequest filterInvPlaceOrderRequest);
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.glxp.api.dao.inv;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.glxp.api.entity.inv.InvPlaceOrderDetailEntity;
|
||||||
|
|
||||||
|
public interface InvPlaceOrderDetailDao extends BaseMapper<InvPlaceOrderDetailEntity> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.glxp.api.entity.inv;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName(value = "inv_place_order_detail")
|
||||||
|
public class InvPlaceOrderDetailEntity {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上架记录号
|
||||||
|
*/
|
||||||
|
@TableField(value = "recordId")
|
||||||
|
private String recordId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库号
|
||||||
|
*/
|
||||||
|
@TableField(value = "invCode")
|
||||||
|
private String invCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货位号
|
||||||
|
*/
|
||||||
|
@TableField(value = "invSpaceCode")
|
||||||
|
private String invSpaceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UDI码
|
||||||
|
*/
|
||||||
|
@TableField(value = "code")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物资编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "relId")
|
||||||
|
private String relId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批次号
|
||||||
|
*/
|
||||||
|
@TableField(value = "batchNo")
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
@TableField(value = "`count`")
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.glxp.api.req.inv;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.inv.InvProductDetailEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加物资上架记录参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddInvPlaceOrderRequest {
|
||||||
|
|
||||||
|
private String invCode;
|
||||||
|
|
||||||
|
private String invSpaceCode;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
private List<InvProductDetailEntity> codeList;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.glxp.api.req.inv;
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FilterInvPlaceOrderDetailRequest extends ListPageRequest {
|
||||||
|
|
||||||
|
private String recordId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.glxp.api.req.inv;
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物资上架记录接口查询参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FilterInvPlaceOrderRequest extends ListPageRequest {
|
||||||
|
|
||||||
|
private String recordId;
|
||||||
|
|
||||||
|
private String invCode;
|
||||||
|
|
||||||
|
private String invSpaceCode;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String nameCode;
|
||||||
|
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
private String zczbhhzbapzbh;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.glxp.api.service.inv;
|
||||||
|
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.req.inv.AddInvPlaceOrderRequest;
|
||||||
|
import com.glxp.api.req.inv.FilterInvPlaceOrderRequest;
|
||||||
|
import com.glxp.api.res.inv.InvPlaceOrderResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物资上架记录Service
|
||||||
|
*/
|
||||||
|
public interface InvPlaceOrderService {
|
||||||
|
|
||||||
|
List<InvPlaceOrderResponse> filterList(FilterInvPlaceOrderRequest filterInvPlaceOrderRequest);
|
||||||
|
|
||||||
|
BaseResponse addInvPlaceOrder(AddInvPlaceOrderRequest addInvPlaceOrderRequest);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
package com.glxp.api.service.inv.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.constant.Constant;
|
||||||
|
import com.glxp.api.dao.inv.InvPlaceOrderDao;
|
||||||
|
import com.glxp.api.dao.inv.InvPlaceOrderDetailDao;
|
||||||
|
import com.glxp.api.entity.inv.InvPlaceOrderDetailEntity;
|
||||||
|
import com.glxp.api.entity.inv.InvPlaceOrderEntity;
|
||||||
|
import com.glxp.api.req.inv.AddInvPlaceOrderRequest;
|
||||||
|
import com.glxp.api.req.inv.FilterInvPlaceOrderRequest;
|
||||||
|
import com.glxp.api.res.inv.InvPlaceOrderResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.inv.InvPlaceOrderService;
|
||||||
|
import com.glxp.api.util.GennerOrderUtils;
|
||||||
|
import com.glxp.api.util.OrderNoTypeBean;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class InvPlaceOrderServiceImpl implements InvPlaceOrderService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InvPlaceOrderDao invPlaceOrderDao;
|
||||||
|
@Resource
|
||||||
|
private InvPlaceOrderDetailDao invPlaceOrderDetailDao;
|
||||||
|
@Resource
|
||||||
|
private CustomerService customerService;
|
||||||
|
@Resource
|
||||||
|
private GennerOrderUtils gennerOrderUtils;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<InvPlaceOrderResponse> filterList(FilterInvPlaceOrderRequest filterInvPlaceOrderRequest) {
|
||||||
|
if (null == filterInvPlaceOrderRequest) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (null != filterInvPlaceOrderRequest.getPage() && null != filterInvPlaceOrderRequest.getLimit()) {
|
||||||
|
PageHelper.offsetPage((filterInvPlaceOrderRequest.getPage() - 1) * filterInvPlaceOrderRequest.getLimit(), filterInvPlaceOrderRequest.getLimit());
|
||||||
|
}
|
||||||
|
return invPlaceOrderDao.filterList(filterInvPlaceOrderRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse addInvPlaceOrder(AddInvPlaceOrderRequest addInvPlaceOrderRequest) {
|
||||||
|
if (StrUtil.isBlank(addInvPlaceOrderRequest.getInvCode()) || StrUtil.isBlank(addInvPlaceOrderRequest.getInvSpaceCode()) || CollUtil.isEmpty(addInvPlaceOrderRequest.getCodeList()) || null == addInvPlaceOrderRequest.getType()) {
|
||||||
|
return ResultVOUtils.error(500, "参数错误");
|
||||||
|
}
|
||||||
|
if (addInvPlaceOrderRequest.getType().equals(2)) {
|
||||||
|
if (StrUtil.isBlank(addInvPlaceOrderRequest.getOrderId())) {
|
||||||
|
return ResultVOUtils.error(500, "参数错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//操作人ID
|
||||||
|
String userId = customerService.getUserIdStr();
|
||||||
|
//获取记录号
|
||||||
|
String recordId = gennerOrderUtils.createInvPlaceOrderNo(new OrderNoTypeBean(Constant.INV_PLACE_ORDER, "yyyyMMdd"));
|
||||||
|
|
||||||
|
InvPlaceOrderEntity orderEntity = new InvPlaceOrderEntity();
|
||||||
|
orderEntity.setRecordId(recordId);
|
||||||
|
orderEntity.setType(addInvPlaceOrderRequest.getType());
|
||||||
|
orderEntity.setOrderId(addInvPlaceOrderRequest.getOrderId());
|
||||||
|
orderEntity.setCreateUser(userId);
|
||||||
|
orderEntity.setCreateTime(new Date());
|
||||||
|
orderEntity.setUpdateTime(new Date());
|
||||||
|
|
||||||
|
//生成物资上架详情
|
||||||
|
addInvPlaceOrderRequest.getCodeList().forEach(invProductDetailEntity -> {
|
||||||
|
InvPlaceOrderDetailEntity orderDetailEntity = new InvPlaceOrderDetailEntity();
|
||||||
|
orderDetailEntity.setInvCode(addInvPlaceOrderRequest.getInvCode());
|
||||||
|
orderDetailEntity.setInvSpaceCode(addInvPlaceOrderRequest.getInvSpaceCode());
|
||||||
|
orderDetailEntity.setRelId(String.valueOf(invProductDetailEntity.getRelId()));
|
||||||
|
orderDetailEntity.setCode(invProductDetailEntity.getCode());
|
||||||
|
orderDetailEntity.setBatchNo(invProductDetailEntity.getBatchNo());
|
||||||
|
orderDetailEntity.setRecordId(recordId);
|
||||||
|
invPlaceOrderDetailDao.insert(orderDetailEntity);
|
||||||
|
});
|
||||||
|
|
||||||
|
invPlaceOrderDao.insert(orderEntity);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.glxp.api.dao.inv.InvPlaceOrderDao">
|
||||||
|
<select id="filterList" resultType="com.glxp.api.res.inv.InvPlaceOrderResponse">
|
||||||
|
select t.recordId,
|
||||||
|
t.type,
|
||||||
|
t.orderId,
|
||||||
|
t2.invCode,
|
||||||
|
t2.invSpaceCode,
|
||||||
|
t.createUser,
|
||||||
|
(select employeeName from auth_user where id = t.createUser) operatorName,
|
||||||
|
(select name from auth_warehouse where code = t2.invCode) invName,
|
||||||
|
(select name from auth_space where code = t2.invSpaceCode) invSpaceName,
|
||||||
|
t.createTime,
|
||||||
|
t2.code,
|
||||||
|
t2.batchNo,
|
||||||
|
t2.relId,
|
||||||
|
bp.cpmctymc productName,
|
||||||
|
bp.ggxh,
|
||||||
|
pd.produceDate productionDate,
|
||||||
|
pd.expireDate,
|
||||||
|
bp.nameCode,
|
||||||
|
bp.zczbhhzbapzbh,
|
||||||
|
bp.ylqxzcrbarmc,
|
||||||
|
(select name from basic_corp where erpId = pd.supId) supName,
|
||||||
|
pd.serialNo,
|
||||||
|
bp.manufactory,
|
||||||
|
bp.measname
|
||||||
|
from inv_place_order t
|
||||||
|
right join inv_place_order_detail t2 on t.recordId = t2.recordId
|
||||||
|
left join inv_product_detail pd
|
||||||
|
on t2.invCode = pd.invCode and t2.invSpaceCode = pd.invSpaceCode and t2.relId = pd.relId
|
||||||
|
and t2.code = pd.code
|
||||||
|
left join basic_udirel bu on bu.id = t2.relId
|
||||||
|
left join basic_products bp on bp.uuid = bu.uuid
|
||||||
|
<where>
|
||||||
|
<if test="recordId != null and recordId != ''">
|
||||||
|
and t.recordId like concat('%', #{recordId}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="invCode != null and invCode != ''">
|
||||||
|
and t2.invCode = #{invCode}
|
||||||
|
</if>
|
||||||
|
<if test="invSpaceCode != null and invSpaceCode != ''">
|
||||||
|
and t2.invSpaceCode = #{invSpaceCode}
|
||||||
|
</if>
|
||||||
|
<if test="type != null">
|
||||||
|
and t.type = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="orderId != null and orderId != ''">
|
||||||
|
and t.orderId like concat('%', #{orderId}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="code != null and code != ''">
|
||||||
|
and t2.code like concat('%', #{code}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="nameCode != null and nameCode != ''">
|
||||||
|
and bp.nameCode like concat('%', #{nameCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="productName != null and productName != ''">
|
||||||
|
and bp.cpmctymc like concat('%', #{productName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="batchNo != null and batchNo != ''">
|
||||||
|
and t2.batchNo like concat('%', #{batchNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''">
|
||||||
|
and bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
group by t2.code
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.glxp.api.dao.inv.InvPlaceOrderDetailDao">
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue