# `Sp_purpurchasearrive_CheckUpdate` (procedure) > 采购到货保存更新批号 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sGuid` | `varchar(100)` | | 2 | IN | `sFormGuid` | `varchar(100)` | | 3 | IN | `sLoginId` | `varchar(100)` | | 4 | IN | `sBrId` | `varchar(100)` | | 5 | IN | `sSuId` | `varchar(100)` | | 6 | IN | `iFlag` | `int` | | 7 | OUT | `sCode` | `int` | | 8 | OUT | `sReturn` | `varchar(4000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_purpurchasearrive_CheckUpdate`'`._ ## Narrative **Business context:** 采购管理 / 物料采购流程 → 采购到货(送检)单据 — auto-fills the batch number (`sDefineNo`) on 采购到货 slave lines (`purpurchasearriveslave`) according to the tenant's `CbxMaterialsDefine` system setting. Saves the operator from typing batch codes by hand when the company has a standard date/year/work-order numbering scheme. **What it does:** Reads `SysSystemSettings.sValue` where `sName='CbxMaterialsDefine'`. Branches on the value: `datenum` → `YYYYMMDD`, `datetimenum`/`createnownum` → `YYYYMMDDHHMM`, `worknum` → the row's `sWorkOrderNo`, `yearnum` → `YYYY`, `yearmonthnum` → `YYYYMM`. Each branch is a guarded `UPDATE purpurchasearriveslave SET sDefineNo = … WHERE sParentId = sGuid AND IFNULL(sDefineNo,'') = ''` — only blank batch codes are populated, manually-entered ones are preserved. Always returns `sCode=1, sReturn='保存成功!'`. **Invocation:** Status: appears orphaned. No caller found in any channel (form-master sSqlStr/sConfigSqlStr, gdsmodule sSaveProName/sSaveProNameBefore on 采购到货(送检)单据 form `101251240115016068096930620`, other routines, xly-src grep across all extensions). Signature matches the standard `sSaveProNameBefore` hook contract (`sGuid, sFormGuid, sLoginId, sBrId, sSuId, iFlag, sCode, sReturn`) — the binding looks intended but is currently not present in production metadata; candidate for maintainer audit.