基于Jeecgboot前后端分离的ERP系统开发系列--出库单(2)

简介: 基于Jeecgboot前后端分离的ERP系统开发系列--出库单(2)

原来online表单生成的出库单列表也不满足要求,所以需要重新进行编写与调整。

   一、重新建ErpSaleOutDto如下:

package com.nbcio.modules.erp.sale.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Description: 销售出库单DTO
 * @Author: nbacheng
 * @Date:   2023-02-15
 * @Version: V1.0
 */
@Data
public class ErpSaleOutDto implements Serializable {
    private static final long serialVersionUID = 1L;
    /**ID*/
    private String id;
    /**单号*/
    private String code;
    /**仓库ID*/
    private String scId;
    
    /**仓库编号*/
    private String wsCode;
    /** 仓库名称*/
    private String wsName;
    
    /**客户ID*/
    private String customerId;
    /** 客户编号*/
    private String csCode;
    /** 客户名称*/
    private String csName;
    
    /**付款日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "付款日期")
    private java.util.Date paymentDate;
    
    /**销售员ID*/
    private String salerId;
    /** 销售员姓名*/
    private String salerName;
    /** 销售订单ID*/
    private String saleOrderId;
    /** 销售订单号*/
    private String saleOrderCode;
    /** 销售数量*/
    private Integer totalNum;
    
    /** 赠品数量*/
    private Integer totalGiftNum;
    /** 销售金额*/
    private BigDecimal totalAmount;
    /** 备注*/
    private String description;
    /** 创建人*/
    private String createBy;
    /** 创建时间*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "创建时间")
    private java.util.Date createTime;
    /** 审核人*/
    private String approveBy;
    /** 审核时间*/
  @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "审核时间")
    private java.util.Date approveTime;
    /** 状态*/
    private Integer status;
    /** 拒绝原因*/
    private String refuseReason;
    /** 结算状态*/
    private Integer settleStatus;
}

二、重新建ErpSaleOutDtoController

package com.nbcio.modules.erp.sale.controller;
import javax.servlet.http.HttpServletRequest;
import org.jeecg.common.api.vo.Result;
import com.nbcio.modules.erp.sale.dto.ErpSaleOutDto;
import com.nbcio.modules.erp.sale.vo.QuerySaleOutVo;
import com.nbcio.modules.erp.sale.service.IErpSaleOutDtoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
 * @Description: 销售出库单
 * @Author: nbacheng
 * @Date:   2023-02-15
 * @Version: V1.0
 */
@Api(tags="销售出库单DTO")
@RestController
@RequestMapping("/sale/erpSaleOutDto")
@Slf4j
public class ErpSaleOutDtoController {
  @Autowired
  private IErpSaleOutDtoService erpSaleOutDtoService;
  
  /**
   * 分页列表查询
   *
   * @param erpSaleOut
   * @param pageNo
   * @param pageSize
   * @param req
   * @return
   */
  @AutoLog(value = "销售出库单-分页列表查询")
  @ApiOperation(value="销售出库单-分页列表查询", notes="销售出库单-分页列表查询")
  @GetMapping(value = "/list")
  public Result<?> querySaleOutList(QuerySaleOutVo querySaleOutVo,
         @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
         @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
         HttpServletRequest req) {
      Page<ErpSaleOutDto> page = new Page<ErpSaleOutDto>(pageNo, pageSize);
      IPage<ErpSaleOutDto> pageList = erpSaleOutDtoService.querySaleOutList(page, querySaleOutVo);
      return Result.OK(pageList);
    }
  
}

三、ErpSaleOutDtoMapper 如下

package com.nbcio.modules.erp.sale.mapper;
import com.nbcio.modules.erp.sale.dto.ErpSaleOutDto;
import com.nbcio.modules.erp.sale.vo.QuerySaleOutVo;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
 * @Description: 销售出库单
 * @Author: nbacheng
 * @Date:   2023-02-15
 * @Version: V1.0
 */
public interface ErpSaleOutDtoMapper extends BaseMapper<ErpSaleOutDto> {
  List<ErpSaleOutDto> querySaleOutList(Page<ErpSaleOutDto> page, @Param("vo") QuerySaleOutVo vo);
}

