Browse Source

[feat]

品质管理 退换货
新增退换货列表页面导出方法;
新增退换货导出全部和导出多选controller接口;
新增退换货service获取导出全部和多选列表接口;
dev
王晓迪 3 months ago
parent
commit
f503afc410
  1. 22
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityRefundsExchangesController.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityRefundsExchangesMapper.java
  3. 8
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityRefundsExchangesService.java
  4. 39
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesServiceImpl.java
  5. 8
      ruoyi-admin/src/main/resources/mapper/quality/QualityRefundsExchangesMapper.xml
  6. 54
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/refundsExchanges.html

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

@ -11,6 +11,7 @@ import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.quality.domain.*;
import com.ruoyi.quality.domain.VO.CheckoutMaterialVO;
import com.ruoyi.quality.domain.VO.QualityRefundsExchangesExportVO;
import com.ruoyi.quality.mapper.QualityRefundsExchangesOrderMapper;
import com.ruoyi.quality.service.IQualityRefundsExchangesDetailService;
import com.ruoyi.quality.service.IQualityRefundsExchangesOrderService;
@ -84,10 +85,25 @@ public class QualityRefundsExchangesController extends BaseController
@Log(title = "品质管理退换货单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(QualityRefundsExchanges qualityRefundsExchanges)
public AjaxResult export(@RequestBody String[] refundsExchangesCodes)
{
List<QualityRefundsExchanges> list = qualityRefundsExchangesService.selectQualityRefundsExchangesList(qualityRefundsExchanges);
ExcelUtil<QualityRefundsExchanges> util = new ExcelUtil<QualityRefundsExchanges>(QualityRefundsExchanges.class);
String refundsExchangesCodesString = String.join(",", refundsExchangesCodes); // 带分隔符
List<QualityRefundsExchangesExportVO> list = qualityRefundsExchangesService.getExportList(refundsExchangesCodes);
ExcelUtil<QualityRefundsExchangesExportVO> util = new ExcelUtil<QualityRefundsExchangesExportVO>(QualityRefundsExchangesExportVO.class);
return util.exportExcel(list, refundsExchangesCodesString);
}
/**
* 导出品质管理退换货单列表
*/
@RequiresPermissions("quality:refundsExchanges:export")
@Log(title = "品质管理退换货单", businessType = BusinessType.EXPORT)
@PostMapping("/exportAll")
@ResponseBody
public AjaxResult exportAll(QualityRefundsExchanges qualityRefundsExchanges)
{
List<QualityRefundsExchangesExportVO> list = qualityRefundsExchangesService.getAllExportList(qualityRefundsExchanges);
ExcelUtil<QualityRefundsExchangesExportVO> util = new ExcelUtil<QualityRefundsExchangesExportVO>(QualityRefundsExchangesExportVO.class);
return util.exportExcel(list, "品质管理退换货单数据");
}

2
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityRefundsExchangesMapper.java

@ -78,4 +78,6 @@ public interface QualityRefundsExchangesMapper
/*查找当前最大编号*/
public String findMaxRoundCode(@Param("prefix") String prefix);
public List<QualityRefundsExchanges> selectQualityRefundsExchangesByCodes(String[] refundsExchangesCodes);
}

8
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.QualityRefundsExchangesExportVO;
/**
* 品质管理退换货单Service接口
@ -89,4 +90,11 @@ public interface IQualityRefundsExchangesService
* 保存入库前退货-确认供应商
*/
int updateBeforeConfirmDelivery(QualityRefundsExchanges qualityRefundsExchanges);
// 获取导出对象列表
List<QualityRefundsExchangesExportVO> getExportList(String[] refundsExchangesCodes);
// 获取全部导出对象列表
List<QualityRefundsExchangesExportVO> getAllExportList(QualityRefundsExchanges qualityRefundsExchanges);
}

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

