Browse Source

[feat]品质管理:

退换货
修改添加品质报告不合格分类的插入接口,不合格分类新增的时候详情中不需要新增
退换货详情新增供应商相关字段
退换货新增入库类型字段
退换货新增入库前退货详情页面returnBeforeStorageDetail.html
退换货新增入库前退货按钮和对应后端接口
dev
liuxiaoxu 6 months ago
parent
commit
fd027087a5
  1. 47
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityRefundsExchangesController.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityRefundsExchanges.java
  3. 68
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityRefundsExchangesDetail.java
  4. 8
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityRefundsExchangesDetailMapper.java
  5. 10
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityRefundsExchangesDetailService.java
  6. 3
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityRefundsExchangesService.java
  7. 15
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesDetailServiceImpl.java
  8. 7
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesServiceImpl.java
  9. 29
      ruoyi-admin/src/main/resources/mapper/quality/QualityRefundsExchangesDetailMapper.xml
  10. 6
      ruoyi-admin/src/main/resources/mapper/quality/QualityRefundsExchangesMapper.xml
  11. 13
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/refundsExchanges.html
  12. 195
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/returnBeforeStorageDetail.html

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

@ -1,13 +1,13 @@
package com.ruoyi.quality.controller;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
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.QualityRefundsExchangesDetail;
import com.ruoyi.quality.domain.QualityRefundsExchangesUnqualified;
import com.ruoyi.quality.domain.*;
import com.ruoyi.quality.domain.VO.CheckoutMaterialVO;
import com.ruoyi.quality.service.IQualityRefundsExchangesDetailService;
import com.ruoyi.quality.service.IQualityRefundsExchangesUnqualifiedService;
@ -20,7 +20,6 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.quality.domain.QualityRefundsExchanges;
import com.ruoyi.quality.service.IQualityRefundsExchangesService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -177,9 +176,6 @@ public class QualityRefundsExchangesController extends BaseController
return toAjax(qualityRefundsExchangesService.updateRefundsExchangesStatus(qualityRefundsExchanges));
}
/**
* 修改品质单报告不良分类
*/
@ -210,4 +206,41 @@ public class QualityRefundsExchangesController extends BaseController
return toAjax(refundsExchangesDetailService.insertQualityRefundsExchangesDetail(refundsExchangesDetail));
}
/**
* 修改品质管理退换货单
*/
@GetMapping("/returnBeforeStorageDetail/{refundsExchangesId}")
public String returnBeforeStorageDetail(@PathVariable("refundsExchangesId") Long refundsExchangesId, ModelMap mmap)
{
QualityRefundsExchanges qualityRefundsExchanges = qualityRefundsExchangesService.selectQualityRefundsExchangesById(refundsExchangesId);
mmap.put("qualityRefundsExchanges", qualityRefundsExchanges);
return prefix + "/returnBeforeStorageDetail";
}
/**
* 修改保存品质管理退换货单
*/
@RequiresPermissions("quality:refundsExchanges:returnBeforeStorageDetail")
@Log(title = "品质管理退换货单", businessType = BusinessType.UPDATE)
@PostMapping("/returnBeforeStorageDetail")
@ResponseBody
public AjaxResult returnBeforeStorageDetailSave(QualityRefundsExchanges qualityRefundsExchanges)
{
return toAjax(qualityRefundsExchangesService.returnBeforeStorageDetail(qualityRefundsExchanges));
}
/**
* 入库前退货详情物料和供应商列表
*/
@ResponseBody
@RequestMapping("/detailListGroupedBySupplier")
public Map<String, List<QualityRefundsExchangesDetail>> detailListGroupedBySupplier(String refundsExchangesCode) {
List<QualityRefundsExchangesDetail> allDetails = refundsExchangesDetailService.selectRefundsExchangesDetailListByCode(refundsExchangesCode);
Map<String, List<QualityRefundsExchangesDetail>> groupedDetails = allDetails.stream()
.collect(Collectors.groupingBy(QualityRefundsExchangesDetail::getSupplierCode));
return groupedDetails;
}
}

