机具出库查询
This commit is contained in:
parent
e5e2b286b2
commit
3fb4ac8d17
|
|
@ -4,10 +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;
|
||||
import com.bonus.material.basic.domain.*;
|
||||
import com.bonus.material.basic.service.ComplexQueryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -122,11 +119,33 @@ public class ComplexQueryController extends BaseController {
|
|||
*/
|
||||
@ApiOperation("导出综合查询机具入库查询")
|
||||
@PostMapping("/exportInputRecord")
|
||||
public void exportMachineHistoryRecord(HttpServletResponse response, InputRecordInfo bean)
|
||||
public void exportInputRecord(HttpServletResponse response, InputRecordInfo bean)
|
||||
{
|
||||
List<InputRecordInfo> list = complexQueryService.getInputRecordList(bean);
|
||||
ExcelUtil<InputRecordInfo> util = new ExcelUtil<>(InputRecordInfo.class);
|
||||
util.exportExcel(response, list, "综合查询--机具入库查询");
|
||||
}
|
||||
|
||||
/**
|
||||
* 机具出库查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "综合查询--机具出库查询列表")
|
||||
@GetMapping("/getOutRecordList")
|
||||
public AjaxResult getOutRecordList(OutRecordInfo bean) {
|
||||
startPage();
|
||||
List<OutRecordInfo> list = complexQueryService.getOutRecordList(bean);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
@ApiOperation("导出综合查询机具出库查询")
|
||||
@PostMapping("/exportOutRecord")
|
||||
public void exportOutRecord(HttpServletResponse response, OutRecordInfo bean)
|
||||
{
|
||||
List<OutRecordInfo> list = complexQueryService.getOutRecordList(bean);
|
||||
ExcelUtil<OutRecordInfo> util = new ExcelUtil<>(OutRecordInfo.class);
|
||||
util.exportExcel(response, list, "综合查询--机具出库查询");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import java.util.Date;
|
|||
|
||||
/**
|
||||
* @description 综合查询--机具入库查询
|
||||
* @author hay
|
||||
* @author ma_sh
|
||||
* @date 2024/2/26 14:51
|
||||
*/
|
||||
@ApiModel(description = "机具入库查询")
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
|||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 综合查询-设备使用追溯查询
|
||||
* @Author ma_sh
|
||||
* @create 2024/12/16 14:03
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
package com.bonus.material.basic.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 综合查询-机具出库列表查询
|
||||
* @Author ma_sh
|
||||
* @create 2024/12/18 9:23
|
||||
*/
|
||||
@Data
|
||||
public class OutRecordInfo {
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "工程Id")
|
||||
private Integer proId;
|
||||
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
@Excel(name = "工程名称")
|
||||
private String proName;
|
||||
|
||||
@ApiModelProperty(value = "往来单位Id")
|
||||
private Integer unitId;
|
||||
|
||||
@ApiModelProperty(value = "往来单位")
|
||||
@Excel(name = "往来单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "协议号")
|
||||
@Excel(name = "协议号")
|
||||
private String agreementCode;
|
||||
|
||||
@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 outNum;
|
||||
|
||||
@ApiModelProperty(value = "出库人员")
|
||||
@Excel(name = "出库人员")
|
||||
private String outUser;
|
||||
|
||||
@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 outTime;
|
||||
|
||||
@ApiModelProperty(value = "领料单号")
|
||||
@Excel(name = "领料单号")
|
||||
private String leaseCode;
|
||||
|
||||
@ApiModelProperty(value = "出库方式")
|
||||
@Excel(name = "出库方式")
|
||||
private String outStyle;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value="开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "装备管理方式")
|
||||
private String manageType;
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ 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.OutRecordInfo;
|
||||
import com.bonus.material.basic.domain.ProjUsingRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -32,4 +33,11 @@ public interface ComplexQueryMapper {
|
|||
* @return
|
||||
*/
|
||||
List<InputRecordInfo> getInputRecordList(InputRecordInfo bean);
|
||||
|
||||
/**
|
||||
* 机具出库查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<OutRecordInfo> getOutRecordList(OutRecordInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ 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.OutRecordInfo;
|
||||
import com.bonus.material.basic.domain.ProjUsingRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -39,4 +40,11 @@ public interface ComplexQueryService {
|
|||
* @return
|
||||
*/
|
||||
List<InputRecordInfo> getInputRecordList(InputRecordInfo bean);
|
||||
|
||||
/**
|
||||
* 机具出库查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<OutRecordInfo> getOutRecordList(OutRecordInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ 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.OutRecordInfo;
|
||||
import com.bonus.material.basic.domain.ProjUsingRecord;
|
||||
import com.bonus.material.basic.mapper.ComplexQueryMapper;
|
||||
import com.bonus.material.basic.service.ComplexQueryService;
|
||||
|
|
@ -123,4 +124,35 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 机具出库查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OutRecordInfo> getOutRecordList(OutRecordInfo bean) {
|
||||
List<OutRecordInfo> recordList = complexQueryMapper.getOutRecordList(bean);
|
||||
List<OutRecordInfo> list = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
for (OutRecordInfo outRecordInfo : recordList) {
|
||||
if (StringUtils.isNotBlank(outRecordInfo.getMaCode())) {
|
||||
String[] split = outRecordInfo.getMaCode().split(",");
|
||||
if (split.length > 1) {
|
||||
for (String code : split) {
|
||||
OutRecordInfo recordInfo = new OutRecordInfo();
|
||||
BeanUtils.copyProperties(outRecordInfo, recordInfo);
|
||||
recordInfo.setMaCode(code);
|
||||
list.add(recordInfo);
|
||||
}
|
||||
} else {
|
||||
list.add(outRecordInfo);
|
||||
}
|
||||
} else {
|
||||
list.add(outRecordInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,8 +156,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getMachineHistoryRecordList" resultType="com.bonus.material.basic.domain.MachineHistoryRecordBean">
|
||||
SELECT
|
||||
bai.agreement_id,
|
||||
mt.type_id,
|
||||
bai.agreement_id as agreementId,
|
||||
mt.type_id as typeId,
|
||||
bai.agreement_code AS agreementCode,
|
||||
bui.unit_name AS unitName,
|
||||
bpl.pro_name AS proName,
|
||||
|
|
@ -280,4 +280,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getOutRecordList" resultType="com.bonus.material.basic.domain.OutRecordInfo">
|
||||
SELECT
|
||||
bpl.pro_name AS proName,
|
||||
bui.unit_name AS unitName,
|
||||
bai.agreement_code AS agreementCode,
|
||||
bs.type_name as typeName,
|
||||
bs.type_model_name as typeModelName,
|
||||
bs.ma_code as maCode,
|
||||
mt.unit_name as unit,
|
||||
bs.out_num as outNum,
|
||||
bs.creator as outUser,
|
||||
bs.create_time as outTime,
|
||||
tt.`code` as leaseCode,
|
||||
CASE
|
||||
WHEN bs.out_type = '0' THEN '编码'
|
||||
WHEN bs.out_type = '1' THEN '数量'
|
||||
WHEN bs.out_type = '2' THEN '二维码'
|
||||
WHEN bs.out_type = '3' THEN '标准箱'
|
||||
ELSE '未知入库方式'
|
||||
END AS outStyle
|
||||
FROM
|
||||
bm_storage_log bs
|
||||
LEFT JOIN tm_task_agreement tta ON tta.task_id = bs.task_id
|
||||
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
||||
LEFT JOIN bm_project bpl ON bpl.pro_id = bai.project_id
|
||||
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||
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.out_num != 0
|
||||
<if test="unitId != null">
|
||||
and bui.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and bpl.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="outStyle != null and outStyle != ''">
|
||||
and (
|
||||
CASE
|
||||
WHEN bs.out_type = '0' THEN '编码'
|
||||
WHEN bs.out_type = '1' THEN '数量'
|
||||
WHEN bs.out_type = '2' THEN '二维码'
|
||||
WHEN bs.out_type = '3' THEN '标准箱'
|
||||
ELSE '未知入库方式'
|
||||
END = #{outStyle}
|
||||
)
|
||||
</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