27 lines
1.9 KiB
SQL
27 lines
1.9 KiB
SQL
-- VOL_8000: charge_weight = max(L*W*H/8000, volume_weight)
|
|
-- customer_code column stores 对外代码 customer_code_dw (C00222/C00562/C00521/C00805)
|
|
SET NAMES utf8mb4;
|
|
|
|
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark)
|
|
SELECT 2, N'材积重8000取大', 'VOL_8000', 'bms_biz_rule_type', '', 'success', 'N', '0', 'admin', sysdate(),
|
|
N'计费重=max(长×宽×高/8000, 材积重)'
|
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_dict_data WHERE dict_type = 'bms_biz_rule_type' AND dict_value = 'VOL_8000');
|
|
|
|
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark)
|
|
SELECT 3, N'材积重', 'VOLUME_WEIGHT', 'bms_biz_weight_source', '', 'info', 'N', '0', 'admin', sysdate(),
|
|
N'订单材积重 volume_weight'
|
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_dict_data WHERE dict_type = 'bms_biz_weight_source' AND dict_value = 'VOLUME_WEIGHT');
|
|
|
|
-- Seed by 对外代码 (customer_code_dw). Matcher also accepts customer_code.
|
|
INSERT INTO biz_rule (rule_name, rule_type, product_code, country_code, customer_code, weight_min, weight_max, weight_source, side_sum_max, status, remark, create_by, create_time, del_flag)
|
|
SELECT CONCAT(N'对外代码', v.customer_code, N' 材积重8000取大'), 'VOL_8000', NULL, NULL, v.customer_code, NULL, NULL, 'VOLUME_WEIGHT', NULL, '0',
|
|
N'客户维度为对外代码customer_code_dw;计费重=max(长×宽×高/8000, 材积重)', 'admin', sysdate(), '0'
|
|
FROM (
|
|
SELECT 'C00222' AS customer_code UNION ALL SELECT 'C00562' UNION ALL SELECT 'C00521' UNION ALL SELECT 'C00805'
|
|
) v
|
|
WHERE NOT EXISTS (
|
|
SELECT 1 FROM biz_rule r
|
|
WHERE r.del_flag = '0' AND r.rule_type = 'VOL_8000' AND r.customer_code = v.customer_code
|
|
AND r.product_code IS NULL AND r.country_code IS NULL
|
|
);
|