# `Sp_SaleOrder_ProocessImplementation` (procedure)

> 订单全生命周期


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sBrId` | `varchar(100)` |
| 2 | IN | `sSuId` | `varchar(100)` |
| 3 | IN | `sLoginId` | `varchar(100)` |
| 4 | IN | `bFilter` | `longtext` |
| 5 | IN | `pageNum` | `int` |
| 6 | IN | `pageSize` | `int` |
| 7 | OUT | `totalCount` | `int` |
| 8 | IN | `countCloumn` | `longtext` |
| 9 | OUT | `countMapJson` | `longtext` |
| 10 | IN | `sFilterOrderBy` | `longtext` |
| 11 | IN | `sGroupby_select_sql` | `longtext` |
| 12 | IN | `sGroupby_group_sql` | `longtext` |

## Body

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

## Narrative

**Business context:** 销售管理 → 订单全生命周期 — paged report (note the typo `Prooces…` in the proc name) that walks each `salsalesorderslave` row through 工单 → 文件确认 → 首工序开工 → 成品入库 → 发货 → 对账 → 发票 → 收款, exposing per-stage qty, money and lag metrics so sales can see where individual orders are stuck.

**What it does:** Parses `bFilter` via `Fun_bFilter_toWhere`, replaces `@sTableAlias@` with `A.`, defaults the period to the last six months and builds `p_TmpTb` from `viw_salsalesorder`. Successive joins/updates pull figures and dates from `viw_mftproductionreport`, `Viw_opsoutsideinstore`/`opsoutsideinstoreslave`, `Viw_PitProductInStore`/`PitProductInStoreSlave`/`PitProductRejectSlave`, `viw_saldelivergoods`/`SalDeliverGoodsSlave`/`SalRejectGoodsSlave`, `viw_salsaleschecking`/`SalSalesCheckingSlave`, `viw_salsalesinvoice`/`SalSalesInvoiceSlave` and `CahReceiptSlave`. The page slice is emitted via the standard `Sp_Outstanding_Query`-style trailer (`pageNum/pageSize`, `countMapJson`).

**Invocation:** Status: appears orphaned. No `gdsconfigformmaster` binding, no other-routine caller, no xly-src reference (not even an install script). Sister proc `Sp_SaleOrder_ProgressOfImplementationNew` covers the same business surface — likely the surviving variant; candidate for maintainer audit.