四、ErpSaleOutDtoMapper.xml  这个以后根据查询条件还要增加多个字段

<?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.nbcio.modules.erp.sale.mapper.ErpSaleOutDtoMapper">
  <resultMap id="ErpSaleOutDtoMap" type="com.nbcio.modules.erp.sale.dto.ErpSaleOutDto">
        <id column="id" property="id"/>
        <result column="code" property="code"/>
        <result column="sc_id" property="scId"/>
        <result column="customer_id" property="customerId"/>
        <result column="saler_id" property="salerId"/>
        <result column="payment_date" property="paymentDate"/>
        <result column="sale_order_id" property="saleOrderId"/>
        <result column="total_num" property="totalNum"/>
        <result column="total_gift_num" property="totalGiftNum"/>
        <result column="total_amount" property="totalAmount"/>
        <result column="description" property="description"/>
        <result column="create_by" property="createBy"/>
        <result column="create_time" property="createTime"/>
        <result column="approve_by" property="approveBy"/>
        <result column="approve_time" property="approveTime"/>
        <result column="status" property="status"/>
        <result column="refuse_reason" property="refuseReason"/>
        <result column="settle_status" property="settleStatus"/>
        <result column="ws_code" property="wsCode"/>
        <result column="ws_name" property="wsName"/>
        <result column="cs_code" property="csCode"/>
        <result column="cs_name" property="csName"/>
        <result column="saler_name" property="salerName"/>
        
    </resultMap>
    <sql id="ErpSaleOutDto_sql">
        SELECT
            a.id,
            a.code,
            a.sc_id,
      a.customer_id,
      a.saler_id,
      a.payment_date,
      a.sale_order_id,
      a.total_num,
      a.total_gift_num,
      a.total_amount,
      a.description,
      a.create_by,
      a.create_time,
      a.approve_by,
      a.approve_time,
      a.status,
      a.refuse_reason,
      a.settle_status,
      ws.code as ws_code,
            ws.name as ws_name,
      cs.code as cs_code,
      cs.name as cs_name,
      u.realname saler_name
        FROM erp_sale_out AS a
        LEFT JOIN erp_warehouse AS ws ON ws.id = a.sc_id
        LEFT JOIN erp_customer AS cs ON cs.id = a.customer_id
        LEFT JOIN sys_user AS u ON u.username = a.saler_id
    </sql>
    <select id="querySaleOutList" resultMap="ErpSaleOutDtoMap">
        <include refid="ErpSaleOutDto_sql"/>
        <where>
           <if test="vo != null">
              <if test="vo.scId != null and vo.scId != ''">
                  AND a.sc_id = #{vo.scId}
              </if>
              <if test="vo.customerId != null and vo.customerId != ''">
                  AND (a.customer_id = #{vo.customerId} 
              </if>
            </if>
            AND a.status = '1' 
        </where>
        ORDER BY a.code
    </select>
    
</mapper>

五、IErpSaleOutDtoService

package com.nbcio.modules.erp.sale.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nbcio.modules.erp.sale.dto.ErpSaleOutDto;
import com.nbcio.modules.erp.sale.vo.QuerySaleOutVo;
/**
 * @Description: 销售出库单
 * @Author: nbacheng
 * @Date:   2023-02-15
 * @Version: V1.0
 */
public interface IErpSaleOutDtoService extends IService<ErpSaleOutDto> {
  IPage<ErpSaleOutDto> querySaleOutList(Page<ErpSaleOutDto> page, QuerySaleOutVo querySaleOutVo);
}

六、ErpSaleOutDtoServiceImpl

package com.nbcio.modules.erp.sale.service.impl;
import com.nbcio.modules.erp.sale.dto.ErpSaleOutDto;
import com.nbcio.modules.erp.sale.mapper.ErpSaleOutDtoMapper;
import com.nbcio.modules.erp.sale.service.IErpSaleOutDtoService;
import com.nbcio.modules.erp.sale.vo.QuerySaleOutVo;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
 * @Description: erp_goods_dto
 * @Author: nbacheng
 * @Date:   2023-02-15
 * @Version: V1.0
 */
@Service
public class ErpSaleOutDtoServiceImpl extends ServiceImpl<ErpSaleOutDtoMapper, ErpSaleOutDto> implements IErpSaleOutDtoService {
  @Autowired
  private ErpSaleOutDtoMapper erpSaleOutDtoMapper;
  
  @Override
  public IPage<ErpSaleOutDto> querySaleOutList(Page<ErpSaleOutDto> page, QuerySaleOutVo querySaleOutVo) {
    List<ErpSaleOutDto> erpSaleOutDtoLists = this.baseMapper.querySaleOutList(page, querySaleOutVo);
        return page.setRecords(erpSaleOutDtoLists);
  }
}

七、vue前端代码主要增加一些列表

data () {
      return {
        description: '销售出库单管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'单号',
            align:"center",
            dataIndex: 'code'
          },
          /*{
            title:'仓库ID',
            align:"center",
            dataIndex: 'scId'
          },*/
          {
            title:'仓库编码',
            align:"center",
            dataIndex: 'wsCode'
          },
          {
            title:'仓库名称',
            align:"center",
            dataIndex: 'wsName'
          },
          /*{
            title:'客户ID',
            align:"center",
            dataIndex: 'customerId'
          },*/
          {
            title:'客户编码',
            align:"center",
            dataIndex: 'csCode'
          },
          {
            title:'客户名称',
            align:"center",
            dataIndex: 'csName'
          },
          /*{
            title:'销售员ID',
            align:"center",
            dataIndex: 'salerId'
          },*/
          {
            title:'销售员',
            align:"center",
            dataIndex: 'salerName'
          },
          {
            title:'付款日期',
            align:"center",
            dataIndex: 'paymentDate',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'销售单ID',
            align:"center",
            dataIndex: 'saleOrderId'
          },
          {
            title:'商品数量',
            align:"center",
            dataIndex: 'totalNum'
          },
          {
            title:'赠品数量',
            align:"center",
            dataIndex: 'totalGiftNum'
          },
          {
            title:'出库金额',
            align:"center",
            dataIndex: 'totalAmount'
          },
          {
            title:'备注',
            align:"center",
            dataIndex: 'description'
          },
          {
            title:'状态',
            align:"center",
            dataIndex: 'status_dictText'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' },
          }
        ],

八、效果图如下:

 

相关文章
|
5天前
|
移动开发 供应链 前端开发
基于jeecgboot的ERP部分演示功能发布
基于jeecgboot的ERP部分演示功能发布
10 0
|
5天前
|
数据库
基于Jeecgboot前后端分离的ERP系统开发代码生成(六)
基于Jeecgboot前后端分离的ERP系统开发代码生成(六)
|
5天前
|
前端开发
基于Jeecgboot前后端分离的ERP系统开发系列--出库单(3)
基于Jeecgboot前后端分离的ERP系统开发系列--出库单(3)
12 0
|
5天前
|
监控 供应链 物联网
ERP系统中的在制品管理与工艺路线规划
ERP系统中的在制品管理与工艺路线规划
51 2
|
5天前
|
数据采集 监控 供应链
ERP系统在大型企业中的实施案例研究
ERP系统在大型企业中的实施案例研究
51 0
|
5天前
|
安全
选择最佳供应商:ERP系统的供应商选择与评估方法论
选择最佳供应商:ERP系统的供应商选择与评估方法论
101 0
|
5天前
|
存储 自然语言处理 Oracle
打造全球化企业:ERP系统的国际化与多语言支持
打造全球化企业:ERP系统的国际化与多语言支持
50 2
|
5天前
|
安全 虚拟化 数据安全/隐私保护
比较本地部署与私有云方案:选择适合你的ERP系统
比较本地部署与私有云方案:选择适合你的ERP系统
105 2
|
5天前
|
存储 供应链 Oracle
探究ERP系统的云端部署与SaaS模式
探究ERP系统的云端部署与SaaS模式
82 0
|
5天前
|
数据可视化 BI
探索ERP系统的移动端应用与移动办公解决方案
探索ERP系统的移动端应用与移动办公解决方案
35 2