From 497bff23fdca32ff03b7ec2621e0743416700f49 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Thu, 11 Jul 2024 14:16:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=BA=94=E4=BB=98=E8=B4=A6=E6=AC=BE=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=A0=B9=E6=8D=AE=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86=E9=87=8D=E6=96=B0=E8=AE=A1=E7=AE=97=E5=BA=94?= =?UTF-8?q?=E4=BB=98=E8=B4=A6=E6=AC=BE=EF=BC=8C=E5=B9=B6=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95=E4=B8=AD=E7=9B=B8=E5=90=8C=E7=9A=84?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E5=90=88=E8=AE=A1=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=BA=94=E4=BB=98=E8=B4=A6=E6=AC=BE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PurchaseOrderServiceImpl.java | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) 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 1b397589..734d2c1b 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 @@ -41,6 +41,7 @@ import java.util.*; import java.util.stream.Collectors; +import static com.github.pagehelper.page.PageMethod.offsetPage; import static com.github.pagehelper.page.PageMethod.startPage; /** @@ -455,8 +456,6 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService //根据供应商划分物料信息,合计物料不含税单价 ,含税单价,含税总价,不含税总价,实际采购数量 // 获取采购订单的子项列表 List children = purchaseOrder.getPurchaseOrderChildList(); - BigDecimal apySupplierNoRmbPrice = new BigDecimal(0); - BigDecimal apySupplierTaxRmbPrice = new BigDecimal(0); // 分组供应商的子订单,分组统计各供应商应付单供应商 List supplierGroup = (List) children.stream() // 分组依据为supplierCode @@ -469,43 +468,55 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService .collect(Collectors.toList()); //根据物料中提出的供应商列表核对, 遍历每个相关的子订单,合计数据量 for (PurchaseOrderChild purchaseOrderChild : supplierGroup) { + //初始化合计数 + BigDecimal supplierNoRmbPrice = BigDecimal.ZERO; + BigDecimal supplierRmbTaxPrice = BigDecimal.ZERO; List purchaseOrderChildList = purchaseOrder.getPurchaseOrderChildList(); + //创建供应商应付单 FinancialAccountsPayable financialAccountsPayable = new FinancialAccountsPayable(); financialAccountsPayable.setAccountsPayableCode(redisCache.generateBillNo("YF")); financialAccountsPayable.setRelevanceCode(purchaseOrder.getPurchaseOrderCode()); for (PurchaseOrderChild purchaseOrderChild1 : purchaseOrderChildList) { - BigDecimal supplierNoRmbPrice = purchaseOrderChild1.getMaterialRealNoRmbSum(); - BigDecimal supplierRmbTaxPrice = purchaseOrderChild1.getMaterialRealRmbSum(); - //供应商应付账款 不含税金额 - apySupplierNoRmbPrice = supplierNoRmbPrice.add(supplierNoRmbPrice); - //供应商应付账款 含税金额 - apySupplierTaxRmbPrice = apySupplierTaxRmbPrice.add(supplierRmbTaxPrice); - //每当当前供应商完成一次循环,生成一条供应商应付账款 - - SysSupplier sysSupplier = new SysSupplier(); - sysSupplier.setSupplierCode(purchaseOrderChild1.getSupplierCode()); - - List sysSupplierList = sysSupplierService.selectSysSupplierList(sysSupplier); - financialAccountsPayable.setSupplierCode(purchaseOrderChild.getSupplierCode()); - financialAccountsPayable.setSupplierName(purchaseOrderChild.getSupplierName()); - int supplierListSize = sysSupplierList.size(); - if(supplierListSize == 0){ - continue; + //如果是如上述的供应商,则进行统计 + if (purchaseOrderChild1.getSupplierCode().equals(purchaseOrderChild.getSupplierCode())) { + //供应商应付账款 不含税金额 + supplierNoRmbPrice = supplierNoRmbPrice.add(purchaseOrderChild1.getMaterialRealNoRmbSum()); + //供应商应付账款 含税金额 + supplierRmbTaxPrice = supplierRmbTaxPrice.add(purchaseOrderChild1.getMaterialRealRmbSum()); }else{ - SysSupplier sysSupplier1 = sysSupplierList.get(0); - //获取供应商相关的信息 - financialAccountsPayable.setOpenBank(sysSupplier1.getDepositBank()); - financialAccountsPayable.setOpenAccount(sysSupplier1.getBankAccount()); - financialAccountsPayable.setPaymentCondition(sysSupplier1.getPaymentTerms()); + continue; } } + //每当当前供应商完成一次循环,生成一条供应商应付账款 + SysSupplier sysSupplier = new SysSupplier(); + sysSupplier.setSupplierCode(purchaseOrderChild.getSupplierCode()); + List sysSupplierList = sysSupplierService.selectSysSupplierList(sysSupplier); + int supplierListSize = sysSupplierList.size(); + if(supplierListSize == 0){ + continue; + }else{ + SysSupplier sysSupplier1 = sysSupplierList.get(0); + //获取供应商开户银行 + financialAccountsPayable.setOpenBank(sysSupplier1.getDepositBank()); + //供应商银行账号 + financialAccountsPayable.setOpenAccount(sysSupplier1.getBankAccount()); + //供应商付款条件 + financialAccountsPayable.setPaymentCondition(sysSupplier1.getPaymentTerms()); + } + //供应商编号 + financialAccountsPayable.setSupplierCode(purchaseOrderChild.getSupplierCode()); + //供应商名称 + financialAccountsPayable.setSupplierName(purchaseOrderChild.getSupplierName()); + //创建单号人员 financialAccountsPayable.setCreateBy(ShiroUtils.getLoginName()); + //创建时间 financialAccountsPayable.setCreateTime(DateUtils.getNowDate()); + //采购订单的采购员 financialAccountsPayable.setPurchaseBuyer(purchaseOrder.getPurchaseBuyer()); //不含税金额 - financialAccountsPayable.setPriceExcludingTax(apySupplierNoRmbPrice); + financialAccountsPayable.setPriceExcludingTax(supplierNoRmbPrice); //含税金额 - financialAccountsPayable.setPriceIncludesTax(apySupplierTaxRmbPrice); + financialAccountsPayable.setPriceIncludesTax(supplierRmbTaxPrice); financialAccountsPayable.setStorageStatus("0"); financialAccountsPayable.setAccountsPayableStatus("0"); financialAccountsPayableService.insertFinancialAccountsPayable(financialAccountsPayable);