@ -13,6 +13,7 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.quality.domain.QualityRefundsExchangesDetail;
import com.ruoyi.quality.domain.QualityRefundsExchangesUnqualified;
import com.ruoyi.quality.domain.VO.QualityRefundsExchangesExportVO;
import com.ruoyi.quality.mapper.QualityRefundsExchangesDetailMapper;
import com.ruoyi.quality.mapper.QualityRefundsExchangesUnqualifiedMapper;
import com.ruoyi.storehouse.domain.WarehousingInInfo;
@ -385,4 +386,42 @@ public class QualityRefundsExchangesServiceImpl implements IQualityRefundsExchan
DecimalFormat df = new DecimalFormat("000");
return prefix+df.format(sequence);
}
@Override
public List<QualityRefundsExchangesExportVO> getExportList(String[] refundsExchangesCodes) {
List<QualityRefundsExchanges> exchangesList = qualityRefundsExchangesMapper.selectQualityRefundsExchangesByCodes(refundsExchangesCodes);
List<QualityRefundsExchangesExportVO> exchangesExportVOList = generateQualityRefundsExchangesExportVO(exchangesList);
return exchangesExportVOList;
}
@Override
public List<QualityRefundsExchangesExportVO> getAllExportList(QualityRefundsExchanges qualityRefundsExchanges) {
List<QualityRefundsExchanges> exchangesList = qualityRefundsExchangesMapper.selectQualityRefundsExchangesList(qualityRefundsExchanges);
List<QualityRefundsExchangesExportVO> exchangesExportVOList = generateQualityRefundsExchangesExportVO(exchangesList);
return exchangesExportVOList;
}
//根据退换货单查找详情并生成导出表单
public List<QualityRefundsExchangesExportVO> generateQualityRefundsExchangesExportVO(List<QualityRefundsExchanges> qualityRefundsExchangesList){
List<QualityRefundsExchangesExportVO> exchangesExportVOList = new ArrayList<>();
for (QualityRefundsExchanges refundsExchanges : qualityRefundsExchangesList) {
List<QualityRefundsExchangesDetail> refundsExchangesDetails = refundsExchangesDetailMapper.selectRefundsExchangesDetailListByCode(refundsExchanges.getRefundsExchangesCode());
if (StringUtils.isEmpty(refundsExchangesDetails)){
log.warn("退款换货单[{}]无关联的物料详情信息", refundsExchanges.getRefundsExchangesCode());
}
for (QualityRefundsExchangesDetail exchangesDetail : refundsExchangesDetails) {
QualityRefundsExchangesExportVO exchangesExportVO = new QualityRefundsExchangesExportVO();
exchangesExportVO.setRefundsExchangesCode(exchangesDetail.getRefundsExchangesCode());
exchangesExportVO.setRelatedOrderCode(refundsExchanges.getRelatedOrderCode());
exchangesExportVO.setRefundsExchangesStatus(refundsExchanges.getRefundsExchangesStatus());
exchangesExportVO.setQualityReturnNode(refundsExchanges.getQualityReturnNode());
exchangesExportVO.setRemark(refundsExchanges.getRemark());
exchangesExportVO.setSalesman(refundsExchanges.getCreateBy());
exchangesExportVO.setSupplierCode(exchangesDetail.getSupplierCode());
exchangesExportVO.setSupplierName(exchangesDetail.getSupplierName());
exchangesExportVOList.add(exchangesExportVO);
}
}
return exchangesExportVOList;
}
}

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

@ -141,4 +141,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findMaxRoundCode" resultType="String">
select max(substring(manufacturing_checkout_code,9)) from quality_manufacturing_checkout where manufacturing_checkout_code like concat(#{prefix},'%')
</select>
<select id="selectQualityRefundsExchangesByCodes" parameterType="String" resultMap="QualityRefundsExchangesResult">
<include refid="selectQualityRefundsExchangesVo"/>
where refunds_exchanges_code in
<foreach item="refundsExchangesCode" collection="array" open="(" separator="," close=")">
#{refundsExchangesCode}
</foreach>
</select>
</mapper>

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

@ -67,7 +67,7 @@
<a id="addRefundsButton" class="btn btn-success" onclick="add()" shiro:hasPermission="quality:refundsExchanges:add">
<i class="fa fa-plus"></i> 添加退货单
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="quality:refundsExchanges:export">
<a class="btn btn-warning" onclick="exportExcel()" shiro:hasPermission="quality:refundsExchanges:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
@ -282,6 +282,58 @@
$.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);
});
}
};
</script>
</body>
</html>
Loading…
Cancel
Save