Browse Source

[feat] 品质管理

按照万材要求,品质管理退换货新增导出功能,支持部分行和全部行导出,导出更多数据
新增导出所有和选择导出后端接口
新增 导出品质管理退换货明细方法
新增根据品质管理退检管理集合方法
新增导出品质管理退检管理明细
修复,品质管理退换货分页查询多余的异常抛出问题
dev
liuxiaoxu 1 day ago
parent
commit
352cd8bc14
  1. 23
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityRefundsExchangesController.java
  2. 148
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/VO/ExportQualityRefundsExchangesVo.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityRefundsExchangesDetailMapper.java
  4. 7
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityRefundsExchangesService.java
  5. 79
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesServiceImpl.java
  6. 8
      ruoyi-admin/src/main/resources/mapper/quality/QualityRefundsExchangesDetailMapper.xml
  7. 71
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/refundsExchanges.html

23
ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityRefundsExchangesController.java

@ -7,10 +7,13 @@ import java.util.stream.Collectors;
import com.ruoyi.aftersales.domain.AftersalesComplaintNoticeDetail;
import com.ruoyi.aftersales.domain.vo.AftersalesMaterialVO;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpMaterialReturnInspection;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.domain.vo.ExportMaterialReturnInspectionVo;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.quality.domain.*;
import com.ruoyi.quality.domain.VO.CheckoutMaterialVO;
import com.ruoyi.quality.domain.VO.ExportQualityRefundsExchangesVo;
import com.ruoyi.quality.domain.VO.QualityRefundsExchangesExportVO;
import com.ruoyi.quality.mapper.QualityRefundsExchangesOrderMapper;
import com.ruoyi.quality.service.IQualityRefundsExchangesDetailService;
@ -85,12 +88,22 @@ public class QualityRefundsExchangesController extends BaseController
@Log(title = "品质管理退换货单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(@RequestBody String[] refundsExchangesCodes)
public AjaxResult export(QualityRefundsExchanges qualityRefundsExchanges,String ids)
{
String refundsExchangesCodesString = String.join(",", refundsExchangesCodes); // 带分隔符
List<QualityRefundsExchangesExportVO> list = qualityRefundsExchangesService.getExportList(refundsExchangesCodes);
ExcelUtil<QualityRefundsExchangesExportVO> util = new ExcelUtil<QualityRefundsExchangesExportVO>(QualityRefundsExchangesExportVO.class);
return util.exportExcel(list, refundsExchangesCodesString);
if (org.springframework.util.StringUtils.isEmpty(ids)){
List<QualityRefundsExchanges> list = qualityRefundsExchangesService.selectQualityRefundsExchangesList(qualityRefundsExchanges);
List<ExportQualityRefundsExchangesVo> exportQualityRefundsExchangesVos = qualityRefundsExchangesService.exportQualityRefundsExchangesList(list);
ExcelUtil<ExportQualityRefundsExchangesVo> util = new ExcelUtil<ExportQualityRefundsExchangesVo>(ExportQualityRefundsExchangesVo.class);
return util.exportExcel(exportQualityRefundsExchangesVos, "品质管理退换货单数据");
}else {
String[] refundsExchangesCodes = ids.split(",");
List<QualityRefundsExchanges> list = qualityRefundsExchangesService.selectQualityRefundsExchangesListByCodes(refundsExchangesCodes);
List<ExportQualityRefundsExchangesVo> exportQualityRefundsExchangesVos = qualityRefundsExchangesService.exportQualityRefundsExchangesList(list);
ExcelUtil<ExportQualityRefundsExchangesVo> util = new ExcelUtil<ExportQualityRefundsExchangesVo>(ExportQualityRefundsExchangesVo.class);
return util.exportExcel(exportQualityRefundsExchangesVos, "品质管理退换货单数据");
}
}
/**

148
ruoyi-admin/src/main/java/com/ruoyi/quality/domain/VO/ExportQualityRefundsExchangesVo.java

@ -0,0 +1,148 @@
package com.ruoyi.quality.domain.VO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 导出退换货单明细
* */
@Data
public class ExportQualityRefundsExchangesVo {
/** 退换货单号 */
@Excel(name = "退换货单号")
private String refundsExchangesCode;
/** 退换货状态 (0待结案、1已结案)*/
@Excel(name = "退换货状态",dictType = "refunds_exchanges_status")
private String refundsExchangesStatus;
/** 仓库状态(0待入库、1全部入库、2待出库、3部分出库、4全部出库) */
@Excel(name = "仓库状态",dictType = "refunds_exchanges_status")
private String qualityWarehouseStatus;
/** 采购状态(0待确认、1已确认、2供应商收货、3部分收货、4全部收货) */
@Excel(name = "采购状态",dictType = "quality_purchase_status")
private String qualityPurchaseStatus;
/** 收货状态(0 待收货 1 部分收货 2 全部收货) */
@Excel(name = "收货状态",dictType = "quality_delivery_status")
private String qualityDeliveryStatus;
/** 关联订单号 */
@Excel(name = "关联订单号")
private String relatedOrderCode;
/** 入库单号 */
@Excel(name = "入库单号")
private String inStorageCode;
/** 入库类型 */
@Excel(name = "入库类型",dictType = "warehouse_storage_type")
private String warehouseStorageType;
/** 退货节点 */
@Excel(name = "退货节点",dictType = "quality_return_node")
private String qualityReturnNode;
/** 物料数合计 */
@Excel(name = "物料数合计")
private Integer materialTotal;
/** 数量合计 */
@Excel(name = "数量合计")
private Integer numTotal;
/** 交付质检时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交付质检时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date deliveryInspectionTime;
/** 品质备注 */
@Excel(name = "品质备注")
private String qualityRemark;
/** 品质时间 */
@Excel(name = "品质时间")
private Date qualityTime;
/** 是否退回供应商 */
@Excel(name = "是否退回供应商",dictType = "yes_or_no")
private String isReturnedToSupplier;
/** 供应商Id */
@Excel(name = "供应商Id")
private String supplierCode;
/** 供应商名称 */
@Excel(name = "供应商名称")
private String supplierName;
/** 联系人 */
@Excel(name = "联系人")
private String customerContact;
/** 联系电话 */
@Excel(name = "联系电话")
private String contactNumber;
/** 公司地址 */
@Excel(name = "公司地址")
private String supplierAddress;
/** 料号 */
@Excel(name = "料号")
private String materialNo;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 物料品牌 */
@Excel(name = "物料品牌")
private String materialBrand;
/** 物料单位 */
@Excel(name = "物料单位")
private String materialUnit;
/** 物料描述 */
@Excel(name = "物料描述")
private String materialDescribe;
/** 物料型号 */
@Excel(name = "物料型号")
private String materialModel;
/** 物料加工方式 */
@Excel(name = "物料加工方式",dictType = "processMethod")
private String materialProcessMethod;
/** 退换货数 */
@Excel(name = "退换货数")
private Integer refundsExchangesNum;
/** 品质不合格数 */
@Excel(name = "品质不合格数")
private Integer qualityUnqualifiedNum;
/** 检验完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "检验完成时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date inspectionTime;
}

5
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityRefundsExchangesDetailMapper.java

@ -87,4 +87,9 @@ public interface QualityRefundsExchangesDetailMapper
* 通过物料号和退货单号查询退换货详情信息
* */
QualityRefundsExchangesDetail selectQualityRefundsExchangesDetailByCodeAndNo(QualityRefundsExchangesDetail refundsExchangesDetail);
/**
* 通过退换货单号集合查询退换货详情信息
* */
List<QualityRefundsExchangesDetail> selectQualityRefundsExchangesDetailListByCodeList(List<String> collectRefundsExchangesCode);
}

7
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityRefundsExchangesService.java

@ -2,6 +2,7 @@ package com.ruoyi.quality.service;
import java.util.List;
import com.ruoyi.quality.domain.QualityRefundsExchanges;
import com.ruoyi.quality.domain.VO.ExportQualityRefundsExchangesVo;
import com.ruoyi.quality.domain.VO.QualityRefundsExchangesExportVO;
/**
@ -99,4 +100,10 @@ public interface IQualityRefundsExchangesService
// 获取全部导出对象列表
List<QualityRefundsExchangesExportVO> getAllExportList(QualityRefundsExchanges qualityRefundsExchanges);
/**
* 导出退换货单明细
* */
List<ExportQualityRefundsExchangesVo> exportQualityRefundsExchangesList(List<QualityRefundsExchanges> list);
List<QualityRefundsExchanges> selectQualityRefundsExchangesListByCodes(String[] refundsExchangesCodes);
}

