# `Sp_WorkOrderProcessDetail` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `tStartDate` | `datetime` | | 2 | IN | `tEndDate` | `datetime` | | 3 | IN | `sLoginId` | `varchar(100)` | | 4 | IN | `sBrId` | `varchar(100)` | | 5 | IN | `sSuId` | `varchar(100)` | | 6 | OUT | `sReturn` | `varchar(1000)` | | 7 | OUT | `sCode` | `int` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_WorkOrderProcessDetail`'`._ ## Narrative **Business context:** 成本管理 → 材料存货分析 → 实际加工费 / 标准加工费 / 机台加工费 — month-aggregate cost-of-process report. Rebuilds `cosstdcostmonth` for the date window from `viw_mftworkorder` + `mftworkordermaterials` + `mftworkorderprocess` (joined to `eleprocess`/`sisprocessclassify`) so the three "加工费" reports can pivot cost by process classification (晒版, 印刷, 模切, …) per product / month. **What it does:** Date-aligns `tEndDate += 1 day`, `DELETE` then `INSERT INTO cosstdcostmonth` rows for `tCreateDate IN (tStartDate, tEndDate)` keyed off `viw_mftworkorder` where `bCheck=1 AND iSlaveOrder=1`. Subsequent `UPDATE`s fill `sMaterials`/`dMaterialsMoney` from `mftworkordermaterials`, `dSbQty` (晒版 process qty), `dOutSideMoney` from `viw_opsoutsideprocess`, then cursors over `sisprocessclassify` building dynamic `Update cosstdcostmonth E ... Set E.dProcessNMoney = ...` per classification (`p_iFor=1,2,3,…`) so each classification id lands in its own column. Final statement is `SELECT * FROM cosstdcostmonth`. **Invocation:** Bound as `gdsconfigformmaster.sSqlStr` on three reports under 成本管理 → 材料存货分析: `101251240115016165723345830` 实际加工费, `101251240115016157801662250` 标准加工费, `101251240115016170662415160` 机台加工费. Triggered when those reports are opened (date range as query params). No `gdsmodule` hook, no other DB-routine caller, no Java caller in xly-src outside the install scripts.