Browse Source

[feat]品质管理:

退换货
新增*入库后退货-选择供应商-无供应商*afterNoConfirmSupplier.html
新增退换货确认供应商按钮
新增后端退换货确认供应商接口
dev
liuxiaoxu 6 months ago
parent
commit
ad4b2306b1
  1. 39
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityRefundsExchangesController.java
  2. 28
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityRefundsExchangesDetail.java
  3. 6
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityRefundsExchangesService.java
  4. 34
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesServiceImpl.java
  5. 6
      ruoyi-admin/src/main/resources/mapper/quality/QualityRefundsExchangesDetailMapper.xml
  6. 220
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/afterNoConfirmSupplier.html
  7. 15
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/refundsExchanges.html

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

@ -352,4 +352,43 @@ public class QualityRefundsExchangesController extends BaseController
return toAjax(qualityRefundsExchangesService.returnBeforeStorageDetail(qualityRefundsExchanges));
}
/**
* 入库后退货-选择供应商-无供应商
*/
@GetMapping("/afterNoConfirmSupplier/{refundsExchangesId}")
public String afterNoConfirmSupplier(@PathVariable("refundsExchangesId") Long refundsExchangesId, ModelMap mmap)
{
QualityRefundsExchanges qualityRefundsExchanges = qualityRefundsExchangesService.selectQualityRefundsExchangesById(refundsExchangesId);
mmap.put("qualityRefundsExchanges", qualityRefundsExchanges);
return prefix + "/afterNoConfirmSupplier";
}
/**
* 保存入库后退货-选择供应商-无供应商
*/
@RequiresPermissions("quality:refundsExchanges:afterNoConfirmSupplier")
@Log(title = "品质管理退换货单", businessType = BusinessType.UPDATE)
@PostMapping("/afterNoConfirmSupplier")
@ResponseBody
public AjaxResult afterNoConfirmSupplierSave(@RequestBody QualityRefundsExchanges qualityRefundsExchanges)
{
return toAjax(qualityRefundsExchangesService.updateAfterNoConfirmSupplier(qualityRefundsExchanges));
}
/**
* 入库后退货-选择供应商-无供应商 物料列表信息
* */
@ResponseBody
@PostMapping("/getAfterMaterialListByCode")
public TableDataInfo getAfterMaterialListByCode(QualityRefundsExchanges qualityRefundsExchanges){
startPage();
List<QualityRefundsExchangesDetail> list = refundsExchangesDetailService.selectRefundsExchangesDetailListByCode(qualityRefundsExchanges.getRefundsExchangesCode());
return getDataTable(list);
}
}

28
ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityRefundsExchangesDetail.java

@ -114,7 +114,12 @@ public class QualityRefundsExchangesDetail extends BaseEntity
/** 退换货数 */
@Excel(name = "退换货数")
private Long refundsExchangesNum;
private Integer refundsExchangesNum;
/** 品质不合格数 */
@Excel(name = "品质不合格数")
private Integer qualityUnqualifiedNum;
/** 交付质检时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ -295,16 +300,24 @@ public class QualityRefundsExchangesDetail extends BaseEntity
{
return materialProcessMethod;
}
public void setRefundsExchangesNum(Long refundsExchangesNum)
{
public Integer getRefundsExchangesNum() {
return refundsExchangesNum;
}
public void setRefundsExchangesNum(Integer refundsExchangesNum) {
this.refundsExchangesNum = refundsExchangesNum;
}
public Long getRefundsExchangesNum()
{
return refundsExchangesNum;
public Integer getQualityUnqualifiedNum() {
return qualityUnqualifiedNum;
}
public void setDeliveryInspectionTime(Date deliveryInspectionTime)
public void setQualityUnqualifiedNum(Integer qualityUnqualifiedNum) {
this.qualityUnqualifiedNum = qualityUnqualifiedNum;
}
public void setDeliveryInspectionTime(Date deliveryInspectionTime)
{
this.deliveryInspectionTime = deliveryInspectionTime;
}
@ -407,6 +420,7 @@ public class QualityRefundsExchangesDetail extends BaseEntity
.append("materialDescribe", getMaterialDescribe())
.append("materialProcessMethod", getMaterialProcessMethod())
.append("refundsExchangesNum", getRefundsExchangesNum())
.append("qualityUnqualifiedNum",getQualityUnqualifiedNum())
.append("deliveryInspectionTime", getDeliveryInspectionTime())
.append("inspectionTime", getInspectionTime())
.append("qualityRemark", getQualityRemark())

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

@ -78,4 +78,10 @@ public interface IQualityRefundsExchangesService
/*入库前退换货详情*/
int returnBeforeStorageDetail(QualityRefundsExchanges qualityRefundsExchanges);
/**
* 保存入库后退货-选择供应商-无供应商
*/
int updateAfterNoConfirmSupplier(QualityRefundsExchanges qualityRefundsExchanges);
}

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

