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. 2
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html
  7. 118
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html
  8. 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++) {
String planCode = planCodes[i];
String correlationCode = correlationCodes[i];
String purchaseQuote = purchaseQuoteCodes[i];
if (planCode != null) {
PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
@ -186,6 +185,7 @@ public class PurchaseOrderController extends BaseController
material.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode());
material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept());
material.setSupplierName(child.getSupplierName());
material.setMaterialCode(child.getMaterialCode());
material.setMaterialName(child.getMaterialName());
@ -206,7 +206,7 @@ public class PurchaseOrderController extends BaseController
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setCorrelationCode(correlationCode);
material.setPurchasePlanCode(planCode);
material.setPurchaseQuoteCode(purchaseQuote);
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
material.setEceiptStatus("0");
material.setPaymentStatus("0");
material.setDelFlag("0");
@ -220,7 +220,8 @@ public class PurchaseOrderController extends BaseController
}
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();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
//获取物料供应商采购价格
@ -250,6 +251,7 @@ public class PurchaseOrderController extends BaseController
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept());
material.setSupplierName(child.getSupplierName());
material.setMaterialCode(child.getMaterialCode());
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流处理相同供应商\物料\
//将供应商信息解析成List<PurchaseSupplier>
mmap.put("purchasePlanList", purchasePlanList);
mmap.put("purchasePlanCodes", uniquePurchasePlanCodes);
mmap.put("purchasePlanCodes", purchasePlanCodeArray);
mmap.put("purchasePlanChildList", purchasePlanChildList);
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 = "通知到货数量")
private Integer notifyArriveNum;
private Integer notifyHasArriveNum;
/** 实际已到货数量 */
@Excel(name = "实际已到货数量")
private Integer actualHasArrivedNum;
private Integer notifyArrivedNum;
public Integer getNotifyHasArriveNum() {
return notifyHasArriveNum;
}
public void setNotifyHasArriveNum(Integer notifyHasArriveNum) {
this.notifyHasArriveNum = notifyHasArriveNum;
}
public Integer getNotifyArrivedNum() {
return notifyArrivedNum;
}

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

@ -38,7 +38,6 @@ logging:
level:
com.ruoyi: debug
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="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</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="materialRmb != null">material_rmb = #{materialRmb},</if>
<if test="materialNum != null">material_num = #{materialNum},</if>

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

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

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

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

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

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

Loading…
Cancel
Save