|
@ -1,5 +1,7 @@ |
|
|
package com.ruoyi.system.service.impl; |
|
|
package com.ruoyi.system.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.math.RoundingMode; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
@ -8,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.system.domain.BaseRequisitioningOrderChild; |
|
|
import com.ruoyi.system.domain.BaseRequisitioningOrderChild; |
|
|
import com.ruoyi.system.mapper.BaseRequisitioningOrderChildMapper; |
|
|
import com.ruoyi.system.mapper.BaseRequisitioningOrderChildMapper; |
|
|
|
|
|
import io.swagger.models.auth.In; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import com.ruoyi.system.mapper.BaseRequisitioningOrderMapper; |
|
|
import com.ruoyi.system.mapper.BaseRequisitioningOrderMapper; |
|
@ -71,17 +74,36 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr |
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
baseRequisitioningOrder.setCreateBy(loginName); |
|
|
baseRequisitioningOrder.setCreateBy(loginName); |
|
|
baseRequisitioningOrder.setCreateTime(DateUtils.getNowDate()); |
|
|
baseRequisitioningOrder.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
if (baseRequisitioningOrder.getRequisitioningCode() == null) { |
|
|
|
|
|
baseRequisitioningOrder.setRequisitioningCode(redisCache.generateBillNo("QG")); |
|
|
|
|
|
} |
|
|
baseRequisitioningOrder.setRequisitioningCode(redisCache.generateBillNo("QG")); |
|
|
baseRequisitioningOrder.setRequisitioningCode(redisCache.generateBillNo("QG")); |
|
|
List<BaseRequisitioningOrderChild> childList = baseRequisitioningOrder.getBaseRequisitioningOrderChildList(); |
|
|
List<BaseRequisitioningOrderChild> 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) { |
|
|
if (childSize > 0) { |
|
|
for (BaseRequisitioningOrderChild child : childList) { |
|
|
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.setQuoteId(baseRequisitioningOrder.getRequisitioningCode()); |
|
|
child.setCreateBy(loginName); |
|
|
child.setCreateBy(loginName); |
|
|
child.setCreateTime(DateUtils.getNowDate()); |
|
|
child.setCreateTime(DateUtils.getNowDate()); |
|
|
baseRequisitioningOrderChildMapper.insertBaseRequisitioningOrderChild(child); |
|
|
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); |
|
|
return baseRequisitioningOrderMapper.insertBaseRequisitioningOrder(baseRequisitioningOrder); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -101,9 +123,15 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr |
|
|
String requisitioningCode = baseRequisitioningOrder.getRequisitioningCode(); |
|
|
String requisitioningCode = baseRequisitioningOrder.getRequisitioningCode(); |
|
|
baseRequisitioningOrderChildMapper.deleteBaseRequisitioningOrderChildByQuoteId(baseRequisitioningOrder.getRequisitioningCode()); |
|
|
baseRequisitioningOrderChildMapper.deleteBaseRequisitioningOrderChildByQuoteId(baseRequisitioningOrder.getRequisitioningCode()); |
|
|
List<BaseRequisitioningOrderChild> childList = baseRequisitioningOrder.getBaseRequisitioningOrderChildList(); |
|
|
List<BaseRequisitioningOrderChild> childList = baseRequisitioningOrder.getBaseRequisitioningOrderChildList(); |
|
|
|
|
|
Long materialSum = 0L; |
|
|
|
|
|
BigDecimal materialRmbSum = new BigDecimal(0); |
|
|
|
|
|
BigDecimal materialNoRmbSum = new BigDecimal(0); |
|
|
int childSize = childList.size(); |
|
|
int childSize = childList.size(); |
|
|
if (childSize > 0) { |
|
|
if (childSize > 0) { |
|
|
for (BaseRequisitioningOrderChild child: childList) { |
|
|
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.setQuoteId(requisitioningCode); |
|
|
child.setCreateBy(loginName); |
|
|
child.setCreateBy(loginName); |
|
|
child.setCreateTime(DateUtils.getNowDate()); |
|
|
child.setCreateTime(DateUtils.getNowDate()); |
|
@ -112,6 +140,12 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr |
|
|
baseRequisitioningOrderChildMapper.insertBaseRequisitioningOrderChild(child); |
|
|
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); |
|
|
return baseRequisitioningOrderMapper.updateBaseRequisitioningOrder(baseRequisitioningOrder); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|