机具入库查询
This commit is contained in:
parent
c961c0c3c6
commit
e5e2b286b2
|
|
@ -4,6 +4,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
|
|||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.InputRecordInfo;
|
||||
import com.bonus.material.basic.domain.MachineHistoryRecordBean;
|
||||
import com.bonus.material.basic.domain.ProjUsingDto;
|
||||
import com.bonus.material.basic.domain.ProjUsingRecord;
|
||||
|
|
@ -89,6 +90,11 @@ public class ComplexQueryController extends BaseController {
|
|||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备使用追溯查询
|
||||
* @param response
|
||||
* @param bean
|
||||
*/
|
||||
@ApiOperation("导出综合查询设备使用追溯查询")
|
||||
@PostMapping("/exportMachineHistoryRecord")
|
||||
public void exportMachineHistoryRecord(HttpServletResponse response, MachineHistoryRecordBean bean)
|
||||
|
|
@ -98,4 +104,29 @@ public class ComplexQueryController extends BaseController {
|
|||
util.exportExcel(response, list, "综合查询--设备使用追溯查询");
|
||||
}
|
||||
|
||||
/**
|
||||
* 机具入库查询列表
|
||||
*/
|
||||
@ApiOperation(value = "综合查询--机具入库查询列表")
|
||||
@GetMapping("/getInputRecordList")
|
||||
public AjaxResult getInputRecordList(InputRecordInfo bean) {
|
||||
startPage();
|
||||
List<InputRecordInfo> list = complexQueryService.getInputRecordList(bean);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出机具入库查询
|
||||
* @param response
|
||||
* @param bean
|
||||
*/
|
||||
@ApiOperation("导出综合查询机具入库查询")
|
||||
@PostMapping("/exportInputRecord")
|
||||
public void exportMachineHistoryRecord(HttpServletResponse response, InputRecordInfo bean)
|
||||
{
|
||||
List<InputRecordInfo> list = complexQueryService.getInputRecordList(bean);
|
||||
ExcelUtil<InputRecordInfo> util = new ExcelUtil<>(InputRecordInfo.class);
|
||||
util.exportExcel(response, list, "综合查询--机具入库查询");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
package com.bonus.material.basic.domain;
|
||||
|
||||
import com.bonus.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.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description 综合查询--机具入库查询
|
||||
* @author hay
|
||||
* @date 2024/2/26 14:51
|
||||
*/
|
||||
@ApiModel(description = "机具入库查询")
|
||||
@Data
|
||||
public class InputRecordInfo {
|
||||
|
||||
private static final long serialVersionUID = 2227217051604273598L;
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "物资名称")
|
||||
@Excel(name = "物资名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
private Integer typeId;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
@Excel(name = "设备编码")
|
||||
private String maCode;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
@Excel(name = "计量单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty(value = "入库数量")
|
||||
@Excel(name = "入库数量")
|
||||
private BigDecimal inputNum;
|
||||
|
||||
@ApiModelProperty(value = "入库人员")
|
||||
@Excel(name = "入库人员")
|
||||
private String inputUser;
|
||||
|
||||
@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 inputTime;
|
||||
|
||||
@ApiModelProperty(value = "入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inputCode;
|
||||
|
||||
@ApiModelProperty(value = "入库类型")
|
||||
@Excel(name = "入库类型")
|
||||
private String inputType;
|
||||
|
||||
@ApiModelProperty(value = "入库方式")
|
||||
@Excel(name = "入库方式")
|
||||
private String inputStyle;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value="开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "装备管理方式")
|
||||
private String manageType;
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.basic.mapper;
|
||||
|
||||
import com.bonus.material.basic.domain.InputRecordInfo;
|
||||
import com.bonus.material.basic.domain.MachineHistoryRecordBean;
|
||||
import com.bonus.material.basic.domain.ProjUsingRecord;
|
||||
|
||||
|
|
@ -24,4 +25,11 @@ public interface ComplexQueryMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MachineHistoryRecordBean> getMachineHistoryRecordList(MachineHistoryRecordBean bean);
|
||||
|
||||
/**
|
||||
* 机具入库查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<InputRecordInfo> getInputRecordList(InputRecordInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.basic.service;
|
||||
|
||||
import com.bonus.material.basic.domain.InputRecordInfo;
|
||||
import com.bonus.material.basic.domain.MachineHistoryRecordBean;
|
||||
import com.bonus.material.basic.domain.ProjUsingRecord;
|
||||
|
||||
|
|
@ -32,4 +33,10 @@ public interface ComplexQueryService {
|
|||
*/
|
||||
List<ProjUsingRecord> exportProjUsingRecord(ProjUsingRecord bean);
|
||||
|
||||
/**
|
||||
* 机具入库查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<InputRecordInfo> getInputRecordList(InputRecordInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,20 @@
|
|||
package com.bonus.material.basic.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.bonus.material.basic.domain.InputRecordInfo;
|
||||
import com.bonus.material.basic.domain.MachineHistoryRecordBean;
|
||||
import com.bonus.material.basic.domain.ProjUsingRecord;
|
||||
import com.bonus.material.basic.mapper.ComplexQueryMapper;
|
||||
import com.bonus.material.basic.service.ComplexQueryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 综合查询服务实现类
|
||||
|
|
@ -78,4 +82,45 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 机具入库查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<InputRecordInfo> getInputRecordList(InputRecordInfo bean) {
|
||||
List<InputRecordInfo> recordList = complexQueryMapper.getInputRecordList(bean);
|
||||
List<InputRecordInfo> list = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
for (InputRecordInfo inputRecordInfo : recordList) {
|
||||
if (StringUtils.isNotBlank(inputRecordInfo.getMaCode())) {
|
||||
String[] split = inputRecordInfo.getMaCode().split(",");
|
||||
if (split.length > 1) {
|
||||
for (String code : split) {
|
||||
InputRecordInfo newRecord = new InputRecordInfo();
|
||||
BeanUtils.copyProperties(inputRecordInfo, newRecord);
|
||||
newRecord.setMaCode(code);
|
||||
list.add(newRecord);
|
||||
}
|
||||
} else {
|
||||
list.add(inputRecordInfo);
|
||||
}
|
||||
} else {
|
||||
list.add(inputRecordInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(bean.getKeyWord())) {
|
||||
String keyword = bean.getKeyWord();
|
||||
return list.stream().filter(item -> {
|
||||
return (StringUtils.isNotBlank(item.getMaCode()) && item.getMaCode().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getTypeName()) && item.getTypeName().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getTypeModelName()) && item.getTypeModelName().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getInputUser()) && item.getInputUser().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getInputCode()) && item.getInputCode().contains(keyword));
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,4 +230,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bai.agreement_code
|
||||
</select>
|
||||
|
||||
<select id="getInputRecordList" resultType="com.bonus.material.basic.domain.InputRecordInfo">
|
||||
SELECT
|
||||
bs.type_name as typeName,
|
||||
bs.type_model_name as typeModelName,
|
||||
bs.ma_code as maCode,
|
||||
mt.unit_name as unit,
|
||||
bs.in_num as inputNum,
|
||||
bs.creator as inputUser,
|
||||
bs.create_time as inputTime,
|
||||
tt.`code` as inputCode,
|
||||
CASE
|
||||
WHEN tt.`code` LIKE 'XG%' THEN '新购入库'
|
||||
WHEN tt.`code` LIKE 'R%' THEN '修饰入库'
|
||||
WHEN tt.`code` LIKE 'PD%' THEN '盘点入库'
|
||||
ELSE '未知入库类型'
|
||||
END AS inputType,
|
||||
CASE
|
||||
WHEN bs.input_type = '0' THEN '编码'
|
||||
WHEN bs.input_type = '1' THEN '数量'
|
||||
WHEN bs.input_type = '2' THEN '二维码'
|
||||
WHEN bs.input_type = '3' THEN '标准箱'
|
||||
ELSE '未知入库方式'
|
||||
END AS inputStyle
|
||||
FROM
|
||||
bm_storage_log bs
|
||||
LEFT JOIN ma_type mt ON bs.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN tm_task tt ON bs.task_id = tt.task_id
|
||||
WHERE bs.in_num != 0
|
||||
<if test="inputType != null and inputType != ''">
|
||||
and (
|
||||
CASE
|
||||
WHEN tt.`code` LIKE 'XG%' THEN '新购入库'
|
||||
WHEN tt.`code` LIKE 'R%' THEN '修饰入库'
|
||||
WHEN tt.`code` LIKE 'PD%' THEN '盘点入库'
|
||||
ELSE '未知入库类型'
|
||||
END = #{inputType}
|
||||
)
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and bs.type_name like CONCAT('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
and bs.type_model_name like CONCAT('%',#{typeModelName},'%')
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND bs.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue