初始代码

This commit is contained in:
hhh
2026-04-02 10:38:23 +08:00
parent d8b4140f50
commit aed67ce1fd
1937 changed files with 447678 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
-- 1. 先修改字段精度(支持小数)
ALTER TABLE pro_workorder_entry
MODIFY COLUMN report_quantity DECIMAL(10, 3) NULL DEFAULT NULL COMMENT '报工数量';
-- 2. 从 pro_report 表汇总报工数量,更新回 pro_workorder_entry
UPDATE pro_workorder_entry pwe
INNER JOIN (
SELECT
work_order_entry_id,
SUM(report_quantity) AS total_report_qty
FROM pro_report
WHERE work_order_entry_id IS NOT NULL
GROUP BY work_order_entry_id
) pr ON pwe.id = pr.work_order_entry_id
SET pwe.report_quantity = pr.total_report_qty
WHERE pwe.type = 'report';