GetPriorProcess.md 2.11 KB

GetPriorProcess (function)

得到前道工序

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

Parameters

# Mode Name Type
1 IN uGuid varchar(100)
2 IN uProcessGuid varchar(100)
3 IN sControlId varchar(100)

Body

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

Narrative

Business context: 得到前道工序 — for a given work-order process row, returns a one-line "prior process" label with a status symbol so 产量上报 / OEE 报工 / APS gantt screens can show at a glance whether the upstream step is done. Glyph legend: = upstream produced output (dProductionReportQty>0), = upstream's downstream is in state 2, = pending. Outsourced steps get a (外) suffix.

What it does: reads the current row's iOrder/sType/process-name from MftWorkOrderProcess (treating sType='3' rows as iOrder+10000). Empty result for cutting/制作 leaf steps. For sType 0/1/2 picks the largest-iOrder row that is upstream within the same control group and composes <glyph><processName><outsideFlag>. For sType='3' (special control-group type), it falls back to a control-group view: either reports the prior sType='3' step or aggregates completion (★全部完工 or ☆完工<done>/<total>) across auto-arrange (bAutoArrange=1) processes upstream.

Invocation: referenced by Sp_Manufacture_PlanReport, Sp_Manufacture_ProcessReport, Sp_Manufacture_ProductionPlanInfo12, Sp_Manufacture_ProductionReport, Sp_Manufacture_Report, Sp_OEE_PlanByProcess, Sp_OEE_ProductionReport. Companion of GetNextMachine (downstream-machine list), GetPriorPlate (mould/proof preparation), and GetPriorProcessPlan (prior step's plan-side info). Caveat: one branch references @uGuid/@sCurProcessName (session vars) instead of the proc-local uGuid/p_sCurProcessName — the auto-arrange count branch will always see those vars as NULL unless the caller set them, suggesting copy-paste bug.