Browse Source

[feat] 品质管理

修改品质物料退检前端页面:新增导出前端js方法,支持批量导出和单个导出选项
修改品质管理物料退检Controller层:修改导出物料退检单列表后端接口
新增物料退检导出列表专属dto类
新增物料退检导出后端批量查询接口
新增新增物料退检批量查询物料退检详情后端接口
dev
liuxiaoxu 4 months ago
parent
commit
e9ea6325fa
  1. 12
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterialReturnInspectionExcelDto.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialReturnInspectionDetailMapper.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialReturnInspectionMapper.java
  4. 17
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityReturnInspectionController.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityReturnInspectionService.java
  6. 36
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityReturnInspectionServiceImpl.java
  7. 10
      ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialReturnInspectionDetailMapper.xml
  8. 8
      ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialReturnInspectionMapper.xml
  9. 57
      ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspection.html

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

@ -14,26 +14,36 @@ import java.util.Date;
*/
@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 = "异常原因")
@Excel(name = "异常原因",dictType = "return_inspection_abnormal_cause")
private String abnormalCause;
@Excel(name = "责任单位")
private String dutyUnit;
@Excel(name = "复检备注")
private String recheckRemark;
}

5
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialReturnInspectionDetailMapper.java

@ -80,4 +80,9 @@ public interface ErpMaterialReturnInspectionDetailMapper
* @return 结果
*/
public int restoreErpMaterialReturnInspectionDetailById(Long id);
/**
* 根据退检单号查询物料退检单明细
* */
List<ErpMaterialReturnInspectionDetail> selectQualityReturnInspectionDetailByNos(String[] returnInspectionNos);
}

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

@ -82,4 +82,9 @@ public interface ErpMaterialReturnInspectionMapper
* 根据物料退检编号查询物料退检单
* */
ErpMaterialReturnInspection selectErpMaterialReturnInspectionByNo(String returnInspectionNo);
/**
* 根据退检单号批量查找退检单
* */
List<ErpMaterialReturnInspection> selectQualityReturnInspectionByNos(String[] returnInspectionNos);
}

17
ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityReturnInspectionController.java

@ -4,15 +4,12 @@ import java.util.List;
import com.ruoyi.erp.domain.ErpMaterialReturnInspection;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto;
import com.ruoyi.system.domain.SysSalesShippingInform;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.quality.service.IQualityReturnInspectionService;
@ -56,20 +53,22 @@ public class QualityReturnInspectionController extends BaseController
return getDataTable(list);
}
/**
* 导出物料退检单列表
*/
@RequiresPermissions("quality:returnInspection:export")
@Log(title = "物料退检单", businessType = BusinessType.EXPORT)
@Log(title = "品质退检处理导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ErpMaterialReturnInspection erpMaterialReturnInspection)
public AjaxResult export(@RequestBody String[] returnInspectionNos)
{
List<ErpMaterialReturnInspectionExcelDto> list = qualityReturnInspectionService.selectExportList(erpMaterialReturnInspection);
List<ErpMaterialReturnInspectionExcelDto> list = qualityReturnInspectionService.selectQualityReturnInspectionByNos(returnInspectionNos);
ExcelUtil<ErpMaterialReturnInspectionExcelDto> util = new ExcelUtil<ErpMaterialReturnInspectionExcelDto>(ErpMaterialReturnInspectionExcelDto.class);
return util.exportExcel(list, "物料退检单数据");
return util.exportExcel(list, "品质退检处理数据");
}
/**
* 新增物料退检单
*/

5
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityReturnInspectionService.java

@ -60,4 +60,9 @@ public interface IQualityReturnInspectionService
* 退检处理
* */
int processingQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection);
/**
* 退检处理导出
* */
List<ErpMaterialReturnInspectionExcelDto> selectQualityReturnInspectionByNos(String[] returnInspectionNos);
}

36
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityReturnInspectionServiceImpl.java

