diff --git a/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetail.java b/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetail.java index 16b85456..f16c5606 100644 --- a/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetail.java +++ b/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetail.java @@ -34,6 +34,10 @@ public class ArBillDetail implements Serializable { private BigDecimal actualWeight; private BigDecimal volumeWeight; private BigDecimal chargeWeight; + /** 订单计费时命中的运费单价快照,对应 prc_order_bill.freight_rate。 */ + private BigDecimal freightRate; + /** 订单计费时的标准处理费快照,对应 prc_order_bill.registration_fee。 */ + private BigDecimal registrationFee; private BigDecimal pkgLength; private BigDecimal pkgWidth; private BigDecimal pkgHeight; diff --git a/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java index 63fe9b5a..889ce3bd 100644 --- a/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java @@ -1142,6 +1142,8 @@ public class ArBillServiceImpl implements IArBillService { detail.setActualWeight(source.getActualWeight()); detail.setVolumeWeight(source.getVolumeWeight()); detail.setChargeWeight(source.getChargeWeight() == null ? source.getWeight() : source.getChargeWeight()); + detail.setFreightRate(source.getFreightRate()); + detail.setRegistrationFee(source.getRegistrationFee()); detail.setPkgLength(source.getPkgLength()); detail.setPkgWidth(source.getPkgWidth()); detail.setPkgHeight(source.getPkgHeight()); @@ -1614,42 +1616,11 @@ public class ArBillServiceImpl implements IArBillService { } private BigDecimal exportUnitPrice(ArBillDetail detail) { - BigDecimal direct = firstFeeUnitPrice(detail.getFees()); - if (direct != null) { - return direct; - } - BigDecimal freight = feeAmount(detail, "BASIC_FREIGHT"); - if (freight == null || detail.getChargeWeight() == null || detail.getChargeWeight().compareTo(BigDecimal.ZERO) <= 0) { - return null; - } - return freight.divide(detail.getChargeWeight(), 4, java.math.RoundingMode.HALF_UP); - } - - private BigDecimal firstFeeUnitPrice(List fees) { - if (fees == null) { - return null; - } - for (ArBillDetailFee fee : fees) { - if (fee.getUnitPrice() != null) { - return fee.getUnitPrice(); - } - } - return null; + return detail == null ? null : detail.getFreightRate(); } private BigDecimal exportProcessingFee(ArBillDetail detail) { - BigDecimal total = BigDecimal.ZERO; - boolean found = false; - if (detail.getFees() != null) { - for (ArBillDetailFee fee : detail.getFees()) { - String name = fee.getFeeName() == null ? "" : fee.getFeeName(); - if ("REGISTRATION_FEE".equalsIgnoreCase(fee.getFeeType()) || name.contains("处理费")) { - total = total.add(nvl(fee.getAmount())); - found = true; - } - } - } - return found ? total : null; + return detail == null ? null : detail.getRegistrationFee(); } private String exportFormula(ArBillDetail detail) { diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/BmsProductServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/BmsProductServiceImpl.java index 2453fb53..edb5b081 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/BmsProductServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/BmsProductServiceImpl.java @@ -1586,10 +1586,17 @@ public class BmsProductServiceImpl implements IBmsProductService { return null; } + s = s.trim(); + // Excel NA markers: / 、- 、— 、N/A + if ("/".equals(s) || "-".equals(s) || "\u2014".equals(s) || "\uff0d".equals(s) + || "N/A".equalsIgnoreCase(s) || "NA".equalsIgnoreCase(s)) + { + return null; + } // strip currency / unit suffixes: 56、56元、56 RMB s = s.replace(",", "").replace("\uffe5", "").replace("\u5143", "") .replace("RMB", "").replace("rmb", "").trim(); - if (s.isEmpty()) + if (s.isEmpty() || "/".equals(s)) { return null; } diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcPriceSetServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcPriceSetServiceImpl.java index c6f57b97..1c5c3bd3 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcPriceSetServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcPriceSetServiceImpl.java @@ -1031,7 +1031,12 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService } continue; } - // New band: always insert weight/country row (fees may be null; editable later). + // New band: skip when Excel has no usable fee (blank / slash = no service). + if (freight == null && registration == null) + { + skippedFee++; + continue; + } PrcPriceSetDetail created = buildDetailFromImportRow( priceSetId, psvId, productCode, productName, row, freight, registration); created.setPspId(pspId); @@ -1041,10 +1046,6 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService { touched.add(created.getPsdId()); } - if (freight == null && registration == null) - { - skippedFee++; - } inserted++; } } diff --git a/bms-back/bms-system/src/main/resources/mapper/ar/ArBillDetailMapper.xml b/bms-back/bms-system/src/main/resources/mapper/ar/ArBillDetailMapper.xml index bb27940a..7aae0fd5 100644 --- a/bms-back/bms-system/src/main/resources/mapper/ar/ArBillDetailMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/ar/ArBillDetailMapper.xml @@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -35,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -43,7 +45,7 @@ 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, 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.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, 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, @@ -97,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"