库存记录报表页面优化
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package org.nl.wms.sch.data.controller;
|
||||
|
||||
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.sch.data.service.MaterialDataService;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataRequest;
|
||||
import org.nl.wms.sch.report.service.dto.ReportQuery;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -31,8 +35,8 @@ public class MaterialDataController {
|
||||
@GetMapping
|
||||
@ApiOperation("查询data")
|
||||
//@PreAuthorize("@el.check('materialData:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(materialDataService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
public ResponseEntity<Object> query(MaterialDataRequest whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(materialDataService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package org.nl.wms.sch.data.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataRequest;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataResponse;
|
||||
import org.nl.wms.sch.material.service.dao.Material;
|
||||
import org.nl.wms.sch.report.service.dto.ReportDto;
|
||||
import org.nl.wms.sch.report.service.dto.ReportQuery;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
@@ -22,7 +28,7 @@ public interface MaterialDataService extends IService<MaterialDataDto> {
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
IPage<MaterialDataResponse> queryAll(MaterialDataRequest whereJson, PageQuery pageable);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package org.nl.wms.sch.data.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataRequest;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataResponse;
|
||||
import org.nl.wms.sch.material.service.dao.Material;
|
||||
import org.nl.wms.sch.report.service.dto.ReportDto;
|
||||
import org.nl.wms.sch.report.service.dto.ReportQuery;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
@@ -10,4 +15,7 @@ import org.nl.wms.sch.material.service.dao.Material;
|
||||
**/
|
||||
public interface MaterialDataMapper extends BaseMapper<MaterialDataDto> {
|
||||
|
||||
void set();
|
||||
IPage<MaterialDataResponse> queryAll(IPage<MaterialDataResponse> pages, MaterialDataRequest query);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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="org.nl.wms.sch.data.service.dao.mapper.MaterialDataMapper">
|
||||
|
||||
<select id="set">
|
||||
SET SESSION sql_mode = (SELECT REPLACE(@@SESSION.sql_mode, 'ONLY_FULL_GROUP_BY', ''));
|
||||
</select>
|
||||
|
||||
<select id="queryAll" resultType="org.nl.wms.sch.data.service.dto.MaterialDataResponse">
|
||||
SELECT
|
||||
supplierCode,
|
||||
MAX(md.supplierName) AS supplierName,
|
||||
productName,
|
||||
specification,
|
||||
MAX(batch) AS batch,
|
||||
MAX(barLevel) AS barLevel,
|
||||
DATE_FORMAT(md.createTime, '%Y-%m') AS date,
|
||||
COALESCE(SUM(CASE WHEN md.type = 1 THEN md.length ELSE 0 END), 0) AS ll_length,
|
||||
COALESCE(SUM(CASE WHEN md.type = 1 THEN md.weight ELSE 0 END), 0) AS ll_weight,
|
||||
COALESCE(SUM(CASE WHEN md.type = 2 THEN md.length ELSE 0 END), 0) AS sc_length,
|
||||
COALESCE(SUM(CASE WHEN md.type = 2 THEN md.weight ELSE 0 END), 0) AS sc_weight,
|
||||
COALESCE(
|
||||
(SELECT
|
||||
SUM(CASE WHEN type = 1 THEN length ELSE 0 END) - SUM(CASE WHEN type = 2 THEN length ELSE 0 END)
|
||||
FROM material_data
|
||||
WHERE
|
||||
supplierCode = md.supplierCode AND
|
||||
createTime <![CDATA[ < ]]> DATE_FORMAT(DATE_SUB(CONCAT(YEAR(#{query.start_time}), '-', MONTH(#{query.start_time}), '-01'), INTERVAL 1 DAY), '%Y-%m-%d')
|
||||
), 0) AS sy_length,
|
||||
COALESCE(
|
||||
(SELECT
|
||||
SUM(CASE WHEN type = 1 THEN weight ELSE 0 END) - SUM(CASE WHEN type = 2 THEN weight ELSE 0 END)
|
||||
FROM material_data
|
||||
WHERE
|
||||
supplierCode = md.supplierCode AND
|
||||
createTime <![CDATA[ < ]]> DATE_FORMAT(DATE_SUB(CONCAT(YEAR(#{query.start_time}), '-', MONTH(#{query.start_time}), '-01'), INTERVAL 1 DAY), '%Y-%m-%d')
|
||||
), 0) AS sy_weight,
|
||||
COALESCE(
|
||||
(SELECT
|
||||
SUM(CASE WHEN type = 1 THEN length ELSE 0 END) - SUM(CASE WHEN type = 2 THEN length ELSE 0 END)
|
||||
FROM material_data
|
||||
WHERE
|
||||
supplierCode = md.supplierCode and productName = md.productName and specification = md.specification
|
||||
), 0) AS jc_length,
|
||||
COALESCE(
|
||||
(SELECT
|
||||
SUM(CASE WHEN type = 1 THEN weight ELSE 0 END) - SUM(CASE WHEN type = 2 THEN weight ELSE 0 END)
|
||||
FROM material_data
|
||||
WHERE
|
||||
supplierCode = md.supplierCode and productName =md.productName and specification = md.specification
|
||||
), 0) AS jc_weight
|
||||
FROM
|
||||
material_data md
|
||||
WHERE
|
||||
DATE_FORMAT(md.createTime, '%Y-%m') = DATE_FORMAT(#{query.start_time}, '%Y-%m')
|
||||
GROUP BY
|
||||
md.productName,md.specification,supplierCode, DATE_FORMAT(md.createTime, '%Y-%m')
|
||||
ORDER BY
|
||||
md.supplierCode, md.productName
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,6 +1,9 @@
|
||||
package org.nl.wms.sch.data.service.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
@@ -11,6 +14,8 @@ import java.io.Serializable;
|
||||
* @date 2024-05-17
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("material_data")
|
||||
public class MaterialDataDto implements Serializable {
|
||||
|
||||
/** 客户编码 */
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.sch.data.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author psh
|
||||
* @date 2024-05-17
|
||||
**/
|
||||
@Data
|
||||
public class MaterialDataRequest implements Serializable {
|
||||
|
||||
/** 客户编码 */
|
||||
private String start_time;
|
||||
|
||||
/** 客户名称 */
|
||||
private String end_time;
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import java.sql.Timestamp;
|
||||
* @date 2024-05-17
|
||||
**/
|
||||
@Data
|
||||
public class MaterialDataQuery implements Serializable {
|
||||
public class MaterialDataResponse implements Serializable {
|
||||
|
||||
/** 客户编码 */
|
||||
private String supplierCode;
|
||||
@@ -42,7 +42,7 @@ public class MaterialDataQuery implements Serializable {
|
||||
private BigDecimal weight;
|
||||
|
||||
/** 日期 */
|
||||
private Timestamp createTime;
|
||||
private String date;
|
||||
|
||||
/** 上月长度 */
|
||||
private BigDecimal sy_length;
|
||||
@@ -1,14 +1,22 @@
|
||||
package org.nl.wms.sch.data.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.data.service.MaterialDataService;
|
||||
import org.nl.wms.sch.data.service.dao.mapper.MaterialDataMapper;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataRequest;
|
||||
import org.nl.wms.sch.data.service.dto.MaterialDataResponse;
|
||||
import org.nl.wms.sch.material.service.dao.Material;
|
||||
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper;
|
||||
import org.nl.wms.sch.report.service.dto.ReportDto;
|
||||
import org.nl.wms.sch.report.service.dto.ReportQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -35,10 +43,14 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
@Slf4j
|
||||
public class MaterialDataServiceImpl extends ServiceImpl<MaterialDataMapper, MaterialDataDto> implements MaterialDataService {
|
||||
|
||||
@Autowired
|
||||
private MaterialDataMapper materialDataMapper;
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
//todo
|
||||
return new HashMap<>();
|
||||
public IPage<MaterialDataResponse> queryAll(MaterialDataRequest query, PageQuery pageQuery){
|
||||
IPage<MaterialDataResponse> pages = new Page<>(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
materialDataMapper.set();
|
||||
pages=materialDataMapper.queryAll(pages, query);
|
||||
return pages;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="起始时间">
|
||||
<el-form-item label="查询时间">
|
||||
<el-date-picker
|
||||
v-model="form.start_time"
|
||||
v-model="query.start_time"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="date"
|
||||
type="month"
|
||||
style="width: 240px;"
|
||||
placeholder="选择日期时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间">
|
||||
<!-- <el-form-item label="结束时间">
|
||||
<el-date-picker
|
||||
v-model="form.end_time"
|
||||
value-format="yyyy-MM-dd"
|
||||
@@ -27,7 +27,7 @@
|
||||
style="width: 240px;"
|
||||
placeholder="选择日期时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -40,11 +40,7 @@
|
||||
<el-table-column prop="supplierCode" label="客户编码" />
|
||||
<el-table-column prop="supplierName" label="客户名称" />
|
||||
<el-table-column prop="productName" label="物料编码" />
|
||||
<el-table-column prop="createTime" label="日期">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" label="日期"/>
|
||||
<el-table-column prop="specification" label="规格" />
|
||||
<el-table-column prop="batch" label="来料批次" />
|
||||
<el-table-column prop="barLevel" label="棒源等级" />
|
||||
|
||||
Reference in New Issue
Block a user