From 81c85405701b1504e263962eccbddbbd25f9e808 Mon Sep 17 00:00:00 2001 From: pengyongcheng <pyc_1215@163.com> Date: Fri, 23 Feb 2024 14:53:20 +0800 Subject: [PATCH] 报表:盘点报表 --- ant-design-vue-jeecg/src/views/system/report/ReportCycleCountList.vue | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/controller/ReportController.java | 18 ++++++++++++++++++ huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/QueryReportCycleCountDto.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/ReportCycleCountDto.java | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailChildMapper.java | 13 ++++++++++++- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/xml/CycleCountDetailChildMapper.xml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java | 10 ++++++++++ huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java | 8 ++++++++ 8 files changed, 446 insertions(+), 1 deletion(-) create mode 100644 ant-design-vue-jeecg/src/views/system/report/ReportCycleCountList.vue create mode 100644 huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/QueryReportCycleCountDto.java create mode 100644 huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/ReportCycleCountDto.java create mode 100644 huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/xml/CycleCountDetailChildMapper.xml diff --git a/ant-design-vue-jeecg/src/views/system/report/ReportCycleCountList.vue b/ant-design-vue-jeecg/src/views/system/report/ReportCycleCountList.vue new file mode 100644 index 0000000..ac477d1 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/report/ReportCycleCountList.vue @@ -0,0 +1,229 @@ +<template> + <a-card :bordered="false"> + <!-- 查询区域 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="库位编码"> + <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="物料编码"> + <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="物料名称"> + <a-input placeholder="请输入物料名称" v-model="queryParam.materialName"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="物料规格"> + <a-input placeholder="请输入物料规格" v-model="queryParam.materialSpec"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="物料单位"> + <a-input placeholder="请输入物料单位" v-model="queryParam.materialUnit"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="盘点人"> + <a-input placeholder="请输入盘点人" v-model="queryParam.stocktakingAc"></a-input> + </a-form-item> + </a-col> + <a-col :xl="12" :lg="14" :md="16" :sm="24"> + <a-form-item label="盘点日期"> + <j-date :show-date="true" date-format="YYYY-MM-DD" placeholder="请选择开始时间" + class="query-group-cust" v-model="queryParam.completedAtBegin"></j-date> + <span class="query-group-split-cust"></span> + <j-date :show-date="true" date-format="YYYY-MM-DD" placeholder="请选择结束时间" + class="query-group-cust" v-model="queryParam.completedAtEnd"></j-date> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button id="search" type="primary" @click="searchQuery" icon="search">查询</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 查询区域-END --> + <!-- table区域-begin --> + <div> + <a-table + ref="table" + size="middle" + :scroll="{x:true}" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + class="j-table-force-nowrap" + @change="handleTableChange"> + + <span slot="zoneCode" slot-scope="zoneCode"> + <a-tag :key="zoneCode" color="blue"> + {{ solutionZoneCode(zoneCode) }} + </a-tag> + </span> + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + </a-table> + </div> + </a-card> +</template> + +<script> + +import '@/assets/less/TableExpand.less' +import {mixinDevice} from '@/utils/mixin' +import {JeecgListMixin} from '@/mixins/JeecgListMixin' +import {getMaterialTypeList, getZoneList} from '@/api/api' + +export default { + name: 'ReportInventoryClassificationList', + mixins: [JeecgListMixin, mixinDevice], + components: {}, + data() { + return { + description: '库存分类报表页面', + zoneList: [], + zoneOptions: [], + materialTypeList: [], + firstLoad: 0, + // 表头 + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: 'center', + customRender: function (t, r, index) { + return parseInt(index) + 1 + } + }, + { + title: '库存位置', + align: "center", + dataIndex: 'locationCode' + }, + { + title: '物料编码', + align: "center", + dataIndex: 'materialCode' + }, + { + title: '物料名称', + align: "center", + dataIndex: 'materialName' + }, + { + title: '物料规格', + align: "center", + dataIndex: 'materialSpec' + }, + { + title: '物料单位', + align: "center", + dataIndex: 'materialUnit' + }, + { + title: '库存数量', + align: "center", + dataIndex: 'systemQty' + }, + { + title: '实际数量', + align: "center", + dataIndex: 'countedQty' + }, + { + title: '差异数量', + align: "center", + dataIndex: 'gapQty' + }, + { + title: '盘点日期', + align: "center", + dataIndex: 'completedAt' + }, + { + title: '盘点人', + align: "center", + dataIndex: 'stocktakingAc' + } + ], + url: { + list: "/report/listCycleCount", + }, + } + }, + created() { + this.loadFrom(); + }, + mounted() { + if (this.firstLoad === 0) { + this.firstLoad = 1; + return; + } + //页面没加载完,此时methods里的方法找不到,使用定时器模拟点击 + let timeSearch = setInterval(() => { + let eleSearch = document.getElementById("search"); + if (eleSearch != null) { + //调用成功,清除定时器 + clearInterval(timeSearch) + eleSearch.click(); + } + }, 200) + }, + computed: { + importExcelUrl: function () { + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, + methods: { + loadFrom() { + getMaterialTypeList().then((res) => { + if (res.success) { + this.materialTypeList = res.result + } + }); + getZoneList().then((res) => { + if (res.success) { + this.zoneList = res.result + //延迟半秒执行,避免组件未加载完,数据已经加载完 + setTimeout(() => { + //slice可以在数组的任何位置进行删除/添加操作 + this.zoneOptions.splice(0, 1); + for (const element of res.result) { + this.zoneOptions.push({value: element.code, text: element.name}) + } + }, 500) + } + }); + }, + solutionZoneCode(value) { + let actions = [] + Object.keys(this.zoneList).some(key => { + if (this.zoneList[key].code === '' + value) { + actions.push(this.zoneList[key].name) + return true + } + }) + return actions.join('') + } + } +} +</script> +<style scoped> +@import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/controller/ReportController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/controller/ReportController.java index 699eba9..4a36be7 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/controller/ReportController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/controller/ReportController.java @@ -30,8 +30,11 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; +import org.jeecg.modules.wms.report.dto.QueryReportCycleCountDto; +import org.jeecg.modules.wms.report.dto.ReportCycleCountDto; import org.jeecg.modules.wms.report.dto.ReportInventoryClassificationDto; import org.jeecg.modules.wms.report.dto.ReportPerformanceAssessmentDto; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.ICycleCountDetailChildService; import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; import org.jeecg.utils.HuahengJwtUtil; import org.jeecg.utils.StringUtils; @@ -69,6 +72,8 @@ public class ReportController extends JeecgController<InventoryTransaction, IInv private ILocationService locationService; @Resource private IInventoryDetailService inventoryDetailService; + @Resource + private ICycleCountDetailChildService cycleCountDetailChildService; /** * 分页列表查询 @@ -230,4 +235,17 @@ public class ReportController extends JeecgController<InventoryTransaction, IInv page.setRecords(performanceAssessmentReportList); return Result.OK(page); } + + /** + * 盘点报表列表查询 + */ + @GetMapping(value = "/listCycleCount") + public Result listCycleCount(QueryReportCycleCountDto queryReportCycleCountDto, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + List<ReportCycleCountDto> cycleCountReportList = cycleCountDetailChildService.getCycleCountReport(queryReportCycleCountDto); + Page<ReportCycleCountDto> page = new Page<>(pageNo, pageSize); + page.setRecords(cycleCountReportList); + return Result.OK(page); + } } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/QueryReportCycleCountDto.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/QueryReportCycleCountDto.java new file mode 100644 index 0000000..ccaa368 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/QueryReportCycleCountDto.java @@ -0,0 +1,53 @@ +package org.jeecg.modules.wms.report.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 盘点报表查询Dto类 + */ +@Data +public class QueryReportCycleCountDto implements Serializable { + + /** + * 库位编码 + */ + private String locationCode; + + /** + * 物料编码 + */ + private String materialCode; + + /** + * 物料名称 + */ + private String materialName; + + /** + * 物料规格 + */ + private String materialSpec; + + /** + * 物料单位 + */ + private String materialUnit; + + /** + * 盘点人 + */ + private String stocktakingAc; + + /** + * 盘点日期起始; + */ + private String completedAtBegin; + + /** + * 盘点日期结束; + */ + private String completedAtEnd; +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/ReportCycleCountDto.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/ReportCycleCountDto.java new file mode 100644 index 0000000..d3ab7a0 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/ReportCycleCountDto.java @@ -0,0 +1,64 @@ +package org.jeecg.modules.wms.report.dto; + +import io.micrometer.core.annotation.Counted; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 盘点报表Dto类 + */ +@Data +public class ReportCycleCountDto implements Serializable { + + /** + * 库位编码 + */ + private String locationCode; + + /** + * 物料编码 + */ + private String materialCode; + + /** + * 物料名称 + */ + private String materialName; + + /** + * 物料规格 + */ + private String materialSpec; + + /** + * 物料单位 + */ + private String materialUnit; + + /** + * 系统数量 + */ + private BigDecimal systemQty; + + /** + * 盘点数量 + */ + private BigDecimal countedQty; + + /** + * 差异数量 + */ + private BigDecimal gapQty; + + /** + * 盘点人 + */ + private String stocktakingAc; + + /** + * '盘点日期; + */ + private String completedAt; +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailChildMapper.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailChildMapper.java index 5df7a8f..b82d80f 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailChildMapper.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailChildMapper.java @@ -1,6 +1,9 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper; import java.util.List; + +import org.jeecg.modules.wms.report.dto.QueryReportCycleCountDto; +import org.jeecg.modules.wms.report.dto.ReportCycleCountDto; import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; @@ -13,5 +16,13 @@ import org.apache.ibatis.annotations.Param; */ public interface CycleCountDetailChildMapper extends BaseMapper<CycleCountDetailChild> { - + /** + * 盘点报表查询 + * + * @param queryReportCycleCountDto 查询参数 + * @param statuses 盘点明细状态 + * @return 盘点报表信息 + */ + List<ReportCycleCountDto> selectCycleCount(@Param("queryParam") QueryReportCycleCountDto queryReportCycleCountDto, + @Param("statuses") List<Integer> statuses); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/xml/CycleCountDetailChildMapper.xml b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/xml/CycleCountDetailChildMapper.xml new file mode 100644 index 0000000..d5d06c0 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/xml/CycleCountDetailChildMapper.xml @@ -0,0 +1,52 @@ +<?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.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailChildMapper"> + + <select id="selectCycleCount" resultType="org.jeecg.modules.wms.report.dto.ReportCycleCountDto"> + SELECT child.location_code, + child.material_code, + child.material_name, + child.material_spec, + child.material_unit, + child.system_qty, + child.counted_qty, + child.gap_qty, + header.stocktaking_ac, + detail.completed_at + FROM cycle_count_detail_child child + LEFT JOIN cycle_count_detail detail ON child.cycle_count_detailid = detail.id + LEFT JOIN cycle_count_header header ON detail.cycle_count_head_id = header.id + <where> + <if test="queryParam.locationCode != null and queryParam.locationCode != ''"> + and child.location_code = #{queryParam.locationCode} + </if> + <if test="queryParam.materialCode != null and queryParam.materialCode != ''"> + and child.material_code = #{queryParam.materialCode} + </if> + <if test="queryParam.materialName != null and queryParam.materialName != ''"> + <bind name="queryParam.materialName" value="'%' + queryParam.materialName + '%'"/> + and child.material_name LIKE #{queryParam.materialName} + </if> + <if test="queryParam.materialSpec != null and queryParam.materialSpec != ''"> + and child.material_spec = #{queryParam.materialSpec} + </if> + <if test="queryParam.materialUnit != null and queryParam.materialUnit != ''"> + and child.material_unit = #{queryParam.materialUnit} + </if> + <if test="queryParam.stocktakingAc != null and queryParam.stocktakingAc != ''"> + <bind name="queryParam.stocktakingAc" value="'%' + queryParam.stocktakingAc + '%'"/> + and header.stocktaking_ac LIKE #{queryParam.stocktakingAc} + </if> + <if test="queryParam.completedAtBegin != null and queryParam.completedAtBegin != ''"> + and detail.completed_at >= #{queryParam.completedAtBegin} + </if> + <if test="queryParam.completedAtEnd != null and queryParam.completedAtEnd != ''"> + and detail.completed_at <= #{queryParam.completedAtEnd} + </if> + and detail.enable_status IN + <foreach collection="statuses" open="(" close=")" item="status" separator=","> + #{status} + </foreach> + </where> + </select> +</mapper> \ No newline at end of file diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java index 06e7c31..ffb3fb1 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java @@ -1,6 +1,9 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.config.material.entity.Material; +import org.jeecg.modules.wms.report.dto.QueryReportCycleCountDto; +import org.jeecg.modules.wms.report.dto.ReportCycleCountDto; import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; @@ -15,4 +18,11 @@ public interface ICycleCountDetailChildService extends IService<CycleCountDetail Result confirmGapQty(String id, String countedQty,String state); + + /** + * 盘点报表查询 + * @param queryReportCycleCountDto 查询参数 + * @return 盘点报表信息 + */ + List<ReportCycleCountDto> getCycleCountReport(QueryReportCycleCountDto queryReportCycleCountDto); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java index 4dbe7f3..67a813d 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java @@ -1,6 +1,7 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl; import java.math.BigDecimal; +import java.util.Collections; import java.util.List; import javax.annotation.Resource; @@ -9,6 +10,8 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.wms.report.dto.QueryReportCycleCountDto; +import org.jeecg.modules.wms.report.dto.ReportCycleCountDto; import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; import org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailChildMapper; @@ -142,4 +145,9 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta // result.setResult(cycleCountHeader.getId()); return Result.OK("调整成功"); } + + @Override + public List<ReportCycleCountDto> getCycleCountReport(QueryReportCycleCountDto queryReportCycleCountDto) { + return super.baseMapper.selectCycleCount(queryReportCycleCountDto, Collections.singletonList(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED)); + } } -- libgit2 0.22.2