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