问题修复及综合查询

This commit is contained in:
bns_han 2024-03-05 18:41:35 +08:00
parent 2da530bc41
commit a3e922936f
10 changed files with 680 additions and 16 deletions

View File

@ -74,4 +74,7 @@ public class MaLabelBindVO {
@ApiModelProperty(value = "中间表主键")
private String id;
@ApiModelProperty(value = "关键字")
private String keyWord;
}

View File

@ -38,25 +38,36 @@
mt4.type_name as kindName ,a.status,a.binder,dic.name,ma.ma_code,user.user_name
FROM ma_machine_label b
left join ma_label_bind a on a.ma_id = b.ma_id
LEFT JOIN ma_type mt ON a.type_id = mt.type_id
LEFT JOIN ma_type mt ON a.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id AND mt2.`level` = '3'
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id AND mt3.`level` = '2'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id AND mt4.`level` = '1'
LEFT JOIN ma_type_repair mtk ON mtk.type_id = mt.type_id
LEFT JOIN sys_dic dic ON dic.id = b.label_type
LEFT JOIN ma_machine ma ON ma.ma_id = a.ma_id
LEFT JOIN ma_machine ma ON ma.ma_id = a.ma_id
LEFT JOIN sys_user user on user.user_id =a.binder
<where>
<if test="labelCode != null and labelCode != ''"> and a.label_code = #{labelCode}</if>
<if test="typeId != null "> and a.type_id = #{typeId}</if>
<if test="bindTime != null and bindTime != ''"> and a.bind_time = #{bindTime}</if>
<if test="binder != null and binder != ''"> and a.binder = #{binder}</if>
<if test="labelType != null "> and a.label_type = #{labelType}</if>
<if test="companyId != null and companyId != ''"> and a.company_id = #{companyId}</if>
<if test="modelId != null and modelId != ''"> and mt2.type_id= #{modelId}</if>
<if test="wpName != null and wpName != ''"> and mt3.type_name = #{wpName}</if>
<if test="isBind != null and isBind != ''"> and b.is_bind = #{isBind}</if>
</where>
where 1=1
<if test="keyWord != null and keyWord != ''">
and (b.label_code like concat('%',#{keyWord},'%') or
mt2.type_name like concat('%',#{keyWord},'%') or
mt.type_name like concat('%',#{keyWord},'%') or
ma.ma_code like concat('%',#{keyWord},'%')
)
</if>
<if test="typeId != null ">
and mt2.type_id = #{typeId}
</if>
<if test="modelId != null and modelId != ''">
and mt.type_id= #{modelId}
</if>
<if test="labelCode != null and labelCode != ''">and a.label_code = #{labelCode}</if>
<if test="bindTime != null and bindTime != ''">and a.bind_time = #{bindTime}</if>
<if test="binder != null and binder != ''">and a.binder = #{binder}</if>
<if test="companyId != null and companyId != ''">and a.company_id = #{companyId}</if>
<if test="wpName != null and wpName != ''">and mt3.type_name = #{wpName}</if>
<if test="isBind != null and isBind != ''">and b.is_bind = #{isBind}</if>
ORDER BY b.is_bind ASC,a.bind_time DESC,b.create_time DESC
</select>
<select id="selecthistoryList" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" resultMap="MaLabelBindVOResult">

View File

@ -0,0 +1,59 @@
package com.bonus.sgzb.material.controller;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.material.domain.BackRecord;
import com.bonus.sgzb.material.domain.ScrapRecord;
import com.bonus.sgzb.material.service.BackRecordService;
import com.bonus.sgzb.material.service.ScrapRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @description 综合查询--机具报废查询
* @author hay
* @date 2024/2/26 14:15
*/
@Api(tags = "综合查询--机具报废查询")
@RestController
@RequestMapping("/scrapRecord")
public class ScrapRecordController extends BaseController {
@Autowired
private ScrapRecordService scrapRecordService;
/**
* 机具报废查询列表
*/
@ApiOperation(value = "综合查询--机具报废查询列表")
@GetMapping("/getScrapRecordList")
public AjaxResult getBackRecordList(ScrapRecord bean) {
startPage();
List<ScrapRecord> list = scrapRecordService.getScrapRecordList(bean);
return AjaxResult.success(getDataTable(list));
}
/**
* 导出综合查询机具报废查询列表
*/
@ApiOperation("导出综合查询机具报废查询列表")
@Log(title = "导出综合查询机具报废查询列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScrapRecord bean)
{
List<ScrapRecord> list = scrapRecordService.getScrapRecordList(bean);
ExcelUtil<ScrapRecord> util = new ExcelUtil<ScrapRecord>(ScrapRecord.class);
util.exportExcel(response, list, "综合查询--报废记录");
}
}

View File

@ -0,0 +1,209 @@
package com.bonus.sgzb.material.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @description 综合查询--机具报废查询
* @author hay
* @date 2024/2/26 14:51
*/
@ApiModel(description = "机具报废查询")
@Data
public class ScrapRecord {
private static final long serialVersionUID = 2227217051604273598L;
@ApiModelProperty(value = "")
private Integer id;
/**
* 单位Id
*/
@ApiModelProperty(value = "单位Id")
private Integer unitId;
/**
* 往来单位
*/
@ApiModelProperty(value = "往来单位")
@Excel(name = "往来单位")
private String unitName;
/**
* 工程Id
*/
@ApiModelProperty(value = "工程Id")
private Integer proId;
/**
* 工程名称
*/
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
private String proName;
/**
* 报废单号
*/
@ApiModelProperty(value = "报废单号")
@Excel(name = "报废单号")
private String code;
/**
* 来源单号
*/
@ApiModelProperty(value = "来源单号")
@Excel(name = "来源单号")
private String sourceCode;
/**
* 机具名称
*/
@ApiModelProperty(value = "机具名称")
@Excel(name = "机具名称")
private String typeName;
/**
* 规格ID
*/
@ApiModelProperty(value = "规格ID")
private Integer typeId;
/**
* 规格型号
*/
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
private String typeModelName;
/**
* 单位
*/
@ApiModelProperty(value = "单位")
@Excel(name = "单位")
private String unit;
/**
* 协议号
*/
@ApiModelProperty(value = "协议号")
private String agreementCode;
/**
* 设备编号
*/
@ApiModelProperty(value = "设备编号")
@Excel(name = "设备编号")
private String maCode;
/**
* 报废时间
*/
@ApiModelProperty(value = "报废时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报废时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date scrapTime;
/**
* 报废数量
*/
@ApiModelProperty(value = "报废数量")
@Excel(name = "报废数量",cellType = Excel.ColumnType.NUMERIC)
private Double scrapNum;
/**
* 退料人
*/
@ApiModelProperty(value = "退料人")
private String backPerson;
/**
* 创建者
*/
@ApiModelProperty(value = "创建者")
private String createBy;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新者
*/
@ApiModelProperty(value = "更新者")
private String updateBy;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间 ")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 报废原因
*/
@ApiModelProperty(value = "报废原因")
@Excel(name = "报废原因")
private String remark;
/**
* 报废人
*/
@ApiModelProperty(value = "报废人")
@Excel(name = "报废人")
private String userName;
/**
* 关键字
*/
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value="开始时间")
private String startTime;
@ApiModelProperty(value="结束时间")
private String endTime;
/**
* 设备所属类型
*/
@ApiModelProperty(value = "数据所属组织")
private Integer companyId;
/**
* 装备管理方式(0编号 1计数)
*/
@ApiModelProperty(value = "装备管理方式")
private int manageType;
/**
* 装备管理方式(0编号 1计数)
*/
@ApiModelProperty(value = "装备管理方式名称")
private String manageTypeName;
/**
* 实时库存
*/
@ApiModelProperty(value = "实时库存")
private Double num;
}

View File

@ -0,0 +1,23 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.BackRecord;
import com.bonus.sgzb.material.domain.ScrapRecord;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @description 综合查询--机具报废查询
* @author hay
* @date 2024/2/26 14:19
*/
@Mapper
public interface ScrapRecordMapper {
/**
* 综合查询--机具报废查询
* @param bean
* @return List<ScrapRecord>
*/
List<ScrapRecord> getScrapRecordList(ScrapRecord bean);
}

View File

@ -0,0 +1,21 @@
package com.bonus.sgzb.material.service;
import com.bonus.sgzb.material.domain.BackRecord;
import com.bonus.sgzb.material.domain.ScrapRecord;
import java.util.List;
/**
* @description 综合查询--机具报废查询
* @author hay
* @date 2024/2/26 14:19
*/
public interface ScrapRecordService {
/**
* 综合查询--机具报废查询列表
* @param bean
* @return List<ScrapRecord>
*/
List<ScrapRecord> getScrapRecordList(ScrapRecord bean);
}

View File

@ -0,0 +1,29 @@
package com.bonus.sgzb.material.service.impl;
import com.bonus.sgzb.material.domain.BackRecord;
import com.bonus.sgzb.material.domain.ScrapRecord;
import com.bonus.sgzb.material.mapper.BackRecordMapper;
import com.bonus.sgzb.material.mapper.ScrapRecordMapper;
import com.bonus.sgzb.material.service.BackRecordService;
import com.bonus.sgzb.material.service.ScrapRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author hay
* @date 2023/12/20 14:55
*/
@Service
public class ScrapRecordServiceImpl implements ScrapRecordService {
@Autowired
private ScrapRecordMapper scrapRecordMapper;
@Override
public List<ScrapRecord> getScrapRecordList(ScrapRecord bean) {
return scrapRecordMapper.getScrapRecordList(bean);
}
}

View File

@ -0,0 +1,52 @@
import request from '@/utils/request'
//综合查询
// 查询报废记录列表
export function scrapRecord(query) {
return request({
url: '/material/scrapRecord/getScrapRecordList',
method: 'get',
params: query
})
}
// 列表导出
export function exportList(params = {}){
return request({
url: '/material/scrapRecord/export',
method: 'post',
data: params
})
}
// 获取 来往单位 列表
export function getUnitData(params = {}){
return request({
url: '/system/select/getUnitCbx',
method: 'post',
data: params
})
}
// 获取 工程 列表
export function getProData(params = {}){
return request({
url: '/system/select/getSectionEngineeringCbx',
method: 'post',
data: params
})
}

View File

@ -11,9 +11,9 @@
label-width="68px"
style="z-index: 10000"
>
<el-form-item label="关键字" prop="labelType">
<el-form-item label="关键字" prop="keyWord">
<el-input
v-model="queryParams.labelType"
v-model="queryParams.keyWord"
placeholder="请输入关键字"
clearable
style="width: 240px"

View File

@ -0,0 +1,257 @@
<template>
<div class="app-container" id="scrapRecord">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
<el-form-item label="报废日期">
<el-date-picker
v-model="queryParams.time"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="往来单位">
<el-select v-model="queryParams.unitId" clearable @change="GetProData" style="width: 240px" placeholder="请选择">
<el-option
v-for="item in unitList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="工程名称">
<el-select v-model="queryParams.proId" clearable @change="GetUnitData" style="width: 240px" placeholder="请选择">
<el-option
v-for="item in proList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="协议号" prop="agreementCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.agreementCode"-->
<!-- placeholder="请输入协议号"-->
<!-- clearable-->
<!-- :maxlength="20"-->
<!-- style="width: 240px"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="机具名称" prop="typeName">
<el-input
v-model="queryParams.typeName"
placeholder="请输入机具名称"
clearable
:maxlength="20"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="规格型号" prop="typeModelName">
<el-input
v-model="queryParams.typeModelName"
placeholder="请输入规格型号"
clearable
:maxlength="20"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="关键字" prop="keyWord">
<el-input
v-model="queryParams.keyWord"
placeholder="请输入关键字"
clearable
:maxlength="20"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<el-table v-loading="loading" :data="leaseAuditList">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="序号" align="center" type="index" />
<el-table-column label="往来单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="工程名称" align="center" prop="proName" :show-overflow-tooltip="true" />
<el-table-column label="报废单号" align="center" prop="code" :show-overflow-tooltip="true" />
<el-table-column label="来源单号" align="center" prop="sourceCode" :show-overflow-tooltip="true" />
<el-table-column label="机具名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" prop="unit" :show-overflow-tooltip="true" />
<el-table-column label="设备编号" align="center" prop="maCode" :show-overflow-tooltip="true" />
<el-table-column label="报废时间" align="center" prop="scrapTime" :show-overflow-tooltip="true" />
<el-table-column label="报废数量" align="center" prop="scrapNum" :show-overflow-tooltip="true" />
<el-table-column label="报废原因" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="报废人" align="center" prop="userName" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
:page-sizes="[5,10,15,20,30]"
@pagination="getList"
/>
</div>
</template>
<script>
import { scrapRecord,exportList,getUnitData,getProData } from "@/api/stquery/deviceScrapQuery";
export default {
name: "scrapRecord",
dicts: ['sys_normal_disable'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
leaseAuditList: [],
//
dateRange: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
dictName: undefined,
dictType: undefined,
status: undefined,
time:null, //
unitId:null, //id
proId:null, //id
types: 1, // 1 2
},
unitList:[], //
proList:[], //
};
},
created() {
this.getList();
this.getUnitList();
this.getProList();
},
methods: {
//
async getList() {
this.loading = true;
const params = {
unitId:this.queryParams.unitId,
proId:this.queryParams.proId,
keyWord:this.queryParams.keyWord,
agreementCode:this.queryParams.agreementCode,
typeName:this.queryParams.typeName,
typeModelName:this.queryParams.typeModelName,
startTime:this.queryParams.time && this.queryParams.time[0],
endTime:this.queryParams.time && this.queryParams.time[1],
pageSize: this.queryParams.pageSize,
pageNum: this.queryParams.pageNum
}
const res = await scrapRecord(params)
this.loading = false;
this.leaseAuditList = res.data.rows;
this.total = res.data.total;
},
//
async getUnitList(){
const params = {
id:this.queryParams.proId
}
const res = await getUnitData(params)
this.unitList = res.data
console.log('GetUnitData ======================',res)
},
//
async getProList(){
const params = {
id:this.queryParams.unitId
}
const res = await getProData(params)
this.proList = res.data
console.log('GetProData ======================',res)
},
//
reset() {
this.form = {
dictId: undefined,
dictName: undefined,
dictType: undefined,
status: "0",
remark: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 导出按钮操作 */
handleExport() {
this.download('material/scrapRecord/export', {
...this.queryParams
}, `综合查询_报废记录_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
</style>