# `Sp_Inventory_SemigoodsInOutStore` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sCustomerGuid` | `varchar(255)` |
| 2 | IN | `sProductGuid` | `varchar(255)` |
| 3 | IN | `sPartsNameGuid` | `varchar(100)` |
| 4 | IN | `dSinglePQtyGuid` | `decimal(18,6)` |
| 5 | IN | `sProcessIdGuid` | `varchar(100)` |
| 6 | IN | `sVerGuid` | `varchar(100)` |
| 7 | IN | `sWarehouseGuid` | `varchar(255)` |
| 8 | IN | `sDefineNoS` | `varchar(255)` |
| 9 | IN | `sDefineNoS2` | `varchar(255)` |
| 10 | IN | `tStartDate` | `datetime` |
| 11 | IN | `tEndDate` | `datetime` |
| 12 | IN | `iViewOperation` | `int` |
| 13 | IN | `sBrId` | `varchar(255)` |
| 14 | IN | `sSuId` | `varchar(255)` |
| 15 | IN | `bFilter` | `varchar(5000)` |
| 16 | IN | `pageNum` | `int` |
| 17 | IN | `pageSize` | `int` |
| 18 | OUT | `totalCount` | `int` |
| 19 | IN | `countCloumn` | `varchar(5000)` |
| 20 | OUT | `countMapJson` | `longtext` |
| 21 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 22 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 23 | IN | `sGroupby_group_sql` | `varchar(5000)` |

## Body

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

## Narrative

**Business context:** Semi-finished-goods (半成品) counterpart of `Sp_Inventory_ProductInOutStore` — semi-goods 进销存 / 出入库流水账 report keyed by product / 半成品零件 / 工序 / 版本 / 自定义项 / warehouse. Mirrors the finished-product variant but reads the semi-goods ledger tables.

**What it does:** Builds a temp ledger of opening qty/money (semi-goods stock rows before `tStartDate`) plus in-window receipts and dispatches grouped by semi-product / 自定义项 / warehouse / location, joins `elesemgoods` / `elewarehouse` / `elecustomer` for display, then paginates / counts through `Sp_Outstanding_Query`.

**Invocation:** Status: appears orphaned in the standard catalog. No form-master binding, no `gdsmodule` hook, no other DB caller. xly-src ships `script/标版/30100101/Sp_Inventory_SemigoodsInOutStore.sql` and `script/标版/optimize/Sp_Inventory_SemigoodsInOutStore.sql`. Likely installed for a semi-goods cost view that has not been wired into a form on this deployment — candidate for maintainer audit.
