基于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' },
          }
        ],

八、效果图如下:

 

相关文章
|
9月前
|
消息中间件 缓存 JavaScript
如何开发ERP(离散制造-MTO)系统中的生产管理板块(附架构图+流程图+代码参考)
本文详解离散制造MTO模式下的ERP生产管理模块,涵盖核心问题、系统架构、关键流程、开发技巧及数据库设计,助力企业打通计划与执行“最后一公里”,提升交付率、降低库存与浪费。
|
9月前
|
消息中间件 JavaScript 前端开发
如何开发ERP(离散制造-MTO)系统中的技术管理板块(附架构图+流程图+代码参考)
本文详解ERP(离散制造-MTO)系统中的技术管理板块,涵盖产品定义、BOM、工序、工艺文件及变更控制的结构化与系统化管理。内容包括技术管理的核心目标、总体架构、关键组件、业务流程、开发技巧与最佳实践,并提供完整的参考代码,助力企业将技术数据转化为可执行的生产指令,提升制造效率与质量。
|
9月前
|
消息中间件 JavaScript 关系型数据库
如何开发一套ERP(离散制造-MTO)系统(附架构图+流程图+代码参考)
本文介绍了面向离散制造-MTO(按订单生产)模式的ERP系统设计与实现方法。内容涵盖ERP系统定义、总体架构设计、主要功能模块解析、关键业务流程(订单到交付、BOM展开、MRP逻辑、排产等)、开发技巧(DDD、微服务、事件驱动)、参考代码示例、部署上线注意事项及实施效果评估。旨在帮助企业与开发团队构建高效、灵活、可扩展的ERP系统,提升订单交付能力与客户满意度。
|
11月前
|
人工智能 运维 安全
如何自己开发一套ERP系统?
本文探讨了企业自建ERP系统的可行性,分析了轻量、中型和重型ERP的区别,并指出自研ERP需明确业务需求、流程逻辑及投入成本。文章建议企业在决定自研前,应先梳理清楚管理逻辑,而非盲目追求技术方案。
|
11月前
|
SQL 存储 供应链
如何开发ERP系统中的库存管理板块(附架构图+流程图+代码参考)
本文介绍如何通过ERP系统实现企业库存管理的数字化与自动化,涵盖仓库管理、库位管理、出入库操作、库存调拨与盘点等功能设计,并提供开发技巧及代码参考,帮助企业提升库存管理效率,减少错误与资源浪费。
|
9月前
|
监控 供应链 前端开发
如何开发ERP(离散制造-MTO)系统中的财务管理板块(附架构图+流程图+代码参考)
本文详解离散制造MTO企业ERP系统中财务管理模块的搭建,聚焦应收账款与应付账款管理,涵盖核心功能、业务流程、开发技巧及Python代码示例,助力企业实现财务数据准确、实时可控,提升现金流管理能力。
1181 32
|
9月前
|
供应链 监控 JavaScript
如何开发ERP(离散制造-MTO)系统中的库存管理板块(附架构图+流程图+代码参考)
本文详解MTO模式下ERP库存管理的关键作用,涵盖核心模块、业务流程、开发技巧与代码示例,助力制造企业提升库存周转率、降低缺货风险,实现高效精准的库存管控。
|
9月前
|
消息中间件 JavaScript BI
如何开发ERP(离散制造-MTO)系统中的客户管理板块(附架构图+流程图+代码参考)
本文详解离散制造-MTO模式下ERP系统客户管理模块的设计与实现,涵盖架构图、流程图、功能拆解、开发技巧及TypeScript参考代码,助力企业打通客户信息与报价、生产、交付全链路,提升响应效率与订单准交率。
|
9月前
|
JSON 前端开发 关系型数据库
如何开发ERP(离散制造-MTO)系统中的销售管理板块(附架构图+流程图+代码参考)
针对离散制造MTO模式,销售管理是业务核心入口,贯穿报价、订单、ATP、排产与交付。本文详解其架构设计、关键流程、数据模型及开发实践,助力企业提升交付准确率与运营效率。
|
11月前
|
SQL 数据挖掘 API
如何开发ERP系统中的质量管理板块(附架构图+流程图+代码参考)
质量管理在ERP系统中的作用不仅仅是记录质量检验数据,它还涉及到从物料采购、生产过程、到最终产品的全流程管理。如何搭建一个高效、可靠的质量管理板块,成为了许多企业在进行ERP系统开发时需要重点考虑的问题。本文将详细介绍如何开发ERP系统中的质量管理板块,涵盖功能模块、业务流程、开发技巧和实现效果等方面,并提供具体的代码参考。

热门文章

最新文章