✨ 应收账单快照保存产品价和红线价
This commit is contained in:
@@ -43,6 +43,10 @@ public class ArBillDetail implements Serializable {
|
|||||||
private BigDecimal pkgHeight;
|
private BigDecimal pkgHeight;
|
||||||
private String currency;
|
private String currency;
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
|
/** 来源应收主表中的整单产品价合计快照。 */
|
||||||
|
private BigDecimal productAmount;
|
||||||
|
/** 来源应收主表中的整单红线价合计快照。 */
|
||||||
|
private BigDecimal redlineAmount;
|
||||||
private String remark;
|
private String remark;
|
||||||
private String createBy;
|
private String createBy;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ public class ArBillDetailFee implements Serializable {
|
|||||||
private String unit;
|
private String unit;
|
||||||
private BigDecimal unitPrice;
|
private BigDecimal unitPrice;
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
/** 来源费用明细中的产品价快照。 */
|
||||||
|
private BigDecimal productAmount;
|
||||||
|
/** 来源费用明细中的红线价快照。 */
|
||||||
|
private BigDecimal redlineAmount;
|
||||||
private String currency;
|
private String currency;
|
||||||
private String calculationFormula;
|
private String calculationFormula;
|
||||||
private String roundMode;
|
private String roundMode;
|
||||||
|
|||||||
@@ -80,8 +80,10 @@ import com.bms.common.utils.StringUtils;
|
|||||||
import com.bms.common.utils.file.FileUtils;
|
import com.bms.common.utils.file.FileUtils;
|
||||||
import com.bms.common.utils.file.FileUploadUtils;
|
import com.bms.common.utils.file.FileUploadUtils;
|
||||||
import com.bms.common.utils.uuid.IdUtils;
|
import com.bms.common.utils.uuid.IdUtils;
|
||||||
|
import com.bms.price.domain.PrcIncomeBill;
|
||||||
import com.bms.price.domain.PrcIncomeBillFee;
|
import com.bms.price.domain.PrcIncomeBillFee;
|
||||||
import com.bms.price.domain.PrcOrderBill;
|
import com.bms.price.domain.PrcOrderBill;
|
||||||
|
import com.bms.price.mapper.PrcIncomeBillMapper;
|
||||||
import com.bms.price.mapper.PrcIncomeBillFeeMapper;
|
import com.bms.price.mapper.PrcIncomeBillFeeMapper;
|
||||||
import com.bms.price.mapper.PrcOrderBillMapper;
|
import com.bms.price.mapper.PrcOrderBillMapper;
|
||||||
|
|
||||||
@@ -174,6 +176,8 @@ public class ArBillServiceImpl implements IArBillService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PrcIncomeBillFeeMapper sourceFeeMapper;
|
private PrcIncomeBillFeeMapper sourceFeeMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private PrcIncomeBillMapper sourceIncomeBillMapper;
|
||||||
|
@Autowired
|
||||||
private PlatformTransactionManager transactionManager;
|
private PlatformTransactionManager transactionManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -665,6 +669,14 @@ public class ArBillServiceImpl implements IArBillService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, PrcIncomeBill> sourceIncomeBillsByBillId = new HashMap<>();
|
||||||
|
List<PrcIncomeBill> sourceIncomeBills = sourceIncomeBillMapper.selectByBillIds(currentSourceBillIds);
|
||||||
|
if (sourceIncomeBills != null) {
|
||||||
|
for (PrcIncomeBill sourceIncomeBill : sourceIncomeBills) {
|
||||||
|
sourceIncomeBillsByBillId.put(sourceIncomeBill.getBillId(), sourceIncomeBill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 先抓取本批次的未出账费用快照,后续只更新和复制这些费用,避免把同订单已有 BILLED 费用重复带入新账单。
|
// 先抓取本批次的未出账费用快照,后续只更新和复制这些费用,避免把同订单已有 BILLED 费用重复带入新账单。
|
||||||
List<PrcIncomeBillFee> sourceFees = sourceFeeMapper.selectUnbilledByBillIds(
|
List<PrcIncomeBillFee> sourceFees = sourceFeeMapper.selectUnbilledByBillIds(
|
||||||
currentSourceBillIds, ArIncomeBillFeeStatus.UNBILLED.getCode());
|
currentSourceBillIds, ArIncomeBillFeeStatus.UNBILLED.getCode());
|
||||||
@@ -698,7 +710,8 @@ public class ArBillServiceImpl implements IArBillService {
|
|||||||
int detailNo = (task.getProcessedCount() == null ? 0 : task.getProcessedCount()) + 1;
|
int detailNo = (task.getProcessedCount() == null ? 0 : task.getProcessedCount()) + 1;
|
||||||
List<ArBillDetail> details = new ArrayList<>(sources.size());
|
List<ArBillDetail> details = new ArrayList<>(sources.size());
|
||||||
for (PrcOrderBill source : sources) {
|
for (PrcOrderBill source : sources) {
|
||||||
details.add(toDetail(bill, source, detailNo++, task.getCreateBy()));
|
details.add(toDetail(bill, source, sourceIncomeBillsByBillId.get(source.getBillId()),
|
||||||
|
detailNo++, task.getCreateBy()));
|
||||||
}
|
}
|
||||||
detailMapper.insertBatch(details);
|
detailMapper.insertBatch(details);
|
||||||
|
|
||||||
@@ -1137,7 +1150,8 @@ public class ArBillServiceImpl implements IArBillService {
|
|||||||
return !details.isEmpty() && detailTotal.compareTo(nvl(billTotal)) == 0;
|
return !details.isEmpty() && detailTotal.compareTo(nvl(billTotal)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArBillDetail toDetail(ArBill bill, PrcOrderBill source, int detailNo, String operator) {
|
private ArBillDetail toDetail(ArBill bill, PrcOrderBill source, PrcIncomeBill sourceIncomeBill,
|
||||||
|
int detailNo, String operator) {
|
||||||
ArBillDetail detail = new ArBillDetail();
|
ArBillDetail detail = new ArBillDetail();
|
||||||
detail.setArBillId(bill.getArBillId());
|
detail.setArBillId(bill.getArBillId());
|
||||||
detail.setPrcOrderBillId(source.getBillId());
|
detail.setPrcOrderBillId(source.getBillId());
|
||||||
@@ -1162,6 +1176,10 @@ public class ArBillServiceImpl implements IArBillService {
|
|||||||
detail.setPkgHeight(source.getPkgHeight());
|
detail.setPkgHeight(source.getPkgHeight());
|
||||||
detail.setCurrency(source.getCurrency() == null ? bill.getCurrency() : source.getCurrency());
|
detail.setCurrency(source.getCurrency() == null ? bill.getCurrency() : source.getCurrency());
|
||||||
detail.setTotalAmount(nvl(source.getIncomeTotal()));
|
detail.setTotalAmount(nvl(source.getIncomeTotal()));
|
||||||
|
if (sourceIncomeBill != null) {
|
||||||
|
detail.setProductAmount(sourceIncomeBill.getProductAmount());
|
||||||
|
detail.setRedlineAmount(sourceIncomeBill.getRedlineAmount());
|
||||||
|
}
|
||||||
detail.setRemark(source.getOrderRemark());
|
detail.setRemark(source.getOrderRemark());
|
||||||
detail.setCreateBy(operator);
|
detail.setCreateBy(operator);
|
||||||
return detail;
|
return detail;
|
||||||
@@ -1176,6 +1194,8 @@ public class ArBillServiceImpl implements IArBillService {
|
|||||||
fee.setFeeName(source.getFeeName());
|
fee.setFeeName(source.getFeeName());
|
||||||
fee.setScId(source.getScId());
|
fee.setScId(source.getScId());
|
||||||
fee.setAmount(nvl(source.getAmount()));
|
fee.setAmount(nvl(source.getAmount()));
|
||||||
|
fee.setProductAmount(source.getProductAmount());
|
||||||
|
fee.setRedlineAmount(source.getRedlineAmount());
|
||||||
fee.setCurrency(source.getCurrency() == null ? detail.getCurrency() : source.getCurrency());
|
fee.setCurrency(source.getCurrency() == null ? detail.getCurrency() : source.getCurrency());
|
||||||
fee.setRoundMode(source.getRoundMode());
|
fee.setRoundMode(source.getRoundMode());
|
||||||
fee.setRemark(source.getRemark());
|
fee.setRemark(source.getRemark());
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
package com.bms.price.mapper;
|
package com.bms.price.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import com.bms.price.domain.PrcIncomeBill;
|
import com.bms.price.domain.PrcIncomeBill;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/** prc_income_bill mapper */
|
/** prc_income_bill mapper */
|
||||||
public interface PrcIncomeBillMapper
|
public interface PrcIncomeBillMapper
|
||||||
{
|
{
|
||||||
PrcIncomeBill selectByBillId(String billId);
|
PrcIncomeBill selectByBillId(String billId);
|
||||||
|
|
||||||
|
List<PrcIncomeBill> selectByBillIds(@Param("billIds") List<String> billIds);
|
||||||
|
|
||||||
PrcIncomeBill selectByIncomeBillId(String incomeBillId);
|
PrcIncomeBill selectByIncomeBillId(String incomeBillId);
|
||||||
|
|
||||||
int insertPrcIncomeBill(PrcIncomeBill row);
|
int insertPrcIncomeBill(PrcIncomeBill row);
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
<result property="unit" column="unit"/>
|
<result property="unit" column="unit"/>
|
||||||
<result property="unitPrice" column="unit_price"/>
|
<result property="unitPrice" column="unit_price"/>
|
||||||
<result property="amount" column="amount"/>
|
<result property="amount" column="amount"/>
|
||||||
|
<result property="productAmount" column="product_amount"/>
|
||||||
|
<result property="redlineAmount" column="redline_amount"/>
|
||||||
<result property="currency" column="currency"/>
|
<result property="currency" column="currency"/>
|
||||||
<result property="calculationFormula" column="calculation_formula"/>
|
<result property="calculationFormula" column="calculation_formula"/>
|
||||||
<result property="roundMode" column="round_mode"/>
|
<result property="roundMode" column="round_mode"/>
|
||||||
@@ -36,6 +38,8 @@
|
|||||||
unit,
|
unit,
|
||||||
unit_price,
|
unit_price,
|
||||||
amount,
|
amount,
|
||||||
|
product_amount,
|
||||||
|
redline_amount,
|
||||||
currency,
|
currency,
|
||||||
calculation_formula,
|
calculation_formula,
|
||||||
round_mode,
|
round_mode,
|
||||||
@@ -59,6 +63,8 @@
|
|||||||
f.unit,
|
f.unit,
|
||||||
f.unit_price,
|
f.unit_price,
|
||||||
f.amount,
|
f.amount,
|
||||||
|
f.product_amount,
|
||||||
|
f.redline_amount,
|
||||||
f.currency,
|
f.currency,
|
||||||
f.calculation_formula,
|
f.calculation_formula,
|
||||||
f.round_mode,
|
f.round_mode,
|
||||||
@@ -84,6 +90,8 @@
|
|||||||
unit,
|
unit,
|
||||||
unit_price,
|
unit_price,
|
||||||
amount,
|
amount,
|
||||||
|
product_amount,
|
||||||
|
redline_amount,
|
||||||
currency,
|
currency,
|
||||||
calculation_formula,
|
calculation_formula,
|
||||||
round_mode,
|
round_mode,
|
||||||
@@ -97,7 +105,7 @@
|
|||||||
|
|
||||||
<select id="selectByDetailIds" resultMap="ArBillDetailFeeResult">
|
<select id="selectByDetailIds" resultMap="ArBillDetailFeeResult">
|
||||||
select detail_fee_id, detail_id, prc_income_bill_fee_id, fee_no, fee_type, fee_name, sc_id, quantity,
|
select detail_fee_id, detail_id, prc_income_bill_fee_id, fee_no, fee_type, fee_name, sc_id, quantity,
|
||||||
unit, unit_price, amount, currency, calculation_formula, round_mode, remark, create_by, create_time
|
unit, unit_price, amount, product_amount, redline_amount, currency, calculation_formula, round_mode, remark, create_by, create_time
|
||||||
from ar_bill_detail_fee
|
from ar_bill_detail_fee
|
||||||
where detail_id in
|
where detail_id in
|
||||||
<foreach collection="detailIds" item="detailId" open="(" separator="," close=")">
|
<foreach collection="detailIds" item="detailId" open="(" separator="," close=")">
|
||||||
@@ -109,22 +117,22 @@
|
|||||||
<insert id="insert" parameterType="ArBillDetailFee" useGeneratedKeys="true" keyProperty="detailFeeId">
|
<insert id="insert" parameterType="ArBillDetailFee" useGeneratedKeys="true" keyProperty="detailFeeId">
|
||||||
insert into ar_bill_detail_fee (detail_id, prc_income_bill_fee_id, fee_no, fee_type, fee_name, sc_id, quantity,
|
insert into ar_bill_detail_fee (detail_id, prc_income_bill_fee_id, fee_no, fee_type, fee_name, sc_id, quantity,
|
||||||
unit, unit_price,
|
unit, unit_price,
|
||||||
amount, currency, calculation_formula, round_mode, remark, create_by,
|
amount, product_amount, redline_amount, currency, calculation_formula, round_mode, remark, create_by,
|
||||||
create_time)
|
create_time)
|
||||||
values (#{detailId}, #{prcIncomeBillFeeId}, #{feeNo}, #{feeType}, #{feeName}, #{scId}, #{quantity}, #{unit},
|
values (#{detailId}, #{prcIncomeBillFeeId}, #{feeNo}, #{feeType}, #{feeName}, #{scId}, #{quantity}, #{unit},
|
||||||
#{unitPrice}, #{amount}, #{currency}, #{calculationFormula}, #{roundMode}, #{remark},
|
#{unitPrice}, #{amount}, #{productAmount}, #{redlineAmount}, #{currency}, #{calculationFormula}, #{roundMode}, #{remark},
|
||||||
#{createBy}, sysdate())
|
#{createBy}, sysdate())
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="detailFeeId">
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="detailFeeId">
|
||||||
insert into ar_bill_detail_fee (
|
insert into ar_bill_detail_fee (
|
||||||
detail_id, prc_income_bill_fee_id, fee_no, fee_type, fee_name, sc_id, quantity, unit, unit_price,
|
detail_id, prc_income_bill_fee_id, fee_no, fee_type, fee_name, sc_id, quantity, unit, unit_price,
|
||||||
amount, currency, calculation_formula, round_mode, remark, create_by, create_time
|
amount, product_amount, redline_amount, currency, calculation_formula, round_mode, remark, create_by, create_time
|
||||||
) values
|
) values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.detailId}, #{item.prcIncomeBillFeeId}, #{item.feeNo}, #{item.feeType}, #{item.feeName},
|
(#{item.detailId}, #{item.prcIncomeBillFeeId}, #{item.feeNo}, #{item.feeType}, #{item.feeName},
|
||||||
#{item.scId},
|
#{item.scId},
|
||||||
#{item.quantity}, #{item.unit}, #{item.unitPrice}, #{item.amount}, #{item.currency},
|
#{item.quantity}, #{item.unit}, #{item.unitPrice}, #{item.amount}, #{item.productAmount}, #{item.redlineAmount}, #{item.currency},
|
||||||
#{item.calculationFormula}, #{item.roundMode}, #{item.remark}, #{item.createBy}, sysdate())
|
#{item.calculationFormula}, #{item.roundMode}, #{item.remark}, #{item.createBy}, sysdate())
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="pkgHeight" column="pkg_height"/>
|
<result property="pkgHeight" column="pkg_height"/>
|
||||||
<result property="currency" column="currency"/>
|
<result property="currency" column="currency"/>
|
||||||
<result property="totalAmount" column="total_amount"/>
|
<result property="totalAmount" column="total_amount"/>
|
||||||
|
<result property="productAmount" column="product_amount"/>
|
||||||
|
<result property="redlineAmount" column="redline_amount"/>
|
||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
@@ -38,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
||||||
product_code, product_name, goods_description, country_code, country_name, dest_postcode,
|
product_code, product_name, goods_description, country_code, country_name, dest_postcode,
|
||||||
actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
||||||
currency, total_amount, remark, create_by, create_time
|
currency, total_amount, product_amount, redline_amount, remark, create_by, create_time
|
||||||
from ar_bill_detail where ar_bill_id = #{arBillId} order by detail_no
|
from ar_bill_detail where ar_bill_id = #{arBillId} order by detail_no
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
||||||
product_code, product_name, goods_description, country_code, country_name, dest_postcode,
|
product_code, product_name, goods_description, country_code, country_name, dest_postcode,
|
||||||
actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
||||||
currency, total_amount, remark, create_by, create_time
|
currency, total_amount, product_amount, redline_amount, remark, create_by, create_time
|
||||||
from ar_bill_detail
|
from ar_bill_detail
|
||||||
where ar_bill_id = #{arBillId}
|
where ar_bill_id = #{arBillId}
|
||||||
and prc_order_bill_id in
|
and prc_order_bill_id in
|
||||||
@@ -69,6 +71,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="unit" column="fee_unit"/>
|
<result property="unit" column="fee_unit"/>
|
||||||
<result property="unitPrice" column="fee_unit_price"/>
|
<result property="unitPrice" column="fee_unit_price"/>
|
||||||
<result property="amount" column="fee_amount"/>
|
<result property="amount" column="fee_amount"/>
|
||||||
|
<result property="productAmount" column="fee_product_amount"/>
|
||||||
|
<result property="redlineAmount" column="fee_redline_amount"/>
|
||||||
<result property="currency" column="fee_currency"/>
|
<result property="currency" column="fee_currency"/>
|
||||||
<result property="calculationFormula" column="fee_calculation_formula"/>
|
<result property="calculationFormula" column="fee_calculation_formula"/>
|
||||||
<result property="roundMode" column="fee_round_mode"/>
|
<result property="roundMode" column="fee_round_mode"/>
|
||||||
@@ -82,11 +86,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select d.detail_id, d.ar_bill_id, d.prc_order_bill_id, d.detail_no, d.order_no, d.tracking_no, d.transfer_no, d.receive_time,
|
select d.detail_id, d.ar_bill_id, d.prc_order_bill_id, d.detail_no, d.order_no, d.tracking_no, d.transfer_no, d.receive_time,
|
||||||
d.product_code, d.product_name, d.goods_description, d.country_code, d.country_name, d.dest_postcode,
|
d.product_code, d.product_name, d.goods_description, d.country_code, d.country_name, d.dest_postcode,
|
||||||
d.actual_weight, d.volume_weight, d.charge_weight, d.freight_rate, d.registration_fee, d.pkg_length, d.pkg_width, d.pkg_height,
|
d.actual_weight, d.volume_weight, d.charge_weight, d.freight_rate, d.registration_fee, d.pkg_length, d.pkg_width, d.pkg_height,
|
||||||
d.currency, d.total_amount, d.remark, d.create_by, d.create_time,
|
d.currency, d.total_amount, d.product_amount, d.redline_amount, d.remark, d.create_by, d.create_time,
|
||||||
f.detail_fee_id as fee_detail_id, f.detail_id as fee_parent_detail_id,
|
f.detail_fee_id as fee_detail_id, f.detail_id as fee_parent_detail_id,
|
||||||
f.prc_income_bill_fee_id as fee_prc_income_bill_fee_id,
|
f.prc_income_bill_fee_id as fee_prc_income_bill_fee_id,
|
||||||
f.fee_no, f.fee_type, f.fee_name, f.sc_id as fee_sc_id, f.quantity as fee_quantity,
|
f.fee_no, f.fee_type, f.fee_name, f.sc_id as fee_sc_id, f.quantity as fee_quantity,
|
||||||
f.unit as fee_unit, f.unit_price as fee_unit_price, f.amount as fee_amount,
|
f.unit as fee_unit, f.unit_price as fee_unit_price, f.amount as fee_amount,
|
||||||
|
f.product_amount as fee_product_amount, f.redline_amount as fee_redline_amount,
|
||||||
f.currency as fee_currency, f.calculation_formula as fee_calculation_formula,
|
f.currency as fee_currency, f.calculation_formula as fee_calculation_formula,
|
||||||
f.round_mode as fee_round_mode, f.remark as fee_remark, f.create_by as fee_create_by,
|
f.round_mode as fee_round_mode, f.remark as fee_remark, f.create_by as fee_create_by,
|
||||||
f.create_time as fee_create_time
|
f.create_time as fee_create_time
|
||||||
@@ -100,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
||||||
product_code, product_name, goods_description, country_code, country_name, dest_postcode,
|
product_code, product_name, goods_description, country_code, country_name, dest_postcode,
|
||||||
actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
||||||
currency, total_amount, remark, create_by, create_time
|
currency, total_amount, product_amount, redline_amount, remark, create_by, create_time
|
||||||
from ar_bill_detail
|
from ar_bill_detail
|
||||||
where ar_bill_id = #{arBillId} and detail_no > #{lastDetailNo}
|
where ar_bill_id = #{arBillId} and detail_no > #{lastDetailNo}
|
||||||
order by detail_no
|
order by detail_no
|
||||||
@@ -113,12 +118,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
product_name, goods_description, country_code, country_name, dest_postcode,
|
product_name, goods_description, country_code, country_name, dest_postcode,
|
||||||
actual_weight,
|
actual_weight,
|
||||||
volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, currency,
|
volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, currency,
|
||||||
total_amount,
|
total_amount, product_amount, redline_amount,
|
||||||
remark, create_by, create_time)
|
remark, create_by, create_time)
|
||||||
values (#{arBillId}, #{prcOrderBillId}, #{detailNo}, #{orderNo}, #{trackingNo}, #{transferNo}, #{receiveTime},
|
values (#{arBillId}, #{prcOrderBillId}, #{detailNo}, #{orderNo}, #{trackingNo}, #{transferNo}, #{receiveTime},
|
||||||
#{productCode}, #{productName}, #{goodsDescription}, #{countryCode}, #{countryName},
|
#{productCode}, #{productName}, #{goodsDescription}, #{countryCode}, #{countryName},
|
||||||
#{destPostcode}, #{actualWeight}, #{volumeWeight}, #{chargeWeight}, #{freightRate}, #{registrationFee}, #{pkgLength}, #{pkgWidth},
|
#{destPostcode}, #{actualWeight}, #{volumeWeight}, #{chargeWeight}, #{freightRate}, #{registrationFee}, #{pkgLength}, #{pkgWidth},
|
||||||
#{pkgHeight}, #{currency}, #{totalAmount}, #{remark}, #{createBy}, sysdate())
|
#{pkgHeight}, #{currency}, #{totalAmount}, #{productAmount}, #{redlineAmount}, #{remark}, #{createBy}, sysdate())
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="detailId">
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="detailId">
|
||||||
@@ -126,6 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time, product_code,
|
ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time, product_code,
|
||||||
product_name, goods_description, country_code, country_name, dest_postcode, actual_weight,
|
product_name, goods_description, country_code, country_name, dest_postcode, actual_weight,
|
||||||
volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, currency, total_amount,
|
volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, currency, total_amount,
|
||||||
|
product_amount, redline_amount,
|
||||||
remark, create_by, create_time
|
remark, create_by, create_time
|
||||||
) values
|
) values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
@@ -133,7 +139,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{item.transferNo}, #{item.receiveTime}, #{item.productCode}, #{item.productName}, #{item.goodsDescription},
|
#{item.transferNo}, #{item.receiveTime}, #{item.productCode}, #{item.productName}, #{item.goodsDescription},
|
||||||
#{item.countryCode}, #{item.countryName}, #{item.destPostcode}, #{item.actualWeight},
|
#{item.countryCode}, #{item.countryName}, #{item.destPostcode}, #{item.actualWeight},
|
||||||
#{item.volumeWeight}, #{item.chargeWeight}, #{item.freightRate}, #{item.registrationFee}, #{item.pkgLength}, #{item.pkgWidth}, #{item.pkgHeight},
|
#{item.volumeWeight}, #{item.chargeWeight}, #{item.freightRate}, #{item.registrationFee}, #{item.pkgLength}, #{item.pkgWidth}, #{item.pkgHeight},
|
||||||
#{item.currency}, #{item.totalAmount}, #{item.remark}, #{item.createBy}, sysdate())
|
#{item.currency}, #{item.totalAmount}, #{item.productAmount}, #{item.redlineAmount},
|
||||||
|
#{item.remark}, #{item.createBy}, sysdate())
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where bill_id = #{billId}
|
where bill_id = #{billId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByBillIds" resultMap="PrcIncomeBillResult">
|
||||||
|
<include refid="selectPrcIncomeBillVo"/>
|
||||||
|
where bill_id in
|
||||||
|
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||||
|
#{billId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectByIncomeBillId" parameterType="String" resultMap="PrcIncomeBillResult">
|
<select id="selectByIncomeBillId" parameterType="String" resultMap="PrcIncomeBillResult">
|
||||||
<include refid="selectPrcIncomeBillVo"/>
|
<include refid="selectPrcIncomeBillVo"/>
|
||||||
where income_bill_id = #{incomeBillId}
|
where income_bill_id = #{incomeBillId}
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
-- 应收账单订单/费用快照增加产品价和红线价,并从可匹配的计费来源回填历史数据。
|
||||||
|
-- 字段保持可空:来源缺失或来源字段为空时,不将其伪造为 0。
|
||||||
|
|
||||||
|
SET @column_exists := (
|
||||||
|
SELECT COUNT(1) FROM information_schema.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ar_bill_detail' AND COLUMN_NAME = 'product_amount'
|
||||||
|
);
|
||||||
|
SET @sql := IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `ar_bill_detail` ADD COLUMN `product_amount` decimal(18,4) DEFAULT NULL COMMENT ''产品价合计快照'' AFTER `total_amount`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
SET @column_exists := (
|
||||||
|
SELECT COUNT(1) FROM information_schema.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ar_bill_detail' AND COLUMN_NAME = 'redline_amount'
|
||||||
|
);
|
||||||
|
SET @sql := IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `ar_bill_detail` ADD COLUMN `redline_amount` decimal(18,4) DEFAULT NULL COMMENT ''红线价合计快照'' AFTER `product_amount`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
SET @column_exists := (
|
||||||
|
SELECT COUNT(1) FROM information_schema.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ar_bill_detail_fee' AND COLUMN_NAME = 'product_amount'
|
||||||
|
);
|
||||||
|
SET @sql := IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `ar_bill_detail_fee` ADD COLUMN `product_amount` decimal(18,4) DEFAULT NULL COMMENT ''产品价快照'' AFTER `amount`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
SET @column_exists := (
|
||||||
|
SELECT COUNT(1) FROM information_schema.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ar_bill_detail_fee' AND COLUMN_NAME = 'redline_amount'
|
||||||
|
);
|
||||||
|
SET @sql := IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `ar_bill_detail_fee` ADD COLUMN `redline_amount` decimal(18,4) DEFAULT NULL COMMENT ''红线价快照'' AFTER `product_amount`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- 主表字段对应同一订单的整单合计;费用表字段对应同一来源费用 ID。
|
||||||
|
UPDATE `ar_bill_detail` d
|
||||||
|
INNER JOIN `prc_income_bill` p ON p.`bill_id` = d.`prc_order_bill_id`
|
||||||
|
SET d.`product_amount` = IF(d.`product_amount` IS NULL, p.`product_amount`, d.`product_amount`),
|
||||||
|
d.`redline_amount` = IF(d.`redline_amount` IS NULL, p.`redline_amount`, d.`redline_amount`)
|
||||||
|
WHERE d.`product_amount` IS NULL OR d.`redline_amount` IS NULL;
|
||||||
|
|
||||||
|
UPDATE `ar_bill_detail_fee` d
|
||||||
|
INNER JOIN `prc_income_bill_fee` p ON p.`fee_id` = d.`prc_income_bill_fee_id`
|
||||||
|
SET d.`product_amount` = IF(d.`product_amount` IS NULL, p.`product_amount`, d.`product_amount`),
|
||||||
|
d.`redline_amount` = IF(d.`redline_amount` IS NULL, p.`redline_amount`, d.`redline_amount`)
|
||||||
|
WHERE d.`product_amount` IS NULL OR d.`redline_amount` IS NULL;
|
||||||
@@ -125,6 +125,8 @@ CREATE TABLE `ar_bill_detail` (
|
|||||||
`pkg_height` decimal(10,2) DEFAULT NULL COMMENT '高度CM',
|
`pkg_height` decimal(10,2) DEFAULT NULL COMMENT '高度CM',
|
||||||
`currency` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '币种快照',
|
`currency` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '币种快照',
|
||||||
`total_amount` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '订单费用合计',
|
`total_amount` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '订单费用合计',
|
||||||
|
`product_amount` decimal(18,4) DEFAULT NULL COMMENT '产品价合计快照',
|
||||||
|
`redline_amount` decimal(18,4) DEFAULT NULL COMMENT '红线价合计快照',
|
||||||
`remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '订单账单备注',
|
`remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '订单账单备注',
|
||||||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '创建人',
|
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '创建人',
|
||||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
@@ -151,6 +153,8 @@ CREATE TABLE `ar_bill_detail_fee` (
|
|||||||
`unit` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '计费单位',
|
`unit` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '计费单位',
|
||||||
`unit_price` decimal(15,4) DEFAULT NULL COMMENT '费用单价',
|
`unit_price` decimal(15,4) DEFAULT NULL COMMENT '费用单价',
|
||||||
`amount` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '费用金额',
|
`amount` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '费用金额',
|
||||||
|
`product_amount` decimal(18,4) DEFAULT NULL COMMENT '产品价快照',
|
||||||
|
`redline_amount` decimal(18,4) DEFAULT NULL COMMENT '红线价快照',
|
||||||
`currency` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '币种',
|
`currency` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '币种',
|
||||||
`calculation_formula` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '计算公式或说明',
|
`calculation_formula` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '计算公式或说明',
|
||||||
`round_mode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '取舍规则',
|
`round_mode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '取舍规则',
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
<el-table-column prop="feeType" label="费用类型" width="140" />
|
<el-table-column prop="feeType" label="费用类型" width="140" />
|
||||||
<el-table-column prop="feeName" label="费用名称" min-width="160" />
|
<el-table-column prop="feeName" label="费用名称" min-width="160" />
|
||||||
<el-table-column prop="amount" label="金额" width="120" align="right"><template #default="{ row: fee }">{{ money(fee.amount) }}</template></el-table-column>
|
<el-table-column prop="amount" label="金额" width="120" align="right"><template #default="{ row: fee }">{{ money(fee.amount) }}</template></el-table-column>
|
||||||
|
<el-table-column prop="productAmount" label="产品价" width="120" align="right"><template #default="{ row: fee }">{{ amount4(fee.productAmount) }}</template></el-table-column>
|
||||||
|
<el-table-column prop="redlineAmount" label="红线价" width="120" align="right"><template #default="{ row: fee }">{{ amount4(fee.redlineAmount) }}</template></el-table-column>
|
||||||
<el-table-column prop="currency" label="币种" width="80" />
|
<el-table-column prop="currency" label="币种" width="80" />
|
||||||
<el-table-column prop="remark" label="说明" show-overflow-tooltip />
|
<el-table-column prop="remark" label="说明" show-overflow-tooltip />
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -42,6 +44,8 @@
|
|||||||
<el-table-column label="目的地" min-width="120"><template #default="{ row }">{{ row.countryName || row.countryCode || '-' }}</template></el-table-column>
|
<el-table-column label="目的地" min-width="120"><template #default="{ row }">{{ row.countryName || row.countryCode || '-' }}</template></el-table-column>
|
||||||
<el-table-column label="重量/尺寸" min-width="170"><template #default="{ row }">{{ row.chargeWeight || '-' }} kg / {{ dimensions(row) }}</template></el-table-column>
|
<el-table-column label="重量/尺寸" min-width="170"><template #default="{ row }">{{ row.chargeWeight || '-' }} kg / {{ dimensions(row) }}</template></el-table-column>
|
||||||
<el-table-column prop="totalAmount" label="订单金额" width="120" align="right"><template #default="{ row }">{{ money(row.totalAmount) }}</template></el-table-column>
|
<el-table-column prop="totalAmount" label="订单金额" width="120" align="right"><template #default="{ row }">{{ money(row.totalAmount) }}</template></el-table-column>
|
||||||
|
<el-table-column prop="productAmount" label="整单产品价" width="130" align="right"><template #default="{ row }">{{ amount4(row.productAmount) }}</template></el-table-column>
|
||||||
|
<el-table-column prop="redlineAmount" label="整单红线价" width="130" align="right"><template #default="{ row }">{{ amount4(row.redlineAmount) }}</template></el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-pagination
|
<el-pagination
|
||||||
v-if="detailTotal > 0"
|
v-if="detailTotal > 0"
|
||||||
@@ -131,6 +135,7 @@ function handleExpandChange(row, expandedRows) {
|
|||||||
|
|
||||||
function date(value) { return value ? String(value).slice(0, 10) : '-' }
|
function date(value) { return value ? String(value).slice(0, 10) : '-' }
|
||||||
function money(value) { const num = Number(value); return Number.isNaN(num) ? '-' : num.toFixed(2) }
|
function money(value) { const num = Number(value); return Number.isNaN(num) ? '-' : num.toFixed(2) }
|
||||||
|
function amount4(value) { if (value == null || value === '') return '-'; const num = Number(value); return Number.isNaN(num) ? '-' : num.toFixed(4) }
|
||||||
function statusText(value) { return arEnumLabel(AR_BILL_STATUS_OPTIONS, value) }
|
function statusText(value) { return arEnumLabel(AR_BILL_STATUS_OPTIONS, value) }
|
||||||
function statusType(value) { return AR_BILL_STATUS_TYPES[value] || 'info' }
|
function statusType(value) { return AR_BILL_STATUS_TYPES[value] || 'info' }
|
||||||
function exportStatusText(value) { return arEnumLabel(AR_EXPORT_STATUS_OPTIONS, value) }
|
function exportStatusText(value) { return arEnumLabel(AR_EXPORT_STATUS_OPTIONS, value) }
|
||||||
|
|||||||
Reference in New Issue
Block a user