🐛 修正应收账单收货时间来源为订单扩展表
This commit is contained in:
@@ -1159,7 +1159,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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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`);
|
||||
Reference in New Issue
Block a user