# `Sp_Ai_AddSalsalOrder` (procedure)

> AI_调用下单 插入订单


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sBrId` | `varchar(100)` |
| 2 | IN | `sSuId` | `varchar(100)` |
| 3 | IN | `sLoginId` | `varchar(100)` |
| 4 | IN | `sData` | `longtext` |
| 5 | OUT | `sReturn` | `longtext` |
| 6 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** AI-assistant 销售订单 (Sales Order) generator — header says `AI_调用下单 插入订单`. Stub implementation: when the AI flow says "create me a sales order", this proc allocates a new bill number on `salsalesordermaster` for form `101251240115016002469445380` and returns a success message including the number.

**What it does:** Calls `SP_Sis_GetMaxNo('salsalesordermaster', p_sNewWorkOrderNo, '101251240115016002469445380', '', '', '', '1111111111','1111111111')` to mint a new bill number, then sets `sReturn = CONCAT('下单成功，单据号：', p_sNewWorkOrderNo)`. The `JSON_TABLE`-based loop over the inbound `sData` payload (which would insert the actual master+slave rows) is commented out.

**Invocation:** Status: appears orphaned. No `gdsconfigformslave` binding, no `gdsmodule` hook, no other routine references it, and `grep` finds zero call sites anywhere in `xly-src`. Candidate for maintainer audit — AI-assistant scaffolding apparently never wired into a live control. Hardcodes seed-tenant + the same form GUID used by `Sp_Ai_AddWorkOrder`.
