Browse Source

[feat]品质管理:

退换货
修改入库后退货-选择供应商-无供应商afterNoConfirmSupplier.html页面的样式
afterNoConfirmSupplier.html新增供应商相关字段
新增查询供应商所有Id的接口
新增根据供应商ID查找供应商名称的接口
afterNoConfirmSupplier.html
dev
liuxiaoxu 5 months ago
parent
commit
5f6b4b21ed
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityRefundsExchangesServiceImpl.java
  2. 20
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSupplierController.java
  3. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSupplierMapper.java
  4. 12
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSupplierService.java
  5. 21
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java
  6. 11
      ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml
  7. 101
      ruoyi-admin/src/main/resources/templates/quality/refundsExchanges/afterNoConfirmSupplier.html

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

@ -198,12 +198,6 @@ public class QualityRefundsExchangesServiceImpl implements IQualityRefundsExchan
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());

20
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSupplierController.java

@ -265,5 +265,25 @@ public class SysSupplierController extends BaseController
return Result.getSuccessResult(sysSupplierService.getId());
}
/**
* 关联退换货 入库后退货-选择供应商-无供应商
* */
@PostMapping("/getSupplierName")
@ResponseBody
public List<SysSupplier> getSupplierName(String supplierCode){
List<SysSupplier> list = sysSupplierService.getSupplierNameByCode(supplierCode);
return list;
}
/**
* 关联退换货 入库后退货-选择供应商-无供应商
* */
@PostMapping("/getSupplierCodes")
@ResponseBody
public List<SysSupplier> getSupplierCodes(){
List<SysSupplier> list = sysSupplierService.getSupplierCodes();
return list;
}
}

10
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSupplierMapper.java

@ -66,4 +66,14 @@ public interface SysSupplierMapper
* 新增物料信息的时候查关联应商信息
*/
public List<SysSupplier> selectSysSupplierWithMaterial();
/**
* 关联退换货 入库后退货-选择供应商-无供应商
* */
List<SysSupplier> getSupplierNameByCode(String supplierCode);
/**
* 关联退换货 入库后退货-选择供应商-无供应商
* */
List<SysSupplier> getSupplierCodes();
}

12
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSupplierService.java

@ -72,4 +72,16 @@ public interface ISysSupplierService
Object getId();
public List<SysSupplier> selectSysSupplierListAll();
/**
* 关联退换货 入库后退货-选择供应商-无供应商
* */
List<SysSupplier> getSupplierNameByCode(String supplierCode);
/**
* 关联退换货 入库后退货-选择供应商-无供应商
* */
List<SysSupplier> getSupplierCodes();
}

21
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java

@ -163,4 +163,25 @@ public class SysSupplierServiceImpl implements ISysSupplierService
sysSupplier.setAuditStatus("1");
return sysSupplierMapper.selectSysSupplierList(sysSupplier);
}
/**
* 关联退换货 入库后退货-选择供应商-无供应商
* */
@Override
public List<SysSupplier> getSupplierNameByCode(String supplierCode) {
List<SysSupplier> list = sysSupplierMapper.getSupplierNameByCode(supplierCode);
return list;
}
/**
* 关联退换货 入库后退货-选择供应商-无供应商
* */
@Override
public List<SysSupplier> getSupplierCodes() {
List<SysSupplier> list = sysSupplierMapper.getSupplierCodes();
return list;
}
}

11
ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml

@ -130,6 +130,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSysSupplierVo"/>
</select>
<select id="getSupplierNameByCode" resultMap="SysSupplierResult">
<include refid="selectSysSupplierVo"/>
where supplier_code = #{supplierCode}
</select>
<select id="getSupplierCodes" resultMap="SysSupplierResult">
<include refid="selectSysSupplierVo"/>
</select>
<insert id="insertSysSupplier" parameterType="SysSupplier" useGeneratedKeys="true" keyProperty="supplierId">
insert into sys_supplier
<trim prefix="(" suffix=")" suffixOverrides=",">

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

