
4.REFERENCING THE DATABASE USER CUSTOMIZE B-75074EN/04
- 458 -
GetNewLog :: DB_McnCnd
This procedure acquires the latest log information for each machine
from the workpieces process result data table.
Data is acquired in a dynamic array of the structure (typNewLog).
The following SQL statement is created:
tSQL = "SELECT McnID, Max(FirstClock) as MaxOfFirstClock"
& _
" FROM WKPCData" & _
" WHERE McnID<>NULL" & _
" AND FirstClock<>NULL" & _
" GROUP BY McnID" & _
" ORDER BY McnID"
From the workpieces process result data table, this SQL statement
acquires the maximum value of FirstClock with McnID and FirstClock
not set to NULL for each McnID in ascending order of McnID.
To acquire the maximum value, the Max function is used.
GetRunData :: DB_McnCnd
This procedure acquires machining in-progress log information based
on the latest log information for each machine. Whether machining is in
progress is determined from whether data such as end time (LastClock),
machining end ID (LastID), and user area ID (UserID) is acquired.
Data is acquired in the structure (typRunLog).
The following SQL statement is created:
tSQL = "SELECT w.McnID, w.WorkID, w.ONum, w.FirstClock,
ww.PlanTime, w.LastClock, w.LastID, w.UserID" & _
" FROM WKPCWorkName ww RIGHT JOIN WKPCData
w" & _
" ON ww.WorkID=w.WorkID" & _
" WHERE w.McnID=" & m_NewLog(iIdx).McnID & _
" AND w.WorkID<>NULL" & _
" AND ((w.FirstClock) =#" &
Format(m_NewLog(iIdx).FirstClock, "yyyy/m/d h:n:s") &
"#)"
By using RIGHT OUTER JOIN ... ON, this SQL statement connects the
workpiece ID setting table with the workpieces process result data table
when WorkID matches. Such data that McnID and FirstClock of the
latest log information for each machine match McnID and FirstClock of
the connected table, and that WorkID is not set to NULL is acquired.
SetDspMcnCnd :: DB_McnCnd
This procedure sets acquired machining in-progress log information
and normal end count data in the progress status display table.
The following SQL statement is created:
When O number data is absent
tSQL = "INSERT INTO WKPCDspMcnCnd" & _
" (McnID" & _
", WorkID" & _
", FirstClock" & _