# `Sp_GetOrder_Process` (procedure)

> @author:        qmj
			    
		@date:20210714  封存
				
		@describe :     以工单号关联，各阶段插入一条数据，显示各阶段是否完成
                                订单-> 工单-> 工序-> 上报-> 成品入库-> 送货-> 收款
                                             发外-> 发外入库


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 销售管理 → 进度相关查询 → 订单生产进度查询 (form `生产进度查询明细`, sId `19211681019715708441995850`) and 常用报表 → 订单进度 (form `订单生产进度`, sId `101251240115015897738521350`) — per-工单号 stage tracker showing whether each downstream phase (订单 → 工单 → 工序 → 上报 → 成品入库 → 送货 → 收款; outsourcing branch: 发外 → 发外入库) has been reached/completed. Supports paging, group-by, filter, and total-count aggregation in one call.

**What it does:** Builds a `p_tmp_T` temp table with an `iOrder`/`sType` row per stage; for each stage SELECTs the corresponding bill row out of `salsalesordermaster`/`mftworkorder*`/`opsoutsideprocess*`/`mit*storein`/`saldeliver*`/`salrct*` keyed by 工单号, joining `mftworkorderslave` for parts breakdown. Honors `Fun_GetLookCustomer` for data-scope, dynamically composes the OFFSET/LIMIT + ORDER BY + `sGroupby_group_sql`/`sGroupby_select_sql` fragments, and returns the result set + paging metadata in `totalCount`/`countMapJson`.

**Invocation:** Form-master `sSqlStr` binding on two forms (above). Proc header is marked `@date:20210714 封存` (sealed) by author qmj, but the form binding remains active in production — the seal is informational.
