guoyuji
2024-05-20 2a7adfe776c3c7e0aad9405cfd4cc86b2d1c134b
添加订单根据产品分类报表功能
7个文件已修改
1个文件已添加
310 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/lang/en.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/zh.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/Order.vue 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/OrderProductSummanyReport.vue 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderDetailMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/OrderDetailMapper.xml 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/en.js
@@ -57,7 +57,7 @@
    },
    order:{
        orderHomePage:'Order Home Page',
        orderReport:'Order Report',
        orderReport:'Order Detail Report',
        project:'Project',
        orderId:'Order ID',
        money:'Total Amount',
north-glass-erp/northglass-erp/src/lang/zh.js
@@ -112,7 +112,7 @@
    order:{
        orderHomePage:'订单首页',
        orderReport:'订单报表',
        orderReport:'订单明细报表',
        project:'项目名称',
        orderId:'销售单号',
        money:'总金额',
north-glass-erp/northglass-erp/src/views/sd/order/Order.vue
@@ -1,5 +1,5 @@
<script setup>
import {ArrowLeftBold, ArrowRight, Search} from "@element-plus/icons-vue"
import {ArrowDown, ArrowLeftBold, ArrowRight, Search} from "@element-plus/icons-vue"
import {useRouter,useRoute,onBeforeRouteUpdate} from "vue-router"
import {useI18n} from "vue-i18n"
const { t } = useI18n()
@@ -11,7 +11,11 @@
}
const handleCommand = (command) => {
  router.push({
    path: command
  })
}
</script>
@@ -22,8 +26,32 @@
      <el-breadcrumb :separator-icon="ArrowRight">
        <el-breadcrumb-item @click="changeRouter(1)" :class="indexFlag===1?'indexTag':''" :to="{ path: '/main/order/selectOrder' }">{{$t('order.orderHomePage')}}</el-breadcrumb-item>
        <el-breadcrumb-item @click="changeRouter(2)" :class="indexFlag===2?'indexTag':''" :to="{ path: '/main/order/createOrder' }">{{$t('basicData.create')}}</el-breadcrumb-item>
        <el-breadcrumb-item @click="changeRouter(3)" :class="indexFlag===3?'indexTag':''" :to="{ path: '/main/order/orderReport' }">{{$t('order.orderReport')}}</el-breadcrumb-item>
        <el-breadcrumb-item v-show="false" :to="{ path: '/main/order/orderReport' }">报表</el-breadcrumb-item>
        <el-breadcrumb-item
            @click="changeRouter(3)"
            :class="indexFlag===3?'indexTag':''"
            >
          <el-dropdown @command="handleCommand">
            <span class="el-dropdown-link" style="font-weight: 700;outline: none;">
              报表
              <el-icon class="el-icon--right">
                <arrow-down />
              </el-icon>
            </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item command="/main/order/orderReport" >{{ $t('order.orderReport') }}</el-dropdown-item>
                <el-dropdown-item command="/main/order/orderProductSummanyReport">订单明细汇总</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
@@ -61,4 +89,12 @@
:deep(.indexTag .el-breadcrumb__inner){
  color: #5CADFE !important;
}
.example-showcase .el-dropdown-link {
  cursor: pointer;
  color: var(--el-color-primary);
  display: flex;
  align-items: center;
}
</style>
north-glass-erp/northglass-erp/src/views/sd/order/OrderProductSummanyReport.vue
New file
@@ -0,0 +1,76 @@
<script setup>
import BasicTable from "@/components/BasicTable.vue"
import { ref} from "vue"
import request from "@/utils/request"
const childrenData = ref({
  columns:[
    {type:'expand',fixed:"left",width: 80,slots: { content:'content' }},
    {type: 'seq',fixed:"left", title: '自序', width: 80 },
    {field: 'order.orderType',width:120, title: '订单类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.customerName',width:120, title: '客户名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.project',width:120, title: '项目名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.orderId',width:120, title: '销售单号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.batch',width:120, title: '批次',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'productId',width:120, title: '产品编号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'productName',width:120, title: '产品名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderNumber',width:120, title: '订单序号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    // {field: 'buildingNumber',width:120, title: '楼号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'width',width:120, title: '宽',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'height',width:120, title: '高',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'quantity',width:120, title: '数量',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'bendRadius',width:120, title: '弯钢弧度',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'grossArea',width:120, title: '实际面积',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'computeGrossArea',width:150, title: '结算总面积',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'shape',width:120, title: '形状',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'edgingType',width:120, title: '磨边类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.processingNote',width:140, title: '主加工要求',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'processingNote',width:120, title: '加工要求',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.remarks',width:120, title: '备注',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.icon',width:120, title: '商标选项',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.packType',width:120, title: '包装方式',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    // {field: 'prodID',width:120, title: '工艺流程',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'perimeter',width:120, title: '周长',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'price',width:120, title: '单价',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'grossAmount',width:120, title: '金额',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.alType',width:120, title: '铝条方式',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    // {field: 'prodID',width:120, title: '订单类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.salesman',width:120, title: '业务员',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.deliveryAddress',width:120, title: '送货地址',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.creator',width:120, title: '制单员',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'createTime',width:120, title: '建立时间',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'totalThickness',width:120, title: '总厚度',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'levelOne',width:120, title: '产品大类',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'levelTwo',width:120, title: '产品小类',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'order.customerBatch',width:120, title: '客户批次',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}
  ],//表格表头字段
  data:[],//表格数据
  url :'/order/getOrderProductSummary',
  footList:['quantity','grossArea','computeGrossArea','perimeter','price','grossAmount']
})
request.post('/order/exportOrderReport',null,{responseType :'blob'}).then(res => {
  const blob = new Blob([res])
  // console.log(blob)
  // if ('download' in document.createElement('a')) { // 非IE下载
  //   const elink = document.createElement('a')
  //   elink.download = 'a.xlsx'
  //   elink.style.display = 'none'
  //   elink.href = URL.createObjectURL(blob)
  //   document.body.appendChild(elink)
  //   elink.click()
  //   URL.revokeObjectURL(elink.href) // 释放URL 对象
  //   document.body.removeChild(elink)
  // } else { // IE10+下载
  //   navigator.msSaveBlob(blob, fileName)
  // }
})
</script>
<template>
  <basic-table
      :childrenData="childrenData"/>
</template>
<style scoped>
</style>
north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderController.java
@@ -104,6 +104,17 @@
        return  Result.seccess(orderService.getOrderReport(pageNum,pageSize,selectDate,orderDetail));
    }
    //@SaCheckPermission("orderProductSummary.search")
    @ApiOperation("查询订单产品汇总报表")
    @PostMapping("/getOrderProductSummary/{pageNum}/{pageSize}/{selectDate}")
    public Result getOrderProductSummary(@PathVariable Integer pageNum,
                                 @PathVariable Integer pageSize,
                                 @PathVariable List<String> selectDate,
                                 @RequestBody OrderDetail orderDetail)  {
        return  Result.seccess(orderService.getOrderProductSummary(pageNum,pageSize,selectDate,orderDetail));
    }
    @ApiOperation("订单报表导出")
    @PostMapping("/exportOrderReport")
    public void exportOrderReport(HttpServletResponse response) throws IOException, IllegalAccessException, InstantiationException {
north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderDetailMapper.java
@@ -20,4 +20,6 @@
    Map<String,Integer> getOrderReportTotal(Integer offset, Integer pageSize, String startDate, String endDate, OrderDetail orderDetail);
    List<Order> exportOrderReport();
    List<OrderDetail> getOrderProductSummary(Integer offset, Integer pageSize, String startDate, String endDate, OrderDetail orderDetail);
}
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -315,4 +315,28 @@
    public List<Order> exportOrderReport() {
        return orderDetailMapper.exportOrderReport();
    }
    public Map<String,Object> getOrderProductSummary(Integer pageNum, Integer pageSize, List<String> selectDate, OrderDetail orderDetail) {
        Integer offset = (pageNum-1)*pageSize;
        String endDate = LocalDate.now().toString();
        String startDate = LocalDate.now().minusDays(15).toString();
        if(selectDate !=null && selectDate.size()==2){
            if(!selectDate.get(0).isEmpty()){
                startDate = selectDate.get(0);
            }
            if(!selectDate.get(1).isEmpty()){
                endDate = selectDate.get(1);
            }
        }
        Map<String,Object> map = new HashMap<>();
        map.put("data",orderDetailMapper.getOrderProductSummary(offset, pageSize, startDate, endDate, orderDetail));
        map.put("total",orderDetailMapper.getOrderReportTotal(offset, pageSize, startDate, endDate, orderDetail));
        List<String> list = new ArrayList<>();
        list.add(startDate);
        list.add(endDate);
        map.put("selectDate",list);
//        map.put("total",orderMapper.getPageTotal(offset, pageSize, startDate, endDate, orderDetail));
        return map;
    }
}
north-glass-erp/src/main/resources/mapper/sd/OrderDetailMapper.xml
@@ -411,4 +411,153 @@
    </select>
    <!--获取订单产品汇总-->
    <select id="getOrderProductSummary" resultMap="orderMap">
        SELECT
        sum(a.price) as price,
        *,
        a.create_time as createTime,
        d.type_name as levelOne,
        e.type_name as levelTwo
        from order_detail as a
        left join sd.`order` as b
        on b.order_id = a.order_id
        left join sd.product as c
        on c.id = a.product_id
        left join sd.basic_glass_type as d
        on d.type_id = c.type_id
        left join sd.basic_glass_type as e
        on e.type_id = d.belong
        where  date(b.create_time)>=#{startDate} and date(b.create_time) &lt;= #{endDate}
        <if test="orderDetail.order!=null and (orderDetail.order.orderType != null and orderDetail.order.orderType != '')">
            and b.order_type like concat('%',#{orderDetail.order.orderType},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.customerId != null and orderDetail.order.customerId != ''">
            and b.customer_id like concat('%',#{orderDetail.order.customerId},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.project != null and orderDetail.order.project != ''">
            and b.project like concat('%',#{orderDetail.order.project},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.orderId != null and orderDetail.order.orderId != ''">
            and b.order_id like concat('%',#{orderDetail.order.orderId},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.batch != null and orderDetail.order.batch != ''">
            and b.batch like concat('%',#{orderDetail.order.batch},'%')
        </if>
        <if test="orderDetail.productId != null and orderDetail.productId != ''">
            and a.product_id like concat('%',#{orderDetail.productId},'%')
        </if>
        <if test="orderDetail.productName != null and orderDetail.productName != ''">
            and a.product_name like concat('%',#{orderDetail.productName},'%')
        </if>
        <if test="orderDetail.orderNumber != null and orderDetail.orderNumber != ''">
            and a.order_number like concat('%',#{orderDetail.orderNumber},'%')
        </if>
        <if test="orderDetail.width != null and orderDetail.width != ''">
            and a.width like concat('%',#{orderDetail.width},'%')
        </if>
        <if test="orderDetail.height != null and orderDetail.height != ''">
            and a.height like concat('%',#{orderDetail.height},'%')
        </if>
        <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
            and a.quantity like concat('%',#{orderDetail.quantity},'%')
        </if>
        <if test="orderDetail.bendRadius != null and orderDetail.bendRadius != ''">
            and a.bend_radius like concat('%',#{orderDetail.bendRadius},'%')
        </if>
        <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
            and a.gross_area like concat('%',#{orderDetail.grossArea},'%')
        </if>
        <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
            and a.compute_gross_area like concat('%',#{orderDetail.computeGrossArea},'%')
        </if>
        <if test="orderDetail.shape != null and orderDetail.shape != ''">
            and a.shape like concat('%',#{orderDetail.shape},'%')
        </if>
        <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
            and a.edging_type like concat('%',#{orderDetail.edgingType},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.processingNote != null and orderDetail.order.processingNote != ''">
            and b.processing_note like concat('%',#{orderDetail.order.processingNote},'%')
        </if>
        <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
            and a.processing_note like concat('%',#{orderDetail.processingNote},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.icon != null and orderDetail.order.icon != ''">
            and b.icon like concat('%',#{orderDetail.order.icon},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.packType != null and orderDetail.order.packType != ''">
            and b.pack_type like concat('%',#{orderDetail.order.packType},'%')
        </if>
        <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
            and a.perimeter like concat('%',#{orderDetail.perimeter},'%')
        </if>
        <if test="orderDetail.price != null and orderDetail.price != ''">
            and a.price like concat('%',#{orderDetail.price},'%')
        </if>
        <if test="orderDetail.grossAmount != null and orderDetail.grossAmount != ''">
            and a.gross_amount like concat('%',#{orderDetail.grossAmount},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.alType != null and orderDetail.order.alType != ''">
            and b.al_type like concat('%',#{orderDetail.order.alType},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.salesman != null and orderDetail.order.salesman != ''">
            and b.salesman like concat('%',#{orderDetail.order.salesman},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.deliveryAddress != null and orderDetail.order.deliveryAddress != ''">
            and b.delivery_address like concat('%',#{orderDetail.order.deliveryAddress},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.creator != null and orderDetail.order.creator != ''">
            and b.creator like concat('%',#{orderDetail.order.creator},'%')
        </if>
        <if test="orderDetail.totalThickness != null and orderDetail.totalThickness != ''">
            and c.total_thickness like concat('%',#{orderDetail.totalThickness},'%')
        </if>
        <if test="orderDetail.levelOne != null and orderDetail.levelOne != ''">
            and d.type_name like concat('%',#{orderDetail.levelOne},'%')
        </if>
        <if test="orderDetail.levelTwo != null and orderDetail.levelTwo != ''">
            and e.type_name like concat('%',#{orderDetail.levelTwo},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.customerBatch != null and orderDetail.order.customerBatch != ''">
            and b.customer_batch like concat('%',#{orderDetail.order.customerBatch},'%')
        </if>
        group by b.order_id,a.product_id
        order by b.order_id desc
        limit #{offset},#{pageSize}
    </select>
</mapper>