79
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesServiceImpl.java

@ -3,6 +3,7 @@ package com.ruoyi.quality.service.impl;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.BusinessException;
@ -12,6 +13,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityRefundsExchangesDetail;
import com.ruoyi.quality.domain.QualityRefundsExchangesUnqualified;
import com.ruoyi.quality.domain.VO.ExportQualityRefundsExchangesVo;
import com.ruoyi.quality.domain.VO.QualityOrderReportVO;
import com.ruoyi.quality.domain.VO.QualityRefundsExchangesExportVO;
import com.ruoyi.quality.mapper.QualityRefundsExchangesDetailMapper;
@ -533,4 +535,81 @@ public class QualityRefundsExchangesServiceImpl implements IQualityRefundsExchan
}
return exchangesExportVOList;
}
/**
* 通过退换货单号获取退换货单信息
* */
@Override
public List<QualityRefundsExchanges> selectQualityRefundsExchangesListByCodes(String[] refundsExchangesCodes) {
return qualityRefundsExchangesMapper.selectQualityRefundsExchangesByCodes(refundsExchangesCodes);
}
/**
* 导出退换货单明细
* */
@Override
public List<ExportQualityRefundsExchangesVo> exportQualityRefundsExchangesList(List<QualityRefundsExchanges> list) {
// 获取所有退换货单号
List<String> collectRefundsExchangesCode = list.stream()
.map(QualityRefundsExchanges::getRefundsExchangesCode)
.collect(Collectors.toList());
// 根据退换货单号获取详细信息
List<QualityRefundsExchangesDetail> detailList = refundsExchangesDetailMapper.selectQualityRefundsExchangesDetailListByCodeList(collectRefundsExchangesCode);
// 创建结果列表
List<ExportQualityRefundsExchangesVo> exportQualityRefundsExchangesVos = new ArrayList<>();
// 遍历每一个详细信息并填充到ExportQualityRefundsExchangesVo中
for (QualityRefundsExchangesDetail detail : detailList) {
ExportQualityRefundsExchangesVo vo = new ExportQualityRefundsExchangesVo();
// 填充退换货单主表信息
QualityRefundsExchanges refundsExchanges = list.stream()
.filter(r -> r.getRefundsExchangesCode().equals(detail.getRefundsExchangesCode()))
.findFirst()
.orElse(null);
if (refundsExchanges != null) {
vo.setRefundsExchangesCode(refundsExchanges.getRefundsExchangesCode());
vo.setRefundsExchangesStatus(refundsExchanges.getRefundsExchangesStatus());
vo.setQualityWarehouseStatus(refundsExchanges.getQualityWarehouseStatus());
vo.setQualityPurchaseStatus(refundsExchanges.getQualityPurchaseStatus());
vo.setQualityDeliveryStatus(refundsExchanges.getQualityDeliveryStatus());
vo.setRelatedOrderCode(refundsExchanges.getRelatedOrderCode());
vo.setInStorageCode(refundsExchanges.getInStorageCode());
vo.setWarehouseStorageType(refundsExchanges.getWarehouseStorageType());
vo.setQualityReturnNode(refundsExchanges.getQualityReturnNode());
vo.setMaterialTotal(refundsExchanges.getMaterialTotal());
vo.setNumTotal(refundsExchanges.getNumTotal());
vo.setDeliveryInspectionTime(refundsExchanges.getDeliveryInspectionTime());
vo.setQualityRemark(refundsExchanges.getQualityRemark());
vo.setQualityTime(refundsExchanges.getQualityTime());
vo.setIsReturnedToSupplier(refundsExchanges.getIsReturnedToSupplier());
}
// 填充退换货明细表信息
vo.setSupplierCode(detail.getSupplierCode());
vo.setSupplierName(detail.getSupplierName());
vo.setCustomerContact(detail.getCustomerContact());
vo.setContactNumber(detail.getContactNumber());
vo.setSupplierAddress(detail.getSupplierAddress());
vo.setMaterialNo(detail.getMaterialNo());
vo.setMaterialName(detail.getMaterialName());
vo.setMaterialBrand(detail.getMaterialBrand());
vo.setMaterialUnit(detail.getMaterialUnit());
vo.setMaterialDescribe(detail.getMaterialDescribe());
vo.setMaterialModel(detail.getMaterialModel());
vo.setMaterialProcessMethod(detail.getMaterialProcessMethod());
vo.setRefundsExchangesNum(detail.getRefundsExchangesNum());
vo.setQualityUnqualifiedNum(detail.getQualityUnqualifiedNum());
vo.setInspectionTime(detail.getInspectionTime());
// 添加到结果列表
exportQualityRefundsExchangesVos.add(vo);
}
return exportQualityRefundsExchangesVos;
}
}

