From 78eaddb4c65c3f42508fc327da41a7e1c7bae6c4 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Tue, 18 Jun 2024 21:15:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[feat]=20=E9=87=87=E8=B4=AD=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=9A=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=87=87=E8=B4=AD=E7=9A=84=E5=88=92=E5=88=86=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E5=85=B3=E8=81=94=E5=8D=95=E5=8F=B7=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E7=BC=96=E5=8F=B7=EF=BC=8C=E5=88=86=E7=BB=84?= =?UTF-8?q?=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF=E5=92=8C=E5=88=86=E7=BB=84?= =?UTF-8?q?=E7=89=A9=E6=96=99=E4=BE=9B=E5=BA=94=E5=95=86=E8=AF=A6=E6=83=85?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E4=BB=B7=E4=BE=9B=E5=BA=94=E5=95=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=BE=AA=E7=8E=AF=E9=80=92=E5=BD=92,=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=87=87=E8=B4=AD=E6=8A=A5=E4=BB=B7=E5=AD=90=E8=A1=A8?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E5=AD=97=E6=AE=B5=EF=BC=8C=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86=E7=BC=96=E5=8F=B7=EF=BC=8C=E7=BC=96=E5=86=99?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=87=87=E8=B4=AD=E7=9A=84=E5=88=92=E5=88=86=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E5=85=B3=E8=81=94=E5=8D=95=E5=8F=B7=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E7=BC=96=E5=8F=B7SQL=E8=AF=AD=E5=8F=A5?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PurchasePlanController.java | 3 +++ .../impl/PurchaseQuoteServiceImpl.java | 4 ++-- .../purchase/PurchasePlanChildMapper.xml | 22 ++++--------------- .../purchase/PurchaseQuoteChildMapper.xml | 1 + .../purchasePlan/addPurchaseOrder.html | 16 +++++++++++++- .../purchase/purchaseQuote/edit.html | 1 + 6 files changed, 26 insertions(+), 21 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java index fe293a93..4ba47ae1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java @@ -121,6 +121,9 @@ public class PurchasePlanController extends BaseController List purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(purchasePlanCode); //根据采购计划编号查询对应的采购报价数据 List purchasePlanChildList = purchasePlanChildService.getPurchasePlanChildByPlanCodes(purchasePlanCode); + for(PurchasePlanChild purchasePlanChild : purchasePlanChildList){ + List purchaseQuoteChildList = purchasePlanChild.getPurchaseQuoteChildList(); + } //再根据采购计划编号分组查询对应的采购报价数据分组 purchasePlanCodes = purchasePlanCodes.replace("[","").replace("]",""); 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 7aac7fd9..78ffd5fa 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 @@ -125,7 +125,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); child.setCreateBy(loginName); - child.setSupplierCode(purchaseQuote.getPurchaseQuoteCode()); + child.setSupplierCode(purchaseQuote.getSupplierQuoteCode()); child.setSupplierName(purchaseQuote.getSupplierName()); child.setCreateTime(DateUtils.getNowDate()); child.setTaxRate(purchaseQuote.getTaxRate()); @@ -177,7 +177,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService if(childResult > 0){ for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); - child.setSupplierCode(purchaseQuote.getPurchaseQuoteCode()); + child.setSupplierCode(purchaseQuote.getSupplierQuoteCode()); child.setSupplierName(purchaseQuote.getSupplierName()); child.setCreateBy(loginName); child.setCreateTime(DateUtils.getNowDate()); diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml index 20916f8c..29c4e5cc 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml @@ -29,16 +29,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - - - - select purchase_plan_child_id, purchase_plan_code, material_id, material_code, material_name, material_type, process_method, brand, @@ -174,20 +164,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 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 4f6c8e46..ba410a1a 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html @@ -93,8 +93,22 @@ ''+ '' ); + foreach(material.supplierList, function(supplier, index) { + var $supplier = $('
'); + $supplier.append(''); + var headerContent = + '' + var $header = $('
' + headerContent + '
'); + var $inputsWrapper = $('
'); // 用于存放输入框等表单元素 + $('#supplierCode' + tableId).append($inputsWrapper.append($header)); + }) + var $supplier = $('
'); + $tableWrapper.append($table); var $formGroup = $('
'); - var supplierName = + var supplierSum = '
' + '' + '
' + diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/edit.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/edit.html index 73fd9c42..d3b00715 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/edit.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/edit.html @@ -176,6 +176,7 @@ sortName: params.sort, sortOrder: params.order, purchaseQuoteCode: purchaseQuote.purchaseQuoteCode, + delFlag: 0 } return temp; }, From 784b1fdf41fea877fb5e629ad42c5b0f1939408b Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Wed, 19 Jun 2024 23:16:34 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[feat]=20=E9=87=87=E8=B4=AD=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=9A=E6=96=B0=E5=A2=9E=E9=87=87=E8=B4=AD=E5=8D=95?= =?UTF-8?q?=EF=BC=8C=E9=87=87=E8=B4=AD=E5=AD=90=E8=A1=A8=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=AD=90=E8=A1=A8=E6=B7=BB=E5=8A=A0=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=8A=A5=E4=BB=B7=E9=9B=86=E5=90=88=E4=BD=9C=E4=B8=BA?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95=E4=B8=AD=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PurchaseOrderChildController.java | 151 ++++++++ .../purchase/domain/PurchaseOrderChild.java | 321 ++++++++++++++++++ .../mapper/PurchaseOrderChildMapper.java | 77 +++++ .../service/IPurchaseOrderChildService.java | 75 ++++ .../impl/PurchaseOrderChildServiceImpl.java | 126 +++++++ .../purchase/PurchaseOrderChildMapper.xml | 161 +++++++++ .../purchase/purchaseOrderChild/add.html | 160 +++++++++ .../purchase/purchaseOrderChild/edit.html | 153 +++++++++ .../purchaseOrderChild.html | 202 +++++++++++ 9 files changed, 1426 insertions(+) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java create mode 100644 ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml create mode 100644 ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/add.html create mode 100644 ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/edit.html create mode 100644 ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/purchaseOrderChild.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java new file mode 100644 index 00000000..74f7fa9c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java @@ -0,0 +1,151 @@ +package com.ruoyi.purchase.controller; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.purchase.domain.PurchaseOrderChild; +import com.ruoyi.purchase.service.IPurchaseOrderChildService; +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; + +/** + * 采购订单子表Controller + * + * @author zhang + * @date 2024-06-19 + */ +@Controller +@RequestMapping("/purchase/purchaseOrderChild") +public class PurchaseOrderChildController extends BaseController +{ + private String prefix = "purchase/purchaseOrderChild"; + + @Autowired + private IPurchaseOrderChildService purchaseOrderChildService; + +// @RequiresPermissions("purchase:purchaseOrderChild:view") + @GetMapping() + public String purchaseOrderChild() + { + return prefix + "/purchaseOrderChild"; + } + + /** + * 查询采购订单子表列表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(PurchaseOrderChild purchaseOrderChild) + { + startPage(); + List list = purchaseOrderChildService.selectPurchaseOrderChildList(purchaseOrderChild); + return getDataTable(list); + } + + /** + * 导出采购订单子表列表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:export") + @Log(title = "采购订单子表", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(PurchaseOrderChild purchaseOrderChild) + { + List list = purchaseOrderChildService.selectPurchaseOrderChildList(purchaseOrderChild); + ExcelUtil util = new ExcelUtil(PurchaseOrderChild.class); + return util.exportExcel(list, "采购订单子表数据"); + } + + /** + * 新增采购订单子表 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:add") + @Log(title = "采购订单子表", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(PurchaseOrderChild purchaseOrderChild) + { + return toAjax(purchaseOrderChildService.insertPurchaseOrderChild(purchaseOrderChild)); + } + + /** + * 修改采购订单子表 + */ + @GetMapping("/edit/{purchaseOrderChildId}") + public String edit(@PathVariable("purchaseOrderChildId") Long purchaseOrderChildId, ModelMap mmap) + { + PurchaseOrderChild purchaseOrderChild = purchaseOrderChildService.selectPurchaseOrderChildById(purchaseOrderChildId); + mmap.put("purchaseOrderChild", purchaseOrderChild); + return prefix + "/edit"; + } + + /** + * 修改保存采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:edit") + @Log(title = "采购订单子表", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(PurchaseOrderChild purchaseOrderChild) + { + return toAjax(purchaseOrderChildService.updatePurchaseOrderChild(purchaseOrderChild)); + } + + /** + * 删除采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:remove") + @Log(title = "采购订单子表", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(purchaseOrderChildService.deletePurchaseOrderChildByIds(ids)); + } + + /** + * 作废采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:cancel") + @Log(title = "采购订单子表", businessType = BusinessType.CANCEL) + @GetMapping( "/cancel/{id}") + @ResponseBody + public AjaxResult cancel(@PathVariable("id") Long id){ + return toAjax(purchaseOrderChildService.cancelPurchaseOrderChildById(id)); + } + + /** + * 恢复采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:restore") + @Log(title = "采购订单子表", businessType = BusinessType.RESTORE) + @GetMapping( "/restore/{id}") + @ResponseBody + public AjaxResult restore(@PathVariable("id")Long id) + { + return toAjax(purchaseOrderChildService.restorePurchaseOrderChildById(id)); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java new file mode 100644 index 00000000..0ff3a2c4 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java @@ -0,0 +1,321 @@ +package com.ruoyi.purchase.domain; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 采购订单子表对象 purchase_order_child + * + * @author zhang + * @date 2024-06-19 + */ +public class PurchaseOrderChild extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 采购订单子表id */ + private Long purchaseOrderChildId; + + /** 关联采购订单号 */ + @Excel(name = "关联采购订单号") + private String purchaseOrderCode; + + /** 供应商代码 */ + @Excel(name = "供应商代码") + private String supplierCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String supplierName; + + /** 物料料号 */ + @Excel(name = "物料料号") + private String materialCode; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 物料不含税单价 */ + @Excel(name = "物料不含税单价") + private BigDecimal materialNormb; + + /** 物料含税单价 */ + @Excel(name = "物料含税单价") + private BigDecimal materialRmb; + + /** 采购物料数量 */ + @Excel(name = "采购物料数量") + private Long materialNum; + + /** 物料合计 */ + @Excel(name = "物料合计") + private Long materialAmount; + + /** 数量合计 */ + @Excel(name = "数量合计") + private Long materialSum; + + /** 不含税总价(RMB) */ + @Excel(name = "不含税总价(RMB)") + private BigDecimal materialNormbsum; + + /** 含税总价(RMB) */ + @Excel(name = "含税总价(RMB)") + private BigDecimal materialRmbsum; + + /** 交货时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "交货时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date deliveryTime; + + /** 收货状态 */ + @Excel(name = "收货状态") + private String eceiptStatus; + + /** 打款结案状态 */ + @Excel(name = "打款结案状态") + private String paymentStatus; + + /** 税率 */ + @Excel(name = "税率") + private String taxRate; + + /** 删除标志 */ + private String delFlag; + + /** 备用一 */ + @Excel(name = "备用一") + private String standbyOne; + + /** 备用二 */ + @Excel(name = "备用二") + private String standbyTwo; + + private List purchaseQuoteChildList; + + public List getPurchaseQuoteChildList() { + return purchaseQuoteChildList; + } + + public void setPurchaseQuoteChildList(List purchaseQuoteChildList) { + this.purchaseQuoteChildList = purchaseQuoteChildList; + } + + public void setPurchaseOrderChildId(Long purchaseOrderChildId) + { + this.purchaseOrderChildId = purchaseOrderChildId; + } + + public Long getPurchaseOrderChildId() + { + return purchaseOrderChildId; + } + public void setPurchaseOrderCode(String purchaseOrderCode) + { + this.purchaseOrderCode = purchaseOrderCode; + } + + public String getPurchaseOrderCode() + { + return purchaseOrderCode; + } + public void setSupplierCode(String supplierCode) + { + this.supplierCode = supplierCode; + } + + public String getSupplierCode() + { + return supplierCode; + } + public void setSupplierName(String supplierName) + { + this.supplierName = supplierName; + } + + public String getSupplierName() + { + return supplierName; + } + public void setMaterialCode(String materialCode) + { + this.materialCode = materialCode; + } + + public String getMaterialCode() + { + return materialCode; + } + public void setMaterialName(String materialName) + { + this.materialName = materialName; + } + + public String getMaterialName() + { + return materialName; + } + public void setMaterialNormb(BigDecimal materialNormb) + { + this.materialNormb = materialNormb; + } + + public BigDecimal getMaterialNormb() + { + return materialNormb; + } + public void setMaterialRmb(BigDecimal materialRmb) + { + this.materialRmb = materialRmb; + } + + public BigDecimal getMaterialRmb() + { + return materialRmb; + } + public void setMaterialNum(Long materialNum) + { + this.materialNum = materialNum; + } + + public Long getMaterialNum() + { + return materialNum; + } + public void setMaterialAmount(Long materialAmount) + { + this.materialAmount = materialAmount; + } + + public Long getMaterialAmount() + { + return materialAmount; + } + public void setMaterialSum(Long materialSum) + { + this.materialSum = materialSum; + } + + public Long getMaterialSum() + { + return materialSum; + } + public void setMaterialNormbsum(BigDecimal materialNormbsum) + { + this.materialNormbsum = materialNormbsum; + } + + public BigDecimal getMaterialNormbsum() + { + return materialNormbsum; + } + public void setMaterialRmbsum(BigDecimal materialRmbsum) + { + this.materialRmbsum = materialRmbsum; + } + + public BigDecimal getMaterialRmbsum() + { + return materialRmbsum; + } + public void setDeliveryTime(Date deliveryTime) + { + this.deliveryTime = deliveryTime; + } + + public Date getDeliveryTime() + { + return deliveryTime; + } + public void setEceiptStatus(String eceiptStatus) + { + this.eceiptStatus = eceiptStatus; + } + + public String getEceiptStatus() + { + return eceiptStatus; + } + public void setPaymentStatus(String paymentStatus) + { + this.paymentStatus = paymentStatus; + } + + public String getPaymentStatus() + { + return paymentStatus; + } + public void setTaxRate(String taxRate) + { + this.taxRate = taxRate; + } + + public String getTaxRate() + { + return taxRate; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + public void setStandbyOne(String standbyOne) + { + this.standbyOne = standbyOne; + } + + public String getStandbyOne() + { + return standbyOne; + } + public void setStandbyTwo(String standbyTwo) + { + this.standbyTwo = standbyTwo; + } + + public String getStandbyTwo() + { + return standbyTwo; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("purchaseOrderChildId", getPurchaseOrderChildId()) + .append("purchaseOrderCode", getPurchaseOrderCode()) + .append("supplierCode", getSupplierCode()) + .append("supplierName", getSupplierName()) + .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) + .append("materialNormb", getMaterialNormb()) + .append("materialRmb", getMaterialRmb()) + .append("materialNum", getMaterialNum()) + .append("materialAmount", getMaterialAmount()) + .append("materialSum", getMaterialSum()) + .append("materialNormbsum", getMaterialNormbsum()) + .append("materialRmbsum", getMaterialRmbsum()) + .append("deliveryTime", getDeliveryTime()) + .append("eceiptStatus", getEceiptStatus()) + .append("paymentStatus", getPaymentStatus()) + .append("taxRate", getTaxRate()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("delFlag", getDelFlag()) + .append("standbyOne", getStandbyOne()) + .append("standbyTwo", getStandbyTwo()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java new file mode 100644 index 00000000..f6181b61 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java @@ -0,0 +1,77 @@ +package com.ruoyi.purchase.mapper; + +import java.util.List; +import com.ruoyi.purchase.domain.PurchaseOrderChild; + +/** + * 采购订单子表Mapper接口 + * + * @author zhang + * @date 2024-06-19 + */ +public interface PurchaseOrderChildMapper +{ + /** + * 查询采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 采购订单子表 + */ + public PurchaseOrderChild selectPurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 查询采购订单子表列表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 采购订单子表集合 + */ + public List selectPurchaseOrderChildList(PurchaseOrderChild purchaseOrderChild); + + /** + * 新增采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + public int insertPurchaseOrderChild(PurchaseOrderChild purchaseOrderChild); + + /** + * 修改采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + public int updatePurchaseOrderChild(PurchaseOrderChild purchaseOrderChild); + + /** + * 删除采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + public int deletePurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 批量删除采购订单子表 + * + * @param purchaseOrderChildIds 需要删除的数据ID + * @return 结果 + */ + public int deletePurchaseOrderChildByIds(String[] purchaseOrderChildIds); + + /** + * 作废采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + public int cancelPurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 恢复采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + public int restorePurchaseOrderChildById(Long purchaseOrderChildId); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java new file mode 100644 index 00000000..9972df39 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java @@ -0,0 +1,75 @@ +package com.ruoyi.purchase.service; + +import java.util.List; +import com.ruoyi.purchase.domain.PurchaseOrderChild; + +/** + * 采购订单子表Service接口 + * + * @author zhang + * @date 2024-06-19 + */ +public interface IPurchaseOrderChildService +{ + /** + * 查询采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 采购订单子表 + */ + public PurchaseOrderChild selectPurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 查询采购订单子表列表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 采购订单子表集合 + */ + public List selectPurchaseOrderChildList(PurchaseOrderChild purchaseOrderChild); + + /** + * 新增采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + public int insertPurchaseOrderChild(PurchaseOrderChild purchaseOrderChild); + + /** + * 修改采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + public int updatePurchaseOrderChild(PurchaseOrderChild purchaseOrderChild); + + /** + * 批量删除采购订单子表 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deletePurchaseOrderChildByIds(String ids); + + /** + * 删除采购订单子表信息 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + public int deletePurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 作废采购订单子表 + * @param purchaseOrderChildId 采购订单子表ID + * @return + */ + int cancelPurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 恢复采购订单子表 + * @param purchaseOrderChildId 采购订单子表ID + * @return + */ + int restorePurchaseOrderChildById(Long purchaseOrderChildId); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java new file mode 100644 index 00000000..b4b9d8e8 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java @@ -0,0 +1,126 @@ +package com.ruoyi.purchase.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper; +import com.ruoyi.purchase.domain.PurchaseOrderChild; +import com.ruoyi.purchase.service.IPurchaseOrderChildService; +import com.ruoyi.common.core.text.Convert; + +/** + * 采购订单子表Service业务层处理 + * + * @author zhang + * @date 2024-06-19 + */ +@Service +public class PurchaseOrderChildServiceImpl implements IPurchaseOrderChildService +{ + @Autowired + private PurchaseOrderChildMapper purchaseOrderChildMapper; + + /** + * 查询采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 采购订单子表 + */ + @Override + public PurchaseOrderChild selectPurchaseOrderChildById(Long purchaseOrderChildId) + { + return purchaseOrderChildMapper.selectPurchaseOrderChildById(purchaseOrderChildId); + } + + /** + * 查询采购订单子表列表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 采购订单子表 + */ + @Override + public List selectPurchaseOrderChildList(PurchaseOrderChild purchaseOrderChild) + { + return purchaseOrderChildMapper.selectPurchaseOrderChildList(purchaseOrderChild); + } + + /** + * 新增采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + @Override + public int insertPurchaseOrderChild(PurchaseOrderChild purchaseOrderChild) + { + String loginName = ShiroUtils.getLoginName(); + purchaseOrderChild.setCreateBy(loginName); + purchaseOrderChild.setCreateTime(DateUtils.getNowDate()); + return purchaseOrderChildMapper.insertPurchaseOrderChild(purchaseOrderChild); + } + + /** + * 修改采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + @Override + public int updatePurchaseOrderChild(PurchaseOrderChild purchaseOrderChild) + { + String loginName = ShiroUtils.getLoginName(); + purchaseOrderChild.setUpdateBy(loginName); + purchaseOrderChild.setUpdateTime(DateUtils.getNowDate()); + return purchaseOrderChildMapper.updatePurchaseOrderChild(purchaseOrderChild); + } + + /** + * 删除采购订单子表对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deletePurchaseOrderChildByIds(String ids) + { + return purchaseOrderChildMapper.deletePurchaseOrderChildByIds(Convert.toStrArray(ids)); + } + + /** + * 删除采购订单子表信息 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + @Override + public int deletePurchaseOrderChildById(Long purchaseOrderChildId) + { + return purchaseOrderChildMapper.deletePurchaseOrderChildById(purchaseOrderChildId); + } + + /** + * 作废采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + @Override + public int cancelPurchaseOrderChildById(Long purchaseOrderChildId) + { + return purchaseOrderChildMapper.cancelPurchaseOrderChildById(purchaseOrderChildId); + } + + /** + * 恢复采购订单子表信息 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + @Override + public int restorePurchaseOrderChildById(Long purchaseOrderChildId) + { + return purchaseOrderChildMapper.restorePurchaseOrderChildById(purchaseOrderChildId); + } +} diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml new file mode 100644 index 00000000..9cdcf82d --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select purchase_order_child_id, purchase_order_code, supplier_code, supplier_name, material_code, material_name, material_noRmb, material_rmb, material_num, material_amount, material_sum, material_noRmbSum, material_rmbSum, delivery_time, eceipt_status, payment_status, tax_rate, create_by, create_time, update_by, update_time, del_flag, standby_one, standby_two from purchase_order_child + + + + + + + + insert into purchase_order_child + + purchase_order_code, + supplier_code, + supplier_name, + material_code, + material_name, + material_noRmb, + material_rmb, + material_num, + material_amount, + material_sum, + material_noRmbSum, + material_rmbSum, + delivery_time, + eceipt_status, + payment_status, + tax_rate, + create_by, + create_time, + update_by, + update_time, + del_flag, + standby_one, + standby_two, + + + #{purchaseOrderCode}, + #{supplierCode}, + #{supplierName}, + #{materialCode}, + #{materialName}, + #{materialNormb}, + #{materialRmb}, + #{materialNum}, + #{materialAmount}, + #{materialSum}, + #{materialNormbsum}, + #{materialRmbsum}, + #{deliveryTime}, + #{eceiptStatus}, + #{paymentStatus}, + #{taxRate}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{delFlag}, + #{standbyOne}, + #{standbyTwo}, + + + + + update purchase_order_child + + purchase_order_code = #{purchaseOrderCode}, + supplier_code = #{supplierCode}, + supplier_name = #{supplierName}, + material_code = #{materialCode}, + material_name = #{materialName}, + material_noRmb = #{materialNormb}, + material_rmb = #{materialRmb}, + material_num = #{materialNum}, + material_amount = #{materialAmount}, + material_sum = #{materialSum}, + material_noRmbSum = #{materialNormbsum}, + material_rmbSum = #{materialRmbsum}, + delivery_time = #{deliveryTime}, + eceipt_status = #{eceiptStatus}, + payment_status = #{paymentStatus}, + tax_rate = #{taxRate}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + del_flag = #{delFlag}, + standby_one = #{standbyOne}, + standby_two = #{standbyTwo}, + + where purchase_order_child_id = #{purchaseOrderChildId} + + + + delete from purchase_order_child where purchase_order_child_id = #{purchaseOrderChildId} + + + + delete from purchase_order_child where purchase_order_child_id in + + #{purchaseOrderChildId} + + + + + update purchase_order_child set del_flag = '1' where purchase_order_child_id = #{purchaseOrderChildId} + + + + update purchase_order_child set del_flag = '0' where purchase_order_child_id = #{purchaseOrderChildId} + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/add.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/add.html new file mode 100644 index 00000000..0e33c514 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/add.html @@ -0,0 +1,160 @@ + + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+ 代码生成请选择字典属性 +
+
+
+ +
+
+ + +
+ 代码生成请选择字典属性 +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/edit.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/edit.html new file mode 100644 index 00000000..b1c32746 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/edit.html @@ -0,0 +1,153 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+ 代码生成请选择字典属性 +
+
+
+ +
+
+ + +
+ 代码生成请选择字典属性 +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/purchaseOrderChild.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/purchaseOrderChild.html new file mode 100644 index 00000000..99436f85 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/purchaseOrderChild.html @@ -0,0 +1,202 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file From 0e8f69c05ab6f214a858fa50216303f6b806a21d Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Wed, 19 Jun 2024 23:19:03 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[feat]=20=E9=87=87=E8=B4=AD=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=9A=E9=87=87=E8=B4=AD=E5=8D=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=87=E8=B4=AD=E5=8D=95=EF=BC=8C=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=8A=A5=E4=BB=B7=E4=BF=A1=E6=81=AF=E5=8F=AF=E6=8C=89?= =?UTF-8?q?=E7=85=A7prd=E4=B8=8A=E6=98=BE=E7=A4=BA=EF=BC=8C=E5=AF=B9?= =?UTF-8?q?=E5=BA=94prd=E6=98=BE=E7=A4=BA=E7=9A=84=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E4=B8=BA=E7=89=A9=E6=96=99=E4=B8=8B=E6=9C=89=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E5=88=97=E8=A1=A8=E5=BE=AA=E7=8E=AF=E6=88=90=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E7=B1=BB=E6=98=BE=E7=A4=BA=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=BE=9B=E5=BA=94=E5=95=86=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E3=80=82=E6=B7=BB=E5=8A=A0=E8=AE=A1=E5=88=92=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PurchaseOrderController.java | 43 ++++++++++++- .../controller/PurchasePlanController.java | 18 +++--- .../ruoyi/purchase/domain/PurchaseOrder.java | 12 ++++ .../purchase/domain/PurchasePlanChild.java | 60 +++++++++++++++++-- .../impl/PurchaseOrderServiceImpl.java | 2 + .../purchase/PurchasePlanChildMapper.xml | 39 ++++++------ .../purchase/purchasePlan/purchasePlan.html | 5 +- 7 files changed, 137 insertions(+), 42 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java index 85c66db2..cdbefe30 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java @@ -13,10 +13,13 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.purchase.domain.PurchaseMaterial; import com.ruoyi.purchase.domain.PurchaseOrder; +import com.ruoyi.purchase.domain.PurchaseOrderChild; +import com.ruoyi.purchase.domain.PurchaseQuoteChild; import com.ruoyi.purchase.domain.exportDto.PurchaseMaterialDto; import com.ruoyi.purchase.domain.exportDto.PurchaseOrderDto; import com.ruoyi.purchase.service.IPurchaseMaterialService; @@ -32,6 +35,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.math.BigDecimal; import java.util.*; import static com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder.log; @@ -53,6 +57,9 @@ public class PurchaseOrderController extends BaseController @Autowired private IPurchaseMaterialService purchaseMaterialService; + @Autowired + private RedisCache redisCache; + @RequiresPermissions("purchase:purchaseOrder:view") @GetMapping() public String purchaseOrder() @@ -103,8 +110,40 @@ public class PurchaseOrderController extends BaseController @Log(title = "采购订单", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody - public AjaxResult addSave(PurchaseOrder purchaseOrder) - { + public AjaxResult addSave(@RequestBody PurchaseOrder purchaseOrder) throws Exception{ + //获取采购订单子表中的供应商,核算供应商数量和采购物料合计以及采购数量合计,采购不含税报价合计,采购含税报价合计 + List purchaseMaterials = purchaseOrder.getPurchaseOrderChildList(); + purchaseOrder.setPurchaseOrderCode(redisCache.generateBillNo("CG")); + BigDecimal materialNoRmb = BigDecimal.valueOf(0.0); + BigDecimal materialRmb = BigDecimal.valueOf(0.0); + BigDecimal materialNoRmbSum = BigDecimal.valueOf(0.0); + BigDecimal materialRmbSum = BigDecimal.valueOf(0.0); + BigDecimal materialSum = BigDecimal.valueOf(0.0); + Long materialNum = 0L; + Long supplierNum = 0L; + for (PurchaseOrderChild purchaseOrderChild : purchaseMaterials) { + purchaseOrderChild.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); + for (PurchaseQuoteChild purchaseSupplierQuote : purchaseOrderChild.getPurchaseQuoteChildList()){ + BigDecimal suplierMaterialNoRmb = purchaseSupplierQuote.getMaterialNoRmb(); + BigDecimal suplierMaterialRmb = purchaseSupplierQuote.getMaterialRmb(); + Long suplierMaterialNum = purchaseSupplierQuote.getMaterialNum(); + BigDecimal suplierMaterialNoRmbSum = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); + BigDecimal suplierMaterialRmbSum = suplierMaterialRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); + materialNum = materialNum + suplierMaterialNum; + materialNoRmb = materialNoRmb.add(purchaseSupplierQuote.getMaterialNoRmb()); + materialRmb = materialRmb.add(purchaseSupplierQuote.getMaterialRmb()); + materialRmbSum = materialRmbSum.add(suplierMaterialRmbSum); + materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSum); + purchaseSupplierQuote.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode()); + if (purchaseSupplierQuote.getSupplierCode() != null){ + supplierNum ++; + } + } + purchaseOrderChild.setMaterialNormb(materialNoRmb); + purchaseOrderChild.setMaterialRmb(materialRmb); + purchaseOrderChild.setMaterialNum(materialNum); + } + purchaseOrder.setSupplierNum(Math.toIntExact(supplierNum)); return toAjax(purchaseOrderService.insertPurchaseOrder(purchaseOrder)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java index 4ba47ae1..3ec562d4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java @@ -2,6 +2,7 @@ package com.ruoyi.purchase.controller; import java.util.Arrays; import java.util.List; +import java.util.Set; import com.ruoyi.common.core.text.Convert; import com.ruoyi.purchase.domain.PurchasePlan; @@ -114,22 +115,21 @@ public class PurchasePlanController extends BaseController @GetMapping("/addPurchaseOrder/{purchasePlanCodes}") public String purChaseOrder(@PathVariable("purchasePlanCodes") String purchasePlanCodes,ModelMap mmap){ //purchasePlanCodes去除重复数据,purchasePlanCodeArray作为数组类型去除 - String purchasePlanCode = purchasePlanCodes; + + // 直接使用String的split方法分割字符串,然后转为Stream去重,最后再拼接回字符串 String[] purchasePlanCodeArray = purchasePlanCodes.split(","); - purchasePlanCodes = Arrays.toString(Arrays.stream(purchasePlanCodeArray).distinct().toArray()); + String uniquePurchasePlanCodes = String.join(",", Arrays.stream(purchasePlanCodeArray).distinct().toArray(String[]::new)); //查询相关采购计划数据 - List purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(purchasePlanCode); + List purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(uniquePurchasePlanCodes); //根据采购计划编号查询对应的采购报价数据 - List purchasePlanChildList = purchasePlanChildService.getPurchasePlanChildByPlanCodes(purchasePlanCode); + List purchasePlanChildList = purchasePlanChildService.getPurchasePlanChildByPlanCodes(uniquePurchasePlanCodes); + //再根据采购计划编号分组查询对应的采购报价数据分组 for(PurchasePlanChild purchasePlanChild : purchasePlanChildList){ - List purchaseQuoteChildList = purchasePlanChild.getPurchaseQuoteChildList(); + purchasePlanChild.setPurchaseSupplierList(purchasePlanChild.parseSupplierMaterialCombinations(purchasePlanChild.getSupplierCodes())); } - //再根据采购计划编号分组查询对应的采购报价数据分组 - - purchasePlanCodes = purchasePlanCodes.replace("[","").replace("]",""); //查询物料报价中供应商 mmap.put("purchasePlanList", purchasePlanList); - mmap.put("purchasePlanCodes", purchasePlanCodes); + mmap.put("purchasePlanCodes", uniquePurchasePlanCodes); mmap.put("purchasePlanChildList", purchasePlanChildList); return prefix + "/addPurchaseOrder"; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java index 393abf2f..1ec203d4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java @@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import java.util.List; + /** * 采购订单对象 purchase_order * @@ -177,6 +179,16 @@ public class PurchaseOrder extends BaseEntity /** 备用二 */ private String standbyTwo; + private List purchaseOrderChildList; + + public List getPurchaseOrderChildList() { + return purchaseOrderChildList; + } + + public void setPurchaseOrderChildList(List purchaseOrderChildList) { + this.purchaseOrderChildList = purchaseOrderChildList; + } + public Long getPurchaseOrderId() { return purchaseOrderId; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java index d6c0bcf3..0f3012a5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java @@ -1,6 +1,8 @@ package com.ruoyi.purchase.domain; import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -17,6 +19,7 @@ import com.ruoyi.common.core.domain.BaseEntity; public class PurchasePlanChild extends BaseEntity { private static final long serialVersionUID = 1L; + public List parseSupplierMaterialCombinations; /** 采购计划物料清单索引 */ private Long purchasePlanChildId; @@ -83,10 +86,30 @@ public class PurchasePlanChild extends BaseEntity /** 删除标志 */ private String delFlag; + /** 关联供应商编号 */ + private String supplierCodes; + /** 关联采购报价单编号 */ + private String correlationCodes; - private List purchaseQuoteChildList; + private List purchaseSupplierList; - public void setPurchasePlanChildId(Long purchasePlanChildId) + public String getSupplierCodes() { + return supplierCodes; + } + + public void setSupplierCodes(String supplierCodes) { + this.supplierCodes = supplierCodes; + } + + public String getCorrelationCodes() { + return correlationCodes; + } + + public void setCorrelationCodes(String correlationCodes) { + this.correlationCodes = correlationCodes; + } + + public void setPurchasePlanChildId(Long purchasePlanChildId) { this.purchasePlanChildId = purchasePlanChildId; } @@ -233,12 +256,12 @@ public class PurchasePlanChild extends BaseEntity this.supplierName = supplierName; } - public List getPurchaseQuoteChildList() { - return purchaseQuoteChildList; + public List getPurchaseSupplierList() { + return purchaseSupplierList; } - public void setPurchaseQuoteChildList(List purchaseQuoteChildList) { - this.purchaseQuoteChildList = purchaseQuoteChildList; + public void setPurchaseSupplierList(List purchaseSupplierList) { + this.purchaseSupplierList = purchaseSupplierList; } public String getUseStatus() @@ -264,6 +287,31 @@ public class PurchasePlanChild extends BaseEntity return delFlag; } + public List parseSupplierMaterialCombinations(String combinations) { + if (combinations == null || combinations.isEmpty()) { + return Collections.emptyList(); + } + //materialCode|purchaseQuoteCode|supplierCode|supplierName|materialName|materialNoRmb|materialRmb + /* 1. 料号 | 2. 供应商报价编号 | 3. 供应商编号 | 4.供应商名称 | 5. 物料名称 | 6. 物料含税单价(RMB) | 7. 物料不含税单价(RMB) */ + List purchaseSupplierList = new ArrayList<>(); + String[] split = combinations.split(","); + for (int i = 0; i < split.length; i++) { + String[] split1 = split[i].split("\\|"); + if (split1.length != 7) { + continue; + } + PurchaseQuoteChild purchaseQuoteChild = new PurchaseQuoteChild(); + purchaseQuoteChild.setMaterialCode(split1[0]); + purchaseQuoteChild.setPurchaseQuoteCode(split1[1]); + purchaseQuoteChild.setSupplierCode(split1[2]); + purchaseQuoteChild.setSupplierName(split1[3]); + purchaseQuoteChild.setMaterialName(split1[4]); + purchaseQuoteChild.setMaterialNoRmb(BigDecimal.valueOf(Float.parseFloat(split1[5]))); + purchaseQuoteChild.setMaterialRmb(BigDecimal.valueOf(Float.parseFloat(split1[6]))); + purchaseSupplierList.add(purchaseQuoteChild); + } + return purchaseSupplierList; + } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java index 57adf4c4..dbdf08e3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java @@ -59,6 +59,8 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService @Override public int insertPurchaseOrder(PurchaseOrder purchaseOrder) { + //根据上传的物料信息做采购订单子项 + // return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder); } diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml index 29c4e5cc..7e798987 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml @@ -19,6 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -164,31 +166,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html index 073ea231..13fcbaeb 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html @@ -171,14 +171,13 @@ //·拼接采购计划单号 for(var i=0;i