# `Sp_CostAccount_WorkCenterToOperation` (procedure)

> 印刷机台汇总达成统计


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sCostPeriod` | `varchar(100)` |
| 2 | IN | `sCustomerName` | `varchar(100)` |
| 3 | IN | `sWorkCenterName` | `varchar(100)` |
| 4 | IN | `sWorkOrderNo` | `varchar(100)` |
| 5 | IN | `sLoginId` | `varchar(100)` |
| 6 | IN | `sBrId` | `varchar(100)` |
| 7 | IN | `sSuId` | `varchar(100)` |
| 8 | IN | `bFilter` | `varchar(5000)` |
| 9 | IN | `pageNum` | `int` |
| 10 | IN | `pageSize` | `int` |
| 11 | OUT | `totalCount` | `int` |
| 12 | IN | `countCloumn` | `varchar(5000)` |
| 13 | OUT | `countMapJson` | `longtext` |
| 14 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 15 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 16 | IN | `sGroupby_group_sql` | `varchar(5000)` |
| 17 | OUT | `sColumnNameConfig` | `longtext` |

## Body

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

## Narrative

**Business context:** 成本管理 → 印刷机台汇总达成统计 (work-centre → operation cost roll-up) — paged report joining `accordercostanalysis` × `elecostframe` and rolling per-cost-frame columns onto each work-centre row for the chosen period, optionally filtered by customer, work-centre and work-order number.

**What it does:** Builds the dynamic show-column config (`bConfirm`, `sWorkCenterName`, `sCostPeriod`, `sWorkOrderNo`, …) via `Fun_get_show_config_basic`, then drops/recreates `Sp_EquipmentOutput_Machine_Table` with one row per work-order × work-centre. Reads each cost frame from `elecostframe`, dynamically appends a money column for it via `p_sALTERSql`, populates rows from `accordercostanalysis` (filtered by `sCostPeriod`/`sCustomerName`/`sWorkCenterName`/`sWorkOrderNo`), and runs the per-cost-frame `p_sUpdate1Sql`/`p_sUpdate2Sql` updates that fan expense amounts onto the matching column. Final SELECT hands off to the standard pagination wrapper.

**Invocation:** Status: appears orphaned. No `gdsmodule` hook, `gdsconfigformmaster.sSqlStr` binding, or other-routine caller; xly-src only ships the install script `script/标版/30100101/schedule/Sp_CostAccount_WorkCenterToOperation.sql`. Signature matches the form-master report-proc contract; presumably wired to a 印刷机台汇总 report screen but the binding row is absent. Candidate for maintainer audit.
