Browse Source

feat] 涉及物料部分,根据数据来源整合采购计划转采购订单对象已获取,根据提供的采购物料生成采购入库通知单,查询入库通知单数据在采购入库中,供应商物料价格已获取,可添加供应商数据,入库单采购入库暂收已完成暂收。

dev
zhangsiqi 5 months ago
parent
commit
1931624cd6
  1. 8
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java
  3. 10
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java
  4. 1
      ruoyi-admin/src/main/resources/application.yml
  5. 2
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml
  6. 4
      ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml
  7. 2
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html
  8. 184
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html
  9. 2
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html

8
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java

@ -154,7 +154,6 @@ public class PurchaseOrderController extends BaseController
for (int i = 0; i < planCodes.length - 1; i++) { for (int i = 0; i < planCodes.length - 1; i++) {
String planCode = planCodes[i]; String planCode = planCodes[i];
String correlationCode = correlationCodes[i]; String correlationCode = correlationCodes[i];
String purchaseQuote = purchaseQuoteCodes[i];
if (planCode != null) { if (planCode != null) {
PurchaseOrderChild material = new PurchaseOrderChild(); PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
@ -186,6 +185,7 @@ public class PurchaseOrderController extends BaseController
material.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode()); material.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode());
material.setSupplierCode(child.getSupplierCode()); material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit()); material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept());
material.setSupplierName(child.getSupplierName()); material.setSupplierName(child.getSupplierName());
material.setMaterialCode(child.getMaterialCode()); material.setMaterialCode(child.getMaterialCode());
material.setMaterialName(child.getMaterialName()); material.setMaterialName(child.getMaterialName());
@ -206,7 +206,7 @@ public class PurchaseOrderController extends BaseController
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setCorrelationCode(correlationCode); material.setCorrelationCode(correlationCode);
material.setPurchasePlanCode(planCode); material.setPurchasePlanCode(planCode);
material.setPurchaseQuoteCode(purchaseQuote); material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
material.setEceiptStatus("0"); material.setEceiptStatus("0");
material.setPaymentStatus("0"); material.setPaymentStatus("0");
material.setDelFlag("0"); material.setDelFlag("0");
@ -220,7 +220,8 @@ public class PurchaseOrderController extends BaseController
} }
child.setMaterialNoRmb(BigDecimal.ZERO); child.setMaterialNoRmb(BigDecimal.ZERO);
} }
else if ((child.getCorrelationCode().contains(",")==false) && child.getPurchasePlanCode() != null) { else if ((child.getCorrelationCode().contains(",")==false)
&& child.getPurchasePlanCode() != null) {
PurchaseOrderChild material = new PurchaseOrderChild(); PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
//获取物料供应商采购价格 //获取物料供应商采购价格
@ -250,6 +251,7 @@ public class PurchaseOrderController extends BaseController
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
material.setSupplierCode(child.getSupplierCode()); material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit()); material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept());
material.setSupplierName(child.getSupplierName()); material.setSupplierName(child.getSupplierName());
material.setMaterialCode(child.getMaterialCode()); material.setMaterialCode(child.getMaterialCode());
material.setMaterialName(child.getMaterialName()); material.setMaterialName(child.getMaterialName());

2
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java

@ -134,7 +134,7 @@ public class PurchasePlanController extends BaseController
//用stream流处理相同供应商\物料\ //用stream流处理相同供应商\物料\
//将供应商信息解析成List<PurchaseSupplier> //将供应商信息解析成List<PurchaseSupplier>
mmap.put("purchasePlanList", purchasePlanList); mmap.put("purchasePlanList", purchasePlanList);
mmap.put("purchasePlanCodes", uniquePurchasePlanCodes); mmap.put("purchasePlanCodes", purchasePlanCodeArray);
mmap.put("purchasePlanChildList", purchasePlanChildList); mmap.put("purchasePlanChildList", purchasePlanChildList);
return prefix + "/addPurchaseOrder"; return prefix + "/addPurchaseOrder";
} }

