【销毁仿真,先调用程序销毁】

This commit is contained in:
weizhihong 2023-08-25 17:49:09 +08:00
parent 6b3738ae8f
commit e228486dda
8 changed files with 216 additions and 65 deletions

View File

@ -100,6 +100,7 @@ func CreateSimulation(mapId int32) string {
// 删除仿真对象
func DestroySimulation(simulationId string) {
simulationMap.Delete(simulationId)
//移除道岔状态发送
dynamics.Stop()
//通知动力学
@ -107,7 +108,6 @@ func DestroySimulation(simulationId string) {
if httpCode != http.StatusOK || err != nil {
panic(dto.ErrorDto{Code: dto.LogicError, Message: fmt.Sprintf("动力学接口调用失败:[%d][%s]", httpCode, err)})
}
simulationMap.Delete(simulationId)
}
// 创建时生成仿真Id
@ -215,20 +215,24 @@ func buildLineBaseInfo(vs *memory.VerifyStructure) *dynamics.LineBaseInfo {
for _, link := range vs.LinkModelMap {
id, _ := strconv.Atoi(link.Index)
var aTurnoutId int
if link.ARelatedSwitchRef.SwitchDevice != nil {
var aPort string
if link.ARelatedSwitchRef != nil && link.ARelatedSwitchRef.SwitchDevice != nil {
aTurnoutId, _ = strconv.Atoi(link.ARelatedSwitchRef.SwitchDevice.GetIndex())
aPort = link.ARelatedSwitchRef.Port.Name()
}
var bTurnoutId int
if link.BRelatedSwitchRef.SwitchDevice != nil {
var bPort string
if link.BRelatedSwitchRef != nil && link.BRelatedSwitchRef.SwitchDevice != nil {
bTurnoutId, _ = strconv.Atoi(link.BRelatedSwitchRef.SwitchDevice.GetIndex())
bPort = link.BRelatedSwitchRef.Port.Name()
}
links = append(links, &dynamics.Link{
ID: int32(id),
Len: link.Length,
ARelTurnoutId: int32(aTurnoutId),
ARelTurnoutPoint: link.ARelatedSwitchRef.Port.Name(),
ARelTurnoutPoint: aPort,
BRelTurnoutId: int32(bTurnoutId),
BRelTurnoutPoint: link.BRelatedSwitchRef.Port.Name(),
BRelTurnoutPoint: bPort,
})
}
return &dynamics.LineBaseInfo{

View File

@ -782,6 +782,19 @@ const docTemplate = `{
"collectionFormat": "csv",
"name": "proto",
"in": "query"
},
{
"enum": [
0,
1
],
"type": "integer",
"x-enum-varnames": [
"PictureType_StationLayout",
"PictureType_Psl"
],
"name": "type",
"in": "query"
}
],
"responses": {
@ -911,6 +924,19 @@ const docTemplate = `{
"collectionFormat": "csv",
"name": "proto",
"in": "query"
},
{
"enum": [
0,
1
],
"type": "integer",
"x-enum-varnames": [
"PictureType_StationLayout",
"PictureType_Psl"
],
"name": "type",
"in": "query"
}
],
"responses": {
@ -1037,6 +1063,19 @@ const docTemplate = `{
"collectionFormat": "csv",
"name": "proto",
"in": "query"
},
{
"enum": [
0,
1
],
"type": "integer",
"x-enum-varnames": [
"PictureType_StationLayout",
"PictureType_Psl"
],
"name": "type",
"in": "query"
}
],
"responses": {
@ -1313,14 +1352,14 @@ const docTemplate = `{
}
}
},
"/api/v1/projectLink/trainSize/:id": {
"/api/v1/projectLink/mapInfo/trainSize/:id": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "查询项目的关联列车尺寸信息",
"description": "通过地图ID查询项目的关联列车尺寸信息",
"consumes": [
"application/json"
],
@ -1330,11 +1369,11 @@ const docTemplate = `{
"tags": [
"项目关联信息Api"
],
"summary": "查询项目的关联列车尺寸信息",
"summary": "通过地图ID查询项目的关联列车尺寸信息",
"parameters": [
{
"type": "integer",
"description": "项目ID",
"description": "地图ID",
"name": "id",
"in": "path",
"required": true
@ -2384,7 +2423,7 @@ const docTemplate = `{
"parameters": [
{
"type": "integer",
"name": "carriageLength",
"name": "carriage_length",
"in": "query"
},
{
@ -2404,7 +2443,7 @@ const docTemplate = `{
},
{
"type": "integer",
"name": "totalLength",
"name": "total_length",
"in": "query"
}
],
@ -2514,7 +2553,7 @@ const docTemplate = `{
},
{
"type": "integer",
"name": "carriageLength",
"name": "carriage_length",
"in": "query"
},
{
@ -2534,7 +2573,7 @@ const docTemplate = `{
},
{
"type": "integer",
"name": "totalLength",
"name": "total_length",
"in": "query"
}
],
@ -2703,7 +2742,7 @@ const docTemplate = `{
"parameters": [
{
"type": "integer",
"name": "AxialPosition",
"name": "axial_position",
"in": "query"
},
{
@ -2718,17 +2757,17 @@ const docTemplate = `{
},
{
"type": "string",
"name": "installDirection",
"name": "install_direction",
"in": "query"
},
{
"type": "integer",
"name": "maxDiameter",
"name": "max_diameter",
"in": "query"
},
{
"type": "integer",
"name": "minDiameter",
"name": "min_diameter",
"in": "query"
},
{
@ -2843,7 +2882,7 @@ const docTemplate = `{
},
{
"type": "integer",
"name": "AxialPosition",
"name": "axial_position",
"in": "query"
},
{
@ -2858,17 +2897,17 @@ const docTemplate = `{
},
{
"type": "string",
"name": "installDirection",
"name": "install_direction",
"in": "query"
},
{
"type": "integer",
"name": "maxDiameter",
"name": "max_diameter",
"in": "query"
},
{
"type": "integer",
"name": "minDiameter",
"name": "min_diameter",
"in": "query"
},
{
@ -3514,7 +3553,7 @@ const docTemplate = `{
"dto.TrainSizeDto": {
"type": "object",
"properties": {
"carriageLength": {
"carriage_length": {
"type": "integer"
},
"description": {
@ -3526,11 +3565,22 @@ const docTemplate = `{
"name": {
"type": "string"
},
"totalLength": {
"total_length": {
"type": "integer"
}
}
},
"graphicData.PictureType": {
"type": "integer",
"enum": [
0,
1
],
"x-enum-varnames": [
"PictureType_StationLayout",
"PictureType_Psl"
]
},
"model.Category": {
"type": "object",
"properties": {
@ -3590,6 +3640,10 @@ const docTemplate = `{
"type": "integer"
}
},
"type": {
"description": "数据类型",
"type": "integer"
},
"update_at": {
"description": "修改时间",
"type": "string"

View File

@ -775,6 +775,19 @@
"collectionFormat": "csv",
"name": "proto",
"in": "query"
},
{
"enum": [
0,
1
],
"type": "integer",
"x-enum-varnames": [
"PictureType_StationLayout",
"PictureType_Psl"
],
"name": "type",
"in": "query"
}
],
"responses": {
@ -904,6 +917,19 @@
"collectionFormat": "csv",
"name": "proto",
"in": "query"
},
{
"enum": [
0,
1
],
"type": "integer",
"x-enum-varnames": [
"PictureType_StationLayout",
"PictureType_Psl"
],
"name": "type",
"in": "query"
}
],
"responses": {
@ -1030,6 +1056,19 @@
"collectionFormat": "csv",
"name": "proto",
"in": "query"
},
{
"enum": [
0,
1
],
"type": "integer",
"x-enum-varnames": [
"PictureType_StationLayout",
"PictureType_Psl"
],
"name": "type",
"in": "query"
}
],
"responses": {
@ -1306,14 +1345,14 @@
}
}
},
"/api/v1/projectLink/trainSize/:id": {
"/api/v1/projectLink/mapInfo/trainSize/:id": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "查询项目的关联列车尺寸信息",
"description": "通过地图ID查询项目的关联列车尺寸信息",
"consumes": [
"application/json"
],
@ -1323,11 +1362,11 @@
"tags": [
"项目关联信息Api"
],
"summary": "查询项目的关联列车尺寸信息",
"summary": "通过地图ID查询项目的关联列车尺寸信息",
"parameters": [
{
"type": "integer",
"description": "项目ID",
"description": "地图ID",
"name": "id",
"in": "path",
"required": true
@ -2377,7 +2416,7 @@
"parameters": [
{
"type": "integer",
"name": "carriageLength",
"name": "carriage_length",
"in": "query"
},
{
@ -2397,7 +2436,7 @@
},
{
"type": "integer",
"name": "totalLength",
"name": "total_length",
"in": "query"
}
],
@ -2507,7 +2546,7 @@
},
{
"type": "integer",
"name": "carriageLength",
"name": "carriage_length",
"in": "query"
},
{
@ -2527,7 +2566,7 @@
},
{
"type": "integer",
"name": "totalLength",
"name": "total_length",
"in": "query"
}
],
@ -2696,7 +2735,7 @@
"parameters": [
{
"type": "integer",
"name": "AxialPosition",
"name": "axial_position",
"in": "query"
},
{
@ -2711,17 +2750,17 @@
},
{
"type": "string",
"name": "installDirection",
"name": "install_direction",
"in": "query"
},
{
"type": "integer",
"name": "maxDiameter",
"name": "max_diameter",
"in": "query"
},
{
"type": "integer",
"name": "minDiameter",
"name": "min_diameter",
"in": "query"
},
{
@ -2836,7 +2875,7 @@
},
{
"type": "integer",
"name": "AxialPosition",
"name": "axial_position",
"in": "query"
},
{
@ -2851,17 +2890,17 @@
},
{
"type": "string",
"name": "installDirection",
"name": "install_direction",
"in": "query"
},
{
"type": "integer",
"name": "maxDiameter",
"name": "max_diameter",
"in": "query"
},
{
"type": "integer",
"name": "minDiameter",
"name": "min_diameter",
"in": "query"
},
{
@ -3507,7 +3546,7 @@
"dto.TrainSizeDto": {
"type": "object",
"properties": {
"carriageLength": {
"carriage_length": {
"type": "integer"
},
"description": {
@ -3519,11 +3558,22 @@
"name": {
"type": "string"
},
"totalLength": {
"total_length": {
"type": "integer"
}
}
},
"graphicData.PictureType": {
"type": "integer",
"enum": [
0,
1
],
"x-enum-varnames": [
"PictureType_StationLayout",
"PictureType_Psl"
]
},
"model.Category": {
"type": "object",
"properties": {
@ -3583,6 +3633,10 @@
"type": "integer"
}
},
"type": {
"description": "数据类型",
"type": "integer"
},
"update_at": {
"description": "修改时间",
"type": "string"

View File

@ -203,7 +203,7 @@ definitions:
type: object
dto.TrainSizeDto:
properties:
carriageLength:
carriage_length:
type: integer
description:
type: string
@ -211,9 +211,17 @@ definitions:
type: integer
name:
type: string
totalLength:
total_length:
type: integer
type: object
graphicData.PictureType:
enum:
- 0
- 1
type: integer
x-enum-varnames:
- PictureType_StationLayout
- PictureType_Psl
model.Category:
properties:
code:
@ -257,6 +265,9 @@ definitions:
items:
type: integer
type: array
type:
description: 数据类型
type: integer
update_at:
description: 修改时间
type: string
@ -849,6 +860,15 @@ paths:
type: integer
name: proto
type: array
- enum:
- 0
- 1
in: query
name: type
type: integer
x-enum-varnames:
- PictureType_StationLayout
- PictureType_Psl
produces:
- application/json
responses:
@ -963,6 +983,15 @@ paths:
type: integer
name: proto
type: array
- enum:
- 0
- 1
in: query
name: type
type: integer
x-enum-varnames:
- PictureType_StationLayout
- PictureType_Psl
produces:
- application/json
responses:
@ -1011,6 +1040,15 @@ paths:
type: integer
name: proto
type: array
- enum:
- 0
- 1
in: query
name: type
type: integer
x-enum-varnames:
- PictureType_StationLayout
- PictureType_Psl
produces:
- application/json
responses:
@ -1192,13 +1230,13 @@ paths:
summary: 查询项目的所有关联信息
tags:
- 项目关联信息Api
/api/v1/projectLink/trainSize/:id:
/api/v1/projectLink/mapInfo/trainSize/:id:
get:
consumes:
- application/json
description: 查询项目的关联列车尺寸信息
description: 通过地图ID查询项目的关联列车尺寸信息
parameters:
- description: 项目ID
- description: 地图ID
in: path
name: id
required: true
@ -1224,7 +1262,7 @@ paths:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 查询项目的关联列车尺寸信息
summary: 通过地图ID查询项目的关联列车尺寸信息
tags:
- 项目关联信息Api
/api/v1/publishedGi/{id}:
@ -1867,7 +1905,7 @@ paths:
description: 创建列车尺寸数据
parameters:
- in: query
name: carriageLength
name: carriage_length
type: integer
- in: query
name: description
@ -1879,7 +1917,7 @@ paths:
name: name
type: string
- in: query
name: totalLength
name: total_length
type: integer
produces:
- application/json
@ -1981,7 +2019,7 @@ paths:
required: true
type: integer
- in: query
name: carriageLength
name: carriage_length
type: integer
- in: query
name: description
@ -1993,7 +2031,7 @@ paths:
name: name
type: string
- in: query
name: totalLength
name: total_length
type: integer
produces:
- application/json
@ -2069,7 +2107,7 @@ paths:
description: 创建列车轮径数据
parameters:
- in: query
name: AxialPosition
name: axial_position
type: integer
- in: query
name: diameter
@ -2078,13 +2116,13 @@ paths:
name: id
type: integer
- in: query
name: installDirection
name: install_direction
type: string
- in: query
name: maxDiameter
name: max_diameter
type: integer
- in: query
name: minDiameter
name: min_diameter
type: integer
- in: query
name: name
@ -2189,7 +2227,7 @@ paths:
required: true
type: integer
- in: query
name: AxialPosition
name: axial_position
type: integer
- in: query
name: diameter
@ -2198,13 +2236,13 @@ paths:
name: id
type: integer
- in: query
name: installDirection
name: install_direction
type: string
- in: query
name: maxDiameter
name: max_diameter
type: integer
- in: query
name: minDiameter
name: min_diameter
type: integer
- in: query
name: name

View File

@ -98,7 +98,7 @@ func checkCategoryInfo(name string, code string, id int32) error {
findNameQuery := dbquery.Category
w := findNameQuery.Where()
if id != 0 {
w = w.Where(findNameQuery.ID.Eq(id))
w = w.Where(findNameQuery.ID.NotIn(id))
}
if name != "" {
count, err := w.Where(findNameQuery.Name.Eq(name)).Debug().Count()

View File

@ -101,7 +101,7 @@ func checkProjectInfo(code string, id int32) error {
findNameQuery := dbquery.Project
w := findNameQuery.Where()
if id != 0 {
w = w.Where(findNameQuery.ID.Eq(id))
w = w.Where(findNameQuery.ID.NotIn(id))
}
if code != "" {
count, err := w.Where(findNameQuery.Code.Eq(code)).Debug().Count()

View File

@ -14,11 +14,12 @@ import (
)
func PageQueryPublishedGi(req *publishedGi.PublishedGiReqDto) *dto.PageDto {
where := dbquery.PublishedGi.Where(dbquery.PublishedGi.Status.Eq(1))
dp := dbquery.PublishedGi
where := dp.Where(dp.Status.Eq(1))
if req.Name != "" {
where = where.Where(dbquery.PublishedGi.Name.Like(fmt.Sprintf("%%%s%%", req.Name)))
where = where.Where(dp.Name.Like(fmt.Sprintf("%%%s%%", req.Name)))
}
result, count, err := where.Debug().FindByPage(req.Offset(), req.Size)
result, count, err := where.Select(dp.ID, dp.Name, dp.Note, dp.PublishAt).Debug().FindByPage(req.Offset(), req.Size)
if err != nil {
panic(dto.ErrorDto{Code: dto.DataOperationError, Message: err.Error()})
}

View File

@ -270,7 +270,7 @@ func checkTrainModel(name string, id int32) error {
findNameQuery := dbquery.TrainModel
w := findNameQuery.Where()
if id != 0 {
w = w.Where(findNameQuery.ID.Eq(id))
w = w.Where(findNameQuery.ID.NotIn(id))
}
if name != "" {
count, err := w.Where(findNameQuery.Name.Eq(name)).Debug().Count()