🐛 修复应收账单单价和处理费快照

This commit is contained in:
caojia
2026-09-30 14:47:18 +08:00
parent 90cde8da4a
commit 4475bff243
5 changed files with 37 additions and 41 deletions
@@ -0,0 +1,17 @@
-- 应收账单订单明细保留订单计费时实际命中的运费单价快照。
ALTER TABLE `ar_bill_detail`
ADD COLUMN `freight_rate` decimal(10,4) DEFAULT NULL COMMENT '运费单价快照' AFTER `charge_weight`;
ALTER TABLE `ar_bill_detail`
ADD COLUMN `registration_fee` decimal(10,2) DEFAULT NULL COMMENT '处理费快照' AFTER `freight_rate`;
-- 回填已生成的历史应收账单,避免导出单价为空。
UPDATE `ar_bill_detail` d
INNER JOIN `prc_order_bill` p ON p.`bill_id` = d.`prc_order_bill_id`
SET d.`freight_rate` = p.`freight_rate`
WHERE d.`freight_rate` IS NULL;
UPDATE `ar_bill_detail` d
INNER JOIN `prc_order_bill` p ON p.`bill_id` = d.`prc_order_bill_id`
SET d.`registration_fee` = p.`registration_fee`
WHERE d.`registration_fee` IS NULL;
+2
View File
@@ -118,6 +118,8 @@ CREATE TABLE `ar_bill_detail` (
`actual_weight` decimal(12,3) DEFAULT NULL COMMENT '实际重量KG',
`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 '运费单价快照',
`registration_fee` decimal(10,2) DEFAULT NULL COMMENT '处理费快照',
`pkg_length` decimal(10,2) DEFAULT NULL COMMENT '长度CM',
`pkg_width` decimal(10,2) DEFAULT NULL COMMENT '宽度CM',
`pkg_height` decimal(10,2) DEFAULT NULL COMMENT '高度CM',