# `Sp_SaleOrder_ProgressOfImplementationNew` (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_ProgressOfImplementationNew`'`._

## Narrative

**Business context:** 销售管理 → 订单(工单)执行情况 — paged lifecycle report that lays out, for each 销售订单 row, every downstream stage of production, delivery, settlement, invoicing and receipt. Updated/replacement variant of the legacy `Sp_SaleOrder_ProgressOfImplementation` proc.

**What it does:** Builds the temp table `p_TmpTb` keyed on order slave, then `INSERT INTO`s the base rows from `Viw_SalSalesOrder` filtered by `bFilter` (defaults to the last 6 months from `tCreateDate`). Successive `UPDATE`s fold in customer-visibility (`Fun_GetLookCustomer`), 工单下达 (`viw_mftproductionreport`), 委外入库 (`Viw_opsoutsideinstore`/`opsoutsideinstoreslave`), 成品入库 (`Viw_PitProductInStore`/`PitProductInStoreSlave`), 送货 (`viw_saldelivergoods`/`SalDeliverGoodsSlave`), 退货 (`SalRejectGoodsSlave`), 销售对账 (`viw_salsaleschecking`/`SalSalesCheckingSlave`), 发票 (`viw_SalSalesInvoice`/`SalSalesInvoiceSlave`) and 收款 (`CahReceiptSlave`). Final SELECT pages out of `p_TmpTb` using `pageNum/pageSize`, with `countMapJson` aggregating totals from `countCloumn`.

**Invocation:** No live form-master binding in `gdsconfigformmaster` and no Java/MyBatis hit in xly-src — only the install script `script/标版/30100101/Sp_SaleOrder_ProgressOfImplementationNew.sql` and customer override `script/客户/千彩/Sp_SaleOrder_ProgressOfImplementationNew.sql`. Likely wired through a form-master row not present in this database snapshot (or driven dynamically as a `Sp_SalesQuery*`-style report); maintainer audit recommended before pruning.
