This commit is contained in:
linfso 2025-06-30 22:31:27 +08:00
parent 972aa789da
commit 8be6118aad
4 changed files with 22 additions and 18 deletions

View File

@ -192,7 +192,7 @@ public class EmisTmsCostFeeController extends BaseController
public AjaxResult reCalcSplitCostFee(@RequestBody EmisTmsCostFee emisTmsCostFee) public AjaxResult reCalcSplitCostFee(@RequestBody EmisTmsCostFee emisTmsCostFee)
{ {
try { try {
return toAjax(emisTmsCostFeeService.reCalcSplitCostFee(emisTmsCostFee.getCostNo(),null)); return toAjax(emisTmsCostFeeService.reCalcSplitCostFee(emisTmsCostFee.getCostNo(),null,true));
}catch(EmisBizError ex){ }catch(EmisBizError ex){
ex.printStackTrace(); ex.printStackTrace();
return AjaxResult.error("("+ex.getErrorCode()+")"+ex.getMessage()); return AjaxResult.error("("+ex.getErrorCode()+")"+ex.getMessage());

View File

@ -100,7 +100,7 @@ public interface IEmisTmsCostFeeService
* @return * @return
* @throws EmisBizError * @throws EmisBizError
*/ */
public int reCalcSplitCostFee(String costNo,String billCode) throws EmisBizError; public int reCalcSplitCostFee(String costNo,String billCode,boolean isMerge) throws EmisBizError;
/** /**

View File

@ -419,12 +419,14 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
if(!CollectionUtil.isEmpty(listBillCodeRel)){ if(!CollectionUtil.isEmpty(listBillCodeRel)){
for(CostFeeWaybillRel item:listBillCodeRel){ for(CostFeeWaybillRel item:listBillCodeRel){
try { try {
reCalcSplitCostFee(item.getCostNo(),billCode); reCalcSplitCostFee(item.getCostNo(),billCode,false);
}catch (Exception ex){ }catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
} }
} }
} }
mergeCostFeeByBillCode(billCode);
return 1; return 1;
} }
@ -441,7 +443,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
if(!CollectionUtil.isEmpty(listCostFee)){ if(!CollectionUtil.isEmpty(listCostFee)){
for(EmisTmsCostFee item:listCostFee){ for(EmisTmsCostFee item:listCostFee){
try { try {
reCalcSplitCostFee(item.getCostNo(),null); reCalcSplitCostFee(item.getCostNo(),null,true);
}catch (Exception ex){ }catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
} }
@ -549,7 +551,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
* @throws EmisBizError * @throws EmisBizError
*/ */
@Override @Override
public int reCalcSplitCostFee(String costNo,String calcBillCode) throws EmisBizError { public int reCalcSplitCostFee(String costNo,String calcBillCode,boolean isMerge) throws EmisBizError {
// 获取最新的数据 // 获取最新的数据
EmisTmsCostFee oldCostFee = emisTmsCostFeeMapper.selectEmisTmsCostFeeByCostNo(costNo); EmisTmsCostFee oldCostFee = emisTmsCostFeeMapper.selectEmisTmsCostFeeByCostNo(costNo);
// /* 总票数 总重量 总体积 */ // /* 总票数 总重量 总体积 */
@ -695,21 +697,23 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
emisTmsCostFeeMapper.updateEmisTmsCostFee(emisTmsCostFee); emisTmsCostFeeMapper.updateEmisTmsCostFee(emisTmsCostFee);
// 合并单个运单费用 // 合并单个运单费用
for (CostFeeWaybillRel billCodeItem: listBillCodeRel) { if(isMerge) {
try { for (CostFeeWaybillRel billCodeItem : listBillCodeRel) {
try {
String billCode=billCodeItem.getBillCode(); String billCode = billCodeItem.getBillCode();
// 如果指定单号,则其他单号做过滤 // 如果指定单号,则其他单号做过滤
if(!StringUtils.isEmpty(calcBillCode)) { if (!StringUtils.isEmpty(calcBillCode)) {
if(!billCode.equals(calcBillCode)){ if (!billCode.equals(calcBillCode)) {
continue; continue;
}
} }
mergeCostFeeByBillCode(billCode);
} catch (Exception ex) {
ex.printStackTrace();
} }
mergeCostFeeByBillCode(billCode);
}catch (Exception ex){
ex.printStackTrace();
} }
} }
return 1; return 1;

View File

@ -115,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectListByBillCode" parameterType="String" resultMap="EmisTmsCostFeeSplitResult"> <select id="selectListByBillCode" parameterType="String" resultMap="EmisTmsCostFeeSplitResult">
select id, cost_no, batch_no, bill_code, main_bill_code, send_place, dest_place, bill_month, trade_date, trans_sign_no, supplier_code, fee_type, split_type, split_value, cost_fee, total_volume, bill_weight, trans_weight, trans_volume, trans_cost_fee, fee_item_id, calc_expr, calc_remark, bl_manual, bl_virtual, bl_sub, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site select id, cost_no, batch_no, bill_code, main_bill_code, send_place, dest_place, bill_month, trade_date, trans_sign_no, supplier_code, fee_type, split_type, split_value, cost_fee, total_volume, bill_weight, trans_weight, trans_volume, trans_cost_fee, fee_item_id, calc_expr, calc_remark, bl_manual, bl_virtual, bl_sub, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_cost_fee_split a from emis_tms_cost_fee_split a
where a.del_flag='0' and a.bill_code = #{billCode} where a.del_flag='0' and a.main_bill_code = #{billCode}
</select> </select>
<select id="selectListByCostNo" parameterType="String" resultMap="EmisTmsCostFeeSplitResult"> <select id="selectListByCostNo" parameterType="String" resultMap="EmisTmsCostFeeSplitResult">