This commit is contained in:
linfso 2024-07-28 20:13:13 +08:00
parent 6ed897b971
commit eb33722b48

View File

@ -96,6 +96,8 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
@Autowired
private EmisWarehouseInMapper emisWarehouseInMapper;
private EmisExchangeRateMapper emisExchangeRateMapper;
/**
* 直接数据查询运单列表 by billCode
@ -630,7 +632,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
// 新开单
if(isNew){
addNewWaybill(emisWaybillSave);
@ -1566,6 +1567,31 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 公共计算部分
calcWayBillCommonInfo(emisWaybillSave,true);
// 计算标准运费
List<EmisWaybillFeeitem> feeitemList=emisWaybillSave.getFeeitemList();
BigDecimal totalRealFee = BigDecimal.ZERO;
if(!CollectionUtils.isEmpty(feeitemList)){
for (EmisWaybillFeeitem feeItem:feeitemList) {
BigDecimal realFee = feeItem.getFee();
// 汇率计算
if( !StringUtils.isEmpty(feeItem.getCurrency()) ){
EmisExchangeRate emisExchangeRate=emisExchangeRateMapper.getValidExchangeRate(feeItem.getCurrency(),"CNY");
if(emisExchangeRate!=null){
BigDecimal rate=BigDecimal.valueOf(Double.valueOf(emisExchangeRate.getRate()));
realFee=realFee.multiply(rate);
realFee=realFee.setScale(2,BigDecimal.ROUND_HALF_UP);
}
}
totalRealFee=totalRealFee.add(realFee);
}
totalRealFee=totalRealFee.setScale(2,BigDecimal.ROUND_HALF_UP);
emisWaybillSave.setRealFee(totalRealFee);
}
//补齐数据
emisWaybillMapper.insertEmisWaybill(emisWaybillSave);