# `Sp_Calc_sSmo` (procedure) > 装配工单 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `iFlag` | `int` | | 2 | IN | `iTmpCheck` | `int` | | 3 | IN | `sFormGuid` | `varchar(100)` | | 4 | IN | `sGuid` | `varchar(100)` | | 5 | IN | `sLoginId` | `varchar(100)` | | 6 | OUT | `sReturn` | `varchar(4000)` | | 7 | IN | `sBrId` | `varchar(100)` | | 8 | IN | `sSuId` | `varchar(100)` | | 9 | OUT | `sCode` | `int` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Calc_sSmo`'`._ ## Narrative **Business context:** 半成品出库 (semi-goods outbound — `sgdsemigoodsoutstoremaster`) audit / un-audit. Mirror of `Sp_Calc_sSmi`: auditing the outbound bill deducts the semi-goods qty from stock, posts the movement row and back-writes the originating 出库申请. **What it does:** Validates `sGuid`/`bInvalid` and `SysLocking`, then on `iFlag=1` sets `bCheck=1`, `sCheckPerson`, `tCheckDate` on `sgdsemigoodsoutstoremaster`; iterates `sgdsemigoodsoutstoreslave`, calls `SP_Inventory_SemgoodsInOutWareHouse` (`-1` direction) per row to deduct from `elesemigoodsstock` and `INSERT INTO sgdSemigoodsStore` for the movement row; writes back `UPDATE sgdsemigoodsoutstoreapplyslave` to mark the apply line as picked. `iFlag=0` reverses every step. **Invocation:** Status: appears orphaned. No `gdsmodule.sProcName` binding, no form-master `sSqlStr` ref, no other-routine caller, no Java caller — only install/optimize SQL scripts. Despite the page comment 装配工单, the deployed body targets the semi-goods outbound master. Candidate for maintainer audit. Flag: page comment `装配工单` does not match the deployed body (which targets `sgdsemigoodsoutstoremaster`). One of the two is stale — candidate for maintainer audit.