添加排除文件
This commit is contained in:
@@ -1,95 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
<Requirement>
|
||||
******数据库操作规范
|
||||
项目使用 CreateData + ExecDatabase 模式调用 SQL Server 存储过程,具体使用方式如下:
|
||||
|
||||
## CreateData 方法规范
|
||||
```javascript
|
||||
// 语法: this.CreateData(type, procedureName, paramArray)
|
||||
// 参数说明:
|
||||
const Data = this.CreateData('11', '存储过程名称', param)
|
||||
```
|
||||
|
||||
**参数1 (type): 操作类型**
|
||||
- '11': 查询操作,返回存储过程的 SELECT 结果集
|
||||
- '12': 增删改操作,返回执行状态 (result: 1=成功, 其他=失败)
|
||||
|
||||
**参数2: 存储过程名称**
|
||||
- 必须是完整的存储过程名称,如 'MES_计划BOM_工位与名称_查询_在线状态'
|
||||
|
||||
**参数3: 存储过程参数数组**
|
||||
```javascript
|
||||
const param = [
|
||||
['工位号', this.$store.state.station.stationNumber],
|
||||
['产品型号代码', this.$store.state.station.engineValue.EngineTypeID],
|
||||
['发动机号', EngineID]
|
||||
]
|
||||
// 数组格式: [参数名, 参数值]
|
||||
```
|
||||
|
||||
## ExecDatabase 方法规范
|
||||
```javascript
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
// 查询操作 (type=11): response.data 为结果数组
|
||||
// 增删改操作 (type=12): response.data[0].result === '1' 表示成功
|
||||
console.log(response.data)
|
||||
})
|
||||
```
|
||||
|
||||
## 实际使用案例
|
||||
**查询操作示例:**
|
||||
```javascript
|
||||
const param = []
|
||||
param[0] = ['工位号', this.$store.state.station.stationNumber]
|
||||
const Data = this.CreateData('11', 'MES_计划BOM_工位与名称_查询_在线状态', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
this.onlineStatus = response.data[0]['在线状态'] === 0
|
||||
})
|
||||
```
|
||||
|
||||
**增删改操作示例:**
|
||||
```javascript
|
||||
const param = []
|
||||
param[0] = ['工位号', this.$store.state.station.stationNumber]
|
||||
param[1] = ['变速器序列号', this.EngineIDRepeat]
|
||||
param[2] = ['删除人', this.$store.state.station.stationUserCount]
|
||||
const Data = this.CreateData('12', '北汽福田_变速器_重号删除', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data[0]['result'] === '1') {
|
||||
this.$message.success('操作成功,请重新扫码变速器条码!')
|
||||
} else {
|
||||
this.$message.error('操作失败,请联系管理员!')
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## 数据库读取操作
|
||||
如需直接查询 SQL Server 数据库,可使用 SQLSERVER MCP 工具:
|
||||
- 查询表结构:mcp_SqlServer-tools_get_table_structure
|
||||
- 执行 SQL 查询:mcp_SqlServer-tools_query
|
||||
- 连接信息:请查看项目 SQLBASE 配置
|
||||
|
||||
## 增删改操作规范
|
||||
业务层存储过程返回格式必须统一:
|
||||
```sql
|
||||
-- 成功返回
|
||||
SELECT 1 as result, '' as msg
|
||||
|
||||
-- 失败返回
|
||||
SELECT 2 as result, '失败消息提示' as msg
|
||||
```
|
||||
</Requirement>
|
||||
|
||||
|
||||
<MQTTBASE>
|
||||
本项目数据库连接地址是
|
||||
IP:172.16.1.5
|
||||
端口:1433
|
||||
账号:sa
|
||||
密码:126.com
|
||||
数据库名:AMES_PDC
|
||||
</MQTTBASE>
|
||||
Reference in New Issue
Block a user