Browse Source

[fix]品质管理:

退换货
新增添加退货单接口
修改前端页面触发添加退货单接口的条件,只有退货节点为入库后退货才可以启用添加退货单按钮
新增查询品质管理退换货不合格分类接口
修改新增品质管理退换货单接口
dev
liuxiaoxu 6 months ago
parent
commit
a8ce7e1313
  1. 49
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityRefundsExchangesController.java
  2. 8
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityRefundsExchangesUnqualifiedMapper.java
  3. 14
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityRefundsExchangesUnqualifiedService.java
  4. 11
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesServiceImpl.java
  5. 25
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesUnqualifiedServiceImpl.java
  6. 10
      ruoyi-admin/src/main/resources/mapper/quality/QualityRefundsExchangesUnqualifiedMapper.xml
  7. 24
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/add.html
  8. 2
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/qualityOrderReport.html
  9. 25
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/refundsExchanges.html

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

@ -2,10 +2,14 @@ package com.ruoyi.quality.controller;
import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.quality.domain.QualityRefundsExchangesUnqualified;
import com.ruoyi.quality.domain.VO.CheckoutMaterialVO;
import com.ruoyi.quality.service.IQualityRefundsExchangesUnqualifiedService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,6 +31,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @author 刘晓旭
* @date 2024-05-23
*/
@Slf4j
@Controller
@RequestMapping("/quality/refundsExchanges")
public class QualityRefundsExchangesController extends BaseController
@ -39,6 +44,9 @@ public class QualityRefundsExchangesController extends BaseController
@Autowired
private IErpMaterialService erpMaterialService;
@Autowired
private IQualityRefundsExchangesUnqualifiedService refundsExchangesUnqualifiedService;
@RequiresPermissions("quality:refundsExchanges:view")
@GetMapping()
public String refundsExchanges()
@ -76,9 +84,10 @@ public class QualityRefundsExchangesController extends BaseController
/**
* 新增品质管理退换货单
*/
@GetMapping("/add")
public String add()
@GetMapping("/add/{refundsExchangesCode}")
public String add(@PathVariable("refundsExchangesCode") String refundsExchangesCode,ModelMap mmap)
{
mmap.put("refundsExchangesCode", refundsExchangesCode);
return prefix + "/add";
}
@ -163,4 +172,40 @@ public class QualityRefundsExchangesController extends BaseController
return toAjax(qualityRefundsExchangesService.updateRefundsExchangesStatus(qualityRefundsExchanges));
}
/**
* 修改品质单报告不良分类
*/
@GetMapping("/qualityReport")
public String qualityReport( @RequestParam("materialNo") String materialNo,
@RequestParam("refundsExchangesCode") String refundsExchangesCode, ModelMap mmap)
{
if (StringUtils.isEmpty(materialNo)){
log.warn("物料号为空:{}",materialNo);
}
if (StringUtils.isEmpty(refundsExchangesCode)){
log.warn("退换货号为空:{}",refundsExchangesCode);
}
QualityRefundsExchangesUnqualified tempRefundsExchangesUnqualified = new QualityRefundsExchangesUnqualified();
tempRefundsExchangesUnqualified.setRefundsExchangesCode(refundsExchangesCode);
tempRefundsExchangesUnqualified.setMaterialNo(materialNo);
QualityRefundsExchangesUnqualified refundsExchangesUnqualified=refundsExchangesUnqualifiedService.selectRefundsExchangesUnqualifiedByNoAndCode(tempRefundsExchangesUnqualified);
mmap.put("refundsExchangesUnqualified", refundsExchangesUnqualified);
return prefix + "/qualityOrderReport";
}
/**
* 新增保存品质单报告不良分类
*/
@RequiresPermissions("quality:qualityOrder:qualityReport")
@Log(title = "品质管理品质单", businessType = BusinessType.INSERT)
@PostMapping("/qualityReport")
@ResponseBody
public AjaxResult qualityReportSave(@RequestBody QualityRefundsExchangesUnqualified refundsExchangesUnqualified)
{
return toAjax(refundsExchangesUnqualifiedService.addRefundsExchangesUnqualified(refundsExchangesUnqualified));
}
}

8
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityRefundsExchangesUnqualifiedMapper.java

@ -74,4 +74,12 @@ public interface QualityRefundsExchangesUnqualifiedMapper
* @return 结果
*/
public int restoreQualityRefundsExchangesUnqualifiedById(Long refundsExchangesUnqualifiedId);
/**
* 查询品质管理退换货不合格分类
*
* @param refundsExchangesUnqualified 品质管理退换货不合格分类
* @return 品质管理退换货不合格分类
*/
QualityRefundsExchangesUnqualified selectRefundsExchangesUnqualifiedByNoAndCode(QualityRefundsExchangesUnqualified refundsExchangesUnqualified);
}

