Feature #26991
[OEE][Performance Dashboard] ปรับ Resolution กราฟ Production Plan vs Actual ตาม Filter ใหม่ (Up to Date/Weekly/Monthly/Custom) #kiro
Start date:
05/12/2026
Due date:
05/13/2026
% Done:
0%
Estimated time:
นำ AI มาช่วย(%):
100
Description
- รายละเอียด
อ้างอิง: #26758
เนื่องจากมีการปรับ Filter ของ Performance Dashboard เป็นรูปแบบใหม่:
- Up to Date
- Weekly
- Monthly
- Custom
ต้องการปรับ logic การแบ่งกรุ๊ปกราฟ "Production Plan vs Actual with Efficiency Over Time" ให้เป็นดังนี้:
- เงื่อนไขใหม่
| เงื่อนไข Filter | Resolution | การแบ่งกรุ๊ป |
| --- | --- | --- |
| Filter ≤ 24hr | `shift` | แบ่งตามกะงาน (shift) จากตาราง ms_shift |
| Filter > 24hr | `day` | แบ่งตามวัน (1 วัน/bucket) เริ่มที่เวลา first shift start |
- เงื่อนไขเดิม (ก่อนแก้ไข)
| เงื่อนไข Filter | Resolution |
| --- | --- |
| ≤ 1 วัน | shift |
| > 1 วัน ถึง ≤ 7 วัน | day |
| > 7 วัน ถึง ≤ 30 วัน | week |
| > 30 วัน | month |
- สิ่งที่ต้องแก้ไข
- Backend (oee-api)
- ไฟล์: `lib/get-timepoints.js` → function `getTimepointsByShift()`
- ปรับ logic จากเดิมที่แบ่ง 4 ระดับ (shift/day/week/month) เหลือ 2 ระดับ:
- `totalDays <= 1` → resolution = "shift" (เหมือนเดิม)
- `totalDays > 1` → resolution = "day" (ใช้ `getTimepointsByDay`)
- Frontend (oee-web)
- ไฟล์: `src/routes/PerformanceDashboard/PerformanceDashboard.js`
- function `targetActualHistories()` — ปรับ label format ให้รองรับ 2 resolution:
- shift → แสดง "shift_name (DD MMM)"
- day → แสดง "DD MMM YYYY"
- หมายเหตุ
- ตัด resolution "week" และ "month" ออก เนื่องจาก Filter ใหม่ (Weekly/Monthly) จะจัดการช่วงเวลาเองแล้ว
- กราฟ series ยังคงเหมือนเดิม: Production Plan (P1), Machine Working (P2), Actual, Diff (Actual-P1)
History
Updated by Supparoek Sariphan 2 days ago
- Status changed from New to Resolved
- Assignee changed from Supparoek Sariphan to Suphawan Phiwngam
- นำ AI มาช่วย(%) changed from 0 to 100