Browse Source

[update]:退料退检单-导出功能

dev
youjianchi 6 months ago
parent
commit
28392fb275
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialReturnInspectionController.java
  2. 39
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterialReturnInspectionExcelDto.java
  3. 3
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialReturnInspectionMapper.java
  4. 3
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialReturnInspectionService.java
  5. 6
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialReturnInspectionServiceImpl.java
  6. 50
      ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialReturnInspectionMapper.xml

6
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialReturnInspectionController.java

@ -1,6 +1,8 @@
package com.ruoyi.erp.controller; package com.ruoyi.erp.controller;
import java.util.List; import java.util.List;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -63,8 +65,8 @@ public class ErpMaterialReturnInspectionController extends BaseController
@ResponseBody @ResponseBody
public AjaxResult export(ErpMaterialReturnInspection erpMaterialReturnInspection) public AjaxResult export(ErpMaterialReturnInspection erpMaterialReturnInspection)
{ {
List<ErpMaterialReturnInspection> list = erpMaterialReturnInspectionService.selectErpMaterialReturnInspectionList(erpMaterialReturnInspection); List<ErpMaterialReturnInspectionExcelDto> list = erpMaterialReturnInspectionService.selectExportList(erpMaterialReturnInspection);
ExcelUtil<ErpMaterialReturnInspection> util = new ExcelUtil<ErpMaterialReturnInspection>(ErpMaterialReturnInspection.class); ExcelUtil<ErpMaterialReturnInspectionExcelDto> util = new ExcelUtil<ErpMaterialReturnInspectionExcelDto>(ErpMaterialReturnInspectionExcelDto.class);
return util.exportExcel(list, "物料退检单数据"); return util.exportExcel(list, "物料退检单数据");
} }

39
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterialReturnInspectionExcelDto.java

@ -0,0 +1,39 @@
package com.ruoyi.erp.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author xiguniang
* @description ErpMaterialReturnInspectionExcelDto
* @date 2024/5/11 21:07
*/
@Data
public class ErpMaterialReturnInspectionExcelDto implements Serializable {
@Excel(name = "退检单号")
private String returnInspectionNo;
@Excel(name = "料号")
private String materialNo;
@Excel(name = "物料名称")
private String materialName;
@Excel(name = "退检数量")
private Long returnInspectionNum;
@Excel(name = "退检类型")
private String returnInspectionType;
/** 领料时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "领料时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date pickMaterialTime;
@Excel(name = "退检备注")
private String returnInspectionRemark;
@Excel(name = "异常原因")
private String abnormalCause;
@Excel(name = "责任单位")
private String dutyUnit;
@Excel(name = "复检备注")
private String recheckRemark;
}

3
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialReturnInspectionMapper.java

@ -2,6 +2,7 @@ package com.ruoyi.erp.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.erp.domain.ErpMaterialReturnInspection; import com.ruoyi.erp.domain.ErpMaterialReturnInspection;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto;
/** /**
* 物料退检单Mapper接口 * 物料退检单Mapper接口
@ -74,4 +75,6 @@ public interface ErpMaterialReturnInspectionMapper
* @return 结果 * @return 结果
*/ */
public int restoreErpMaterialReturnInspectionById(Long id); public int restoreErpMaterialReturnInspectionById(Long id);
List<ErpMaterialReturnInspectionExcelDto> selectExportList(ErpMaterialReturnInspection erpMaterialReturnInspection);
} }

3
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialReturnInspectionService.java

@ -2,6 +2,7 @@ package com.ruoyi.erp.service;
import java.util.List; import java.util.List;
import com.ruoyi.erp.domain.ErpMaterialReturnInspection; import com.ruoyi.erp.domain.ErpMaterialReturnInspection;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto;
/** /**
* 物料退检单Service接口 * 物料退检单Service接口
@ -72,4 +73,6 @@ public interface IErpMaterialReturnInspectionService
* @return * @return
*/ */
int restoreErpMaterialReturnInspectionById(Long id); int restoreErpMaterialReturnInspectionById(Long id);
List<ErpMaterialReturnInspectionExcelDto> selectExportList(ErpMaterialReturnInspection erpMaterialReturnInspection);
} }

6
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialReturnInspectionServiceImpl.java

