GetDispatchUnit.md 1.37 KB

GetDispatchUnit (function)

  • Type: FUNCTION
  • Returns: varchar(255)
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sWorkOrderGuid varchar(100)
2 IN sProcessGuid varchar(100)
3 IN sBrId varchar(100)
4 IN sSuId varchar(100)

Body

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

Narrative

Business context: Production-report unit picker. For a given work-order + process, returns the appropriate reporting unit ( / / 印次 / / or the product's own sProductUnit) based on the process's sProductionReportId category.

What it does: Reads EleProcess.sProductionReportId for the process, then maps via a hardcoded GUID switch — five literal GUIDs map to fixed Chinese unit names; a sixth (6904E091-…) falls back to eleproduct.sProductUnit joined from the work-order's first slave row.

Invocation: Orphan-via-dead-chain. Only routine caller is Sp_Manufacture_ProductionProcess, which itself has no form-master, gdsmodule, or Java caller (a manufacturing-search proc that appears unwired). Hardcodes tenant-specific sProductionReportId GUIDs — would silently default to NULL on any other deployment. Candidate for maintainer audit.