# `Sp_Calc_sDevApply` (procedure)

> 研发申请单


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iFlag` | `int` |
| 2 | IN | `iTmpCheck` | `int` |
| 3 | IN | `sFormGuid` | `varchar(100)` |
| 4 | IN | `sGuid` | `varchar(100)` |
| 5 | IN | `sLoginId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(5000)` |
| 7 | IN | `sBrId` | `varchar(100)` |
| 8 | IN | `sSuId` | `varchar(100)` |
| 9 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 研发申请单 (R&D / new-product development application) — check / uncheck audit. Approves an internal request to create a new product spec (customer, new product GUID, customer-product-no, salesman) so it flows into the product master / pre-sales pipeline; reads `SysSystemSettings.CbxDeliverGoods` to pick the delivery-source default for downstream auto-creation.

**What it does:** Validates `sGuid` and `SysLocking`. Reads `SysSystemSettings.CbxDeliverGoods` → `sDeliverSrc`. Loads master fields (`sBillNo`, `sCustomerId`, `sCustomerNo`, `sCustomerName`, `sSalesManId`, `tCreateDate`, `sMakePerson`, `bInvalid`) joined with `elecustomer`; refuses if `bInvalid=1`. With `iFlag=1`: refuses if already checked, then runs the new-product creation / sample-order branch (full body posts into `eleproduct`, salesman log, and the chosen delivery source). With `iFlag=0`: symmetric uncheck.

**Invocation:** Status: appears orphaned. No `gdsmodule` hook, no form-master, no other procedure caller, no xly-src reference (only the proc's own source / optimize copies). The 研发申请 (R&D request) module exists in source but the audit handler is unwired in this DB instance. Candidate for maintainer audit.