@ -12,6 +12,7 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.erp.domain.ErpMaterialReturnInspection;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionDetail;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto;
import com.ruoyi.erp.mapper.ErpMaterialReturnInspectionDetailMapper;
import com.ruoyi.erp.mapper.ErpMaterialReturnInspectionMapper;
import com.ruoyi.erp.service.IErpMaterialReturnInspectionDetailService;
import org.springframework.beans.factory.annotation.Autowired;
@ -37,6 +38,10 @@ public class QualityReturnInspectionServiceImpl implements IQualityReturnInspect
@Autowired
private IErpMaterialReturnInspectionDetailService materialReturnInspectionDetailService;
@Autowired
private ErpMaterialReturnInspectionDetailMapper erpMaterialReturnInspectionDetailMapper;
/**
* 查询物料退检单
*
@ -52,7 +57,7 @@ public class QualityReturnInspectionServiceImpl implements IQualityReturnInspect
/**
* 查询物料退检单列表
*
* @param qualityReturnInspection 物料退检单
* @param erpMaterialReturnInspection 物料退检单
* @return 物料退检单
*/
@Override
@ -64,7 +69,7 @@ public class QualityReturnInspectionServiceImpl implements IQualityReturnInspect
/**
* 新增物料退检单
*
* @param qualityReturnInspection 物料退检单
* @param erpMaterialReturnInspection 物料退检单
* @return 结果
*/
@Override
@ -91,7 +96,7 @@ public class QualityReturnInspectionServiceImpl implements IQualityReturnInspect
/**
* 修改物料退检单
*
* @param qualityReturnInspection 物料退检单
* @param erpMaterialReturnInspection 物料退检单
* @return 结果
*/
@Override
@ -190,4 +195,29 @@ public class QualityReturnInspectionServiceImpl implements IQualityReturnInspect
int updateFlag = erpMaterialReturnInspectionMapper.updateErpMaterialReturnInspection(erpMaterialReturnInspection);
return updateFlag;
}
/**
* 退检处理导出
* */
@Override
public List<ErpMaterialReturnInspectionExcelDto> selectQualityReturnInspectionByNos(String[] returnInspectionNos) {
List<ErpMaterialReturnInspectionDetail> returnInspectionDetails = erpMaterialReturnInspectionDetailMapper.selectQualityReturnInspectionDetailByNos(returnInspectionNos);
List<ErpMaterialReturnInspectionExcelDto> erpMaterialReturnInspectionExcelDtos = new ArrayList<>();
for (ErpMaterialReturnInspectionDetail returnInspectionDetail : returnInspectionDetails) {
ErpMaterialReturnInspectionExcelDto erpMaterialReturnInspectionExcelDto = new ErpMaterialReturnInspectionExcelDto();
erpMaterialReturnInspectionExcelDto.setAbnormalCause(returnInspectionDetail.getAbnormalCause());
erpMaterialReturnInspectionExcelDto.setDutyUnit(returnInspectionDetail.getDutyUnit());
erpMaterialReturnInspectionExcelDto.setMaterialName(returnInspectionDetail.getMaterialName());
erpMaterialReturnInspectionExcelDto.setMaterialNo(returnInspectionDetail.getMaterialNo());
erpMaterialReturnInspectionExcelDto.setPickMaterialTime(returnInspectionDetail.getPickMaterialTime());
erpMaterialReturnInspectionExcelDto.setRecheckRemark(returnInspectionDetail.getRecheckRemark());
erpMaterialReturnInspectionExcelDto.setReturnInspectionNo(returnInspectionDetail.getReturnInspectionNo());
erpMaterialReturnInspectionExcelDto.setReturnInspectionNum(returnInspectionDetail.getReturnInspectionNum());
erpMaterialReturnInspectionExcelDto.setReturnInspectionRemark(returnInspectionDetail.getReturnInspectionRemark());
erpMaterialReturnInspectionExcelDto.setReturnInspectionType(returnInspectionDetail.getReturnInspectionType());
erpMaterialReturnInspectionExcelDtos.add(erpMaterialReturnInspectionExcelDto);
}
return erpMaterialReturnInspectionExcelDtos;
}
}

10
ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialReturnInspectionDetailMapper.xml

@ -62,7 +62,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectErpMaterialReturnInspectionDetailVo"/>
where a.id = #{id}
</select>
<select id="selectQualityReturnInspectionDetailByNos" parameterType="String" resultMap="ErpMaterialReturnInspectionDetailResult">
<include refid="selectErpMaterialReturnInspectionDetailVo"/>
where a.return_inspection_no in
<foreach collection="array" item="returnInspectionNo" open="(" separator="," close=")">
#{returnInspectionNo}
</foreach>
</select>
<insert id="insertErpMaterialReturnInspectionDetail" parameterType="ErpMaterialReturnInspectionDetail" useGeneratedKeys="true" keyProperty="id">
insert into erp_material_return_inspection_detail
<trim prefix="(" suffix=")" suffixOverrides=",">

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

@ -114,6 +114,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where a.return_inspection_no = #{returnInspectionNo}
</select>
<select id="selectQualityReturnInspectionByNos" parameterType="String" resultMap="ErpMaterialReturnInspectionResult">
<include refid="selectErpMaterialReturnInspectionVo"/>
where a.return_inspection_no in
<foreach collection="array" item="returnInspectionNo" open="(" separator="," close=")">
#{returnInspectionNo}
</foreach>
</select>
<insert id="insertErpMaterialReturnInspection" parameterType="ErpMaterialReturnInspection" useGeneratedKeys="true" keyProperty="id">
insert into erp_material_return_inspection
<trim prefix="(" suffix=")" suffixOverrides=",">

57
ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspection.html

@ -53,7 +53,7 @@
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="quality:returnInspection:export">
<a class="btn btn-warning" onclick="exportExcel()" shiro:hasPermission="quality:returnInspection:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
@ -137,6 +137,61 @@
var url = ctx + 'quality/returnInspection/processing/'+id;
$.modal.open("退检处理",url);
}
// 导出
function exportExcel(formId) {
// $.table.set();
var returnInspectionNoData = [];
var selections = $("#bootstrap-table").bootstrapTable("getSelections");
if(selections.length === 0){
$.modal.confirm("确定导出所有退检处理吗?", function() {
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
var params = $("#bootstrap-table").bootstrapTable('getOptions');
var dataParam = $("#" + currentId).serializeArray();
dataParam.push({ "name": "orderByColumn", "value": params.sortName });
dataParam.push({ "name": "isAsc", "value": params.sortOrder });
$.modal.loading("正在导出数据,请稍后...");
$.post(prefix + '/exportAll', dataParam, function(result) {
if (result.code == web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
} else if (result.code == web_status.WARNING) {
$.modal.alertWarning(result.msg)
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
});
}else {
$.modal.confirm("确定导出选中的所有退检处理吗?", function () {
//·拼接单号
for(let i=0;i<selections.length;i++){
returnInspectionNoData.push(selections[i].returnInspectionNo);
}
var returnInspectionNos = JSON.stringify(returnInspectionNoData);
// console.log(bomNos);
$.modal.loading("正在导出数据,请稍后...");
var config = {
url: prefix + '/export',
type: "post",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: returnInspectionNos,
success: function(result) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
$.modal.alertSuccess("导出成功!")
$.modal.closeLoading();
},
error: function (result){
$.modal.alertError(result.msg);
}
};
$.ajax(config)
});
}
};
</script>
</body>
</html>
Loading…
Cancel
Save