@ -9,6 +9,7 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionDetail; import com.ruoyi.erp.domain.ErpMaterialReturnInspectionDetail;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto;
import com.ruoyi.erp.service.IErpMaterialReturnInspectionDetailService; import com.ruoyi.erp.service.IErpMaterialReturnInspectionDetailService;
import com.ruoyi.system.domain.SysMakeorderPickDetail; import com.ruoyi.system.domain.SysMakeorderPickDetail;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -178,4 +179,9 @@ public class ErpMaterialReturnInspectionServiceImpl implements IErpMaterialRetur
{ {
return erpMaterialReturnInspectionMapper.restoreErpMaterialReturnInspectionById(id); return erpMaterialReturnInspectionMapper.restoreErpMaterialReturnInspectionById(id);
} }
@Override
public List<ErpMaterialReturnInspectionExcelDto> selectExportList(ErpMaterialReturnInspection erpMaterialReturnInspection) {
return erpMaterialReturnInspectionMapper.selectExportList(erpMaterialReturnInspection);
}
} }

50
ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialReturnInspectionMapper.xml

@ -19,6 +19,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isClosed" column="is_closed" /> <result property="isClosed" column="is_closed" />
</resultMap> </resultMap>
<resultMap type="ErpMaterialReturnInspectionExcelDto" id="ErpMaterialReturnInspectionExcelResult">
<result property="returnInspectionNo" column="return_inspection_no" />
<result property="materialNo" column="material_no" />
<result property="materialName" column="material_name" />
<result property="returnInspectionNum" column="return_inspection_num" />
<result property="returnInspectionType" column="return_inspection_type" />
<result property="pickMaterialTime" column="pick_material_time" />
<result property="returnInspectionRemark" column="return_inspection_remark" />
<result property="abnormalCause" column="abnormal_cause" />
<result property="dutyUnit" column="duty_unit" />
<result property="recheckRemark" column="recheck_remark" />
</resultMap>
<sql id="selectErpMaterialReturnInspectionVo"> <sql id="selectErpMaterialReturnInspectionVo">
select a.id, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.return_inspection_no, a.make_no, a.return_material_time, a.urgency_level, a.is_closed from erp_material_return_inspection a select a.id, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.return_inspection_no, a.make_no, a.return_material_time, a.urgency_level, a.is_closed from erp_material_return_inspection a
</sql> </sql>
@ -58,6 +71,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectErpMaterialReturnInspectionVo"/> <include refid="selectErpMaterialReturnInspectionVo"/>
where a.id = #{id} where a.id = #{id}
</select> </select>
<select id="selectExportList" resultMap="ErpMaterialReturnInspectionExcelResult">
select
a.return_inspection_no
,b.material_no
,b.material_name
,b.return_inspection_num
,b.return_inspection_type
,b.pick_material_time
,b.return_inspection_remark
,b.abnormal_cause
,b.duty_unit
,b.recheck_remark
from erp_material_return_inspection a
left join erp_material_return_inspection_detail b
on a.return_inspection_no = b.return_inspection_no
<where>
<if test="returnInspectionNo != null and returnInspectionNo != ''"> and a.return_inspection_no = #{returnInspectionNo}</if>
<if test="makeNo != null and makeNo != ''"> and a.make_no = #{makeNo}</if>
<if test="urgencyLevel != null and urgencyLevel != ''"> and a.urgency_level = #{urgencyLevel}</if>
<if test="isClosed != null and isClosed != ''"> and a.is_closed = #{isClosed}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''"><!-- 开始时间检索 -->
and date_format(a.create_time,'%y%m%d') &gt;= date_format(#{params.beginCreateTime},'%y%m%d')
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''"><!-- 结束时间检索 -->
and date_format(a.create_time,'%y%m%d') &lt;= date_format(#{params.endCreateTime},'%y%m%d')
</if>
<if test="returnInspectionType != null and returnInspectionType != ''">
and b.return_inspection_type = #{returnInspectionType}
</if>
<if test="materialNo != null and materialNo != ''">
and b.material_no = #{materialNo}
</if>
<if test="materialName != null and materialName != ''">
and b.material_name = #{materialName}
</if>
</where>
</select>
<insert id="insertErpMaterialReturnInspection" parameterType="ErpMaterialReturnInspection" useGeneratedKeys="true" keyProperty="id"> <insert id="insertErpMaterialReturnInspection" parameterType="ErpMaterialReturnInspection" useGeneratedKeys="true" keyProperty="id">
insert into erp_material_return_inspection insert into erp_material_return_inspection

Loading…
Cancel
Save