This commit is contained in:
linfso 2025-07-04 15:38:30 +08:00
parent f6d0b2fada
commit 504f2718ac
3 changed files with 60 additions and 1 deletions

View File

@ -54,6 +54,9 @@ public interface EmisTmsCostFeeMapper extends BaseMapper<EmisTmsCostFee>
// 获取最小化的运单信息
public EmisWaybill selectThinWaybillInfoByCostFeeCalc(String billCode);
public List<CostFeeWaybillRel> selectThinWaybillListByMainBillCode(String mainBillCode);
// 成本和费用关系
public List<CostFeeWaybillRel> selectCostFeeRelListByCostNo(String costNo);

View File

@ -240,10 +240,13 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
}else{
mainWaybill=waybill;
}
// 虚拟单备注
String virtualRemark=mainWaybill.getVirtualRemark();
// 计算固定成本费用-取件费
reCalcFixedCostFee(billCode,mainBillCode,waybill,mainWaybill);
// 搜索已录入成本的费用分摊
List<CostFeeWaybillRel> listBillCodeRel=emisTmsCostFeeMapper.selectCostFeeRelListByBillCode(billCode);
if(!CollectionUtil.isEmpty(listBillCodeRel)){
@ -256,6 +259,34 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
}
}
// 计算同主单下的虚拟单
if(!StringUtils.isEmpty(virtualRemark)) {
List<CostFeeWaybillRel> listChildWaybill=emisTmsCostFeeMapper.selectThinWaybillListByMainBillCode(mainBillCode);
if(CollectionUtils.isEmpty(listChildWaybill)){
for(CostFeeWaybillRel childItem:listChildWaybill){
String childBillCode=childItem.getBillCode();
if(childBillCode.equals(billCode)){
continue;
}
// 计算虚拟单的每一个批次
List<CostFeeWaybillRel> listChildBillCodeRel=emisTmsCostFeeMapper.selectCostFeeRelListByBillCode(childBillCode);
if(!CollectionUtil.isEmpty(listChildBillCodeRel)){
for(CostFeeWaybillRel item:listChildBillCodeRel){
try {
reCalcCostFeeOnlyOne(item.getCostNo(),childBillCode,false);
}catch (Exception ex){
ex.printStackTrace();
}
}
}
}
}
}
mergeCostFeeByBillCode(billCode);

View File

@ -136,6 +136,7 @@
a.settlement_weight as settlementWeight,
a.freight as freight,
a.bl_virtual as blVirtual,
a.virtual_remark as virtualRemark,
a.master_bill_code as masterBillCode,
a.send_date as sendDate,
a.take_piece_employee_code as takePieceEmployeeCode,
@ -145,11 +146,35 @@
a.dispatch_underling_site_code as dispatchUnderlingSiteCode,
a.dispatch_date as dispatchDate
FROM emis_waybill a
WHERE a.del_flag = '0' and bill_code=#{billCode}
</select>
<select id="selectThinWaybillListByMainBillCode" parameterType="String" resultType="EmisWaybill">
SELECT
a.id,
a.bill_code as billCode,
a.total_volume as totalVolume,
a.parcel_qty parcelQty,
a.bill_weight as billWeight,
a.volume_weight as volumeWeight,
a.settlement_weight as settlementWeight,
a.freight as freight,
a.bl_virtual as blVirtual,
a.virtual_remark as virtualRemark,
a.master_bill_code as masterBillCode,
a.send_date as sendDate,
a.take_piece_employee_code as takePieceEmployeeCode,
a.send_site_code as sendSiteCode,
a.dispatch_man_code as dispatchManCode,
a.dispatch_man_code as dispatchManCode,
a.dispatch_underling_site_code as dispatchUnderlingSiteCode,
a.dispatch_date as dispatchDate
FROM emis_waybill a
WHERE a.del_flag = '0' and master_bill_code=#{mainbillCode}
</select>
<select id="selectThinCostFeeByCostNo" parameterType="String" resultMap="ThinCostFeeResult">
select
id, cost_no, cost_name, batch_no, fee_type, split_type, trans_type, trans_sign_no, supplier_code, supplier_name, send_place, dest_place, cost_fee, usd_cost_fee, bill_month, trade_date, send_piece_sum, piece_number, total_weight, total_volume, bl_confirm_center, real_piece_number, real_total_weight, real_total_volume