13
ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityRefundsExchanges.java

@ -46,6 +46,10 @@ public class QualityRefundsExchanges extends BaseEntity
@Excel(name = "入库单号")
private String inStorageCode;
/** 入库类型 */
@Excel(name = "入库类型")
private String warehouseStorageType;
/** 退货节点 */
@Excel(name = "退货节点")
private String qualityReturnNode;
@ -180,6 +184,14 @@ public class QualityRefundsExchanges extends BaseEntity
return qualityRemark;
}
public String getWarehouseStorageType() {
return warehouseStorageType;
}
public void setWarehouseStorageType(String warehouseStorageType) {
this.warehouseStorageType = warehouseStorageType;
}
public List<QualityRefundsExchangesDetail> getRefundsExchangesDetails() {
return refundsExchangesDetails;
}
@ -198,6 +210,7 @@ public class QualityRefundsExchanges extends BaseEntity
.append("qualityPurchaseStatus", getQualityPurchaseStatus())
.append("relatedOrderCode", getRelatedOrderCode())
.append("inStorageCode", getInStorageCode())
.append("warehouseStorageType", getWarehouseStorageType())
.append("qualityReturnNode", getQualityReturnNode())
.append("materialTotal", getMaterialTotal())
.append("numTotal", getNumTotal())

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

@ -58,6 +58,28 @@ public class QualityRefundsExchangesDetail extends BaseEntity
@Excel(name = "数量合计")
private Long numTotal;
/** 供应商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;
@ -309,6 +331,47 @@ public class QualityRefundsExchangesDetail extends BaseEntity
this.inspectionTime = inspectionTime;
}
public String getSupplierCode() {
return supplierCode;
}
public void setSupplierCode(String supplierCode) {
this.supplierCode = supplierCode;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getCustomerContact() {
return customerContact;
}
public void setCustomerContact(String customerContact) {
this.customerContact = customerContact;
}
public String getContactNumber() {
return contactNumber;
}
public void setContactNumber(String contactNumber) {
this.contactNumber = contactNumber;
}
public String getSupplierAddress() {
return supplierAddress;
}
public void setSupplierAddress(String supplierAddress) {
this.supplierAddress = supplierAddress;
}
public List<QualityRefundsExchangesUnqualified> getRefundsExchangesUnqualifieds() {
return refundsExchangesUnqualifieds;
}
@ -330,6 +393,11 @@ public class QualityRefundsExchangesDetail extends BaseEntity
.append("qualityReturnNode", getQualityReturnNode())
.append("materialTotal", getMaterialTotal())
.append("numTotal", getNumTotal())
.append("supplierCode", getSupplierCode())
.append("supplierName", getSupplierName())
.append("customerContact", getCustomerContact())
.append("contactNumber", getContactNumber())
.append("supplierAddress", getSupplierAddress())
.append("materialNo", getMaterialNo())
.append("materialName", getMaterialName())
.append("materialType", getMaterialType())

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

@ -74,4 +74,12 @@ public interface QualityRefundsExchangesDetailMapper
* @return 结果
*/
public int restoreQualityRefundsExchangesDetailById(Long refundsExchangesDetailId);
/**
* 查询品质管理退换货单详情列表
*
* @param refundsExchangesCode 退换货单号
* @return 品质管理退换货单详情集合
*/
List<QualityRefundsExchangesDetail> selectRefundsExchangesDetailListByCode(String refundsExchangesCode);
}

10
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityRefundsExchangesDetailService.java

@ -27,6 +27,15 @@ public interface IQualityRefundsExchangesDetailService
*/
public List<QualityRefundsExchangesDetail> selectQualityRefundsExchangesDetailList(QualityRefundsExchangesDetail qualityRefundsExchangesDetail);
/**
* 查询品质管理退换货单详情列表
*
* @param refundsExchangesCode 退换货单号
* @return 品质管理退换货单详情集合
*/
public List<QualityRefundsExchangesDetail> selectRefundsExchangesDetailListByCode(String refundsExchangesCode);
/**
* 新增品质管理退换货单详情
*
@ -72,4 +81,5 @@ public interface IQualityRefundsExchangesDetailService
* @return
*/
int restoreQualityRefundsExchangesDetailById(Long refundsExchangesDetailId);
}

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