10
ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java

@ -144,12 +144,22 @@ public class PurchaseOrderChild extends BaseEntity
@Excel(name = "通知到货数量") @Excel(name = "通知到货数量")
private Integer notifyArriveNum; private Integer notifyArriveNum;
private Integer notifyHasArriveNum;
/** 实际已到货数量 */ /** 实际已到货数量 */
@Excel(name = "实际已到货数量") @Excel(name = "实际已到货数量")
private Integer actualHasArrivedNum; private Integer actualHasArrivedNum;
private Integer notifyArrivedNum; private Integer notifyArrivedNum;
public Integer getNotifyHasArriveNum() {
return notifyHasArriveNum;
}
public void setNotifyHasArriveNum(Integer notifyHasArriveNum) {
this.notifyHasArriveNum = notifyHasArriveNum;
}
public Integer getNotifyArrivedNum() { public Integer getNotifyArrivedNum() {
return notifyArrivedNum; return notifyArrivedNum;
} }

1
ruoyi-admin/src/main/resources/application.yml

@ -38,7 +38,6 @@ logging:
level: level:
com.ruoyi: debug com.ruoyi: debug
org.springframework: warn org.springframework: warn
org.activiti.db.sql: debug

2
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml

@ -173,7 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialPhotourl != null">material_photo_url = #{materialPhotourl}</if> <if test="materialPhotourl != null">material_photo_url = #{materialPhotourl}</if>
<if test="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</if> <if test="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</if>
<if test="materialUnit != null">material_unit = #{materialUnit},</if> <if test="materialUnit != null">material_unit = #{materialUnit},</if>
<if test="warehouseDept != null">warehouse_dept = #{warehouseDept},</if> <if test="warehouseDept != null">warehousezDept = #{warehouseDept},</if>
<if test="materialNoRmb != null">material_no_rmb = #{materialNoRmb},</if> <if test="materialNoRmb != null">material_no_rmb = #{materialNoRmb},</if>
<if test="materialRmb != null">material_rmb = #{materialRmb},</if> <if test="materialRmb != null">material_rmb = #{materialRmb},</if>
<if test="materialNum != null">material_num = #{materialNum},</if> <if test="materialNum != null">material_num = #{materialNum},</if>

4
ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml

@ -230,8 +230,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join purchase_plan as plan on plan.purchase_plan_code = planChild.purchase_plan_code left join purchase_plan as plan on plan.purchase_plan_code = planChild.purchase_plan_code
where plan.purchase_plan_code IN where plan.purchase_plan_code IN
<foreach item="purchasePlanCode" collection="array" open="(" separator="," close=")"> <foreach item="purchasePlanCode" collection="array" open="(" separator="," close=")">
#{purchasePlanCode} #{purchasePlanCode}
</foreach> </foreach>
group by material_code group by material_code
</select> </select>
</mapper> </mapper>

2
ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html

