From 21e570be77aeaf0b49ce3efeb9c1a2798984aca3 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Fri, 17 May 2024 13:24:38 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=9A=E8=AF=B7=E8=B4=AD=E5=8D=95=E5=88=97=E8=A1=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BF=AE=E6=94=B9=E5=88=97=E8=A1=A8=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E4=BF=A1=E6=81=AF=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/BaseRequisitioningOrderChild.java | 6 +-- .../BaseRequisitioningOrderServiceImpl.java | 36 +++++++++++++- .../BaseRequisitioningOrderChildMapper.xml | 48 +++++++++---------- .../templates/system/requisitioning/edit.html | 28 ++++++----- 4 files changed, 78 insertions(+), 40 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseRequisitioningOrderChild.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseRequisitioningOrderChild.java index 32ad2e63..6aa946a9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseRequisitioningOrderChild.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseRequisitioningOrderChild.java @@ -78,7 +78,7 @@ public class BaseRequisitioningOrderChild extends BaseEntity /** 物料的不含税总价(RMB) */ @Excel(name = "物料的不含税总价(RMB)") - private Long materialRmbSum; + private BigDecimal materialRmbSum; /** 删除状态 */ @Excel(name = "删除状态") @@ -223,12 +223,12 @@ public class BaseRequisitioningOrderChild extends BaseEntity { return materialNoRmbSum; } - public void setMaterialRmbSum(Long materialRmbSum) + public void setMaterialRmbSum(BigDecimal materialRmbSum) { this.materialRmbSum = materialRmbSum; } - public Long getMaterialRmbSum() + public BigDecimal getMaterialRmbSum() { return materialRmbSum; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java index 29435385..1fa7bc2d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java @@ -1,5 +1,7 @@ package com.ruoyi.system.service.impl; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; @@ -8,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.system.domain.BaseRequisitioningOrderChild; import com.ruoyi.system.mapper.BaseRequisitioningOrderChildMapper; +import io.swagger.models.auth.In; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.BaseRequisitioningOrderMapper; @@ -71,17 +74,36 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr String loginName = ShiroUtils.getLoginName(); baseRequisitioningOrder.setCreateBy(loginName); baseRequisitioningOrder.setCreateTime(DateUtils.getNowDate()); + if (baseRequisitioningOrder.getRequisitioningCode() == null) { + baseRequisitioningOrder.setRequisitioningCode(redisCache.generateBillNo("QG")); + } baseRequisitioningOrder.setRequisitioningCode(redisCache.generateBillNo("QG")); List childList = baseRequisitioningOrder.getBaseRequisitioningOrderChildList(); - int childSize = childList.size(); + Long materialSum = 0L; + BigDecimal materialRmbSum = new BigDecimal(0); + BigDecimal materialNoRmbSum = new BigDecimal(0); + //物料合计 + Integer childSize = childList.size(); if (childSize > 0) { for (BaseRequisitioningOrderChild child : childList) { + //物料数量 + materialSum += child.getMaterialNum(); + //物料不含税总价(RMB) + materialRmbSum = child.getMaterialRmbSum().setScale(2, RoundingMode.HALF_UP).add(materialNoRmbSum); + //物料含税总价(RMB) + materialNoRmbSum = child.getMaterialNoRmbSum().setScale(2, RoundingMode.HALF_UP).add(materialNoRmbSum); child.setQuoteId(baseRequisitioningOrder.getRequisitioningCode()); child.setCreateBy(loginName); child.setCreateTime(DateUtils.getNowDate()); baseRequisitioningOrderChildMapper.insertBaseRequisitioningOrderChild(child); } } + baseRequisitioningOrder.setAuditStatus("1"); + baseRequisitioningOrder.setUseStatus("1"); + baseRequisitioningOrder.setMaterialAmount(Long.valueOf(childSize)); + baseRequisitioningOrder.setMaterialSum(materialSum); + baseRequisitioningOrder.setRmbSum(materialRmbSum); + baseRequisitioningOrder.setNoRmbSum(materialNoRmbSum); return baseRequisitioningOrderMapper.insertBaseRequisitioningOrder(baseRequisitioningOrder); } @@ -101,9 +123,15 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr String requisitioningCode = baseRequisitioningOrder.getRequisitioningCode(); baseRequisitioningOrderChildMapper.deleteBaseRequisitioningOrderChildByQuoteId(baseRequisitioningOrder.getRequisitioningCode()); List childList = baseRequisitioningOrder.getBaseRequisitioningOrderChildList(); + Long materialSum = 0L; + BigDecimal materialRmbSum = new BigDecimal(0); + BigDecimal materialNoRmbSum = new BigDecimal(0); int childSize = childList.size(); if (childSize > 0) { for (BaseRequisitioningOrderChild child: childList) { + materialSum += child.getMaterialNum(); + materialRmbSum = child.getMaterialRmbSum().setScale(2, RoundingMode.HALF_UP).add(materialNoRmbSum); + materialNoRmbSum = child.getMaterialNoRmbSum().setScale(2, RoundingMode.HALF_UP).add(materialNoRmbSum); child.setQuoteId(requisitioningCode); child.setCreateBy(loginName); child.setCreateTime(DateUtils.getNowDate()); @@ -112,6 +140,12 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr baseRequisitioningOrderChildMapper.insertBaseRequisitioningOrderChild(child); } } + baseRequisitioningOrder.setAuditStatus("1"); + baseRequisitioningOrder.setUseStatus("1"); + baseRequisitioningOrder.setMaterialAmount(Long.valueOf(childSize)); + baseRequisitioningOrder.setMaterialSum(materialSum); + baseRequisitioningOrder.setRmbSum(materialRmbSum); + baseRequisitioningOrder.setNoRmbSum(materialNoRmbSum); return baseRequisitioningOrderMapper.updateBaseRequisitioningOrder(baseRequisitioningOrder); } diff --git a/ruoyi-admin/src/main/resources/mapper/system/BaseRequisitioningOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/BaseRequisitioningOrderChildMapper.xml index 58a3a8a5..ef956d96 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/BaseRequisitioningOrderChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/BaseRequisitioningOrderChildMapper.xml @@ -6,28 +6,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and material_model = #{materilaModel} and specifications = #{specifications} and brand = #{brand} - and describe = #{describe} + and `describe` = #{describe} and materialNum = #{materialNum} and materialRmb = #{materialRmb} and materialNoRmb = #{materialNoRmb} @@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_model, specifications, brand, - describe, + `describe`, materialNum, materialRmb, materialNoRmb, diff --git a/ruoyi-admin/src/main/resources/templates/system/requisitioning/edit.html b/ruoyi-admin/src/main/resources/templates/system/requisitioning/edit.html index 4b16a1ee..cb1ef2e1 100644 --- a/ruoyi-admin/src/main/resources/templates/system/requisitioning/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/requisitioning/edit.html @@ -2,6 +2,8 @@ + +
@@ -55,15 +57,28 @@
+ + \ No newline at end of file