# `Sp_BtnEventWorkPost_New` (procedure)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `varchar(10000)` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(1000)` |
| 6 | OUT | `sCode` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_BtnEventWorkPost_New`'`._

## Narrative

**Business context:** 工单成本分析 — toolbar handler used to override per-line manual adjustments on the work-order cost-analysis grid. Lets a cost accountant pin a corrected `dAdjustHour` and `dAdjustProcessQty` against a `accordercostanalysis` row when the auto-calculated values are wrong, and re-derives the dependent area/colour-process figures from `mftworkordercontrol` machine width/length.

**What it does:** Parses `$.params[*].value[*]` from `sProInParam` for `sId`, `dAdjustHour`, `dAdjustProcessQty`. For each row, updates `accordercostanalysis` with the supplied adjustments, then re-derives `dAreaQty = dAdjustProcessQty * dMachineWidth * dMachineLength / 1000000` and `iProcessColorQty = dAdjustProcessQty * (dCalcQty1 + dCalcQty2) * 0.001` via a join through `mftproductionplanslave` to `mftworkordercontrol`. Scoped to `sBrandsId`/`sSubsidiaryId`.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — front-end button on the 工单成本分析 grid passes this procedure name in the action payload. Newer revision of the legacy `Sp_BtnEventWorkPost` handler. Source file present at `script/标版/30100101/cost/Sp_BtnEventWorkPost_New.sql`.
