# `Sp_Manufacture_InsertWorkOrder` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_sFileName` | `varchar(10000)` |
| 2 | IN | `p_sInfo` | `varchar(10000)` |
| 3 | IN | `p_dQty` | `decimal(10,0)` |
| 4 | IN | `p_iPrintMode` | `int` |
| 5 | IN | `p_sAllInfo` | `longtext` |
| 6 | IN | `sLoginId` | `varchar(100)` |
| 7 | IN | `sBrId` | `varchar(100)` |
| 8 | IN | `sSuId` | `varchar(100)` |
| 9 | OUT | `sReturn` | `varchar(1000)` |
| 10 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 生产管理 → 工单 (work-order creation pipeline) — bulk-insert helper that turns a parsed file payload (filename + multi-order JSON in `p_sInfo`/`p_sAllInfo` + print-mode) into work-order header + slave rows. Likely consumed by an import / scan flow that hands over already-parsed bill data.

**What it does:** Parses `p_sInfo` to split multi-order strings, walks each `sAllOrderNo`, `CALL SP_Sis_GetMaxNo` to mint a 工单 bill-no, then inserts header data into work-order master + slave from `p_sAllInfo`. Builds intermediate tables (`sAllOrderNoTable`, `T`) to stage the per-order rows, with the print-mode (`p_iPrintMode`), file (`p_sFileName`) and qty (`p_dQty`) used to size the plan.

**Invocation:** Status: appears orphaned — no `gdsmodule` hook, no form-master binding, no in-DB caller, and the only xly-src hit is the install script `script/标版/30100101/Sp_Manufacture_InsertWorkOrder.sql`. Likely invoked dynamically (filename-driven import / external integration / `sp_btn_action` with metadata-stored proc name) — candidate for maintainer audit.