14
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityRefundsExchangesUnqualifiedService.java

@ -72,4 +72,18 @@ public interface IQualityRefundsExchangesUnqualifiedService
* @return
*/
int restoreQualityRefundsExchangesUnqualifiedById(Long refundsExchangesUnqualifiedId);
/**
* 查询品质管理退换货不合格分类
*
* @param refundsExchangesUnqualified 品质管理退换货不合格分类
* @return 品质管理退换货不合格分类
*/
public QualityRefundsExchangesUnqualified selectRefundsExchangesUnqualifiedByNoAndCode(QualityRefundsExchangesUnqualified refundsExchangesUnqualified);
/**
* 新增保存品质单报告不良分类
*/
int addRefundsExchangesUnqualified(QualityRefundsExchangesUnqualified refundsExchangesUnqualified);
}

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

@ -69,6 +69,11 @@ public class QualityRefundsExchangesServiceImpl implements IQualityRefundsExchan
public int insertQualityRefundsExchanges(QualityRefundsExchanges qualityRefundsExchanges)
{
String refundsExchangesCode = qualityRefundsExchanges.getRefundsExchangesCode();
if (StringUtils.isEmpty(refundsExchangesCode)){
log.warn("退换货单号为空:{}",refundsExchangesCode);
}
String loginName = ShiroUtils.getLoginName();
List<QualityRefundsExchangesDetail> refundsExchangesDetails = qualityRefundsExchanges.getRefundsExchangesDetails();
if (StringUtils.isEmpty(refundsExchangesDetails)){
@ -76,9 +81,9 @@ public class QualityRefundsExchangesServiceImpl implements IQualityRefundsExchan
}
for (QualityRefundsExchangesDetail tempDetail : refundsExchangesDetails) {
QualityRefundsExchangesDetail refundsExchangesDetail = new QualityRefundsExchangesDetail();
refundsExchangesDetail.setRefundsExchangesCode(tempDetail.getRefundsExchangesCode());
refundsExchangesDetail.setDeliveryInspectionTime(tempDetail.getDeliveryInspectionTime());
refundsExchangesDetail.setQualityRemark(tempDetail.getQualityRemark());
refundsExchangesDetail.setRefundsExchangesCode(refundsExchangesCode);
refundsExchangesDetail.setDeliveryInspectionTime(qualityRefundsExchanges.getDeliveryInspectionTime());
refundsExchangesDetail.setQualityRemark(qualityRefundsExchanges.getQualityRemark());
refundsExchangesDetail.setMaterialNo(tempDetail.getMaterialNo());
refundsExchangesDetail.setMaterialName(tempDetail.getMaterialName());
refundsExchangesDetail.setMaterialBrand(tempDetail.getMaterialBrand());

25
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesUnqualifiedServiceImpl.java

@ -123,4 +123,29 @@ public class QualityRefundsExchangesUnqualifiedServiceImpl implements IQualityRe
{
return qualityRefundsExchangesUnqualifiedMapper.restoreQualityRefundsExchangesUnqualifiedById(refundsExchangesUnqualifiedId);
}
/**
* 查询品质管理退换货不合格分类
*
* @param refundsExchangesUnqualified 品质管理退换货不合格分类
* @return 品质管理退换货不合格分类
*/
@Override
public QualityRefundsExchangesUnqualified selectRefundsExchangesUnqualifiedByNoAndCode(QualityRefundsExchangesUnqualified refundsExchangesUnqualified) {
return qualityRefundsExchangesUnqualifiedMapper.selectRefundsExchangesUnqualifiedByNoAndCode(refundsExchangesUnqualified);
}
/**
* 新增保存品质单报告不良分类
*/
@Override
public int addRefundsExchangesUnqualified(QualityRefundsExchangesUnqualified refundsExchangesUnqualified) {
String loginName = ShiroUtils.getLoginName();
refundsExchangesUnqualified.setUpdateBy(loginName);
refundsExchangesUnqualified.setUpdateTime(DateUtils.getNowDate());
return qualityRefundsExchangesUnqualifiedMapper.insertQualityRefundsExchangesUnqualified(refundsExchangesUnqualified);
}
}

10
ruoyi-admin/src/main/resources/mapper/quality/QualityRefundsExchangesUnqualifiedMapper.xml

@ -35,7 +35,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectQualityRefundsExchangesUnqualifiedVo"/>
where refunds_exchanges_unqualified_id = #{refundsExchangesUnqualifiedId}
</select>
<select id="selectRefundsExchangesUnqualifiedByNoAndCode" parameterType="QualityRefundsExchangesUnqualified" resultMap="QualityRefundsExchangesUnqualifiedResult">
<include refid="selectQualityRefundsExchangesUnqualifiedVo"/>
where refunds_exchanges_code = #{refundsExchangesCode}
and material_no = #{materialNo}
</select>
<insert id="insertQualityRefundsExchangesUnqualified" parameterType="QualityRefundsExchangesUnqualified" useGeneratedKeys="true" keyProperty="refundsExchangesUnqualifiedId">
insert into quality_refunds_exchanges_unqualified
<trim prefix="(" suffix=")" suffixOverrides=",">

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

@ -45,6 +45,9 @@
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var prefix = ctx + "quality/refundsExchanges"
var refundsExchangesCode = /*[[${refundsExchangesCode}]]*/ '';
$("#form-refundsExchanges-add").validate({
focusCleanup: true
});
@ -82,7 +85,11 @@
};
});
const combinedData = Object.assign({}, refundsExchangesData, { refundsExchangesDetails: materialDataList });
// 将全局变量 refundsExchangesCode 添加到要提交的数据中
const combinedData = Object.assign({}, refundsExchangesData, {
refundsExchangesDetails: materialDataList,
refundsExchangesCode: refundsExchangesCode // 直接使用全局变量
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
@ -112,6 +119,12 @@
columns: [{
checkbox: true
},
{
title: '退换货单号',
field: 'refundsExchangesCode',
visible: false
},
{
title: '料号',
field: 'materialNo',
@ -148,8 +161,9 @@
title: '品质报告',
align: 'center',
formatter: function(value, row, index) {
// 这里直接使用row对象获取refundsExchangesCode,假设它是存在的
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="checkoutReport(\'' + row.materialNo + '\')"><i class="fa fa-plus"></i>报告</a> ');
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="qualityReport(\'' + row.materialNo + '\', \'' + row.refundsExchangesCode + '\')"><i class="fa fa-plus"></i>报告</a> ');
return actions.join('');
}
},
@ -215,12 +229,12 @@
/*品质报告*/
function qualityReport(materialNo, supplierCode) {
function qualityReport(materialNo, refundsExchangesCode) {
var queryParams = new URLSearchParams();
queryParams.append('materialNo', materialNo);
queryParams.append('supplierCode', encodeURIComponent(supplierCode));
queryParams.append('refundsExchangesCode', encodeURIComponent(refundsExchangesCode));
var url = ctx + 'quality/qualityOrder/qualityReport?' + queryParams.toString();
var url = ctx + 'quality/refundsExchanges/qualityReport?' + queryParams.toString();
$.modal.open("品质报告", url);
}

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

@ -54,7 +54,7 @@
var processBadClassificationDatas = [[${@dict.getType('process_bad_classification')}]];
var processBadGradeDatas = [[${@dict.getType('process_bad_grade')}]];
var $table = $("#bootstrap-unqualified-table");
var prefix = ctx + "quality/qualityOrder";
var prefix = ctx + "quality/refundsExchanges";
$("#form-qualityOrderReport-edit").validate({
focusCleanup: true
});

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

@ -64,7 +64,7 @@
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="quality:refundsExchanges:add">
<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">
@ -185,13 +185,14 @@
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.refundsExchangesId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
if (row.refundsExchangesStatus != 1){
if (row.refundsExchangesStatus == 0 && row.qualityPurchaseStatus == 4){
actions.push('<a class="btn btn-success btn-xs ' + closingProceduresFlag + '" href="javascript:void(0)" onclick="closingProcedures(\'' + row.refundsExchangesId + '\')"><i class="fa fa-edit"></i>结案</a> ');
}
return actions.join('');
}
}]
};
$.table.init(options);
});
@ -200,6 +201,26 @@
var url = ctx + 'quality/refundsExchanges/closingProcedures/' +refundsExchangesId;
$.modal.open("结案",url);
}
function add() {
var rows = $("#bootstrap-table").bootstrapTable('getSelections');
console.log("rows" + rows);
if (rows.length == 1){
// var curQualityReturnNode = rows[0].qualityReturnNode;
// var curRefundsExchangesCode = rows[0].refundsExchangesCode;
if (rows[0].qualityReturnNode == 1){
var url = ctx + 'quality/refundsExchanges/add/' +rows[0].refundsExchangesCode;
$.modal.open("添加退换货",url);
}else {
$.modal.msgWarning("请选择退货节点为入库后退货的数据!")
}
// $.modal.open("添加" + table.options.modalName, $.operate.addUrl(rows[0].id));
}else{
$.modal.msgWarning("只能选中一行作为添加对象!")
}
};
</script>
</body>
</html>
Loading…
Cancel
Save