From c4261a3473179b5c0b10f1574bde0ff91a1a92e1 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 22 Nov 2024 15:37:58 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E9=87=87=E8=B4=AD=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E6=B7=BB=E5=8A=A0=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E9=A1=B6=E5=8D=95=EF=BC=8C=E9=80=89=E6=8B=A9=E7=89=A9?= =?UTF-8?q?=E6=96=99=E8=AE=A1=E5=88=92=E7=94=B1=E6=89=93=E5=BC=80=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8A=A0=E8=BD=BD=E4=BF=AE=E6=94=B9=E4=B8=BA=E7=AC=AC?= =?UTF-8?q?=E4=BA=8C=E6=AD=A5=E5=8A=A0=E8=BD=BD=EF=BC=8C=E9=99=84=E5=B8=A6?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AD=A5=E9=80=89=E6=8B=A9=E7=9A=84=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86=E4=BC=A0=E9=80=92=E7=BB=99=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=EF=BC=9B=E5=B9=B6=E4=B8=94=E4=BF=AE=E6=94=B9=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E6=AD=A5=E5=90=8E=E7=AB=AF=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=8A=A0=E4=B8=8A=E9=9D=9E=E7=A9=BA=E5=88=A4=E6=96=AD?= =?UTF-8?q?=20=E9=87=87=E8=B4=AD=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9A=84=E6=97=B6=E5=80=99=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=96=B9=E6=B3=95=20=E9=87=87=E8=B4=AD=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=AE=9E=E4=BD=93=E7=B1=BB=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E5=89=8D=E7=AB=AF=20=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E5=90=8D=E7=A7=B0=E5=92=8C=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86ID=20=E9=87=87=E8=B4=AD=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E5=AD=90=E8=A1=A8=E6=96=B0=E5=A2=9E=20=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E7=BC=96=E7=A0=81=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E6=89=80=E6=9C=89=E9=87=87=E8=B4=AD=E6=8A=A5=E4=BB=B7=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=E9=9B=86=E5=90=88=E6=96=B9=E6=B3=95=20=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=E6=96=B0=E5=A2=9EisLatest=EF=BC=8C=E5=85=B6mapper.xml?= =?UTF-8?q?=E5=B1=82=E6=89=80=E6=9C=89=E6=96=B9=E6=B3=95=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84isLatest=20=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=8A=A5=E4=BB=B7=E7=BC=96=E5=8F=B7=E5=92=8C?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=8F=B7=E6=9F=A5=E8=AF=A2=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E4=B8=80=E6=9D=A1=E8=AE=B0=E5=BD=95=E6=96=B9=E6=B3=95=EF=BC=9B?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E6=89=B9=E9=87=8F=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E7=89=A9=E6=96=99=E5=8E=86=E5=8F=B2=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E4=BF=A1=E6=81=AF=E6=96=B9=E6=B3=95=20=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2impl=E5=B1=82?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9A=84=E6=97=B6=E5=80=99=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=96=B9=E6=B3=95=20=E4=BF=AE=E6=94=B9=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=8A=A5=E4=BB=B7=E6=96=B0=E5=A2=9E=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=8A=A0=E4=B8=8A=20=E6=96=B0=E5=A2=9E=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PurchaseQuoteController.java | 38 ++++++++- .../ruoyi/purchase/domain/PurchasePlan.java | 26 ++++++ .../purchase/domain/PurchaseQuoteHistory.java | 16 +++- .../mapper/PurchaseQuoteChildMapper.java | 5 ++ .../mapper/PurchaseQuoteHistoryMapper.java | 15 ++++ .../service/IPurchaseQuoteHistoryService.java | 8 ++ .../service/IPurchaseQuoteService.java | 7 ++ .../service/impl/PurchasePlanServiceImpl.java | 11 ++- .../impl/PurchaseQuoteHistoryServiceImpl.java | 39 +++++++++ .../impl/PurchaseQuoteServiceImpl.java | 82 +++++++++++++++++++ .../purchase/PurchaseQuoteChildMapper.xml | 8 ++ .../purchase/PurchaseQuoteHistoryMapper.xml | 72 +++++++++++++++- .../purchasePlan/addPurchaseOrder.html | 22 +++-- .../purchase/purchaseQuote/purchaseQuote.html | 6 +- 14 files changed, 342 insertions(+), 13 deletions(-) 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 6bc7effb..7c6f5c0d 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 @@ -32,13 +32,14 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; /** * 采购报价单Controller - * + * * @author 刘晓旭 * @date 2024-04-15 */ @@ -85,11 +86,44 @@ public class PurchaseQuoteController extends BaseController return getDataTable(list); } + + + /** + * 导入采购报价单 + * */ + @Log(title = "采购报价", businessType = BusinessType.IMPORT) + @RequiresPermissions("purchase:purchaseQuote:import") + @PostMapping("/importData") + @ResponseBody + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(PurchaseQuote.class); + List purchaseQuoteList = util.importExcel(file.getInputStream()); + String operName = ShiroUtils.getSysUser().getLoginName(); + String message = purchaseQuoteService.importPurchaseQuote(purchaseQuoteList, updateSupport, operName); + return AjaxResult.success(message); + } + + /** + * 导入模板 + * */ + @RequiresPermissions("purchase:purchaseQuote:view") + @GetMapping("/importTemplate") + @ResponseBody + public AjaxResult importTemplate() + { + ExcelUtil util = new ExcelUtil(PurchaseQuote.class); + return util.importTemplateExcel("采购报价数据"); + } + + + + /** * 导出采购报价单列表 */ @RequiresPermissions("purchase:purchaseQuote:export") - @Log(title = "采购报价单", businessType = BusinessType.EXPORT) + @PostMapping("/export") @ResponseBody public AjaxResult export(PurchaseQuote purchaseQuote) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java index fb947531..0bc6b6bf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java @@ -1,6 +1,8 @@ package com.ruoyi.purchase.domain; import java.math.BigDecimal; + +import com.ruoyi.system.domain.Vo.Supplier; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -83,6 +85,12 @@ public class PurchasePlan extends BaseEntity /** 删除标志 0 启用 1逻辑删除 */ private String delFlag; + //用于前端 显示供应商名称 + private String supplierName; + + //用于前端 显示供应商Id + private String supplierCode; + public void setPurchasePlanId(Long purchasePlanId) { this.purchasePlanId = purchasePlanId; @@ -239,6 +247,22 @@ public class PurchasePlan extends BaseEntity return delFlag; } + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public String getSupplierCode() { + return supplierCode; + } + + public void setSupplierCode(String supplierCode) { + this.supplierCode = supplierCode; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -264,6 +288,8 @@ public class PurchasePlan extends BaseEntity .append("updateTime", getUpdateTime()) .append("remark", getRemark()) .append("delFlag", getDelFlag()) + .append("supplierName", getSupplierName()) + .append("supplierCode", getSupplierCode()) .toString(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteHistory.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteHistory.java index 9b634fe2..8f9ed37a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteHistory.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteHistory.java @@ -96,6 +96,10 @@ public class PurchaseQuoteHistory extends BaseEntity @Excel(name = "审核状态") private String auditStatus; + /** 是否是最新报价(0否、1是) */ + @Excel(name = "是否是最新报价(0否、1是)") + private String isLatest; + /** 删除标志 */ private String delFlag; @@ -279,7 +283,16 @@ public class PurchaseQuoteHistory extends BaseEntity { return auditStatus; } - public void setDelFlag(String delFlag) + + public String getIsLatest() { + return isLatest; + } + + public void setIsLatest(String isLatest) { + this.isLatest = isLatest; + } + + public void setDelFlag(String delFlag) { this.delFlag = delFlag; } @@ -317,6 +330,7 @@ public class PurchaseQuoteHistory extends BaseEntity .append("remark", getRemark()) .append("useStatus", getUseStatus()) .append("auditStatus", getAuditStatus()) + .append("isLatest", getIsLatest()) .append("delFlag", getDelFlag()) .toString(); } 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 ee424d57..85e76154 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 @@ -89,4 +89,9 @@ public interface PurchaseQuoteChildMapper * 通过采购报价单号查找所有采购报价子表集合 * */ List selectPurchaseQuoteChildListByQuoteCodeList(List purchaseQuoteCodes); + + /** + * 通过供应商编码查找所有采购报价子表集合 + * */ + 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 3fca392b..8ed977fe 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 @@ -27,6 +27,12 @@ public interface PurchaseQuoteHistoryMapper */ public List selectPurchaseQuoteHistoryList(PurchaseQuoteHistory purchaseQuoteHistory); + + /* + * 根据报价编号和物料号查询最新一条记录 + * */ + public PurchaseQuoteHistory findLatestPurchaseQuoteHistory(PurchaseQuoteHistory purchaseQuoteHistory); + /** * 新增采购物料历史报价信息 * @@ -35,6 +41,15 @@ public interface PurchaseQuoteHistoryMapper */ public int insertPurchaseQuoteHistory(PurchaseQuoteHistory purchaseQuoteHistory); + + /** + * 批量新增采购物料历史报价信息 + * + * @param purchaseQuoteHistoryList 采购物料历史报价信息集合 + * @return 结果 + */ + public int insertBatchPurchaseQuoteHistory(List purchaseQuoteHistoryList); + /** * 修改采购物料历史报价信息 * 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 9b1a871b..a5b97438 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 @@ -1,6 +1,8 @@ package com.ruoyi.purchase.service; import java.util.List; + +import com.ruoyi.purchase.domain.PurchaseQuote; import com.ruoyi.purchase.domain.PurchaseQuoteHistory; /** @@ -72,4 +74,10 @@ public interface IPurchaseQuoteHistoryService * @return */ int restorePurchaseQuoteHistoryById(Long purchaseQuoteChildId); + + /** + * 采购报价新增的时候生成采购报价历史数据 + * + * */ + int generatePurchaseQuoteHistory(PurchaseQuote purchaseQuote); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteService.java index 8ef72f7d..6f2bd4af 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteService.java @@ -6,6 +6,8 @@ import com.ruoyi.purchase.domain.PurchaseQuote; import org.activiti.engine.runtime.ProcessInstance; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + /** * 采购报价单Service接口 * @@ -92,4 +94,9 @@ public interface IPurchaseQuoteService * @return 结果 */ Object getId(); + + /** + * 导入采购报价单 + * */ + String importPurchaseQuote(List purchaseQuoteList, boolean updateSupport, String operName); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java index 68751d86..84757718 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java @@ -16,6 +16,7 @@ import com.ruoyi.erp.domain.ErpDevelopModifyorderDetail; import com.ruoyi.erp.domain.vo.ErpDevelopModifyorderVo; import com.ruoyi.erp.mapper.ErpDevelopModifyorderDetailMapper; import com.ruoyi.erp.service.IErpBomService; +import com.ruoyi.purchase.controller.PurchaseQuoteController; import com.ruoyi.purchase.domain.PurchasePlan; import com.ruoyi.purchase.domain.PurchasePlanChild; import com.ruoyi.purchase.domain.PurchaseQuote; @@ -81,6 +82,9 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService @Autowired private SysMakeorderBomMapper sysMakeorderBomMapper; + + + /** * 查询采购计划单 * @@ -200,6 +204,11 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService purchasePlanCodeList = Arrays.asList(splitSalesOrderCode); } + String supplierCode = purchasePlan.getSupplierCode(); + + + List purchaseQuoteChildList = purchaseQuoteChildMapper.selectQuoteChildBySupplierCode(supplierCode); + //采购计划子表数据 List purchasePlanChildList = purchasePlanChildMapper.selectPurchasePlanChildPlanCodeList(purchasePlanCodeList); @@ -241,7 +250,7 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService mergedList.forEach(item->{ //字段(本次占用共享库存数):必填;默认为0,若共享可用库存数>0,则默认=共享可用库存数,可修改;需0<=本次占用共享库存数<=共享可用库存数 - if (item.getSharedAvailableInventoryNum() > 0){ + if (item.getSharedAvailableInventoryNum() != null && item.getSharedAvailableInventoryNum() > 0){ item.setSharedInventoryOccupancyNum(item.getSharedAvailableInventoryNum()); }else { item.setSharedInventoryOccupancyNum(0); 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 9320e743..e6580f16 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,8 +1,11 @@ package com.ruoyi.purchase.service.impl; +import java.util.ArrayList; import java.util.List; 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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.purchase.mapper.PurchaseQuoteHistoryMapper; @@ -123,4 +126,40 @@ public class PurchaseQuoteHistoryServiceImpl implements IPurchaseQuoteHistorySer { return purchaseQuoteHistoryMapper.restorePurchaseQuoteHistoryById(purchaseQuoteChildId); } + + + /** + * 采购报价新增的时候生成采购报价历史数据 + * + * */ + @Override + public int generatePurchaseQuoteHistory(PurchaseQuote purchaseQuote) { + String loginName = ShiroUtils.getLoginName(); + + List purchaseQuoteChildList = purchaseQuote.getPurchaseQuoteChildList(); + String supplierQuoteCode = purchaseQuote.getSupplierQuoteCode(); + String supplierName = purchaseQuote.getSupplierName(); + String auditStatus = purchaseQuote.getAuditStatus(); + String purchaseQuoteCode = purchaseQuote.getPurchaseQuoteCode(); + + + List purchaseQuoteHistoryChildren = new ArrayList<>(); + + for (PurchaseQuoteChild purchaseQuoteChild : purchaseQuoteChildList) { + PurchaseQuoteHistory purchaseQuoteHistory = new PurchaseQuoteHistory(); + purchaseQuoteHistory.setPurchaseQuoteCode(purchaseQuoteCode); + purchaseQuoteHistory.setMaterialCode(purchaseQuoteChild.getMaterialCode()); + purchaseQuoteHistory.setMaterialName(purchaseQuoteChild.getMaterialName()); + purchaseQuoteHistory.setMaterialNormb(purchaseQuoteChild.getMaterialNoRmb()); + purchaseQuoteHistory.setMaterialRmb(purchaseQuoteChild.getMaterialRmb()); + purchaseQuoteHistory.setSupplierCode(supplierQuoteCode); + purchaseQuoteHistory.setSupplierName(supplierName); + purchaseQuoteHistory.setIsLatest("0"); //第一次添加没有值 + purchaseQuoteHistory.setAuditStatus(auditStatus); + purchaseQuoteHistory.setCreateBy(loginName); + purchaseQuoteHistory.setCreateTime(DateUtils.getNowDate()); + purchaseQuoteHistoryChildren.add(purchaseQuoteHistory); + } + return purchaseQuoteHistoryMapper.insertBatchPurchaseQuoteHistory(purchaseQuoteHistoryChildren); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java index 90d0add4..f0711d4d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java @@ -7,13 +7,16 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.service.ICommonService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.purchase.domain.PurchaseQuoteHistory; import com.ruoyi.purchase.domain.Vo.PurchaseQuoteVo; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; +import com.ruoyi.purchase.service.IPurchaseQuoteHistoryService; import com.ruoyi.system.domain.SysAttach; import com.ruoyi.purchase.domain.PurchaseQuoteChild; import com.ruoyi.system.mapper.SysUserMapper; @@ -75,6 +78,10 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService @Autowired private IPurchaseQuoteChildService purchaseQuoteChildService; + + @Autowired + private IPurchaseQuoteHistoryService purchaseQuoteHistoryService; + /** * 查询采购报价单 * @@ -202,10 +209,22 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService } } purchaseQuote.setMaterialAmount(String.valueOf(childResult)); + + int result = purchaseQuoteMapper.insertPurchaseQuote(purchaseQuote); + + //新增采购报价历史数据 + int insertHistoryResult = purchaseQuoteHistoryService.generatePurchaseQuoteHistory(purchaseQuote); + if (insertHistoryResult <= 0){ + throw new BusinessException("新增采购报价历史数据失败"); + } + return result; } + + + /** * 修改采购报价单 * @@ -438,4 +457,67 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService public Object getId(){ return redisCache.generateBillNo("CGBJ"); } + + + /** + * 导入采购报价单 + * */ + @Override + public String importPurchaseQuote(List purchaseQuoteList, boolean updateSupport, String operName) { + + if (StringUtils.isNull(purchaseQuoteList) || purchaseQuoteList.size() == 0) + { + throw new BusinessException("导入采购报价数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); +// for (PurchaseQuote purchaseQuote : purchaseQuoteList) +// { +// try +// { +// // 验证是否存在这个用户 +// SysUser u = userMapper.selectUserByLoginName(user.getLoginName()); +// if (StringUtils.isNull(u)) +// { +// user.setPassword(Md5Utils.hash(user.getLoginName() + password)); +// user.setCreateBy(operName); +// this.insertUser(user); +// successNum++; +// successMsg.append("
" + successNum + "、账号 " + user.getLoginName() + " 导入成功"); +// } +// else if (isUpdateSupport) +// { +// user.setUpdateBy(operName); +// this.updateUser(user); +// successNum++; +// successMsg.append("
" + successNum + "、账号 " + user.getLoginName() + " 更新成功"); +// } +// else +// { +// failureNum++; +// failureMsg.append("
" + failureNum + "、账号 " + user.getLoginName() + " 已存在"); +// } +// } +// catch (Exception e) +// { +// failureNum++; +// String msg = "
" + failureNum + "、账号 " + user.getLoginName() + " 导入失败:"; +// failureMsg.append(msg + e.getMessage()); +// log.error(msg, e); +// } +// } +// if (failureNum > 0) +// { +// failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); +// throw new BusinessException(failureMsg.toString()); +// } +// else +// { +// successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); +// } + return successMsg.toString(); + + } } diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml index 00e08ee4..814e8523 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml @@ -84,6 +84,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + insert into purchase_quote_child @@ -242,4 +249,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml index a899c8d2..70be7175 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml @@ -30,11 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select purchase_quote_child_id, purchase_quote_code, material_id, material_code, material_name, material_type, processMethod, brand, photoUrl, describe, tax_rate, usd_rate, material_num, material_sole, material_rmb, material_noRmb, supplier_code, supplier_name, create_by, create_time, update_by, update_time, remark, use_status, audit_status, del_flag from purchase_quote_history + select purchase_quote_child_id, purchase_quote_code, material_id, material_code, material_name, material_type, processMethod, brand, photoUrl, describe, tax_rate, usd_rate, material_num, material_sole, material_rmb, material_noRmb, supplier_code, supplier_name, create_by, create_time, update_by, update_time, remark, use_status, audit_status, is_latest,del_flag from purchase_quote_history + + where purchase_quote_code = #{purchaseQuoteCode} and material_code = #{materialCode} and audit_status = '1' + order by update_time desc + limit 1 + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html index d5212a5e..54d937bb 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html @@ -267,6 +267,10 @@ animation-fill-mode: none; var prefix = ctx + "purchase/purchasePlan" + + // 全局变量存储 supplierCode + var selectedSupplierCode = ''; + $("#form-addPurchaseOrder-addTwo").validate({focusCleanup: true}); $("input[name='planDeliveryTime']").datetimepicker({ @@ -303,6 +307,15 @@ animation-fill-mode: none; $('#supplierCode').val(supplierCode); $('#supplierName').val(supplierName); + // 存储 supplierCode 到全局变量 + selectedSupplierCode = supplierCode; + + // 切换到第二步前,刷新 bootstrap-table + $('#selectMaterial-bootstrap-table').bootstrapTable('refresh', { + url: prefix + "/selectMaterialTwoList", + queryParams: queryParamsTwo + }); + // 切换到第二步 $('#smartwizard').smartWizard("next"); }); @@ -513,7 +526,6 @@ animation-fill-mode: none; $(function() { var options = { id: "selectMaterial-bootstrap-table", - url: prefix + "/selectMaterialTwoList", queryParams: queryParamsTwo, showSearch: false, showRefresh: false, @@ -719,12 +731,12 @@ animation-fill-mode: none; }); - function queryParamsTwo(params){ - + function queryParamsTwo(params) { var curParams = { - purchasePlanCode : $("#purchasePlanCodes").val() + purchasePlanCode: $("#purchasePlanCodes").val(), + supplierCode: selectedSupplierCode // 使用全局变量 }; - return curParams + return curParams; } diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/purchaseQuote.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/purchaseQuote.html index 2fc31fca..71a93b81 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/purchaseQuote.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/purchaseQuote.html @@ -69,9 +69,9 @@ 导出 - - 导入 - + + +