# `SP_Inventory_Materials_Inout_new` (procedure)


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

## Parameters

_No parameters._

## Body

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

## Narrative

**Business context:** 数据修复脚本 — parameterless ad-hoc data-repair procedure. Replays `Sp_System_AutoMaterialsPriceSingle` (per-material automatic costing) over every distinct material/style/warehouse/location combination touched by 生产领料单 (`mitproductionmaterialsmaster` + `MitProductionMaterialsSlave`) within a hardcoded window `'2024-12-28'` ≤ `tCreateDate` < `'2024-12-31 09:48:47'`. Looks like a forensic patch run to re-cost a specific batch of production picks after price-data drift.

**What it does:** Opens cursor `Cur_Slave` over the deduplicated material combinations, counts them, then loops `Fetch Next` → `CALL Sp_System_AutoMaterialsPriceSingle(...)` for each row, capturing `@sCode` / `@sReturn` into discarded session variables. No parameters, no returns — fire-and-forget.

**Invocation:** Status: appears orphaned. No form binding, no `gdsmodule` hook, no other-routine reference, no `xly-src` reference. The hardcoded December-2024 date range and "fire-and-forget" shape mark this as a one-shot manual repair tool intended for a DBA to run by hand; not part of any user flow. Candidate for removal once the repair has been confirmed.