@ -43,6 +43,8 @@
var qualityRefundsExchanges = [[${qualityRefundsExchanges}]];
var $table = $("#bootstrap-table");
var prefix = ctx + "quality/refundsExchanges";
$("#form-qualityRefundsExchanges-edit").validate({
focusCleanup: true
@ -79,10 +81,15 @@
"materialUnit": item.materialUnit,
"materialBrand": item.materialBrand,
"materialDescribe": item.materialDescribe,
"snCode": item.snCode,
"complaintProblem": item.complaintProblem,
// "emergencyDegree": item.emergencyDegree,
"adverseReportUrl": item.adverseReportUrl,
"makeTotal":item.makeTotal,
"qualityHasqualifiedNum":item.qualityHasqualifiedNum,
"thisArrivedNum":item.thisArrivedNum,
"qualityUnqualifiedNum":item.qualityUnqualifiedNum,
"supplierCode":item.supplierCode,
"supplierName":item.supplierName,
"customerContact":item.customerContact,
"contactNumber":item.contactNumber,
"supplierAddress":item.supplierAddress,
// ...其他字段
};
});
@ -180,13 +187,15 @@
title: '品质不合格数',
field: 'qualityUnqualifiedNum',
},
{
title: '选择供应商ID',
field: 'supplierCode',
{title: '选择供应商ID',field: 'supplierCode',
formatter:function (value, row, index) {
return supplierCodeAsyncFormatter(value,row,index);
}
},
{
title: '选择供应商名称',
field: 'supplierName',
{title: '选择供应商名称',field: 'supplierName',
formatter:function(value, row, index){
return getSupplierNameType(value,row,index)
}
},
{
title: '退货联系人',
@ -215,6 +224,78 @@
}
// 自定义供应商代码列的格式化函数,异步获取供应商代码
function supplierCodeAsyncFormatter(value, row, index) {
var selectHtml = '<select class="form-control supplier-code" onchange="supplierCodeChange(this, ' + index + ')">';
// 先不填充,等待ajax获取数据
selectHtml += '</select>';
loadSupplierCodes(selectHtml, index); // 异步加载供应商代码
return selectHtml;
}
// 加载供应商代码的函数
function loadSupplierCodes(selectHtml, index) {
$.ajax({
url: ctx + 'system/supplier/getSupplierCodes', // 获取所有供应商代码
type: 'POST',
dataType: 'json',
success: function (codes) {
var selectElement = $('.supplier-code:eq(' + index + ')');
codes.forEach(function (code) {
selectElement.append('<option value="' + code.supplierCode + '">' + code.supplierCode + '</option>');
});
// 设置默认值(如果存在)
var rowData = $table.bootstrapTable('getData')[index];
if (rowData && rowData.supplierCode) {
selectElement.val(rowData.supplierCode);
}
}
});
}
// 列中获取成本类型的下拉改变数据
function supplierCodeChange(selectElement, rowIndex) {
var newSupplierCode = $(selectElement).val();
var tableData = $table.bootstrapTable('getData');
var newRow = tableData[rowIndex];
newRow.supplierCode = newSupplierCode;
// getSupplierNameType(newRow.supplierCode,newRow,rowIndex);
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
function getSupplierNameType(value, row, index) {
var selectHtml = '<select class="form-control" onchange="onSupplierNameChange(this, ' + index + ')">';
// 假设此函数根据供应商ID返回设备列表
var supplierNames = [];
$.ajax({
url: ctx + 'system/supplier/getSupplierName',
type: 'post',
data: {supplierCode: row.supplierCode},
async: false,
success: function (result) {
console.log(result);
supplierNames = result;
}
});
if (supplierNames) {
supplierNames.forEach(function (child) {
selectHtml += '<option value="' + child.supplierCode + '"' + (value === child.supplierCode ? ' selected' : '') + '>' + child.supplierName + '</option>';
});
selectHtml += '</select>';
return selectHtml;
}
}
// 供应商名称改变时的处理函数
function onSupplierNameChange(selectElement, rowIndex) {
var newSupplierName = $(selectElement).val();
var tableData = $table.bootstrapTable('getData');
var newRow = tableData[rowIndex]; // 获取当前行数据
newRow.supplierName = newSupplierName;
// 更新行数据
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
</script>
</body>
</html>
Loading…
Cancel
Save