demand: tms系统-成本管理-网点固定成本、批次分摊成本根据组批次自由设定的重量、体积分摊计算 tms系统-成本管理-运单成本明细费用、分摊重量、计算备注取批次设定的值适应调整 组批次复制批次无法保存bug修改
committer: heyu
This commit is contained in:
parent
fbafb1332a
commit
f51ddc3cf5
@ -98,4 +98,11 @@ public class EmisTmsCostQuotePrice extends BaseEntity
|
|||||||
private BigDecimal totalVolume;
|
private BigDecimal totalVolume;
|
||||||
private String transType;
|
private String transType;
|
||||||
|
|
||||||
|
/* 分批体积 */
|
||||||
|
private BigDecimal batchVolume;
|
||||||
|
/* 分批件数 */
|
||||||
|
private Integer batchParcelQty;
|
||||||
|
/* 分批重量 */
|
||||||
|
private BigDecimal batchWeight;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,8 @@ import com.xdadan.erp.emis.domain.EmisTmsCostFee;
|
|||||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName EmisTmsCostFeeRel
|
* @ClassName EmisTmsCostFeeRel
|
||||||
@ -37,6 +39,13 @@ public class CostFeeWaybillRel extends BaseEntity
|
|||||||
/* 批次号 */
|
/* 批次号 */
|
||||||
private String batchNo;
|
private String batchNo;
|
||||||
|
|
||||||
|
/* 分批体积 */
|
||||||
|
private BigDecimal batchVolume;
|
||||||
|
/* 分批件数 */
|
||||||
|
private Integer batchParcelQty;
|
||||||
|
/* 分批重量 */
|
||||||
|
private BigDecimal batchWeight;
|
||||||
|
|
||||||
// 扩展参数
|
// 扩展参数
|
||||||
private EmisWaybill waybillDetail;
|
private EmisWaybill waybillDetail;
|
||||||
private EmisTmsCostFee costFeeDetail;
|
private EmisTmsCostFee costFeeDetail;
|
||||||
|
|||||||
@ -551,7 +551,15 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
Map<String, Object> env = new HashMap<>();
|
Map<String, Object> env = new HashMap<>();
|
||||||
env.put("w", mainWaybill.getBillWeight());
|
env.put("w", waybill.getBillWeight());
|
||||||
|
if (quotePriceItem.getBatchWeight() != null) {
|
||||||
|
env.put("w", quotePriceItem.getBatchWeight());
|
||||||
|
splitItem.setBillWeight(quotePriceItem.getBatchWeight());
|
||||||
|
splitItem.setTotalVolume(quotePriceItem.getBatchVolume());
|
||||||
|
calcExprStr = itemCalcExpr.replaceAll("w", quotePriceItem.getBatchWeight().stripTrailingZeros().toPlainString())
|
||||||
|
.replaceAll("t", quotePriceItem.getTransWeight().stripTrailingZeros().toPlainString())
|
||||||
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
|
}
|
||||||
env.put("t", quotePriceItem.getTransWeight());
|
env.put("t", quotePriceItem.getTransWeight());
|
||||||
env.put("c", totalDbCostFee);
|
env.put("c", totalDbCostFee);
|
||||||
double costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
double costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
@ -647,8 +655,14 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
|
|
||||||
String itemCalcExpr = quotePriceItem.getCalculateExpression();
|
String itemCalcExpr = quotePriceItem.getCalculateExpression();
|
||||||
|
|
||||||
|
String calcWeight = waybill.getSettlementWeight().stripTrailingZeros().toPlainString();
|
||||||
|
if (quotePriceItem.getBatchWeight() != null) {
|
||||||
|
calcWeight = quotePriceItem.getBatchWeight().stripTrailingZeros().toPlainString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 正常计算公式
|
// 正常计算公式
|
||||||
String calcExprStr = itemCalcExpr.replaceAll("w", waybill.getSettlementWeight().stripTrailingZeros().toPlainString())
|
String calcExprStr = itemCalcExpr.replaceAll("w", calcWeight)
|
||||||
.replaceAll("t", transWeight.stripTrailingZeros().toPlainString())
|
.replaceAll("t", transWeight.stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("d", quotePriceItem.getPrice().stripTrailingZeros().toPlainString())
|
.replaceAll("d", quotePriceItem.getPrice().stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
@ -658,7 +672,7 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
|
|
||||||
totalDbCostFee=quotePriceItem.getLeastPrice(); // 总成本=最低报价
|
totalDbCostFee=quotePriceItem.getLeastPrice(); // 总成本=最低报价
|
||||||
itemCalcExpr="(w/t)*c";
|
itemCalcExpr="(w/t)*c";
|
||||||
calcExprStr = itemCalcExpr.replaceAll("w", mainWaybill.getSettlementWeight().stripTrailingZeros().toPlainString())
|
calcExprStr = itemCalcExpr.replaceAll("w", calcWeight)
|
||||||
.replaceAll("t", transWeight.stripTrailingZeros().toPlainString())
|
.replaceAll("t", transWeight.stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
@ -666,6 +680,12 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
|
|
||||||
Map<String, Object> env = new HashMap<>();
|
Map<String, Object> env = new HashMap<>();
|
||||||
env.put("w", waybill.getSettlementWeight());
|
env.put("w", waybill.getSettlementWeight());
|
||||||
|
if (quotePriceItem.getBatchWeight() != null) {
|
||||||
|
env.put("w", quotePriceItem.getBatchWeight());
|
||||||
|
splitItem.setBillWeight(quotePriceItem.getBatchWeight());
|
||||||
|
splitItem.setTotalVolume(quotePriceItem.getBatchVolume());
|
||||||
|
|
||||||
|
}
|
||||||
env.put("t", transWeight);
|
env.put("t", transWeight);
|
||||||
env.put("d", quotePriceItem.getPrice());
|
env.put("d", quotePriceItem.getPrice());
|
||||||
env.put("c", totalDbCostFee);
|
env.put("c", totalDbCostFee);
|
||||||
@ -763,12 +783,20 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
|
|
||||||
String itemCalcExpr = quotePriceItem.getCalculateExpression();
|
String itemCalcExpr = quotePriceItem.getCalculateExpression();
|
||||||
|
|
||||||
String calcExprStr = itemCalcExpr.replaceAll("w", mainWaybill.getSettlementWeight().stripTrailingZeros().toPlainString())
|
String calcExprStr = itemCalcExpr.replaceAll("w", waybill.getSettlementWeight().stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("t", transWeight.stripTrailingZeros().toPlainString())
|
.replaceAll("t", transWeight.stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
Map<String, Object> env = new HashMap<>();
|
Map<String, Object> env = new HashMap<>();
|
||||||
env.put("w", waybill.getSettlementWeight());
|
env.put("w", waybill.getSettlementWeight());
|
||||||
|
if (quotePriceItem.getBatchWeight() != null) {
|
||||||
|
env.put("w", quotePriceItem.getBatchWeight());
|
||||||
|
splitItem.setBillWeight(quotePriceItem.getBatchWeight());
|
||||||
|
splitItem.setTotalVolume(quotePriceItem.getBatchVolume());
|
||||||
|
calcExprStr = itemCalcExpr.replaceAll("w", quotePriceItem.getBatchWeight().stripTrailingZeros().toPlainString())
|
||||||
|
.replaceAll("t", transWeight.stripTrailingZeros().toPlainString())
|
||||||
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
|
}
|
||||||
env.put("t", transWeight);
|
env.put("t", transWeight);
|
||||||
env.put("c", totalDbCostFee);
|
env.put("c", totalDbCostFee);
|
||||||
double costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
double costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
@ -1087,6 +1115,14 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
|
|
||||||
Map<String, Object> env = new HashMap<>();
|
Map<String, Object> env = new HashMap<>();
|
||||||
env.put("w", waybill.getSettlementWeight());
|
env.put("w", waybill.getSettlementWeight());
|
||||||
|
if (billCodeItem.getBatchWeight() != null) {
|
||||||
|
env.put("w", billCodeItem.getBatchWeight());
|
||||||
|
splitItem.setBillWeight(billCodeItem.getBatchWeight());
|
||||||
|
splitItem.setTotalVolume(billCodeItem.getBatchVolume());
|
||||||
|
calcExprStr = itemCalcExpr.replaceAll("w", billCodeItem.getBatchWeight().stripTrailingZeros().toPlainString())
|
||||||
|
.replaceAll("t", transWeight.stripTrailingZeros().toPlainString())
|
||||||
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
|
}
|
||||||
env.put("t", transWeight);
|
env.put("t", transWeight);
|
||||||
env.put("c", totalDbCostFee);
|
env.put("c", totalDbCostFee);
|
||||||
costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
@ -1100,7 +1136,15 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
.replaceAll("t", transVolume.stripTrailingZeros().toPlainString())
|
.replaceAll("t", transVolume.stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
Map<String, Object> env = new HashMap<>();
|
Map<String, Object> env = new HashMap<>();
|
||||||
env.put("w", waybill.getSettlementWeight());
|
env.put("w", waybill.getTotalVolume());
|
||||||
|
if (billCodeItem.getBatchWeight() != null) {
|
||||||
|
env.put("w", billCodeItem.getBatchVolume());
|
||||||
|
splitItem.setBillWeight(billCodeItem.getBatchWeight());
|
||||||
|
splitItem.setTotalVolume(billCodeItem.getBatchVolume());
|
||||||
|
calcExprStr = itemCalcExpr.replaceAll("w", billCodeItem.getBatchVolume().stripTrailingZeros().toPlainString())
|
||||||
|
.replaceAll("t", transVolume.stripTrailingZeros().toPlainString())
|
||||||
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
|
}
|
||||||
env.put("t", transVolume);
|
env.put("t", transVolume);
|
||||||
env.put("c", totalDbCostFee);
|
env.put("c", totalDbCostFee);
|
||||||
costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
|
|||||||
@ -191,10 +191,11 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
|||||||
throw new EmisBizError(EmisBizErrorType.FAIL, itemDtl.getBillCode() + "的批次体积必须大于0");
|
throw new EmisBizError(EmisBizErrorType.FAIL, itemDtl.getBillCode() + "的批次体积必须大于0");
|
||||||
}
|
}
|
||||||
|
|
||||||
compareWaybillAndBatch(oldSiteBatch, itemDtl, emisWaybill, rule,true);
|
compareWaybillAndBatch(oldSiteBatch, itemDtl, emisWaybill, rule, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compareWaybillAndBatch(EmisTmsSiteBatch oldSiteBatch, EmisTmsSiteBatchDtl itemDtl, EmisWaybill emisWaybill, EmisTransPlanRule rule, boolean isBatch) throws EmisBizError {
|
private void compareWaybillAndBatch(EmisTmsSiteBatch oldSiteBatch, EmisTmsSiteBatchDtl itemDtl,
|
||||||
|
EmisWaybill emisWaybill, EmisTransPlanRule rule, boolean isBatch) throws EmisBizError {
|
||||||
// 根据起始网点、下一网点和运单号查询TMS组批次
|
// 根据起始网点、下一网点和运单号查询TMS组批次
|
||||||
List<EmisTmsSiteBatch> existingBatches = selectTmsSiteBatchBySiteAndBillCode(
|
List<EmisTmsSiteBatch> existingBatches = selectTmsSiteBatchBySiteAndBillCode(
|
||||||
oldSiteBatch.getStartSiteCode(),
|
oldSiteBatch.getStartSiteCode(),
|
||||||
@ -252,8 +253,18 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
|||||||
|
|
||||||
// 将allBatches根据起始网点、下一网点、批次重量、件数、体积分组去重
|
// 将allBatches根据起始网点、下一网点、批次重量、件数、体积分组去重
|
||||||
Map<String, List<EmisTmsSiteBatch>> groupedBatches = allBatches.stream()
|
Map<String, List<EmisTmsSiteBatch>> groupedBatches = allBatches.stream()
|
||||||
.collect(Collectors.groupingBy(batch -> batch.getStartSiteCode() + "_" + batch.getNextSiteCode() + "_" +
|
.collect(Collectors.groupingBy(batch -> {
|
||||||
batch.getTotalWeight() + "_" + batch.getTotalParcelQty() + "_" + batch.getTotalVolume()));
|
// 去除重量和体积的多余0
|
||||||
|
String weightStr = batch.getTotalWeight() != null
|
||||||
|
? batch.getTotalWeight().stripTrailingZeros().toPlainString()
|
||||||
|
: "0";
|
||||||
|
String volumeStr = batch.getTotalVolume() != null
|
||||||
|
? batch.getTotalVolume().stripTrailingZeros().toPlainString()
|
||||||
|
: "0";
|
||||||
|
|
||||||
|
return batch.getStartSiteCode() + "_" + batch.getNextSiteCode() + "_" +
|
||||||
|
weightStr + "_" + batch.getTotalParcelQty() + "_" + volumeStr;
|
||||||
|
}));
|
||||||
|
|
||||||
// 计算去重后的批次总重量、总件数、总体积
|
// 计算去重后的批次总重量、总件数、总体积
|
||||||
BigDecimal totalWeight = groupedBatches.values().stream()
|
BigDecimal totalWeight = groupedBatches.values().stream()
|
||||||
|
|||||||
@ -72,6 +72,9 @@
|
|||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="costNo" column="cost_no" />
|
<result property="costNo" column="cost_no" />
|
||||||
<result property="billCode" column="bill_code" />
|
<result property="billCode" column="bill_code" />
|
||||||
|
<result property="batchVolume" column="batch_volume" />
|
||||||
|
<result property="batchParcelQty" column="batch_parcel_qty" />
|
||||||
|
<result property="batchWeight" column="batch_weight" />
|
||||||
|
|
||||||
<association property="costFeeDetail"
|
<association property="costFeeDetail"
|
||||||
column="cost_no"
|
column="cost_no"
|
||||||
@ -110,6 +113,9 @@
|
|||||||
distinct
|
distinct
|
||||||
c.cost_no,
|
c.cost_no,
|
||||||
a.bill_code,
|
a.bill_code,
|
||||||
|
a.batch_weight,
|
||||||
|
a.batch_volume,
|
||||||
|
a.batch_parcel_qty,
|
||||||
b.batch_no
|
b.batch_no
|
||||||
FROM
|
FROM
|
||||||
emis_tms_site_batch_dtl a,
|
emis_tms_site_batch_dtl a,
|
||||||
|
|||||||
@ -36,6 +36,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="totalWeight" column="total_weight" />
|
<result property="totalWeight" column="total_weight" />
|
||||||
<result property="transType" column="trans_type" />
|
<result property="transType" column="trans_type" />
|
||||||
|
|
||||||
|
<result property="batchVolume" column="batch_volume" />
|
||||||
|
<result property="batchParcelQty" column="batch_parcel_qty" />
|
||||||
|
<result property="batchWeight" column="batch_weight" />
|
||||||
|
|
||||||
<association property="startSiteName" column="start_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
<association property="startSiteName" column="start_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
||||||
<association property="nextSiteName" column="next_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
<association property="nextSiteName" column="next_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
||||||
<association property="supplierName" column="supplier_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSupplierNameByCode"/>
|
<association property="supplierName" column="supplier_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSupplierNameByCode"/>
|
||||||
@ -104,7 +108,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
b.total_weight,
|
b.total_weight,
|
||||||
b.total_volume,
|
b.total_volume,
|
||||||
b.trans_type,
|
b.trans_type,
|
||||||
b.total_settlement_weight
|
b.total_settlement_weight,
|
||||||
|
|
||||||
|
c.batch_volume,
|
||||||
|
c.batch_parcel_qty,
|
||||||
|
c.batch_weight
|
||||||
|
|
||||||
FROM
|
FROM
|
||||||
emis_tms_cost_quote_price a,
|
emis_tms_cost_quote_price a,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user