---
# System prepended metadata

title: API 整理
tags: [M2ICNC]

---

# API 整理
---

## GetTagValue("path", "device_id", "\$from", "\$to") 
- Range內每個device/每個時間點一筆record
- 整合API如下
    - 無.....
 
## GetTagValueLatest("path", "device_id", "\$from", "\$to")
- Range內每個device的最新一筆
- 整合API如下:

    - #### MInfo
        - DevID, DevName, DevDesc, ImgData,
        - _id, s, d, ts, Status, AlmCode, SpinTmp1, SpinTmp2,
        - ServTemp0, ServTemp1, ServTemp3, ServTemp4, ServTemp5,
        - ServTemp6, ServTemp7, ServTemp8, ServTemp9, ServTemp10,
        - ServTemp11, OvFeed, OvRapid, OvSpin, MainPgm, Mode

    - #### MStatus
        - SCADAID, DevID, Ts, Status, AlmCode, SpinTmp1, ServTemp, 
        - OvFeed, OvRapid, OvSpin, MainPgm, Mode

    - #### MWorkOrderInfo
        - DeviceID (改成DevID), Status, ImgData

    - #### MWorkOrder
        - OrderStatus, WorkOrder, Operator, ProductName, RemainOutput, PlanOutput, RemainTime, StartTime
    - #### FocalConnectedMachineList
        - DevID, StatusDuration, Status
    - #### FocalErrorMsg
        - DevID, AlarmMsg, AlarmMsgTC, Ts

## GetCalcValue("path", "device_id", "\$from", "\$to")
- Range內的統計運算值
- 可依Path or device_id
- 整合API如下
    - #### MAvail (所有device加起來算一個值)
        - OffTime, RunTime, IdleTime, DownTime, Total, DownCount, Availability

    - #### MWorkOrderAch (所有device加起來算一個值)
        - AchiveRate (修改成AchvRate)
    - #### MPowerTime (所有device加起來算一個值)
        - PowerTime
    - #### MProcessTime (所有device加起來算一個值)
        - ProcessTime
    - #### MProductInfo (所有device加起來算一個值)
        - WOCount, FinishWOCount, Achv (修改成AchvRate)





## GetCalcValueByDevice("path", "device_id", "\$from", "\$to")
- 每個Device各自有一筆Record
- 整合API如下
    - MAvailRank (每個device各自算各自的) 
        - No, DevID, OffTime, RunTime, IdleTime, DownTime, Total, DownCount, Availability
## GetCalcValueByPath("path", "\$from", "\$to")
- Range內，依path下的device統計運算值
    - #### FactoryOEE (這部分和factory無關 -> 改成OEE)
        - OEE, Availability, Performance, Quality
    - #### FactoryPerformance (看要不要拿掉?) (這部分和factory無關 -> 改成Performance)
        - Performance
    - #### FactoryQuality (看要不要拿掉?) 這部分和factory無關 -> 改成Quality)
        - Quality

## GetChildCalcValueByPath("path", "\$from", "\$to") 
- Range內，依path，計算各子節點下的device統計運算值
- 整合API如下
    - #### FactoryDowntimeSummary
        - Factory, Machines (改成MachineCount), Occurrence, Duration
    - #### FactoryOEESummary
        - Factory, OEE, Availability, Performance, Quality
    - #### FactoryQualitySummary
        - Factory, Defect, Yield
    - #### FactoryWorkOrderAch
        - Factory, WOCount, FinishWOCount, Achv (修改成AchvRate)



## GetValueTrend("path", "device_id", "\$from", "\$to")
- 有資料的時間點一筆
- For timeseries使用
- 整合API如下
    - #### MAvailTrend
        - DevID, Ts, Availability(每個時間點算一次)
    - #### MTempMonitoring
        - TempName, TempValue, Ts
- 
## GetValueTrendDaily("path", "device_id", "\$from", "\$to")
- 每天算一筆
- For timeseries使用
- 整合API如下
    - #### MAvailDaily
        - DevID, Ts, OffTime, RunTime, IdleTime, DownTime, Total, DownCount, Availability
    - #### MAlarmTrend
        - Level, Ts, AlarmLevelCount

    - #### AvailTrendDaily
        - Availability, Ts
    - #### OEETrendDaily
        - OEE, Ts
    - #### PerformanceTrendDaily
        - Performance, Ts
    - #### QualityTrendDaily
        - Quality, Ts
## GetValueRank("path", "device_id","topN", "\$from", "\$to")
- 所有device加起來算
- 整合API如下
    - #### MEventList (回傳TopN筆, 依TS排序)
        - DevID, AlarmCode, AlarmMsg, AlarmMsgTC, Ts   
    - #### MWorkAbnormalityRank (回傳TopN筆, 依Occurrence排序)
        - No, Desc, Occurrence
    - #### MAlarmDuration(所有device加起來算, 依AlarmCode列出value)
        - No, AlarmCode, Duration, AlarmMsg, AlarmMsgTC
    - #### MAlarmOccurrence(所有device加起來算, 依AlarmCode列出value)
        - No, AlarmCode, Occurrence, AlarmMsg, AlarmMsgTC
## GetValueRankByPath("path", "topN", "\$from", "\$to")
- Range內，依path下的device統計運算值, 並排序
    - #### WorkProductionRank (依PlanOutput排序)
        - No, ProductName, PlanOutput, Yield, WorkingHour
    - #### YieldRanking (依Yield排序)
        - No, Machine (改成DevID), Yield
## GetAlarmCalcValue("path", "device_id", "level", "\$from", "\$to")
- 取得AlarmValue by Alarm level
- 整合API如下
    - #### MAlarmInfo (所有device加起來算一個值) (目的好像不是Info.. 應該可以多加其他的值？)
        - Level, Occurrence
    - #### MAlarmCategory(所有device加起來算一個值)
        - Level, Category(使用者自訂名稱)
        
## For特定Panel
- #### GroupOverview
    - location, latitude, longitude, metric, hostname
- #### FactoryProductionInfo
    - WOCountKey, WOCount, FinishWOCountKey, FinishWOCount, AchvKey (改成AchvRateKey), Achv (改成AchvRate)
- #### MAvailTimeline
    - DevID, Status, Ts, Availability(總)

## Range內的Hourly統計運算值

## Range內的Quarterly統計運算值

---
###### tags: `M2ICNC`