diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisTmsCostFeeSplitMapper.java b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisTmsCostFeeSplitMapper.java index dfbdad0d1..866194a40 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisTmsCostFeeSplitMapper.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisTmsCostFeeSplitMapper.java @@ -84,6 +84,8 @@ public interface EmisTmsCostFeeSplitMapper extends BaseMapper fixedQuotePrice1002List=emisTmsCostQuotePriceMapper.matchBatchFixedQuotePriceByBillCode(billCode,"1002",1); if(!CollectionUtils.isEmpty(fixedQuotePrice1002List)){ - // 检查重复 Map existsMap = new HashMap(); for (EmisTmsCostQuotePrice quotePriceItem : fixedQuotePrice1002List) { @@ -386,7 +405,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService EmisTmsCostFeeSplit splitItem = new EmisTmsCostFeeSplit(); splitItem.setBillCode(billCode); - splitItem.setMainBillCode(billCode); + splitItem.setMainBillCode(mainBillCode); splitItem.setBillWeight(waybill.getBillWeight()); // 运单重量 splitItem.setTotalVolume(waybill.getTotalVolume()); // 运单体积 @@ -436,7 +455,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService splitItem.setCalcExpr(itemCalcExpr); splitItem.setCalcRemark(calcExprStr + "=" + splitCostFee.stripTrailingZeros().toPlainString()); splitItem.setRemark("网点机场短驳费"); - + splitItem.setBlVirtual(waybill.getBlVirtual()); // 总成本费用 splitItem.setTransCostFee(totalDbCostFee); splitItem.setCnyFee(totalDbCostFee); @@ -446,7 +465,6 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService } } - // 机场提货费操作费 - 1004 List fixedQuotePrice1004List=emisTmsCostQuotePriceMapper.matchBatchFixedQuotePriceByBillCode(billCode,"1004",-1); if(!CollectionUtils.isEmpty(fixedQuotePrice1004List)){ @@ -465,7 +483,8 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService // 计算 机场提货费操作费 EmisTmsCostFeeSplit splitItem = new EmisTmsCostFeeSplit(); splitItem.setBillCode(billCode); - splitItem.setMainBillCode(billCode); + + splitItem.setMainBillCode(mainBillCode); splitItem.setBillWeight(waybill.getBillWeight()); // 运单重量 splitItem.setTotalVolume(waybill.getTotalVolume()); // 运单体积 @@ -494,7 +513,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService splitItem.setSplitValue(waybill.getBillWeight()); // 分摊重量 // 总费用=单价*公里数 - BigDecimal totalDbCostFee = quotePriceItem.getPrice().multiply(quotePriceItem.getDistance()); + BigDecimal totalDbCostFee = quotePriceItem.getPrice().multiply(quotePriceItem.getTransWeight()); String itemCalcExpr = quotePriceItem.getCalculateExpression(); @@ -505,11 +524,9 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService .replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString()); // 计算单次成本: 如果低于最低报价,则使用最低成本来分摊 - BigDecimal totalCost =quotePriceItem.getTransWeight().multiply(quotePriceItem.getPrice()); - if(totalCost.compareTo(quotePriceItem.getLeastPrice())<0){ + if( totalDbCostFee.doubleValue() < quotePriceItem.getLeastPrice().doubleValue() ){ totalDbCostFee=quotePriceItem.getLeastPrice(); // 总成本=最低报价 - itemCalcExpr="(w/t)*c"; calcExprStr = itemCalcExpr.replaceAll("w", waybill.getBillWeight().stripTrailingZeros().toPlainString()) .replaceAll("t", quotePriceItem.getTransWeight().stripTrailingZeros().toPlainString()) @@ -533,6 +550,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService // 总成本费用 splitItem.setTransCostFee(totalDbCostFee); splitItem.setCnyFee(totalDbCostFee); + splitItem.setBlVirtual(waybill.getBlVirtual()); // 插入分摊明细数据 emisTmsCostFeeSplitMapper.insertEmisTmsCostFeeSplit(splitItem); diff --git a/emis-biz/src/main/resources/mapper/EmisTmsCostFeeSplitMapper.xml b/emis-biz/src/main/resources/mapper/EmisTmsCostFeeSplitMapper.xml index cb506445c..4ea49e016 100644 --- a/emis-biz/src/main/resources/mapper/EmisTmsCostFeeSplitMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisTmsCostFeeSplitMapper.xml @@ -115,7 +115,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and a.batch_no=#{batchNo} and a.fee_item_id = #{feeItemId} - and ( FIND_IN_SET(a.main_bill_code,#{billCode}) or a.main_bill_code like concat('%', #{billCode}, '%') ) + and ( FIND_IN_SET(a.bill_code,#{billCode}) or a.bill_code like concat('%', #{billCode}, '%') ) + + + and ( FIND_IN_SET(a.main_bill_code,#{mainBillCode}) or a.main_bill_code like concat('%', #{mainBillCode}, '%') ) and a.send_place=#{sendPlace} and a.dest_place=#{destPlace} @@ -345,6 +348,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update emis_tms_cost_fee_split set del_flag='1' where del_flag='0' and cost_no = #{costNo} + + update emis_tms_cost_fee_split set del_flag='1' + where del_flag='0' + and bill_code = #{billCode} + and fee_type = #{feeType} + + update emis_tms_cost_fee_split set del_flag='1' where del_flag='0'