-- shipping_info 新增"本次发货数量"字段,支持部分发货
|
ALTER TABLE shipping_info
|
ADD COLUMN quantity DECIMAL(18, 2) NULL COMMENT '本次发货数量' AFTER sales_ledger_product_id;
|
|
-- 历史数据回填:存量发货单按对应产品行数量回填
|
UPDATE shipping_info si
|
LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id
|
SET si.quantity = slp.quantity
|
WHERE si.quantity IS NULL;
|