109 lines
4.1 KiB
Plaintext
109 lines
4.1 KiB
Plaintext
syntax = "v1"
|
|
|
|
import (
|
|
"base.api"
|
|
)
|
|
|
|
type (
|
|
QueryEquipmentsReq {
|
|
PageReq
|
|
SortReq
|
|
Keyword string `form:"keyword,optional"`
|
|
}
|
|
CreateEquipmentReq {
|
|
Name string `json:"name" validate:"required,gte=2,lte=20" comment:"设备名称"`
|
|
EquipmentTypeId int `json:"equipmentTypeId" validate:"required" comment:"设备类型ID"`
|
|
IpAddress string `json:"ipAddress" comment:"IP地址"`
|
|
Location string `json:"location" comment:"位置"`
|
|
Remark string `json:"remark" comment:"备注"`
|
|
SlotCount int `json:"slotCount" comment:"槽位数量"`
|
|
Exchange bool `json:"exchange,optional" comment:"是否支持换料"`
|
|
Batch bool `json:"batch,optional" comment:"是否批量完成"`
|
|
}
|
|
UpdateEquipmentReq {
|
|
PathId
|
|
Name string `json:"name,optional" validate:"gte=2,lte=20" comment:"设备名称"`
|
|
EquipmentTypeId int `json:"equipmentTypeId,optional" comment:"设备类型ID"`
|
|
IpAddress string `json:"ipAddress" comment:"IP地址"`
|
|
Location string `json:"location" comment:"位置"`
|
|
Remark string `json:"remark" comment:"备注"`
|
|
SlotCount int `json:"slotCount" comment:"槽位数量"`
|
|
Exchange bool `json:"exchange,optional" comment:"是否支持换料"`
|
|
Batch bool `json:"batch,optional" comment:"是否批量完成"`
|
|
}
|
|
QueryEquipmentsReply {
|
|
PageReply
|
|
Data []EquipmentReply `json:"data"`
|
|
}
|
|
EquipmentReply {
|
|
Id int `json:"id"`
|
|
Name string `json:"name" comment:"设备名称"`
|
|
EquipmentTypeId int `json:"equipmentTypeId" comment:"设备类型ID"`
|
|
TypeCode string `json:"typeCode" comment:"设备类型编码"`
|
|
TypeName string `json:"typeName" comment:"设备类型名称"`
|
|
IpAddress string `json:"ipAddress" comment:"IP地址"`
|
|
Location string `json:"location" comment:"位置"`
|
|
Status string `json:"status" comment:"状态"`
|
|
Remark string `json:"remark" comment:"备注"`
|
|
SlotCount int `json:"slotCount" comment:"槽位数量"`
|
|
Exchange bool `json:"exchange" comment:"是否支持换料"`
|
|
Batch bool `json:"batch" comment:"是否批量完成"`
|
|
Slots []EquipmentSlotReply `json:"slots,optional" comment:"槽位列表"`
|
|
CreatedAt int64 `json:"createdAt" comment:"创建时间"`
|
|
UpdatedAt int64 `json:"updatedAt" comment:"更新时间"`
|
|
}
|
|
EquipmentSlotReply {
|
|
Id int `json:"id"`
|
|
SlotNo int `json:"slotNo" comment:"槽位序号"`
|
|
Status string `json:"status" comment:"槽位状态"`
|
|
CurrentJobId int `json:"currentJobId,optional" comment:"当前工件ID"`
|
|
}
|
|
EquipmentTypeReply {
|
|
Id int `json:"id"`
|
|
Code string `json:"code" comment:"类型编码"`
|
|
Name string `json:"name" comment:"类型名称"`
|
|
Movable bool `json:"movable" comment:"是否可移动"`
|
|
DefaultCapacity int `json:"defaultCapacity" comment:"默认槽位容量"`
|
|
}
|
|
BatchDeleteEquipmentsReq {
|
|
Ids []int `json:"ids"`
|
|
}
|
|
)
|
|
|
|
@server (
|
|
jwt: Auth
|
|
group: equipment
|
|
prefix: /api/v1
|
|
)
|
|
service spherical-api {
|
|
@doc "查询设备分页列表"
|
|
@handler queryEquipments
|
|
get /equipments (QueryEquipmentsReq) returns (QueryEquipmentsReply)
|
|
|
|
@doc "获取设备详情"
|
|
@handler getEquipment
|
|
get /equipments/:id (PathId) returns (EquipmentReply)
|
|
|
|
@doc "查询设备类型列表"
|
|
@handler listEquipmentTypes
|
|
get /equipment-types returns ([]EquipmentTypeReply)
|
|
|
|
@doc (
|
|
summary: "创建设备"
|
|
comment: "创建成功返回设备信息"
|
|
)
|
|
@handler createEquipment
|
|
post /equipments (CreateEquipmentReq) returns (int)
|
|
|
|
@doc "编辑设备"
|
|
@handler updateEquipment
|
|
put /equipments/:id (UpdateEquipmentReq)
|
|
|
|
@doc "删除设备"
|
|
@handler deleteEquipment
|
|
delete /equipments/:id (PathId)
|
|
|
|
@doc "批量删除设备"
|
|
@handler batchDeleteEquipments
|
|
post /equipments/batch-delete (BatchDeleteEquipmentsReq)
|
|
} |