fun_GetPreProcessQty.md 1.77 KB

fun_GetPreProcessQty (function)

获取工单上工序报工数

  • Type: FUNCTION
  • Returns: decimal(18,2)
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN p_sWorkOrderProcessTbId varchar(55)
2 IN P_sType varchar(50)
3 IN p_sWorkOrderId varchar(50)

Body

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

Narrative

Business context: Previous-process production-reported-qty lookup — for a given work-order process row, finds its upstream process (via Fun_up_workOrderProcessId) and returns that upstream's reported output: dProductionReportQty + dOpsProductionReportQty, falling back to dProcessOutQty when no report exists, with adjustment-rate / single-piece-qty multipliers applied for the assembly-process case. Catalog header: 获取工单上工序报工数.

What it does: Calls Fun_up_workOrderProcessId(p_sWorkOrderProcessTbId, p_sType, p_sWorkOrderId) to resolve the predecessor sId; reads the current row's sProcessId/dAdjustRate/sControlId; branches on p_sType (3 / 0 / other); when other and sProcessId='1691254111216986535515270' with zero adjust-rate, multiplies by mftworkordercontrol.dSinglePQty, otherwise multiplies by IF(dAdjustRate=0,1,dAdjustRate). Returns the resulting decimal.

Invocation: Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines, xly-src grep) — candidate for maintainer audit. The hardcoded sProcessId literal indicates an in-flight branch tied to one specific process record (likely a 装配 / assembly process); without a caller the function is currently inert.