# `Sp_reportdata_WorkOrder` (procedure)

> 报价单数据源自定义


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sId` | `varchar(50)` |
| 2 | IN | `sFormId` | `varchar(100)` |
| 3 | IN | `sUserName` | `varchar(100)` |
| 4 | IN | `sBrandsId` | `varchar(100)` |
| 5 | IN | `sSubsidiaryId` | `varchar(100)` |
| 6 | OUT | `sSlaveData` | `longtext` |
| 7 | OUT | `sSlaveData1` | `longtext` |
| 8 | OUT | `sControlData` | `longtext` |
| 9 | OUT | `sControlData1` | `longtext` |
| 10 | OUT | `sProcessData` | `longtext` |
| 11 | OUT | `sCPProcessData` | `longtext` |
| 12 | OUT | `sChangeData` | `longtext` |
| 13 | OUT | `sChangeData1` | `longtext` |
| 14 | OUT | `sAccidentData` | `longtext` |
| 15 | OUT | `sControlData1Size` | `int` |
| 16 | OUT | `sProcessDataSize` | `int` |
| 17 | OUT | `sCPProcessDataSize` | `int` |
| 18 | OUT | `sChangeDataSize` | `int` |
| 19 | OUT | `sChangeDataSize1` | `int` |
| 20 | OUT | `sAccidentDataSize1` | `int` |
| 21 | OUT | `sReturn` | `longtext` |
| 22 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 生产管理 → 工单 (生产施工单 print data-source). COMMENT `'报价单数据源自定义'` is a copy-paste leftover — this variant serves the 工单 Jasper template. Returns the master/slave excerpt plus `sChangeData`/`sChangeData1` (工艺变更/材料变更) and `sAccidentData` (质量事故报告) for the work-order print.

**What it does:** Builds TEMP `mftworkordermaster_report` and inserts the master excerpt from `mftworkordermaster` (`sBillNo`, formatted `tCreateDate`/`tCheckDate`, `sMakePerson`, `sMemo`, `sCheckPerson`, `sChangeMemo`). Builds TEMP `mftworkorderslave_report` (iOrder, sOrderNo, sCustomerName, product fields, qty, sales rep, date, plate date, cover/inner page counts, combine memo, stockup/spares qty, bill type, etc.) and populates it via inserts from `mftworkorderslave` and related lookups. Returns nine OUT longtexts (`sSlaveData`, `sSlaveData1`, `sControlData`, `sControlData1`, `sProcessData`, `sCPProcessData`, `sChangeData`工艺变更, `sChangeData1`材料变更, `sAccidentData`质量事故) plus their sizes.

**Invocation:** Status: appears orphaned in this DB snapshot. Signature matches the Jasper print-data-source convention `(sId, sFormId, sUserName, sBrandsId, sSubsidiaryId, …OUT, sReturn, sCode)`, but not bound from `gdsmodule`, `gdsconfigformmaster`, other routines, or xly-src — likely wired in via a Jasper template's internal query or a production-only column. Candidate for maintainer audit.