@ -114,7 +114,7 @@
{title: '计划采购数',field: 'materialNum',}, {title: '计划采购数',field: 'materialNum',},
{title: '实际采购数',field: 'materialRealNum',}, {title: '实际采购数',field: 'materialRealNum',},
{title: '交付时间',field: 'deliveryTime',}, {title: '交付时间',field: 'deliveryTime',},
{title: '通知已到货数',field: 'notifyHasArrivedNum', {title: '通知已到货数',field: 'notifyArriveNum',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value == null || value == '') { if (value == null || value == '') {
return 0; return 0;

184
ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html

@ -2,6 +2,8 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('新增采购计划单')" /> <th:block th:include="include :: header('新增采购计划单')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -9,7 +11,7 @@
<div class="col-xs-12"> <div class="col-xs-12">
<label class="col-sm-4 control-label">已选择采购计划:</label> <label class="col-sm-4 control-label">已选择采购计划:</label>
<div class="col-sm-7"> <div class="col-sm-7">
<input id="purchasePlanCodes" name="purchasePlanCode" class="form-control" type="text"> <input id="purchasePlanCodes" name="purchasePlanCode" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="container" id="material"> <div class="container" id="material">
@ -78,6 +80,8 @@
</div> </div>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-editable-js" /> <th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "purchase/purchaseOrder"; var prefix = ctx + "purchase/purchaseOrder";
@ -149,67 +153,73 @@
if (material.purchaseSupplierList.size == 0) { if (material.purchaseSupplierList.size == 0) {
var $noSupplierDiv = $('<div class="no-supplier">暂无供应商信息,请先添加供应商信息。</div>'); var $noSupplierDiv = $('<div class="no-supplier">暂无供应商信息,请先添加供应商信息。</div>');
$tableWrapper.append($noSupplierDiv); $tableWrapper.append($noSupplierDiv);
}else{ }
else{
material.purchaseSupplierList.forEach(supplier => { material.purchaseSupplierList.forEach(supplier => {
const key = `${supplier.supplierCode}_${supplier.materialCode}`; const key = `${supplier.supplierCode}_${supplier.materialCode}`;
$supplierInfo = $('<div class="card supplier-card" id="supplierInfo-' + tableId + '"></div>');
if (!uniqueSuppliers.map(s => `${s.supplierCode}_${s.materialCode}`).includes(key)) { if (!uniqueSuppliers.map(s => `${s.supplierCode}_${s.materialCode}`).includes(key)) {
uniqueSuppliers.push(supplier); uniqueSuppliers.push(supplier);
}else{
var $noSupplierDiv = $('<div class="no-supplier">暂无供应商信息,请先添加供应商信息。</div>');
$supplierInfo.append($noSupplierDiv);
} }
}); });
// 循环处理每个供应商的信息 // 循环处理每个供应商的信息
uniqueSuppliers.forEach(function (supplier, supplierIndex) { uniqueSuppliers.forEach(function (supplier, supplierIndex) {
//如果供应商相同,则不需要再次添加供应商信息 //如果供应商相同,则不需要再次添加供应商信息
$supplierInfo = $('<div class="card supplier-card" id="supplierInfo-' + tableId +'-'+ supplierIndex + '"></div>'); // 卡片样式容器,用于包裹每个供应商的信息
// 卡片样式容器,用于包裹每个供应商的信息 // 构建供应商信息头部
// 构建供应商信息头部 var $headerContent =
var $headerContent = $('<div class="card-header" id = "supplier-' + tableId + '_' + supplierIndex + '">' +
$('<div class="card-header" id = "supplier-' + tableId + '">' + '<div class="row">' +
'<div class="row">' + '<div class="crad-text">'+
'<div class="crad-text">'+ '<h4>供应商 ' + supplierIndex + ':' + '</h4>' +
'<h4>供应商 ' + supplierIndex + ':' + '</h4>' + '<span class="supplierCode_'+ supplierIndex +'">' + supplier.supplierCode + '</span>' + '-' +
'<span class="supplierCode"">' + supplier.supplierCode + '</span>' + '-' + '<span class="supplierName_'+ supplierIndex +'">' + supplier.supplierName + '</span>' +
'<span class="supplierName">' + supplier.supplierName + '</span>' + '-最新不含税采购价: ' +'<span id="supplierMaterialNoRmb-' + tableId + '" class="supplierMaterialNoRmb_'+ supplierIndex +'">' + supplier.materialNoRmb +'</span>'+
'-最新不含税采购价: ' + ' RMB 最新含税采购价: ' +'<span class="supplierMaterialRmb_'+ supplierIndex +'">' + supplier.materialRmb + '</span> RMB ' +
'<span id="supplierMaterialNoRmb-' + tableId + '" class="supplierMaterialNoRmb">' + supplier.materialNoRmb + '<span class="supplierPurchasePlanCode_'+ supplierIndex +'" hidden="hidden" >' + material.planCodes + '</span>' +
'</span>'+ ' RMB 最新含税采购价: ' + '<span class="supplierCorrelationCode_'+ supplierIndex +'" hidden="hidden" >' + material.correlationCodes + '</span>' +
'<span class="supplierMaterialRmb">' + supplier.materialRmb + '</span> RMB ' + '<span class="supplierPurchaseQuoteCode_'+ supplierIndex +'" hidden="hidden" >' + supplier.purchaseQuoteCode + '</span>' +
'<span class="supplierPurchasePlanCode" hidden="hidden" >' + material.planCodes + '</span>' + '</div>' +
'<span class="supplierCorrelationCode" hidden="hidden" >' + material.correlationCodes + '</span>' + '</div>' +
'<span class="supplierPurchaseQuoteCode" hidden="hidden" >' + supplier.purchaseQuoteCode + '</span>' + '<div class="row">' +
'</div>' + '<div class="form-row">' +
'</div>' + '<label class="col-sm-2"> 实际采购数: </label>' +
'<div class="row">' + '<div class ="col-sm-4">' +
'<div class="form-row">' + '<input type="text" name="materialNum" class="form-control supplierMaterialNum_'+ supplierIndex +'"" id="actualPurchaseNum_' + tableId + '">' +
'<label class="col-sm-2"> 实际采购数: </label>' + '</div>' +
'<div class ="col-sm-4">' + '</div>' +
'<input type="text" name="materialNum" class="form-control supplierMaterialNum" id="actualPurchaseNum_' + tableId + '">' + '<div class="form-row">' +
'</div>' + '<label class="col-sm-2">计划交付时间: </label>' +
'</div>' + '<div class ="col-sm-4">' +
'<div class="form-row">' + '<div class="input-group date"> ' +
'<label class="col-sm-2">计划交付时间: </label>' + '<input type="text" name="deliveryTime" class="form-control supplierDeliveryTime_'+ supplierIndex +'"" id="deliveryTime_' + tableId + '">' +
'<div class ="col-sm-4">' + '<span class="input-group-addon"><i class="fa fa-calendar"></i></span>' +
'<div class="input-group date"> ' + '</div> ' +
'<input type="text" name="deliveryTime" class="form-control supplierDeliveryTime" id="deliveryTime_' + tableId + '">' + '</div>' +
'<span class="input-group-addon"><i class="fa fa-calendar"></i></span>' + '</div>' +
'</div> ' + '</div>' +
'</div>' +
'</div>' +
'</div>'); '</div>');
if (supplier.supplierCode != undefined && supplier.supplierCode != '' && supplier.supplierCode != null) {
$supplierInfo.append($headerContent);
// 构建供应商信息下的输入表单
$supplierForm = $('<div class="card-body" id="card_body_' + tableId + '"></div>');
// 实际采购数输入框
// 其他表单项可以根据需要类似添加
$supplierInfo.append($supplierForm);
}else{
var $noSupplierDiv = $('<div class="no-supplier">暂无供应商信息,请先添加供应商信息。</div>');
$supplierInfo.append($noSupplierDiv);
}
});
$tableWrapper.append($supplierInfo); $tableWrapper.append($supplierInfo);
$supplierInfo.append($headerContent);
// 构建供应商信息下的输入表单
$supplierForm = $('<div class="card-body" id="card_body_' + tableId + '"></div>');
// 实际采购数输入框
// 其他表单项可以根据需要类似添加
$supplierInfo.append($supplierForm);
});
tableSetup($supplierInfo, tableId);
} }
tableSetup($supplierInfo, tableId);
}); });
// 给实际采购数的输入框绑定事件处理器 // 给实际采购数的输入框绑定事件处理器
$('.supplierMaterialNum').off('keyup').on('keyup', function(event,element) { $('.supplierMaterialNum').off('keyup').on('keyup', function(event,element) {
console.log(event);
console.log(element);
var tableId = $(element).closest('.table-materialCode').attr('id'); var tableId = $(element).closest('.table-materialCode').attr('id');
if (event.keyCode === 13) { if (event.keyCode === 13) {
// 获取当前供应商的采购数量 // 获取当前供应商的采购数量
@ -233,6 +243,7 @@
} }
recalculateTotals(tableId); // 重新计算当前物料的合计 recalculateTotals(tableId); // 重新计算当前物料的合计
}); });
getWarehouseInfo();
}); });
// 新增函数:重新计算某物料的采购数量合计、不含税采购总价和含税采购总价 // 新增函数:重新计算某物料的采购数量合计、不含税采购总价和含税采购总价
function recalculateTotals(tableId) { function recalculateTotals(tableId) {
@ -339,6 +350,22 @@
], ],
}); });
} }
function selectSupplierQuote(){
$('.table-materialCode').each(function(index, tableElement) {
var tableId = tableIdList[index];
let materialObj = materialList[index];
if (typeof materialObj === 'undefined') return;
$('#' + 'material-' + tableId).find('.supplier-card').each(function(supplierIndex, supplierCard) {
var supplierCode = $(supplierCard).find('.supplierCode').text().trim();
var supplierName = $(supplierCard).find('.supplierName').text().trim();
var materialRealNum = parseInt($(supplierCard).find('.supplierMaterialNum').val(), 10) || 0;
var materialRealRmb = parseInt($(supplierCard).find('.supplierMaterialRmb').val(), 10) || 0;
var materialRealNoRmb = parseInt($(supplierCard).find('.supplierMaterialNoRmb').val(), 10) || 0;
//计划供应商下面的采购数量
purchaseOrder.purchaseOrderChildList.push(materialData);
});
});
}
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
var purchaseOrder = { var purchaseOrder = {
@ -356,15 +383,17 @@
let materialObj = materialList[index]; let materialObj = materialList[index];
if (typeof materialObj === 'undefined') return; if (typeof materialObj === 'undefined') return;
$('#' + 'material-' + tableId).find('.supplier-card').each(function(supplierIndex, supplierCard) { $('#' + 'material-' + tableId).find('.supplier-card').each(function(supplierIndex, supplierCard) {
var supplierCode = $(supplierCard).find('.supplierCode').text().trim(); var supplierCode = $(supplierCard).find('.supplierCode_'+ supplierIndex ).text().trim();
var supplierName = $(supplierCard).find('.supplierName').text().trim(); var supplierName = $(supplierCard).find('.supplierName_'+ supplierIndex).text().trim();
var materialRealNum = parseInt($(supplierCard).find('.supplierMaterialNum').val(), 10) || 0; var materialRealNum = parseInt($(supplierCard).find('.supplierMaterialNum_'+ supplierIndex ).val(), 10) || 0;
var materialRealRmb = parseInt($(supplierCard).find('.supplierMaterialRmb').val(), 10) || 0; var materialRealRmb = parseFloat($(supplierCard).find('.supplierMaterialRmb_'+ supplierIndex).text(), 10) || 0;
var materialRealNoRmb = parseInt($(supplierCard).find('.supplierMaterialNoRmb').val(), 10) || 0; var materialRealNoRmb = parseFloat($(supplierCard).find('.supplierMaterialNoRmb_'+ supplierIndex ).text(), 10) || 0;
var deliveryTime = $(supplierCard).find('.supplierDeliveryTime').val(); var deliveryTime = $(supplierCard).find('.supplierDeliveryTime_'+ supplierIndex ).val();
var purchasePlanCode = $(supplierCard).find('.supplierPurchasePlanCode').text().trim(); var purchasePlanCode = $(supplierCard).find('.supplierPurchasePlanCode_'+ supplierIndex).text().trim();
var correlationCode = $(supplierCard).find('.supplierCorrelationCode').text().trim(); var correlationCode = $(supplierCard).find('.supplierCorrelationCode_'+ supplierIndex ).text().trim();
var purchaseQuoteCode = $(supplierCard).find('.supplierPurchaseQuoteCode').text().trim(); var purchaseQuoteCode = $(supplierCard).find('.supplierPurchaseQuoteCode_'+ supplierIndex ).text().trim();
var materialRealRmbSum = parseFloat(materialRealRmb) * parseFloat(materialRealNum);
var materialRealNoRmbSum = parseFloat(materialRealNoRmb) * parseFloat(materialRealNum);
var materialData = { var materialData = {
materialCode: materialObj.materialCode, materialCode: materialObj.materialCode,
materialName: materialObj.materialName, materialName: materialObj.materialName,
@ -378,11 +407,13 @@
materialNum: materialObj.materialNum, materialNum: materialObj.materialNum,
supplierCode: supplierCode, supplierCode: supplierCode,
supplierName: supplierName, supplierName: supplierName,
materialNoRmb: materialObj.materialNoRmb,
materialRmb: materialObj.materialRmb,
materialRealNum: materialRealNum, materialRealNum: materialRealNum,
materialRealRmb: materialRealRmb, materialRealRmb: materialRealRmb,
materialRealNoRmb: materialRealNoRmb, materialRealNoRmb: materialRealNoRmb,
materialRealRmbSum: materialRealRmb * materialRealNum, materialRealRmbSum: materialRealRmbSum,
materialRealNoRmbSum: materialRealNoRmb * materialRealNum, materialRealNoRmbSum: materialRealNoRmbSum,
deliveryTime: deliveryTime, deliveryTime: deliveryTime,
purchasePlanCode:purchasePlanCode, purchasePlanCode:purchasePlanCode,
correlationCode:correlationCode, correlationCode:correlationCode,
@ -414,32 +445,33 @@
$("#stockNo").select2({ $("#stockNo").select2({
theme: "bootstrap", theme: "bootstrap",
allowClear: true, allowClear: true,
placeholder: "请选择供应商", placeholder: "请选择仓库",
ajax: { ajax: {
url: ctx + "stock/stockInfo/list", url: ctx + "stock/stockInfo/getAllWarehouseCode",
type: "post", type: "get",
dataType: "json", dataType: "json",
delay: 250, delay: 250,
processResults: function (res, params) { processResults: function (data) {
var resultList = res.rows; var resultList = data;
var options = []; var options = [];
for (let i in resultList) { for (var i = 0; i < resultList.length; i++) {
var option = resultList[i]; var result = resultList[i];
option.id = resultList[i]["StockNo"]; options.push({id: result.stockNo, text: result.stockNo});
option.text = resultList[i]["StockNo"]; }
option.title = resultList[i]["StockName"]; return {
options.push(option); results: options,
} }
return {results: options,}
}, },
escapeMarkup: function (markup) {return markup;}, escapeMarkup: function (markup) {return markup;},
} }
}) })
$("#stockNo").on("select2:select", function (e) { }
var data = e.params.data; $("#stockNo").on("select2:select", function (e) {
$("#stockName").val(data.StockName); var data = e.params.data;
}); $("#stockName").val(data.stockName);
} $("#stockAddress").val(data.stockAddr);
});
</script> </script>
</body> </body>
</html> </html>

2
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html

@ -3,6 +3,7 @@
<head> <head>
<th:block th:include="include :: header('入库-采购单(采购入库)')" /> <th:block th:include="include :: header('入库-采购单(采购入库)')" />
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
<style> <style>
.supplier-value span { .supplier-value span {
@ -86,6 +87,7 @@
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-editable-js" /> <th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript"> <script th:inline="javascript">

Loading…
Cancel
Save