8
ruoyi-admin/src/main/resources/mapper/quality/QualityRefundsExchangesDetailMapper.xml

@ -77,6 +77,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and material_no = #{materialNo}
</select>
<select id="selectQualityRefundsExchangesDetailListByCodeList" parameterType="String" resultMap="QualityRefundsExchangesDetailResult">
<include refid="selectQualityRefundsExchangesDetailVo"/>
where refunds_exchanges_code in
<foreach item="refundsExchangesCode" collection="list" index="index" open="(" separator="," close=")">
#{refundsExchangesCode}
</foreach>
</select>
<insert id="insertQualityRefundsExchangesDetail" parameterType="QualityRefundsExchangesDetail" useGeneratedKeys="true" keyProperty="refundsExchangesDetailId">
insert into quality_refunds_exchanges_detail

71
ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/refundsExchanges.html

@ -315,57 +315,28 @@
$.modal.open("确认收货",url);
}
function exportExcel(formId) {
var refundsExchangesCodeData = [];
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 {
//·拼接单号
for(let i=0;i<selections.length;i++){
refundsExchangesCodeData.push(selections[i].refundsExchangesCode);
}
$.modal.confirm("确定导出" + refundsExchangesCodeData + "吗?", function () {
var refundsExchangesCodes = JSON.stringify(refundsExchangesCodeData);
$.modal.loading("正在导出数据,请稍后...");
var config = {
url: prefix + '/export',
type: "post",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: refundsExchangesCodes,
success: function(result) {
console.log(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)
// $.operate.saveJson(prefix + "/export", bomNos);
});
// 导出
function exportExcel() {
var ids = $.table.selectColumns("refundsExchangesCode");
var dataParam = $("#formId").serializeArray();
let tipMsg = "确定导出当前所有数据吗?";
if ($.common.isNotEmpty(ids)) {
tipMsg = `确定导出 ${ids} 数据吗?`;
dataParam.push({ "name": "ids", "value": ids });
}
};
$.modal.confirm(tipMsg, function () {
$.modal.loading("正在导出数据,请稍后...");
$.post( prefix + "/export", dataParam, function (result) {
if (result.code === web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName="+ encodeURI(result.msg) + "&delete=" + true;
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
});
}
</script>
</body>

Loading…
Cancel
Save