Merge branch 'master' of http://git.lionquexpress.com/wuweihua/BMS
This commit is contained in:
@@ -32,6 +32,8 @@ public class ArBillDetail implements Serializable {
|
||||
private String countryName;
|
||||
private String destPostcode;
|
||||
private BigDecimal actualWeight;
|
||||
/** prc_order_bill.weight 来源快照。 */
|
||||
private BigDecimal weight;
|
||||
private BigDecimal volumeWeight;
|
||||
private BigDecimal chargeWeight;
|
||||
/** 订单计费时命中的运费单价快照,对应 prc_order_bill.freight_rate。 */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.bms.ar.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.bms.ar.domain.ArBillDetail;
|
||||
@@ -19,6 +20,8 @@ public interface ArBillDetailMapper {
|
||||
List<ArBillDetail> selectExportPage(@Param("arBillId") Long arBillId,
|
||||
@Param("lastDetailNo") Integer lastDetailNo, @Param("pageSize") Integer pageSize);
|
||||
|
||||
Map<String, Object> selectReceiveTimeRangeByBillId(@Param("arBillId") Long arBillId);
|
||||
|
||||
int insert(ArBillDetail detail);
|
||||
|
||||
int insertBatch(List<ArBillDetail> details);
|
||||
|
||||
@@ -12,6 +12,8 @@ import java.nio.file.StandardCopyOption;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@@ -1159,7 +1161,7 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
detail.setOrderNo(source.getOrderNo());
|
||||
detail.setTrackingNo(source.getTrackingNo());
|
||||
detail.setTransferNo(source.getTransferNo());
|
||||
detail.setReceiveTime(source.getOrderTime());
|
||||
detail.setReceiveTime(source.getPickupDate());
|
||||
detail.setProductCode(source.getProductCode());
|
||||
detail.setProductName(source.getProductName());
|
||||
detail.setGoodsDescription(source.getOrderRemark());
|
||||
@@ -1167,6 +1169,7 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
detail.setCountryName(source.getCountryName());
|
||||
detail.setDestPostcode(source.getDestPostcode());
|
||||
detail.setActualWeight(source.getActualWeight());
|
||||
detail.setWeight(source.getWeight());
|
||||
detail.setVolumeWeight(source.getVolumeWeight());
|
||||
detail.setChargeWeight(source.getChargeWeight() == null ? source.getWeight() : source.getChargeWeight());
|
||||
detail.setFreightRate(source.getFreightRate());
|
||||
@@ -1319,6 +1322,7 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
}
|
||||
|
||||
Map<Integer, String> templateRows = extractTemplateRows(templateXml.substring(sheetDataOpenEnd + 1, sheetDataEnd));
|
||||
Map<String, Object> receiveTimeRange = detailMapper.selectReceiveTimeRangeByBillId(bill.getArBillId());
|
||||
String prefix = adjustExportColumnWidths(
|
||||
removeSheetDimension(templateXml.substring(0, sheetDataOpenEnd + 1)));
|
||||
writeUtf8(output, prefix);
|
||||
@@ -1329,7 +1333,7 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
writeUtf8(output, templateRows.get(2));
|
||||
String customerRow = replaceCellXml(templateRows.get(3), "C3", bill.getCustomerName(), false);
|
||||
// 账单所属期区域为 O3:T3 合并单元格,必须写入左上角 O3 才能显示。
|
||||
customerRow = replaceCellXml(customerRow, "O3", exportPeriod(bill), false);
|
||||
customerRow = replaceCellXml(customerRow, "O3", exportReceiveTimeRange(receiveTimeRange), false);
|
||||
writeUtf8(output, customerRow);
|
||||
writeUtf8(output, templateRows.get(4));
|
||||
|
||||
@@ -1493,10 +1497,10 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
detail.getOrderNo(), detail.getTrackingNo(),
|
||||
StringUtils.isEmpty(detail.getProductName()) ? detail.getProductCode() : detail.getProductName(),
|
||||
StringUtils.isEmpty(detail.getCountryName()) ? detail.getCountryCode() : detail.getCountryName(),
|
||||
detail.getDestPostcode(), decimal(detail.getActualWeight(), 3), decimal(detail.getPkgLength(), 2),
|
||||
detail.getDestPostcode(), decimal(detail.getWeight(), 3), decimal(detail.getPkgLength(), 2),
|
||||
decimal(detail.getPkgHeight(), 2), decimal(detail.getPkgWidth(), 2), decimal(detail.getVolumeWeight(), 3),
|
||||
decimal(detail.getChargeWeight(), 3), exportUnitPrice(detail), exportProcessingFee(detail),
|
||||
exportFormula(detail), exportFeeTypes(detail), detail.getCurrency(), detail.getTotalAmount(), exportRemark(detail)
|
||||
exportFormula(detail), exportFeeType(), detail.getCurrency(), detail.getTotalAmount(), exportRemark(detail)
|
||||
};
|
||||
StringBuilder row = new StringBuilder(2048);
|
||||
row.append("<row r=\"").append(rowNumber).append("\" ht=\"24.0\" customHeight=\"true\" spans=\"1:20\">");
|
||||
@@ -1731,17 +1735,32 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
return StringUtils.isEmpty(detail.getRemark()) ? detail.getGoodsDescription() : detail.getRemark();
|
||||
}
|
||||
|
||||
private String exportPeriod(ArBill bill) {
|
||||
Date start = bill.getBillPeriodStart();
|
||||
Date end = bill.getBillPeriodEnd();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
if (start != null && end != null) {
|
||||
return format.format(start) + " 至 " + format.format(end);
|
||||
private String exportReceiveTimeRange(Map<String, Object> receiveTimeRange) {
|
||||
if (receiveTimeRange == null) {
|
||||
return "";
|
||||
}
|
||||
if (start != null) {
|
||||
return format.format(start) + " 起";
|
||||
String start = formatReceiveDate(receiveTimeRange.get("minReceiveTime"));
|
||||
String end = formatReceiveDate(receiveTimeRange.get("maxReceiveTime"));
|
||||
return StringUtils.isEmpty(start) || StringUtils.isEmpty(end) ? "" : start + " 至 " + end;
|
||||
}
|
||||
|
||||
private String formatReceiveDate(Object value) {
|
||||
if (value instanceof LocalDateTime) {
|
||||
return ((LocalDateTime) value).toLocalDate().toString();
|
||||
}
|
||||
return end == null ? "" : "截至 " + format.format(end);
|
||||
if (value instanceof LocalDate) {
|
||||
return value.toString();
|
||||
}
|
||||
if (value instanceof java.sql.Date) {
|
||||
return ((java.sql.Date) value).toLocalDate().toString();
|
||||
}
|
||||
if (value instanceof Date) {
|
||||
return new SimpleDateFormat("yyyy-MM-dd").format((Date) value);
|
||||
}
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
throw new IllegalArgumentException("不支持的收货时间类型: " + value.getClass().getName());
|
||||
}
|
||||
|
||||
private BigDecimal exportUnitPrice(ArBillDetail detail) {
|
||||
@@ -1766,8 +1785,8 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
return "结算重量*公斤价" + (processing ? "+处理费" : "") + (surcharge ? "+附加费" : "");
|
||||
}
|
||||
|
||||
private String exportFeeTypes(ArBillDetail detail) {
|
||||
return joinFeeText(detail.getFees(), false);
|
||||
private String exportFeeType() {
|
||||
return "运费";
|
||||
}
|
||||
|
||||
private String joinFeeText(List<ArBillDetailFee> fees, boolean formula) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.bms.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -59,6 +60,9 @@ public class PrcOrderBill extends BaseEntity
|
||||
private String warehouseCode;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderTime;
|
||||
/** 应收来源查询专用:从 prc_order_bill_ext.pickup_date 读取的收件时间。 */
|
||||
@JsonIgnore
|
||||
private Date pickupDate;
|
||||
private String orderRemark;
|
||||
private String productCode;
|
||||
private String productName;
|
||||
@@ -67,7 +71,8 @@ public class PrcOrderBill extends BaseEntity
|
||||
private String countryCode;
|
||||
private String countryName;
|
||||
private BigDecimal weight;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
/** 计费时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date bizDate;
|
||||
private Long tmsId;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class TmsPriceQuoteRequest implements Serializable
|
||||
@NotNull(message = "weight is required")
|
||||
private BigDecimal weight;
|
||||
|
||||
/** yyyy-MM-dd,默认今天 */
|
||||
/** yyyy-MM-dd or yyyy-MM-dd HH:mm:ss; quote defaults today; bill required */
|
||||
private String bizDate;
|
||||
private Integer tmsId;
|
||||
/** Header X-Api-Code 优先;Body 兜底 */
|
||||
|
||||
@@ -62,7 +62,7 @@ public class OracleOrderBillMapper
|
||||
req.setConsigneeName(firstStr(row, "CONSIGNEE_NAME"));
|
||||
req.setWarehouseCode(firstStr(row, "REGISTER_SITE_CODE"));
|
||||
req.setOrderRemark(firstStr(row, "TRACK_REMARK", "EXCEPTION_REMARK", "ORDER_CUSTOMNOTE"));
|
||||
// CREATE_DATE is order place time only; bizDate (billing date) comes from mobile inbound task.
|
||||
// CREATE_DATE is order place time only; bizDate (billing datetime) comes from task.bill_time.
|
||||
Date createDate = firstDate(row, "CREATE_DATE");
|
||||
if (createDate != null)
|
||||
{
|
||||
|
||||
+2
-2
@@ -182,8 +182,8 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
{
|
||||
billReq.setOrderNo(task.getOrderNo());
|
||||
}
|
||||
// Billing date from task.bill_time (mobile), not Oracle CREATE_DATE.
|
||||
billReq.setBizDate(new SimpleDateFormat("yyyy-MM-dd").format(task.getBillTime()));
|
||||
// Billing datetime from task.bill_time (keep HH:mm:ss), not Oracle CREATE_DATE.
|
||||
billReq.setBizDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(task.getBillTime()));
|
||||
task.setCustomerCode(billReq.getCustomerCode());
|
||||
|
||||
TmsPriceQuoteResult result = billWithDbRetry(taskId, billReq);
|
||||
|
||||
+4
-7
@@ -2,8 +2,6 @@ package com.bms.price.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Arrays;
|
||||
@@ -27,6 +25,7 @@ import com.bms.ar.enums.ArOrderBillStatus;
|
||||
import com.bms.common.annotation.DataScope;
|
||||
import com.bms.common.core.domain.entity.SysUser;
|
||||
import com.bms.common.exception.ServiceException;
|
||||
import com.bms.common.utils.DateUtils;
|
||||
import com.bms.common.utils.DictUtils;
|
||||
import com.bms.common.utils.MessageUtils;
|
||||
import com.bms.common.utils.SecurityUtils;
|
||||
@@ -1709,13 +1708,11 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.bizDateRequired"));
|
||||
}
|
||||
try
|
||||
{
|
||||
return new SimpleDateFormat("yyyy-MM-dd").parse(bizDate.trim());
|
||||
}
|
||||
catch (ParseException e)
|
||||
Date parsed = DateUtils.parseDate(bizDate.trim());
|
||||
if (parsed == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.quote.bizDateInvalid"));
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bms.common.exception.ServiceException;
|
||||
import com.bms.common.utils.DateUtils;
|
||||
import com.bms.common.utils.MessageUtils;
|
||||
import com.bms.common.utils.StringUtils;
|
||||
import com.bms.common.utils.sign.Md5Utils;
|
||||
@@ -1630,14 +1631,12 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
return new Date();
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
return new SimpleDateFormat("yyyy-MM-dd").parse(bizDate.trim());
|
||||
}
|
||||
catch (ParseException e)
|
||||
Date parsed = DateUtils.parseDate(bizDate.trim());
|
||||
if (parsed == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.quote.bizDateInvalid"));
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
|
||||
/** Use end of bill day so same-day version activate still matches that day's quote. */
|
||||
|
||||
@@ -20,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="countryName" column="country_name"/>
|
||||
<result property="destPostcode" column="dest_postcode"/>
|
||||
<result property="actualWeight" column="actual_weight"/>
|
||||
<result property="weight" column="weight"/>
|
||||
<result property="volumeWeight" column="volume_weight"/>
|
||||
<result property="chargeWeight" column="charge_weight"/>
|
||||
<result property="freightRate" column="freight_rate"/>
|
||||
@@ -39,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectByBillId" parameterType="long" resultMap="ArBillDetailResult">
|
||||
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,
|
||||
actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
||||
actual_weight, weight, 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
|
||||
from ar_bill_detail where ar_bill_id = #{arBillId} order by detail_no
|
||||
</select>
|
||||
@@ -47,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectByBillIdAndSourceIds" resultMap="ArBillDetailResult">
|
||||
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,
|
||||
actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
||||
actual_weight, weight, 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
|
||||
from ar_bill_detail
|
||||
where ar_bill_id = #{arBillId}
|
||||
@@ -85,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectByBillIdWithFees" parameterType="long" resultMap="ArBillDetailWithFeesResult">
|
||||
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.freight_rate, d.registration_fee, d.pkg_length, d.pkg_width, d.pkg_height,
|
||||
d.actual_weight, d.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.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.prc_income_bill_fee_id as fee_prc_income_bill_fee_id,
|
||||
@@ -104,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectExportPage" resultMap="ArBillDetailResult">
|
||||
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,
|
||||
actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
||||
actual_weight, weight, 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
|
||||
from ar_bill_detail
|
||||
where ar_bill_id = #{arBillId} and detail_no > #{lastDetailNo}
|
||||
@@ -112,24 +113,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
limit #{pageSize}
|
||||
</select>
|
||||
|
||||
<select id="selectReceiveTimeRangeByBillId" resultType="map">
|
||||
select min(receive_time) as minReceiveTime, max(receive_time) as maxReceiveTime
|
||||
from ar_bill_detail
|
||||
where ar_bill_id = #{arBillId}
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="ArBillDetail" useGeneratedKeys="true" keyProperty="detailId">
|
||||
insert into ar_bill_detail (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,
|
||||
actual_weight, weight,
|
||||
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)
|
||||
values (#{arBillId}, #{prcOrderBillId}, #{detailNo}, #{orderNo}, #{trackingNo}, #{transferNo}, #{receiveTime},
|
||||
#{productCode}, #{productName}, #{goodsDescription}, #{countryCode}, #{countryName},
|
||||
#{destPostcode}, #{actualWeight}, #{volumeWeight}, #{chargeWeight}, #{freightRate}, #{registrationFee}, #{pkgLength}, #{pkgWidth},
|
||||
#{destPostcode}, #{actualWeight}, #{weight}, #{volumeWeight}, #{chargeWeight}, #{freightRate}, #{registrationFee}, #{pkgLength}, #{pkgWidth},
|
||||
#{pkgHeight}, #{currency}, #{totalAmount}, #{productAmount}, #{redlineAmount}, #{remark}, #{createBy}, sysdate())
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="detailId">
|
||||
insert into ar_bill_detail (
|
||||
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, weight,
|
||||
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
|
||||
@@ -137,7 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.arBillId}, #{item.prcOrderBillId}, #{item.detailNo}, #{item.orderNo}, #{item.trackingNo},
|
||||
#{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.weight},
|
||||
#{item.volumeWeight}, #{item.chargeWeight}, #{item.freightRate}, #{item.registrationFee}, #{item.pkgLength}, #{item.pkgWidth}, #{item.pkgHeight},
|
||||
#{item.currency}, #{item.totalAmount}, #{item.productAmount}, #{item.redlineAmount},
|
||||
#{item.remark}, #{item.createBy}, sysdate())
|
||||
|
||||
@@ -76,6 +76,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="PrcOrderBill" id="PrcOrderBillArSourceResult" extends="PrcOrderBillResult">
|
||||
<result property="pickupDate" column="pickup_date"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcOrderBillVo">
|
||||
select bill_id, bill_key, order_no, tracking_no, transfer_no,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man, service_man_code,
|
||||
@@ -99,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
p.belong_saler, p.belong_saler_code, p.settlement_man, p.settlement_man_code, p.service_man, p.service_man_code,
|
||||
p.customer_id, p.customer_code, p.customer_name,
|
||||
p.pieces, p.actual_weight, p.volume, p.volume_weight, p.pkg_length, p.pkg_width, p.pkg_height,
|
||||
p.shipper_name, p.consignee_name, p.dest_postcode, p.warehouse_code, p.order_time, p.order_remark,
|
||||
p.shipper_name, p.consignee_name, p.dest_postcode, p.warehouse_code, p.order_time, e.pickup_date, p.order_remark,
|
||||
p.product_code, p.product_name, p.country_code, p.country_name, p.weight, p.biz_date, p.tms_id,
|
||||
p.match_source, p.match_message, p.price_set_id, p.price_set_code, p.price_set_name,
|
||||
p.set_type, p.bind_priority, p.customer_priceset_id, p.psv_id, p.psd_id, p.product_country_id,
|
||||
@@ -114,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
p.customer_active_status, p.credit_arrears_status, p.round_mode,
|
||||
p.created_by, p.create_time, p.updated_by, p.update_time
|
||||
from prc_order_bill p
|
||||
left join prc_order_bill_ext e on e.bill_id = p.bill_id
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcOrderBillByOrderNo" parameterType="String" resultMap="PrcOrderBillResult">
|
||||
@@ -341,7 +346,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcOrderBillByCustomerPeriod" resultMap="PrcOrderBillResult">
|
||||
<select id="selectPrcOrderBillByCustomerPeriod" resultMap="PrcOrderBillArSourceResult">
|
||||
<include refid="selectArBillSourceVo"/>
|
||||
where p.customer_id = #{customerId}
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
@@ -457,7 +462,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</sql>
|
||||
|
||||
<!-- 异步生成使用 bill_id 游标批量读取,避免深分页和一次加载全量订单。 -->
|
||||
<select id="selectPrcOrderBillByCustomerPeriodCursor" resultMap="PrcOrderBillResult">
|
||||
<select id="selectPrcOrderBillByCustomerPeriodCursor" resultMap="PrcOrderBillArSourceResult">
|
||||
<include refid="selectArBillSourceVo"/>
|
||||
<include refid="customerPeriodConditions"/>
|
||||
<if test="lastSourceBillId != null and lastSourceBillId != ''">
|
||||
@@ -474,7 +479,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="customerPeriodConditions"/>
|
||||
</select>
|
||||
|
||||
<select id="selectPrcOrderBillByCustomerCutoffAndIds" resultMap="PrcOrderBillResult">
|
||||
<select id="selectPrcOrderBillByCustomerCutoffAndIds" resultMap="PrcOrderBillArSourceResult">
|
||||
<include refid="selectArBillSourceVo"/>
|
||||
where p.customer_id = #{customerId}
|
||||
and p.biz_date <= #{cutoffDate}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
-- 应收账单的收货时间应取订单扩展表 pickup_date,而非订单主表 order_time。
|
||||
-- 只修正存在扩展表来源的快照;pickup_date 为空时保留 NULL,不回退到 order_time。
|
||||
UPDATE `ar_bill_detail` d
|
||||
INNER JOIN `prc_order_bill_ext` e ON e.`bill_id` = d.`prc_order_bill_id`
|
||||
SET d.`receive_time` = e.`pickup_date`
|
||||
WHERE NOT (d.`receive_time` <=> e.`pickup_date`);
|
||||
@@ -0,0 +1,21 @@
|
||||
-- 应收账单订单明细冗余 prc_order_bill.weight,供账单导出使用。
|
||||
-- 来源字段为空时快照保留 NULL,不伪造为 0。
|
||||
|
||||
SET @column_exists := (
|
||||
SELECT COUNT(1) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'ar_bill_detail'
|
||||
AND COLUMN_NAME = 'weight'
|
||||
);
|
||||
SET @sql := IF(@column_exists = 0,
|
||||
'ALTER TABLE `ar_bill_detail` ADD COLUMN `weight` decimal(10,3) DEFAULT NULL COMMENT ''prc_order_bill.weight来源快照'' AFTER `actual_weight`',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
UPDATE `ar_bill_detail` d
|
||||
INNER JOIN `prc_order_bill` p ON p.`bill_id` = d.`prc_order_bill_id`
|
||||
SET d.`weight` = p.`weight`
|
||||
WHERE d.`weight` IS NULL AND p.`weight` IS NOT NULL;
|
||||
@@ -116,6 +116,7 @@ CREATE TABLE `ar_bill_detail` (
|
||||
`country_name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '目的国家名称',
|
||||
`dest_postcode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '目的邮编',
|
||||
`actual_weight` decimal(12,3) DEFAULT NULL COMMENT '实际重量KG',
|
||||
`weight` decimal(10,3) DEFAULT NULL COMMENT 'prc_order_bill.weight来源快照',
|
||||
`volume_weight` decimal(12,3) DEFAULT NULL COMMENT '材积重量KG',
|
||||
`charge_weight` decimal(12,3) DEFAULT NULL COMMENT '计费重量KG',
|
||||
`freight_rate` decimal(10,4) DEFAULT NULL COMMENT '运费单价快照',
|
||||
@@ -1019,7 +1020,7 @@ CREATE TABLE `prc_order_bill` (
|
||||
`country_code` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '国家二字码',
|
||||
`country_name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '国家名称',
|
||||
`weight` decimal(10,3) NOT NULL COMMENT '计费重量KG',
|
||||
`biz_date` date NOT NULL COMMENT '计费日期',
|
||||
`biz_date` datetime NOT NULL COMMENT '计费时间',
|
||||
`tms_id` bigint(20) DEFAULT NULL COMMENT '多租户系统ID',
|
||||
`match_source` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '命中来源',
|
||||
`match_message` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '命中说明',
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- prc_order_bill.biz_date: date -> datetime (keep hour/minute/second)
|
||||
ALTER TABLE prc_order_bill
|
||||
MODIFY COLUMN `biz_date` datetime NOT NULL COMMENT '计费时间';
|
||||
@@ -69,7 +69,7 @@
|
||||
<el-table-column prop="trackingNo" label="运单号" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="transferNo" label="转单号" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="customerName" label="客户" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="bizDate" label="业务日期" width="105" :formatter="formatDateColumn" />
|
||||
<el-table-column prop="bizDate" label="业务日期" width="170" :formatter="formatDateColumn" />
|
||||
<el-table-column prop="productName" label="产品" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="countryName" label="国家/地区" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="actualWeight" label="实际重(kg)" width="105" align="right" :formatter="formatNumberColumn" />
|
||||
@@ -107,7 +107,7 @@
|
||||
<el-table-column prop="trackingNo" label="运单号" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="transferNo" label="转单号" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="customerName" label="客户" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="bizDate" label="业务日期" width="120" :formatter="formatDateColumn" />
|
||||
<el-table-column prop="bizDate" label="业务日期" width="170" :formatter="formatDateColumn" />
|
||||
<el-table-column prop="incomeTotal" label="应收金额" width="130" align="right" :formatter="formatNumberColumn" />
|
||||
<el-table-column prop="currency" label="币种" width="80" />
|
||||
</el-table>
|
||||
@@ -533,7 +533,11 @@ function confirmGenerate() {
|
||||
})
|
||||
}
|
||||
|
||||
function date(value) { return value ? String(value).slice(0, 10) : '-' }
|
||||
function date(value) {
|
||||
if (!value) return '-'
|
||||
const s = String(value).replace('T', ' ')
|
||||
return s.length >= 19 ? s.slice(0, 19) : (s.length >= 10 ? s.slice(0, 10) : s)
|
||||
}
|
||||
function money(value) { const num = Number(value); return Number.isNaN(num) ? '-' : num.toFixed(2) }
|
||||
function formatDateColumn(_, __, value) { return date(value) }
|
||||
function formatNumberColumn(_, __, value) { return Number(value || 0).toFixed(2) }
|
||||
|
||||
@@ -152,6 +152,7 @@ const columns = [
|
||||
{ label: '计价来源', prop: 'matchSource', align: 'center', width: 130, slot: 'matchSource' },
|
||||
{ label: '客户状态', prop: 'customerActiveStatus', align: 'center', width: 100, slot: 'customerActiveStatus' },
|
||||
{ label: '额度欠费', prop: 'creditArrearsStatus', align: 'center', width: 100, slot: 'creditArrearsStatus' },
|
||||
{ label: '计费时间', prop: 'bizDate', align: 'center', width: 170, parseTime: true },
|
||||
{ label: '下单时间', prop: 'orderTime', align: 'center', width: 170, parseTime: true },
|
||||
{ label: '销售员', prop: 'belongSaler', minWidth: 100, showOverflowTooltip: true },
|
||||
{ label: '结算员', prop: 'settlementMan', minWidth: 100, showOverflowTooltip: true },
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<el-descriptions-item label="产品">{{ productLabel(detail) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="计费重量(kg)">{{ formatWeight(detail.chargeWeight ?? detail.weight) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="重量段">{{ detail.weightLabel || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="计费日期">{{ detail.bizDate || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="计费时间">{{ detail.bizDate || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="计价来源">
|
||||
<el-tag size="small" :type="sourceTagType(detail.matchSource)">{{ sourceLabel(detail.matchSource) }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
|
||||
Reference in New Issue
Block a user