md
This commit is contained in:
parent
fefa52b21a
commit
ea5bc4c15c
@ -212,8 +212,8 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
|
||||
private String getCalcFeeExpStr(String exprStr,BigDecimal w,BigDecimal s,BigDecimal d){
|
||||
return exprStr.replaceAll("w", w.stripTrailingZeros().toPlainString())
|
||||
.replaceAll("s", w.stripTrailingZeros().toPlainString())
|
||||
.replaceAll("d", w.stripTrailingZeros().toPlainString());
|
||||
.replaceAll("s", s.stripTrailingZeros().toPlainString())
|
||||
.replaceAll("d", d.stripTrailingZeros().toPlainString());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,7 +252,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
|
||||
// 供应商
|
||||
splitItem.setSupplierCode("-1"); // 供应商
|
||||
splitItem.setTransSignNo(waybill.getTakePieceEmployeeCode()); // 运输号
|
||||
splitItem.setTransSignNo(waybill.getTakePieceEmployeeName()); // 运输号
|
||||
|
||||
splitItem.setSendPlace("客户现场");
|
||||
splitItem.setDestPlace(waybill.getStartSiteName());
|
||||
@ -276,7 +276,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
splitItem.setCostFee(BigDecimal.valueOf(costFee));
|
||||
splitItem.setCalcExpr(itemCalcExpr);
|
||||
splitItem.setCalcRemark(calcExprStr+"="+String.valueOf(costFee));
|
||||
splitItem.setRemark("网点上门取件费(首重:10元,续重:1元/kg)-取件员:"+waybill.getTakePieceEmployeeName());
|
||||
splitItem.setRemark("网点上门取件费:取件员["+waybill.getTakePieceEmployeeName()+"]");
|
||||
|
||||
// 总成本费用=本次取件费
|
||||
splitItem.setTransCostFee(BigDecimal.valueOf(costFee));
|
||||
@ -382,8 +382,6 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
// 按总重量分摊
|
||||
|
||||
String itemCalcExpr = "(w/t)*c";
|
||||
|
||||
|
||||
String calcExprStr=itemCalcExpr.replaceAll("w", waybill.getBillWeight().stripTrailingZeros().toPlainString())
|
||||
.replaceAll("t", quotePrice0.getTransWeight().stripTrailingZeros().toPlainString())
|
||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||
@ -391,6 +389,8 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
double costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
||||
|
||||
log.info("网点机场短驳费:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
||||
|
||||
|
||||
splitItem.setCostFee(BigDecimal.valueOf(costFee));
|
||||
splitItem.setCalcExpr(calcExprStr);
|
||||
splitItem.setCalcRemark(calcExprStr+"="+String.valueOf(costFee));
|
||||
@ -578,36 +578,81 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
|
||||
// 计算分摊成本
|
||||
for (CostFeeWaybillRel billCodeItem: listBillCodeRel) {
|
||||
|
||||
String billCode=billCodeItem.getBillCode();
|
||||
EmisWaybill waybill = billCodeItem.getWaybillDetail();
|
||||
EmisTmsCostFee costFeeDetail= billCodeItem.getCostFeeDetail();
|
||||
|
||||
// 循环费用类型
|
||||
for (EmisTmsCostFeeFeeitem feeItem: listFeeItemRel) {
|
||||
EmisTmsCostFeeSplit splitItem = new EmisTmsCostFeeSplit();
|
||||
|
||||
splitItem.setCostNo(billCodeItem.getCostNo());
|
||||
splitItem.setBillCode(billCodeItem.getBillCode());
|
||||
splitItem.setBillCode(billCode);
|
||||
splitItem.setMainBillCode(billCode);
|
||||
splitItem.setBillWeight(waybill.getBillWeight()); // 运单重量
|
||||
splitItem.setTotalVolume(waybill.getTotalVolume()); // 运单体积
|
||||
|
||||
splitItem.setFeeItemId(feeItem.getId());
|
||||
splitItem.setFeeType(feeItem.getFeeType());
|
||||
splitItem.setSplitType(oldCostFee.getSplitType());
|
||||
// 运输成本
|
||||
splitItem.setBlManual("0"); // 手工计算
|
||||
splitItem.setCostNo(billCodeItem.getCostNo()); // 固定成本
|
||||
splitItem.setTransWeight(costFeeDetail.getRealTotalWeight()); // 运输重量
|
||||
splitItem.setTransVolume(totalVolume); // 运输体积
|
||||
|
||||
BigDecimal splitCostFee = BigDecimal.ZERO;
|
||||
BigDecimal splitRate = BigDecimal.ZERO;
|
||||
// 供应商
|
||||
splitItem.setSupplierCode(costFeeDetail.getSupplierCode()); // 供应商
|
||||
splitItem.setTransSignNo(costFeeDetail.getTransSignNo()); // 运输号
|
||||
|
||||
splitItem.setSendPlace(costFeeDetail.getSendPlace());
|
||||
splitItem.setDestPlace(costFeeDetail.getDestPlace());
|
||||
splitItem.setBillMonth(DateUtils.parseDateToStr(DateUtils.YYYY_MM,waybill.getSendDate()));
|
||||
splitItem.setTradeDate(costFeeDetail.getTradeDate());
|
||||
|
||||
// 成本分摊
|
||||
splitItem.setFeeType(feeItem.getFeeType()); // 费用类型
|
||||
splitItem.setSplitType(oldCostFee.getSplitType()); // 按重量分摊
|
||||
splitItem.setFeeItemId(feeItem.getId()); // 无成本费用项来源
|
||||
splitItem.setSplitValue(waybill.getBillWeight());
|
||||
|
||||
// 总成本费用
|
||||
BigDecimal totalDbCostFee=feeItem.getCnyFee();
|
||||
splitItem.setTransCostFee(totalDbCostFee);
|
||||
|
||||
String itemCalcExpr="";
|
||||
String calcExprStr="";
|
||||
double costFee = 0.0D;
|
||||
// 按重量分摊
|
||||
if ("1".equals(oldCostFee.getSplitType())) {
|
||||
splitRate = billCodeItem.getWaybillDetail().getBillWeight().divide(totalWeight, BigDecimal.ROUND_CEILING);
|
||||
itemCalcExpr="(w/t)*c";
|
||||
calcExprStr=itemCalcExpr.replaceAll("w", waybill.getBillWeight().stripTrailingZeros().toPlainString())
|
||||
.replaceAll("t", oldCostFee.getRealTotalWeight().stripTrailingZeros().toPlainString())
|
||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||
|
||||
costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
||||
log.info("按重量分摊:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
||||
|
||||
}
|
||||
// 按体积
|
||||
else if ("2".equals(oldCostFee.getSplitType())) {
|
||||
splitRate = billCodeItem.getWaybillDetail().getTotalVolume().divide(totalVolume, BigDecimal.ROUND_CEILING);
|
||||
itemCalcExpr="(w/t)*c";
|
||||
calcExprStr=itemCalcExpr.replaceAll("w", waybill.getTotalVolume().stripTrailingZeros().toPlainString())
|
||||
.replaceAll("t", oldCostFee.getRealTotalVolume().stripTrailingZeros().toPlainString())
|
||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||
costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
||||
log.info("按体积分摊:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
||||
|
||||
}
|
||||
// 按票
|
||||
else if ("3".equals(oldCostFee.getSplitType())) {
|
||||
splitRate = BigDecimal.valueOf(1.0D / (double) sendPieceSum);
|
||||
itemCalcExpr="(1/t)*c";
|
||||
calcExprStr=itemCalcExpr.replaceAll("t",sendPieceSum.toString())
|
||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||
costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
||||
log.info("按票分摊:计算公式:" + calcExprStr + ",票数:1");
|
||||
}
|
||||
splitCostFee = feeItem.getCnyFee().multiply(splitRate);
|
||||
splitItem.setCostFee(splitCostFee);
|
||||
|
||||
splitItem.setBillWeight(billCodeItem.getWaybillDetail().getBillWeight());
|
||||
splitItem.setTotalVolume(billCodeItem.getWaybillDetail().getTotalVolume());
|
||||
splitItem.setCostFee(BigDecimal.valueOf(costFee));
|
||||
splitItem.setCalcExpr(itemCalcExpr);
|
||||
splitItem.setCalcRemark(calcExprStr+"="+String.valueOf(costFee));
|
||||
splitItem.setRemark("批次成本分摊费用");
|
||||
|
||||
// 插入分摊明细数据
|
||||
emisTmsCostFeeSplitMapper.insertEmisTmsCostFeeSplit(splitItem);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user