Fun_GetMachineWorkStartDate.md 1.25 KB

Fun_GetMachineWorkStartDate (function)

获取当前机台时间(包含上一班)

  • Type: FUNCTION
  • Returns: datetime
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sPlcNo int
2 IN sBrId varchar(255)
3 IN sSuId varchar(255)

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTIONFunGetMachineWorkStartDate'._

Narrative

Business context: Machine shift-window helper — given a press (iPlcNo), returns the start of the current shift, including the previous shift when NOW() falls in the night window (i.e. before sOffWork). Used to define "current shift" for machine OEE / 排产 dashboards.

What it does: Reads elemachine.sOffWork / sShiftsWork (default 8:00 / 17:30), classifies NOW() as day-side or night-side, then returns either today's sOffWork or yesterday's sShiftsWork/sOffWork accordingly.

Invocation: Called by Sp_bd_MachinePlanStatus, Sp_bd_McPlanConter, Sp_bd_McPlanRate — the machine-board (机台看板) status / completion / rate procedures that surface real-time shift progress on the production-floor displays.