# `Sp_Sales_NotDeliverGoodList` (procedure)

> 送货通知单


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 销售管理 → 销售送货流程 → 2/4 销售订单->送货单 (also reused by 扫码送货 and 未送货汇总表) — paged worklist of 销售订单 lines that still have outstanding qty to deliver. Source of the dropdown grid that lets the shipping clerk pick orders for the next 送货单.

**What it does:** Builds temp `NotDeliverGoodList`, joins `salsalesordermaster`/`salsalesorderslave` against `eleproduct`, `elecustomer`, `sissalesman`, `siscurrency`, `sispayment`, `sisdeliver`, `sistax` to project order context, then folds in stock (`eleproductstock`, `pitproductstorevirtual`, `PitProductInStoreSlave`), 工单 status (`mftworkorderslave`/`opsoutsideprocessmaster`), inspection (`qlyproducttestmaster`) and reject deductions (`SalRejectGoodsSlave`). Filters by `iCopeEvent` (0 未处理 / 1 已处理 / 2 全部), `sState` (0 正常 / 1 强制完工), `bFilter` and customer-visibility (`Fun_GetLookCustomer(sLoginId)`). Final paging via `Sp_Do_ProcedurePageTree` returning `pageNum/pageSize` slice and `countMapJson`.

**Invocation:** Bound to `gdsconfigformmaster.sSqlStr` on three forms — `192116810113315262977376700` (2/4 销售订单->送货单, 销售送货流程), `101251240115015959228704840` (扫码送货, 功能操作 → 移动端管理), `101251240115016215088119550` (未送货汇总表, 分析报表 → 财务管理). Also reachable through `Fun_getInitColumnByProName`. Install scripts: standard at `script/标版/30100101/`, optimised at `script/标版/optimize/`, customer override at `script/客户/无锡中江/`.
