diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseQuoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseQuoteController.java index c30843e4..7189ded2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseQuoteController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseQuoteController.java @@ -252,6 +252,7 @@ public class PurchaseQuoteController extends BaseController if(!approvedFlag){ // 审核状态-审核拒绝 purchaseQuoteVo.setAuditStatus("2"); + purchaseQuoteHistoryService.updatePurchaseQuoteHistoryByPurchaseQuote(purchaseQuoteVo); } // 如果任务已结束更新业务表状态 boolean processIsFinish = processService.judgeProcessIsFinish(instanceId); @@ -262,6 +263,7 @@ public class PurchaseQuoteController extends BaseController if("submit".equals(instanceType)){ // 使用状态-是 purchaseQuoteVo.setUseStatus("1"); + purchaseQuoteHistoryService.updatePurchaseQuoteHistoryByPurchaseQuote(purchaseQuoteVo); } // 作废 else if("cancel".equals(instanceType)){ @@ -353,7 +355,6 @@ public class PurchaseQuoteController extends BaseController - /** * 查询最新报价历史数据 * */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java index 85e76154..0a24b429 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java @@ -94,4 +94,5 @@ public interface PurchaseQuoteChildMapper * 通过供应商编码查找所有采购报价子表集合 * */ List selectQuoteChildBySupplierCode(String supplierCode); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteHistoryMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteHistoryMapper.java index 8ed977fe..8bd8989f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteHistoryMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteHistoryMapper.java @@ -89,4 +89,9 @@ public interface PurchaseQuoteHistoryMapper * @return 结果 */ public int restorePurchaseQuoteHistoryById(Long purchaseQuoteChildId); + + /** + * 通过供应商编号和物料编号更新采购报价历史数据 + * */ + public int updatePurchaseQuoteHistoryByCode(PurchaseQuoteHistory purchaseQuoteHistory); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteHistoryService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteHistoryService.java index a5b97438..57a9cb7e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteHistoryService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteHistoryService.java @@ -4,6 +4,7 @@ import java.util.List; import com.ruoyi.purchase.domain.PurchaseQuote; import com.ruoyi.purchase.domain.PurchaseQuoteHistory; +import com.ruoyi.purchase.domain.Vo.PurchaseQuoteVo; /** * 采购物料历史报价信息Service接口 @@ -80,4 +81,10 @@ public interface IPurchaseQuoteHistoryService * * */ int generatePurchaseQuoteHistory(PurchaseQuote purchaseQuote); + + /** + * 采购报价更新的时候更新采购报价历史数据 + * + * */ + void updatePurchaseQuoteHistoryByPurchaseQuote(PurchaseQuoteVo purchaseQuoteVo); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteHistoryServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteHistoryServiceImpl.java index e6580f16..c7528461 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteHistoryServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteHistoryServiceImpl.java @@ -1,11 +1,17 @@ package com.ruoyi.purchase.service.impl; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.Objects; + +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.purchase.domain.PurchaseQuote; import com.ruoyi.purchase.domain.PurchaseQuoteChild; +import com.ruoyi.purchase.domain.Vo.PurchaseQuoteVo; +import com.ruoyi.purchase.mapper.PurchaseQuoteChildMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.purchase.mapper.PurchaseQuoteHistoryMapper; @@ -25,6 +31,9 @@ public class PurchaseQuoteHistoryServiceImpl implements IPurchaseQuoteHistorySer @Autowired private PurchaseQuoteHistoryMapper purchaseQuoteHistoryMapper; + @Autowired + private PurchaseQuoteChildMapper purchaseQuoteChildMapper; + /** * 查询采购物料历史报价信息 * @@ -46,7 +55,21 @@ public class PurchaseQuoteHistoryServiceImpl implements IPurchaseQuoteHistorySer @Override public List selectPurchaseQuoteHistoryList(PurchaseQuoteHistory purchaseQuoteHistory) { + //最新的报价 + PurchaseQuoteHistory latestQuoteHistory = purchaseQuoteHistoryMapper.findLatestPurchaseQuoteHistory(purchaseQuoteHistory); + if (latestQuoteHistory != null){ + List purchaseQuoteHistories = purchaseQuoteHistoryMapper.selectPurchaseQuoteHistoryList(purchaseQuoteHistory); + purchaseQuoteHistories.forEach(item -> { + if (Objects.equals(item.getPurchaseQuoteChildId(), latestQuoteHistory.getPurchaseQuoteChildId())) { + item.setIsLatest("1"); + } else { + item.setIsLatest("0"); + } + }); + return purchaseQuoteHistories; + } return purchaseQuoteHistoryMapper.selectPurchaseQuoteHistoryList(purchaseQuoteHistory); + } /** @@ -162,4 +185,42 @@ public class PurchaseQuoteHistoryServiceImpl implements IPurchaseQuoteHistorySer } return purchaseQuoteHistoryMapper.insertBatchPurchaseQuoteHistory(purchaseQuoteHistoryChildren); } + + + + + /** + * 根据采购报价信息更新采购报价最新报价记录 + * @param purchaseQuoteVo + */ + @Override + public void updatePurchaseQuoteHistoryByPurchaseQuote(PurchaseQuoteVo purchaseQuoteVo) { + + String loginName = ShiroUtils.getLoginName(); + String supplierCode = purchaseQuoteVo.getSupplierQuoteCode(); + String auditStatus = purchaseQuoteVo.getAuditStatus(); + + // 获取所有的子项 + List purchaseQuoteChildList= purchaseQuoteChildMapper.selectQuoteChildBySupplierCode(supplierCode); + for (PurchaseQuoteChild purchaseQuoteChild : purchaseQuoteChildList) { + PurchaseQuoteHistory purchaseQuoteHistory = new PurchaseQuoteHistory(); + + // 设置审核状态 + purchaseQuoteHistory.setAuditStatus(auditStatus.equals("1") ? "1" : "2"); + purchaseQuoteHistory.setSupplierCode(supplierCode); + // 设置其他字段 + purchaseQuoteHistory.setMaterialCode(purchaseQuoteChild.getMaterialCode()); + purchaseQuoteHistory.setUpdateBy(loginName); + purchaseQuoteHistory.setUpdateTime(new Date()); + // 更新报价历史记录 + int result = purchaseQuoteHistoryMapper.updatePurchaseQuoteHistoryByCode(purchaseQuoteHistory); + if (result <= 0){ + throw new BusinessException("更新采购报价历史数据失败"); + } + } + } + + + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java index 86efdfea..c29bab9c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java @@ -56,15 +56,19 @@ public class SysCustomerQuoteHistoryServiceImpl implements ISysCustomerQuoteHist //最新的报价 SysCustomerQuoteHistory latestQuoteHistory = sysCustomerQuoteHistoryMapper.findLatestQuoteHistory(sysCustomerQuoteHistory); List sysCustomerQuoteHistories = sysCustomerQuoteHistoryMapper.selectSysCustomerQuoteHistoryList(sysCustomerQuoteHistory); - sysCustomerQuoteHistories.forEach(customerQuoteHistory -> { - if (Objects.equals(customerQuoteHistory.getQuoteHistoryId(), latestQuoteHistory.getQuoteHistoryId())) { - customerQuoteHistory.setIsLatest("1"); - } else { - customerQuoteHistory.setIsLatest("0"); - } - }); - - return sysCustomerQuoteHistories; + if (latestQuoteHistory != null){ + sysCustomerQuoteHistories.forEach(customerQuoteHistory -> { + if (Objects.equals(customerQuoteHistory.getQuoteHistoryId(), latestQuoteHistory.getQuoteHistoryId())) { + customerQuoteHistory.setIsLatest("1"); + } else { + customerQuoteHistory.setIsLatest("0"); + } + }); + + return sysCustomerQuoteHistories; + } + return sysCustomerQuoteHistoryMapper.selectSysCustomerQuoteHistoryList(sysCustomerQuoteHistory); + } /** diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml index 749ccf16..2ec801eb 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml @@ -172,12 +172,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - update purchase_quote_history @@ -211,6 +205,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where purchase_quote_child_id = #{purchaseQuoteChildId} + + + + update purchase_quote_history + + purchase_quote_code = #{purchaseQuoteCode}, + material_id = #{materialId}, + material_code = #{materialCode}, + material_name = #{materialName}, + material_sole = #{materialSole}, + material_rmb = #{materialRmb}, + material_noRmb = #{materialNormb}, + supplier_code = #{supplierCode}, + supplier_name = #{supplierName}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + use_status = #{useStatus}, + audit_status = #{auditStatus}, + is_latest = #{isLatest}, + del_flag = #{delFlag}, + + where material_code = #{materialCode} and supplier_code = #{supplierCode} + + + + + + + delete from purchase_quote_history where purchase_quote_child_id = #{purchaseQuoteChildId} @@ -233,7 +259,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/detail.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/detail.html index 96ab42e8..cd98cb9d 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/detail.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/detail.html @@ -20,26 +20,26 @@
- +
- +
- +
- +
@@ -68,18 +68,13 @@
- + %
-
-
- 选择报价信息 -
-
@@ -208,9 +203,17 @@ } }, {title:'最新报价',field: 'materialSole',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); + } + }, {title: '物料的数量', field: 'materialNum',align: 'center',editable: true,visible: false}, - {title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',editable: true,}, - {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',editable: true,}, + {title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',}, + {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',}, {title: '录入人',field: 'createBy',align: 'center',visible: false}, {title: '录入时间',field: 'createTime',align: 'center',visible: false }, {title: '更新人',field: 'updateBy',align: 'center',visible: false}, @@ -269,6 +272,18 @@ minView: "month", autoclose: true }); + + + //最新报价历史 + function recentQuotationHistory(materialCode){ + var supplierQuoteCode = $("#supplierQuoteCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("supplierQuoteCode", encodeURIComponent(supplierQuoteCode)); + var url = ctx +'purchase/purchaseQuote/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/recentQuotationHistory.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/recentQuotationHistory.html index bd685361..053becd8 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/recentQuotationHistory.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/recentQuotationHistory.html @@ -29,7 +29,7 @@ showToggle: false, queryParams: { materialCode: materialCode, - supplierQuoteCode: supplierQuoteCode + supplierCode: supplierQuoteCode }, columns: [{ checkbox: true diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/taskCgjlVerify.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/taskCgjlVerify.html index 55f67dbf..7f9ee2e3 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/taskCgjlVerify.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/taskCgjlVerify.html @@ -46,26 +46,26 @@
- +
- +
- +
- +
@@ -94,7 +94,7 @@
- + %
@@ -118,11 +118,6 @@
-
-
- 选择报价信息 -
-
@@ -251,7 +246,15 @@ } }, {title:'最新报价',field: 'materialSole',align: 'center',}, - {title: '物料的数量', field: 'materialNum',align: 'center',editable: true,visible: false}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); + } + }, + {title: '物料的数量', field: 'materialNum',align: 'center',visible: false}, {title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',}, {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',}, {title: '录入人',field: 'createBy',align: 'center',visible: false}, @@ -323,6 +326,18 @@ minView: "month", autoclose: true }); + + //最新报价历史 + function recentQuotationHistory(materialCode){ + var supplierQuoteCode = $("#supplierQuoteCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("supplierQuoteCode", encodeURIComponent(supplierQuoteCode)); + var url = ctx +'purchase/purchaseQuote/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/taskFzjlVerify.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/taskFzjlVerify.html index d75393dd..09b3962c 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/taskFzjlVerify.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/taskFzjlVerify.html @@ -46,26 +46,26 @@
- +
- +
- +
- +
@@ -94,7 +94,7 @@
- + %
@@ -118,11 +118,6 @@
-
-
- 选择报价信息 -
-
@@ -251,7 +246,17 @@ } }, {title:'最新报价',field: 'materialSole',align: 'center',}, - {title: '物料的数量', field: 'materialNum',align: 'center',editable: true,visible: false}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); + } + }, + + + {title: '物料的数量', field: 'materialNum',align: 'center',visible: false}, {title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center'}, {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center'}, {title: '录入人',field: 'createBy',align: 'center',visible: false}, @@ -330,6 +335,18 @@ minView: "month", autoclose: true }); + + //最新报价历史 + function recentQuotationHistory(materialCode){ + var supplierQuoteCode = $("#supplierQuoteCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("supplierQuoteCode", encodeURIComponent(supplierQuoteCode)); + var url = ctx +'purchase/purchaseQuote/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + \ No newline at end of file