@ -18,6 +18,7 @@ import com.ruoyi.quality.mapper.QualityRefundsExchangesMapper;
import com.ruoyi.quality.domain.QualityRefundsExchanges;
import com.ruoyi.quality.service.IQualityRefundsExchangesService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/**
* 品质管理退换货单Service业务层处理
@ -180,6 +181,39 @@ public class QualityRefundsExchangesServiceImpl implements IQualityRefundsExchan
return 1;
}
/**
* 保存入库后退货-选择供应商-无供应商
*/
@Transactional
@Override
public int updateAfterNoConfirmSupplier(QualityRefundsExchanges qualityRefundsExchanges) {
String loginName = ShiroUtils.getLoginName();
List<QualityRefundsExchangesDetail> refundsExchangesDetails = qualityRefundsExchanges.getRefundsExchangesDetails();
if (StringUtils.isEmpty(refundsExchangesDetails)){
log.warn("退款换货单[{}]无关联的物料详情信息", qualityRefundsExchanges.getRefundsExchangesCode());
}
int updateRows = 0;
for (QualityRefundsExchangesDetail refundsExchangesDetail : refundsExchangesDetails) {
refundsExchangesDetail.setRefundsExchangesCode(qualityRefundsExchanges.getRefundsExchangesCode());
refundsExchangesDetail.setDeliveryInspectionTime(qualityRefundsExchanges.getDeliveryInspectionTime());
refundsExchangesDetail.setQualityRemark(qualityRefundsExchanges.getQualityRemark());
// refundsExchangesDetail.setSupplierCode(tempRefundsExchangesDetail.getSupplierCode());
// refundsExchangesDetail.setSupplierName(tempRefundsExchangesDetail.getSupplierName());
// refundsExchangesDetail.setCustomerContact(tempRefundsExchangesDetail.getCustomerContact());
// refundsExchangesDetail.setContactNumber(tempRefundsExchangesDetail.getContactNumber());
// refundsExchangesDetail.setSupplierAddress(tempRefundsExchangesDetail.getSupplierAddress());
// refundsExchangesDetail.setQualityUnqualifiedNum(tempRefundsExchangesDetail.getQualityUnqualifiedNum());
refundsExchangesDetail.setUpdateBy(loginName);
refundsExchangesDetail.setUpdateTime(new Date());
//更新数据库记录
updateRows += refundsExchangesDetailMapper.updateQualityRefundsExchangesDetail(refundsExchangesDetail);
}
return updateRows;
}
/**
*退换货单号:

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

@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialDescribe" column="material_describe" />
<result property="materialProcessMethod" column="material_process_method" />
<result property="refundsExchangesNum" column="refunds_exchanges_num" />
<result property="qualityUnqualifiedNum" column="quality_unqualified_num" />
<result property="deliveryInspectionTime" column="delivery_inspection_time" />
<result property="inspectionTime" column="inspection_time" />
<result property="qualityRemark" column="quality_remark" />
@ -40,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectQualityRefundsExchangesDetailVo">
select refunds_exchanges_detail_id, refunds_exchanges_code, refunds_exchanges_status, quality_warehouse_status, quality_purchase_status, related_order_code, in_storage_code, quality_return_node, material_total, num_total, supplier_code, supplier_name, customer_contact, contact_number, supplier_address, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, refunds_exchanges_num, delivery_inspection_time, inspection_time ,quality_remark, remark, create_by, create_time, update_by, update_time from quality_refunds_exchanges_detail
select refunds_exchanges_detail_id, refunds_exchanges_code, refunds_exchanges_status, quality_warehouse_status, quality_purchase_status, related_order_code, in_storage_code, quality_return_node, material_total, num_total, supplier_code, supplier_name, customer_contact, contact_number, supplier_address, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, refunds_exchanges_num, quality_unqualified_num ,delivery_inspection_time, inspection_time ,quality_remark, remark, create_by, create_time, update_by, update_time from quality_refunds_exchanges_detail
</sql>
<select id="selectQualityRefundsExchangesDetailList" parameterType="QualityRefundsExchangesDetail" resultMap="QualityRefundsExchangesDetailResult">
@ -93,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialDescribe != null">material_describe,</if>
<if test="materialProcessMethod != null">material_process_method,</if>
<if test="refundsExchangesNum != null">refunds_exchanges_num,</if>
<if test="qualityUnqualifiedNum != null">quality_unqualified_num,</if>
<if test="deliveryInspectionTime != null">delivery_inspection_time,</if>
<if test="inspectionTime != null">inspection_time,</if>
<if test="qualityRemark != null">quality_remark,</if>
@ -126,6 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialDescribe != null">#{materialDescribe},</if>
<if test="materialProcessMethod != null">#{materialProcessMethod},</if>
<if test="refundsExchangesNum != null">#{refundsExchangesNum},</if>
<if test="qualityUnqualifiedNum != null">#{qualityUnqualifiedNum},</if>
<if test="deliveryInspectionTime != null">#{deliveryInspectionTime},</if>
<if test="inspectionTime != null">#{inspectionTime},</if>
<if test="qualityRemark != null">#{qualityRemark},</if>
@ -163,6 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialDescribe != null">material_describe = #{materialDescribe},</if>
<if test="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</if>
<if test="refundsExchangesNum != null">refunds_exchanges_num = #{refundsExchangesNum},</if>
<if test="qualityUnqualifiedNum != null">quality_unqualified_num = #{qualityUnqualifiedNum},</if>
<if test="deliveryInspectionTime != null">delivery_inspection_time = #{deliveryInspectionTime},</if>
<if test="inspectionTime != null">inspection_time = #{inspectionTime},</if>
<if test="qualityRemark != null">quality_remark = #{qualityRemark},</if>

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

@ -0,0 +1,220 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('入库后退货-选择供应商-无供应商')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-afterNoConfirmSupplier-edit" th:object="${qualityRefundsExchanges}">
<div class="form-group">
<label class="col-sm-3 control-label">退换货单号:</label>
<div class="col-sm-8">
<input name="refundsExchangesCode" th:field="*{refundsExchangesCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联单号:</label>
<div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品质单入库类型:</label>
<div class="col-sm-8">
<select name="warehouseStorageType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_storage_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseStorageType}"></option>
</select>
</div>
</div>
</form>
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<!--用于可以修改列表字段的插件-->
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var refundsExchangesCode = [[${qualityRefundsExchanges.refundsExchangesCode}]]
var qualityRefundsExchanges = [[${qualityRefundsExchanges}]];
var prefix = ctx + "quality/refundsExchanges";
$("#form-qualityRefundsExchanges-edit").validate({
focusCleanup: true
});
// function submitHandler() {
// if ($.validate.form()) {
// $.operate.save(prefix + "/returnBeforeStorageDetail", $('#form-qualityRefundsExchanges-edit').serialize());
// }
// }
// 新增提交
function submitHandler() {
// 获取表单数据
// const afterNoConfirmSupplierData = $("#form-afterNoConfirmSupplier-edit").serializeArray();
// 获取表单数据
const afterNoConfirmSupplierData = $("#form-afterNoConfirmSupplier-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 将表数据转换成与afterNoConfirmSupplierData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"refundsExchangesDetailId":item.refundsExchangesDetailId,
"materialNo": item.materialNo, // 假设id对应materialId
"materialPhotourl": item.materialPhotourl, // 假设quantity是物料数量字段
"materialName": item.materialName,
"materialType": item.materialType,
"materialUnit": item.materialUnit,
"materialBrand": item.materialBrand,
"materialDescribe": item.materialDescribe,
"snCode": item.snCode,
"complaintProblem": item.complaintProblem,
// "emergencyDegree": item.emergencyDegree,
"adverseReportUrl": item.adverseReportUrl,
// ...其他字段
};
});
// 合并表单数据和表格数据
//const combinedData = Object.assign({}, ...afterNoConfirmSupplierData.map(item => ({ [item.name]: item.value })), ...materialData);
const combinedData = Object.assign({}, afterNoConfirmSupplierData, { refundsExchangesDetails: materialDataList });
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/afterNoConfirmSupplier", jsonData);
}
//物料信息展示列表
$(function() {
var options = {
url: ctx + "quality/refundsExchanges/getAfterMaterialListByCode",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
queryParams: queryParams,
modalName: "选择物料",
columns: [{
checkbox: true
},
{
title: '供应商ID',
field: 'supplierCode',
visible: false
},
{
title: '退换货详情Id',
field: 'refundsExchangesDetailId',
visible: false
},
{
title: '料号',
field: 'materialNo'
}, {
title: '物料名称',
field: 'materialName'
},
{
title: '物料类型',
field: 'materialType',
},
{
title: '物料图片地址',
field: 'materialPhotourl',
},
{
title: '物料描述',
field: 'materialDescribe',
},
{
title: '物料品牌',
field: 'materialBrand',
},
{
title: '物料单位',
field: 'materialUnit',
},
{
title: '物料加工方式',
field: 'materialProcessMethod',
},
{
title: '订单数',
field: 'makeTotal',
},
{
title: '品质已合格数',
field: 'qualityHasqualifiedNum',
},
{
title: '本次到货数',
field: 'thisArrivedNum',
},
{
title: '品质报告',
align: 'center',
formatter: function(value, row, index) {
// 这里直接使用row对象获取supplierCode,假设它是存在的
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="qualityReport(\'' + row.materialNo + '\', \'' + row.supplierCode + '\')"><i class="fa fa-plus"></i>报告</a> ');
return actions.join('');
}
},
{
title: '品质不合格数',
field: 'qualityUnqualifiedNum',
},
{
title: '选择供应商ID',
field: 'supplierCode',
},
{
title: '选择供应商名称',
field: 'supplierName',
},
{
title: '退货联系人',
field: 'customerContact',
},
{
title: '联系人电话',
field: 'contactNumber',
},
{
title: '退货地址',
field: 'supplierAddress',
}
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
refundsExchangesCode: qualityRefundsExchanges.refundsExchangesCode
};
console.log(curParams);
return curParams;
}
</script>
</body>
</html>

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

@ -85,7 +85,7 @@
var returnAfterStorageDetailFlag = [[${@permission.hasPermi('quality:refundsExchanges:returnAfterStorageDetail')}]];
var beforeHasConfirmSupplierFlag = [[${@permission.hasPermi('quality:refundsExchanges:beforeHasConfirmSupplier')}]];
var afterNoConfirmSupplierFlag = [[${@permission.hasPermi('quality:refundsExchanges:afterNoConfirmSupplier')}]];
var refundsExchangesStatusDatas = [[${@dict.getType('refunds_exchanges_status')}]];
var qualityWarehouseStatusDatas = [[${@dict.getType('quality_warehouse_status')}]];
@ -206,6 +206,11 @@
actions.push('<a class="btn btn-success btn-xs ' + beforeHasConfirmSupplierFlag + '" href="javascript:void(0)" onclick="beforeHasConfirmSupplier(\'' + row.refundsExchangesId + '\')"><i class="fa fa-edit"></i>确认供应商</a> ');
}
/*入库后退货-确认供应商-没有供应商*/
if (row.qualityReturnNode == 1){
actions.push('<a class="btn btn-success btn-xs ' + afterNoConfirmSupplierFlag + '" href="javascript:void(0)" onclick="afterNoConfirmSupplier(\'' + row.refundsExchangesId + '\')"><i class="fa fa-edit"></i>确认供应商</a> ');
}
return actions.join('');
}
}]
@ -253,12 +258,18 @@
};
/*入库前退货-确认供应商-已经-有供应商*/
/*入库前退货-确认供应商-已经有供应商*/
function beforeHasConfirmSupplier(refundsExchangesId){
var url = ctx + 'quality/refundsExchanges/beforeHasConfirmSupplier/' + refundsExchangesId;
$.modal.open("确认供应商",url);
}
/*入库后退货-确认供应商-没有供应商*/
function afterNoConfirmSupplier(refundsExchangesId){
var url = ctx + 'quality/refundsExchanges/afterNoConfirmSupplier/' + refundsExchangesId;
$.modal.open("确认供应商",url);
}
</script>
</body>
</html>
Loading…
Cancel
Save