@ -75,4 +75,7 @@ public interface IQualityRefundsExchangesService
/*修改退换货状态*/
int updateRefundsExchangesStatus(QualityRefundsExchanges qualityRefundsExchanges);
/*入库前退换货详情*/
int returnBeforeStorageDetail(QualityRefundsExchanges qualityRefundsExchanges);
}

15
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesDetailServiceImpl.java

@ -54,6 +54,19 @@ public class QualityRefundsExchangesDetailServiceImpl implements IQualityRefunds
return qualityRefundsExchangesDetailMapper.selectQualityRefundsExchangesDetailList(qualityRefundsExchangesDetail);
}
/**
* 查询品质管理退换货单详情列表
*
* @param refundsExchangesCode 退换货单号
* @return 品质管理退换货单详情集合
*/
@Override
public List<QualityRefundsExchangesDetail> selectRefundsExchangesDetailListByCode(String refundsExchangesCode) {
return qualityRefundsExchangesDetailMapper.selectRefundsExchangesDetailListByCode(refundsExchangesCode);
}
/**
* 新增品质管理退换货单详情
*
@ -83,7 +96,7 @@ public class QualityRefundsExchangesDetailServiceImpl implements IQualityRefunds
refundsExchangesUnqualified.setCreateTime(new Date());
unqualifiedMapper.insertQualityRefundsExchangesUnqualified(refundsExchangesUnqualified);
}
return qualityRefundsExchangesDetailMapper.insertQualityRefundsExchangesDetail(qualityRefundsExchangesDetail);
return 1;
}
/**

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

@ -173,6 +173,13 @@ public class QualityRefundsExchangesServiceImpl implements IQualityRefundsExchan
return qualityRefundsExchangesMapper.updateQualityRefundsExchanges(qualityRefundsExchanges);
}
/*入库前退换货详情*/
@Override
public int returnBeforeStorageDetail(QualityRefundsExchanges qualityRefundsExchanges) {
return 1;
}
/**
*退换货单号:

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

@ -15,6 +15,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="qualityReturnNode" column="quality_return_node" />
<result property="materialTotal" column="material_total" />
<result property="numTotal" column="num_total" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<result property="customerContact" column="customer_contact" />
<result property="contactNumber" column="contact_number" />
<result property="supplierAddress" column="supplier_address" />
<result property="materialNo" column="material_no" />
<result property="materialName" column="material_name" />
<result property="materialType" column="material_type" />
@ -35,7 +40,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, 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, 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">
@ -49,6 +54,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where refunds_exchanges_detail_id = #{refundsExchangesDetailId}
</select>
<select id="selectRefundsExchangesDetailListByCode" parameterType="String" resultMap="QualityRefundsExchangesDetailResult">
<include refid="selectQualityRefundsExchangesDetailVo"/>
where refunds_exchanges_code = #{refundsExchangesCode}
</select>
<insert id="insertQualityRefundsExchangesDetail" parameterType="QualityRefundsExchangesDetail" useGeneratedKeys="true" keyProperty="refundsExchangesDetailId">
insert into quality_refunds_exchanges_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -61,6 +73,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityReturnNode != null">quality_return_node,</if>
<if test="materialTotal != null">material_total,</if>
<if test="numTotal != null">num_total,</if>
<if test="supplierCode != null">supplier_code,</if>
<if test="supplierName != null">supplier_name,</if>
<if test="customerContact != null">customer_contact,</if>
<if test="contactNumber != null">contact_number,</if>
<if test="supplierAddress != null">supplier_address,</if>
<if test="materialNo != null">material_no,</if>
<if test="materialName != null">material_name,</if>
<if test="materialType != null">material_type,</if>
@ -89,6 +106,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityReturnNode != null">#{qualityReturnNode},</if>
<if test="materialTotal != null">#{materialTotal},</if>
<if test="numTotal != null">#{numTotal},</if>
<if test="supplierCode != null">#{supplierCode},</if>
<if test="supplierName != null">#{supplierName},</if>
<if test="customerContact != null">#{customerContact},</if>
<if test="contactNumber != null">#{contactNumber},</if>
<if test="supplierAddress != null">#{supplierAddress},</if>
<if test="materialNo != null">#{materialNo},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialType != null">#{materialType},</if>
@ -121,6 +143,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityReturnNode != null">quality_return_node = #{qualityReturnNode},</if>
<if test="materialTotal != null">material_total = #{materialTotal},</if>
<if test="numTotal != null">num_total = #{numTotal},</if>
<if test="supplierCode != null">supplier_code = #{supplierCode},</if>
<if test="supplierName != null">supplier_name = #{supplierName},</if>
<if test="customerContact != null">customer_contact = #{customerContact},</if>
<if test="contactNumber != null">contact_number = #{contactNumber},</if>
<if test="supplierAddress != null">supplier_address = #{supplierAddress},</if>
<if test="materialNo != null">material_no = #{materialNo},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialType != null">material_type = #{materialType},</if>

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

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="qualityPurchaseStatus" column="quality_purchase_status" />
<result property="relatedOrderCode" column="related_order_code" />
<result property="inStorageCode" column="in_storage_code" />
<result property="warehouseStorageType" column="warehouse_storage_type" />
<result property="qualityReturnNode" column="quality_return_node" />
<result property="materialTotal" column="material_total" />
<result property="numTotal" column="num_total" />
@ -25,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectQualityRefundsExchangesVo">
select refunds_exchanges_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, delivery_inspection_time, quality_remark, remark, create_by, create_time, update_by, update_time from quality_refunds_exchanges
select refunds_exchanges_id, refunds_exchanges_code, refunds_exchanges_status, quality_warehouse_status, quality_purchase_status, related_order_code, in_storage_code, warehouse_storage_type ,quality_return_node, material_total, num_total, delivery_inspection_time, quality_remark, remark, create_by, create_time, update_by, update_time from quality_refunds_exchanges
</sql>
<select id="selectQualityRefundsExchangesList" parameterType="QualityRefundsExchanges" resultMap="QualityRefundsExchangesResult">
@ -56,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityPurchaseStatus != null">quality_purchase_status,</if>
<if test="relatedOrderCode != null">related_order_code,</if>
<if test="inStorageCode != null">in_storage_code,</if>
<if test="warehouseStorageType != null">warehouse_storage_type,</if>
<if test="qualityReturnNode != null">quality_return_node,</if>
<if test="materialTotal != null">material_total,</if>
<if test="numTotal != null">num_total,</if>
@ -74,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityPurchaseStatus != null">#{qualityPurchaseStatus},</if>
<if test="relatedOrderCode != null">#{relatedOrderCode},</if>
<if test="inStorageCode != null">#{inStorageCode},</if>
<if test="warehouseStorageType != null">#{warehouseStorageType},</if>
<if test="qualityReturnNode != null">#{qualityReturnNode},</if>
<if test="materialTotal != null">#{materialTotal},</if>
<if test="numTotal != null">#{numTotal},</if>
@ -96,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityPurchaseStatus != null">quality_purchase_status = #{qualityPurchaseStatus},</if>
<if test="relatedOrderCode != null">related_order_code = #{relatedOrderCode},</if>
<if test="inStorageCode != null">in_storage_code = #{inStorageCode},</if>
<if test="warehouseStorageType != null">warehouse_storage_type = #{warehouseStorageType},</if>
<if test="qualityReturnNode != null">quality_return_node = #{qualityReturnNode},</if>
<if test="materialTotal != null">material_total = #{materialTotal},</if>
<if test="numTotal != null">num_total = #{numTotal},</if>

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

@ -81,6 +81,8 @@
var editFlag = [[${@permission.hasPermi('quality:refundsExchanges:edit')}]];
var closingProceduresFlag = [[${@permission.hasPermi('quality:refundsExchanges:closingProcedures')}]];
var returnBeforeStorageDetailFlag = [[${@permission.hasPermi('quality:refundsExchanges:returnBeforeStorageDetail')}]];
var refundsExchangesStatusDatas = [[${@dict.getType('refunds_exchanges_status')}]];
var qualityWarehouseStatusDatas = [[${@dict.getType('quality_warehouse_status')}]];
@ -188,6 +190,11 @@
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> ');
}
/*入库前退货详情*/
if (row.qualityReturnNode == 0){
actions.push('<a class="btn btn-success btn-xs ' + returnBeforeStorageDetailFlag + '" href="javascript:void(0)" onclick="returnBeforeStorageDetail(\'' + row.refundsExchangesId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
return actions.join('');
}
}]
@ -196,6 +203,12 @@
$.table.init(options);
});
/*入库前退货详情*/
function returnBeforeStorageDetail(refundsExchangesId){
var url = ctx + 'quality/refundsExchanges/returnBeforeStorageDetail/' +refundsExchangesId;
$.modal.open("入库前退货详情",url);
}
/*结案*/
function closingProcedures(refundsExchangesId){
var url = ctx + 'quality/refundsExchanges/closingProcedures/' +refundsExchangesId;

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

@ -0,0 +1,195 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('入库前退货详情')" />
<th:block th:include="include :: datetimepicker-css" />
<style>
.supplier-value {
display: flex;
align-items: center;
justify-content: space-between;
}
.supplier-value span {
margin-right: 10px;
}
.info-separator::after {
content: "-";
margin: 0 5px;
}
</style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-qualityRefundsExchanges-edit" th:object="${qualityRefundsExchanges}">
<input name="refundsExchangesId" th:field="*{refundsExchangesId}" type="hidden">
<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">
</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">
</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')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseStorageType}"></option>
</select>
</div>
</div>
<div class="container">
<!--物料相关-->
<div class="row">
<div class="col-sm-12" id="tablesContainer">
<!-- 表格将在这里动态生成 -->
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var refundsExchangesCode = [[${qualityRefundsExchanges.refundsExchangesCode}]]
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() {
// 假设refundsExchangesCode已经定义或者可以通过某种方式获取到
var refundsExchangesCode = [[${qualityRefundsExchanges.refundsExchangesCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/detailListGroupedBySupplier?refundsExchangesCode=" + refundsExchangesCode, function(data) {
for (var supplierCode in data) {
if (data.hasOwnProperty(supplierCode)) {
var supplierData = data[supplierCode];
createTableForSupplier(supplierCode, supplierData);
}
}
});
});
function createTableForSupplier(supplierCode, supplierData) {
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase();
var $tableWrapper = $('<div class="table-responsive mt-3"></div>');
// 确保supplierData至少有一条记录,并从中提取供应商详细信息
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在
// 构建含有额外供应商信息的标题字符串
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A') +
' </br> ' + (supplierInfo.customerContact || 'N/A') +
' - ' + (supplierInfo.contactNumber || 'N/A') +
' - ' + (supplierInfo.supplierAddress || 'N/A');
var $header = $('<h4>' + headerTitle + '</h4>');
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>');
$table.bootstrapTable({
data: supplierData,
columns: [{
checkbox: true
},
{
title: '供应商ID',
field: 'supplierCode',
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',
editable:{
type:'text'
},
required:true
},
{
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',
}]
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
}
/*品质报告*/
function qualityReport(materialNo, supplierCode) {
var queryParams = new URLSearchParams();
queryParams.append('materialNo', materialNo);
queryParams.append('supplierCode', encodeURIComponent(supplierCode));
var url = ctx + 'quality/qualityOrder/qualityReport?' + queryParams.toString();
$.modal.open("品质报告", url);
}
</script>
</body>
</html>
Loading…
Cancel
Save