# `Sp_Manufacture_SalSalesChecking` (procedure)

> 工单到采购计划


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sId_s` | `varchar(4000)` |
| 2 | IN | `sStyle_s` | `varchar(4000)` |
| 3 | IN | `sWorkId_s` | `varchar(4000)` |
| 4 | IN | `sLoginId` | `varchar(100)` |
| 5 | IN | `sWorkOrderNo_s` | `varchar(255)` |
| 6 | IN | `sCustomerName_s` | `varchar(255)` |
| 7 | IN | `sProductName_s` | `varchar(255)` |
| 8 | IN | `iPurchase_s` | `int` |
| 9 | IN | `bViewAll_s` | `int` |
| 10 | IN | `bSlaveAll_s` | `int` |
| 11 | OUT | `sCode` | `int` |
| 12 | OUT | `sReturn` | `varchar(5000)` |
| 13 | IN | `sBrId` | `varchar(255)` |
| 14 | IN | `sSuId` | `varchar(255)` |
| 15 | IN | `bFilter` | `varchar(5000)` |
| 16 | IN | `sUnTaskFormId` | `varchar(100)` |
| 17 | IN | `pageNum` | `int` |
| 18 | IN | `pageSize` | `int` |
| 19 | OUT | `totalCount` | `int` |
| 20 | IN | `countCloumn` | `varchar(5000)` |
| 21 | OUT | `countMapJson` | `longtext` |
| 22 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 23 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 24 | IN | `sGroupby_group_sql` | `varchar(5000)` |

## Body

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

## Narrative

**Business context:** 生产管理 / 销售管理 — sales-side mirror of `Sp_Manufacture_PurPurchaseChecking`. COMMENT is `工单到采购计划` (likely mis-labelled — the body operates on `Viw_SalSalesChecking`). Pivots sales-order line items by product for a selected set of work-orders / customers, so a sales operator can decide whether the order is ready to ship.

**What it does:** Builds scratch `Tmp1` keyed on product (`sProductId, sParentId, sProductNo, sProductName, sProductStyle, sProductUnit, sCustomerId, sCustomerProductNo`) with totals `dTotalProductQty / dTotalProductPrice / dTotalProductMoney`, and `dMaxStock`/`dMinStock` from inventory. Source is `Viw_SalSalesChecking` filtered by the comma-list inputs. Two enrichment passes (`UPDATE Tmp AS t` and `update Tmp1 t1`) refresh aggregates, then `Sp_Outstanding_Query` handles paging and the `bFilter` overlay.

**Invocation:** No form-master binding, no `gdsmodule` hook, no other-routine caller in `information_schema.ROUTINES`. xly-src only ships the install script `script/标版/30100101/Sp_Manufacture_sSalSalesChecking.sql` (note typo `sSal`). Status: appears orphaned in the metadata channels — paired with `Sp_Manufacture_PurPurchaseChecking` (also unbound). Candidate for maintainer audit.
